CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Get access to temperature in Openfoam

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 14, 2013, 12:43
Question
  #21
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 14
hz283 is on a distinguished road
When the momentum equations are solved, the solver crashed. When I comment the calculation of the lamianr and turbulent diffusion terms, the code works, although in this case the diffusivity is missing.

Is this the same as yours?

Quote:
Originally Posted by fredo490 View Post
Something I really don't understand is that:

basicThermo.C has the following members:
Code:
// Non Constant access to p
Foam::volScalarField& Foam::basicThermo::p()
{
    return p_;
}

// Constant access to p
const Foam::volScalarField& Foam::basicThermo::p() const
{
    return p_;
}

// Constant access to T
const Foam::volScalarField& Foam::basicThermo::T() const
{
    return T_;
}
Then basicThermo.H has the following members:
Code:
        // Access to thermodynamic state variables

            //- Pressure [Pa]
            //  Non-const access allowed for transport equations
            virtual volScalarField& p();

            //- Pressure [Pa]
            virtual const volScalarField& p() const;

            //- Temperature [K]
            virtual const volScalarField& T() const;
Therefor, why the #&{$ adding the same non constant member as p but with T doesn't work ?! If it works for p, why it doesn't work for T ?
hz283 is offline   Reply With Quote

Old   May 15, 2013, 07:16
Default
  #22
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
fredo490 is on a distinguished road
Yes I get the same problem...
fredo490 is offline   Reply With Quote

Old   May 15, 2013, 07:17
Default
  #23
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 14
hz283 is on a distinguished road
I think I solved the problem:

Please change to: cd $WM_PROJECT_DIR,

and then run: ./Allwmake.

it will work. have a try and tell me if it works. Thank you.

Quote:
Originally Posted by fredo490 View Post
Yes I get the same problem...
hz283 is offline   Reply With Quote

Old   May 15, 2013, 12:05
Default
  #24
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
fredo490 is on a distinguished road
You have found the solution ! Basically what we have to do is to recompile all OpenFoam source code and not only the thermo model.

So after all this, here is the final procedure (tested and approved !):
1) open a text editor in admin by writing in the terminal: "sudo gedit"
2) with this text editor, open: "basicThermo.C" located in /opt/openfoam220/src/thermophysicalModels/basic/basicThermo
3) Add the following line in the Member Functions (I put it at line 396 after the "basicThermo::T()" ):
Code:
// Add this
           //- Temperature [K]
            //  Non-const access allowed
            Foam::volScalarField& Foam::basicThermo::T()
            {
                return T_;
            }
4) with this text editor (still admin), open: "basicThermo.H" located in /opt/openfoam220/src/thermophysicalModels/basic/basicThermo
5) Add the following line after the comment "Fields derived from thermodynamic state variables" (I put it at line 316 after the other Temperature member ):
Code:
// Add this
            //- Temperature [K]
            //  Non-const access allowed for transport equations
            virtual volScalarField& T();
6) Save the two files (To check if it was saved: look at the top of the editor, if the star remains it means that you didn't have the admin / root access).
7) Go to /opt/openfoam220/ and open a terminal
8) With the terminal located in this folder, we now want to get the full root access. To do so, write: "sudo -s". After typing your password, you will see that the command line will start with "root".
9) We need to recompile all OpenFoam. To do so, simply write "./Allwmake". This step might take few minutes depending of your system (for me it took about 45 minutes).
fredo490 is offline   Reply With Quote

Old   May 15, 2013, 12:07
Default
  #25
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 14
hz283 is on a distinguished road
So happy that we solved this problem finally~~

Quote:
Originally Posted by fredo490 View Post
You have found the solution ! Basically what we have to do is to recompile all OpenFoam source code and not only the thermo model.

So after all this, here is the final procedure (tested and approved !):
1) open a text editor in admin by writing in the terminal: "sudo gedit"
2) with this text editor, open: "basicThermo.C" located in /opt/openfoam220/src/thermophysicalModels/basic/basicThermo
3) Add the following line in the Member Functions (I put it at line 396 after the "basicThermo::T()" ):
Code:
// Add this
           //- Temperature [K]
            //  Non-const access allowed
            Foam::volScalarField& Foam::basicThermo::T()
            {
                return T_;
            }
4) with this text editor (still admin), open: "basicThermo.H" located in /opt/openfoam220/src/thermophysicalModels/basic/basicThermo
5) Add the following line after the comment "Fields derived from thermodynamic state variables" (I put it at line 316 after the other Temperature member ):
Code:
// Add this
            //- Temperature [K]
            //  Non-const access allowed for transport equations
            virtual volScalarField& T();
6) Save the two files (To check if it was saved: look at the top of the editor, if the star remains it means that you didn't have the admin / root access).
7) Go to /opt/openfoam220/ and open a terminal
8) With the terminal located in this folder, we now want to get the full root access. To do so, write: "sudo -s". After typing your password, you will see that the command line will start with "root".
9) We need to recompile all OpenFoam. To do so, simply write "./Allwmake". This step might take few minutes depending of your system (for me it took about 45 minutes).
hz283 is offline   Reply With Quote

Old   May 15, 2013, 12:14
Default
  #26
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
fredo490 is on a distinguished road
Haha yeah, actually solving this problem ends my thesis ^^ My simulation runs smoothly and the results are promising.
fredo490 is offline   Reply With Quote

Old   May 15, 2013, 12:22
Default
  #27
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 14
hz283 is on a distinguished road
Congratulations !

Quote:
Originally Posted by fredo490 View Post
Haha yeah, actually solving this problem ends my thesis ^^ My simulation runs smoothly and the results are promising.
hz283 is offline   Reply With Quote

Old   June 17, 2013, 10:52
Default
  #28
Member
 
Join Date: Jun 2012
Posts: 76
Rep Power: 14
maHein is on a distinguished road
In case someone tries to implement this, it has also been implemented by the developers into Version 2.2.x commit a9d0f048e1a387af342531d50c79a2d111e2536b.
maHein is offline   Reply With Quote

Old   June 17, 2013, 11:43
Default
  #29
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
fredo490 is on a distinguished road
It's a great news ! Thanks for the information
fredo490 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with zeroGradient wall BC for temperature - Total temperature loss cboss OpenFOAM 12 October 1, 2018 07:36
Implementation of maxwell slip velocity and Temperature jump with openfoam yassepid OpenFOAM 2 June 28, 2016 08:05
coldEngineFoam (OpenFoam 2.1.x), constant Temperature during adiabatic compression novakm OpenFOAM Verification & Validation 1 February 25, 2013 13:25
Inlet won't apply UDF and has temperature at 0K! tccruise Fluent UDF and Scheme Programming 2 September 14, 2012 07:08
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 3 September 8, 2010 07:25


All times are GMT -4. The time now is 06:55.