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

adding temperature to simpleFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree31Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 31, 2011, 10:27
Default adding temperature to simpleFoam
  #1
New Member
 
carlos
Join Date: Apr 2010
Posts: 8
Rep Power: 16
waters is on a distinguished road
Hello,

Has any of you foamers added temperature to simpleFoam successfully?

Regards,

Carlos
waters is offline   Reply With Quote

Old   February 1, 2011, 12:23
Default
  #2
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 620
Blog Entries: 6
Rep Power: 24
elvis will become famous soon enough
Hi,

maybe this link helps you http://openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam
elvis is offline   Reply With Quote

Old   February 5, 2011, 10:07
Default
  #3
New Member
 
carlos
Join Date: Apr 2010
Posts: 8
Rep Power: 16
waters is on a distinguished road
Thanks Elvis, I'm building it. It is taking me a while to understand how to implement the Temperature equation for a "steady state" for simpleFoam. I am making analogies with the buoyantBoussinesqSimpleFoam solver in a first step, but I am not sure.

Anyway, up to the 12th iteration I get an error message. If I make a step forward implementing simpleTempFoam, i'll post it here.

Thanks again,

Carlos
waters is offline   Reply With Quote

Old   February 6, 2011, 01:51
Default
  #4
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
Hi,
Instead of implementing temperature yourself you could use rhoSimpleFoam. This solver has already the solution of the enthalpy equation included.
rgds
Bjorn
bhh is offline   Reply With Quote

Old   February 6, 2011, 03:35
Default
  #5
New Member
 
carlos
Join Date: Apr 2010
Posts: 8
Rep Power: 16
waters is on a distinguished road
Hi Bjorn,

Is it possible to use water as heat transfer media in rhoSimpleFoam? I haven't been able to change perfectGas in the thermophysicalproperties file.
waters is offline   Reply With Quote

Old   February 6, 2011, 04:28
Default
  #6
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
Ok, I did not realize that your problem had water as medium. So, you probably need to implement the temperature equation after all.

Have you by the way checked the thermomodel:
icoPolynomial Incompressible polynomial equation of state, e.g. for liquids
as indicated in the User Manual?

rgds
Bjorn
bhh is offline   Reply With Quote

Old   June 1, 2011, 11:19
Question
  #7
Member
 
Nickolas P
Join Date: Oct 2010
Location: Greece
Posts: 30
Rep Power: 16
NickolasPl is on a distinguished road
Hello everyone,

I m a relatively new foamer and I mostly work with simpleFoam. I wanted as well to add temperature calculation for my flow as Carlos, so I followed as Bjorn suggested the rhosimpleFoam solver and the instructions from OpenFoam Wiki on how to add temperature to IcoFoam. A lot of erros appeared at the first place but I managed to overcome them, builded the new solver with the temperature and no errors appear. I use Paraview for postprocessing and the problem is that U,p, nu (I work with non - Newtonian flow) is printed normally but I cannot see anywhere the T variable to select to view the results. Did anybody had that problem?I would appreciate any comments.

Kindly,

Nickolas
shiromaniac likes this.
NickolasPl is offline   Reply With Quote

Old   June 1, 2011, 11:21
Question
  #8
Member
 
Nickolas P
Join Date: Oct 2010
Location: Greece
Posts: 30
Rep Power: 16
NickolasPl is on a distinguished road
Also, in the past I have succesfully carried out the addition of temperature to icoFoam and Paraview gave me the results as suggested from OpenFoam Wiki about that subject.

Thanx
NickolasPl is offline   Reply With Quote

Old   June 1, 2011, 11:43
Default
  #9
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
Hi Nickolas,

just a guess, but have you defined the scalarField for T with option "IOobject::AUTO_WRITE"?
Code:
Info << "Reading field T\n" << endl;
    volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE // <---- T should be written out
        ),
        mesh
    );
Beside of that you can force T to be written out with:
Code:
T.write()
near the end of your code.

Martin
MartinB is offline   Reply With Quote

Old   June 1, 2011, 11:48
Default
  #10
Member
 
Nickolas P
Join Date: Oct 2010
Location: Greece
Posts: 30
Rep Power: 16
NickolasPl is on a distinguished road
Yes that is correct. Below I m sending the createFields.H file of my created solver:

Info << "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info << "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

//adding from here
Info<< "Reading field T\n" <<endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
//to here

# include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);


singlePhaseTransportModel laminarTransport(U, phi);


dimensionedScalar DT
(
mesh.solutionDict().subDict("SIMPLE").lookup("DT")
);


autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)




So besides that I can add at the end the line you suggested and leave the option IOobject::AUTO_WRITE the same?
NickolasPl is offline   Reply With Quote

Old   June 1, 2011, 11:57
Default
  #11
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
The AUTO_WRITE option is fine, don't know why it doesn't work.

You can add the T.write() additionally, for example in your runTime loop:
Code:
 while (runTime.loop())
    {
        . . .
        . . .
        if (runTime.outputTime())
            T.write();
    }
or at the very end of your solver:
Code:
    . . .
    }
    T.write();
    Info<< "End\n" << endl;
Martin
MartinB is offline   Reply With Quote

Old   June 1, 2011, 14:35
Default
  #12
Member
 
Nickolas P
Join Date: Oct 2010
Location: Greece
Posts: 30
Rep Power: 16
NickolasPl is on a distinguished road
Martin,

First of all thanks a lot for the useful information.
I tried the method you told me but the problem still remains the same. So I found a similar solver to see if things work out, the solver is the buoyantBoussinesqSimpleFoam. I modified my simpleFoam solver to match with the Boussinesq one. Actually at Boussinesq there is already the code on how to add the temperature but I think in my case I dont implement it correct.

I'm attaching some of the files of the solver to check if I have done anything wrong. Please, I m open to any thoughts, comments!

Kindly,

Nickolas
Attached Files
File Type: h createFields.H (1.2 KB, 338 views)
File Type: c my_simpleFoam.C (2.4 KB, 386 views)
File Type: h readTransportProperties.H (148 Bytes, 308 views)
File Type: h TEqn.H (309 Bytes, 481 views)
albet and ZainorH like this.
NickolasPl is offline   Reply With Quote

Old   June 1, 2011, 17:54
Default
  #13
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
Hi Nickolas,

in the attachment you find the reviewed solver and a test case.

I made two minor changes to your solver in createFields.H and TEqn.H, have a look at comments with "@ Nickolas:".

To run the test case use:
blockMesh
my_simpleFoam

You can run it in parallel, too. It's configured for 4 cpu cores.

Have fun

Martin
Attached Images
File Type: jpg T.jpg (18.4 KB, 668 views)
Attached Files
File Type: gz solver_and_case.tar.gz (16.7 KB, 913 views)
solefire, Mojtaba.a, 0xana and 6 others like this.
MartinB is offline   Reply With Quote

Old   June 2, 2011, 14:13
Default
  #14
Member
 
Nickolas P
Join Date: Oct 2010
Location: Greece
Posts: 30
Rep Power: 16
NickolasPl is on a distinguished road
Hi Martin,

With your suggestions I was able to perform the simulations and the temperature was calculated! Thank you very much. I am now able to understand the code better. Nontheless, I need to validate my results with the theory to check if everythhing works ok, but for the time being the temperature field is plotted.

I have another question concerning the "relaxation factors" that I see in the "fvsolution" file. How these factors affect the results of the simulation and I would like to know if there any standard values. Does it have to do with the flow field (meaning Newtonian approximation, non - Newtonian approximation) or the mesh? Or is it just a short of numerical technique? I found OpenFOAM very interesting and I would like to learn as much as possible although I m not very strong at c++. Do you happen to know any books or internet sites for me to study regarding these matter?

Again thanks a lot for your comments!

Kindly,

Nickolas
NickolasPl is offline   Reply With Quote

Old   September 12, 2011, 12:21
Default
  #15
Member
 
andres
Join Date: Jul 2011
Posts: 31
Rep Power: 15
greel is on a distinguished road
Quote:
Originally Posted by MartinB View Post
Hi Nickolas,

in the attachment you find the reviewed solver and a test case.

I made two minor changes to your solver in createFields.H and TEqn.H, have a look at comments with "@ Nickolas:".

To run the test case use:
blockMesh
my_simpleFoam

You can run it in parallel, too. It's configured for 4 cpu cores.

Have fun

Martin
Hi
I have taken this file to add Temperature to the simpleFoam solver, I have followed the the instructions in the openfom wiki, but I'm having an error.
Cheers.

Quote:
usuarioubuntu@SAN1496UBU:/opt/openfoam200/applications/solvers/incompressible/my_simpleFoam$ wmake
Making dependency list for source file my_simpleFoam.C
/opt/openfoam200/wmake/scripts/addCompile: 53: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 57: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 59: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 60: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 61: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 62: cannot create my_simpleFoam.dep: Permission denied
make: *** [my_simpleFoam.dep] Error 2
greel is offline   Reply With Quote

Old   September 13, 2011, 03:22
Default
  #16
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Andres, /opt/ is a directory that can only be written to with administrator rights. If you compile the solver in your home directory all should be well.
akidess is offline   Reply With Quote

Old   September 13, 2011, 11:44
Default
  #17
Member
 
andres
Join Date: Jul 2011
Posts: 31
Rep Power: 15
greel is on a distinguished road
Quote:
Originally Posted by akidess View Post
Andres, /opt/ is a directory that can only be written to with administrator rights. If you compile the solver in your home directory all should be well.
Hi Anton, thanks for your answer. I have tried to compile the solver in home directory, but I get a new error. Sorry but I donīt have to much experience working with linux, so some instructions are dificult to follow.
Quote:
usuarioubuntu@SAN1496UBU:~/myfoam$ wmake
SOURCE=my_simpleFoam.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/turbulenceModels -I/opt/openfoam200/src/turbulenceModels/incompressible/RAS/RASModel -I/opt/openfoam200/src/transportModels -I/opt/openfoam200/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam200/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/my_simpleFoam.o
my_simpleFoam.C:54:40: fatal error: readSIMPLEControls.H: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/my_simpleFoam.o] Error 1
greel is offline   Reply With Quote

Old   September 13, 2011, 12:15
Default
  #18
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Did you execute wclean before you tried to wmake again?
akidess is offline   Reply With Quote

Old   September 13, 2011, 12:19
Default
  #19
Member
 
andres
Join Date: Jul 2011
Posts: 31
Rep Power: 15
greel is on a distinguished road
Quote:
Originally Posted by akidess View Post
Did you execute wclean before you tried to wmake again?
No, i havenīt executed wclean.

Quote:
usuarioubuntu@SAN1496UBU:~/myfoam$ wclean
usuarioubuntu@SAN1496UBU:~/myfoam$ wmake
Making dependency list for source file my_simpleFoam.C
could not open file readSIMPLEControls.H for source file my_simpleFoam.C
SOURCE=my_simpleFoam.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/turbulenceModels -I/opt/openfoam200/src/turbulenceModels/incompressible/RAS/RASModel -I/opt/openfoam200/src/transportModels -I/opt/openfoam200/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam200/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/my_simpleFoam.o
my_simpleFoam.C:54:40: fatal error: readSIMPLEControls.H: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/my_simpleFoam.o] Error 1
thanks!
greel is offline   Reply With Quote

Old   September 13, 2011, 12:24
Default
  #20
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Does readSIMPLEcontrols.H exist in "/opt/openfoam200/src/finiteVolume/lnInclude/"?
akidess is offline   Reply With Quote

Reply

Tags
simplefoam, temperature


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
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
Adding a new temperature dependent viscositymodel? dgadensg OpenFOAM Programming & Development 10 May 22, 2010 06:47
Adding temperature equation in settlingFoam sachin OpenFOAM Running, Solving & CFD 2 March 31, 2010 04:21
Adding temperature field to InterFoam yapalparvi OpenFOAM Running, Solving & CFD 8 October 14, 2009 21:18
Adding coriolis forces in simplefoam Xabi OpenFOAM Running, Solving & CFD 1 April 24, 2009 05:43


All times are GMT -4. The time now is 01:20.