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 Members List Search Today's Posts Mark Forums Read

Like Tree31Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 13, 2011, 12:30
Default
  #21
Member
 
andres
Join Date: Jul 2011
Posts: 31
Rep Power: 15
greel is on a distinguished road
readSIMPLEcontrols.H doesn´t exist !
greel is offline   Reply With Quote

Old   September 13, 2011, 12:41
Default
  #22
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
Ah, of course not! You are trying to compile a solver made for OpenFoam 1.6! In version 2.0, readSIMPLEcontrols.H has been replaced by simpleControl.H. Try replacing the include in my_simpleFoam.C. I can't guarantee you it will work, but it's worth a try. If it doesn't work, take simpleFoam from version 2.0 and add the modifications from this thread to it.
utkunun likes this.
akidess is offline   Reply With Quote

Old   September 13, 2011, 13:47
Default
  #23
Member
 
andres
Join Date: Jul 2011
Posts: 31
Rep Power: 15
greel is on a distinguished road
I have change the line, re-compile but a new error appear.
I will try to rewrite the new "solver" from 0, because this is for an older version of foam.
thanks for all!
Quote:
Making dependency list 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
In file included from /opt/openfoam200/src/finiteVolume/lnInclude/simpleControl.H:36:0,
from my_simpleFoam.C:54:
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControl.H: In function ‘int main(int, char**)’:
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControl.H:39:1: error: ‘namespace’ definition is not allowed here
In file included from /opt/openfoam200/src/finiteVolume/lnInclude/solutionControl.H:149:0,
from /opt/openfoam200/src/finiteVolume/lnInclude/simpleControl.H:36,
from my_simpleFoam.C:54:
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:28:38: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:29:1: error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:34:26: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:35:1: error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:40:19: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:41:1: error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:46:19: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:47:1: error: a function-definition is not allowed here before ‘{’ token
In file included from my_simpleFoam.C:54:0:
/opt/openfoam200/src/finiteVolume/lnInclude/simpleControl.H:40:1: error: ‘namespace’ definition is not allowed here
In file included from /opt/openfoam200/src/finiteVolume/lnInclude/simpleControl.H:109:0,
from my_simpleFoam.C:54:
/opt/openfoam200/src/finiteVolume/lnInclude/simpleControlI.H:30:19: error: ‘Foam::simpleControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/simpleControlI.H:31:1: error: a function-definition is not allowed here before ‘{’ token
my_simpleFoam.C:80:1: error: expected ‘}’ at end of input
/opt/openfoam200/src/finiteVolume/lnInclude/initContinuityErrs.H:37:8: warning: unused variable ‘cumulativeContErr’
my_simpleFoam.C:80:1: error: expected ‘}’ at end of input
make: *** [Make/linuxGccDPOpt/my_simpleFoam.o] Error 1
greel is offline   Reply With Quote

Old   September 13, 2011, 14:49
Default
  #24
Member
 
andres
Join Date: Jul 2011
Posts: 31
Rep Power: 15
greel is on a distinguished road
I have copied the simpleFoam from /opt/openfoam200/applications/solvers/incompressible, to /home/usuarioubuntu/myfoam directory, then I rename the simpleFoam.C to mysimpleFoam.C, also I have changed the "files" in the Make subdirectory.
Quote:
mysimpleFoam.C

EXE = $(FOAM_APPBIN)/mysimpleFoam
But when I try to compile the solver I´m getting a new error
Quote:
usuarioubuntu@SAN1496UBU:~/myfoam/simpleFoam$ wclean
usuarioubuntu@SAN1496UBU:~/myfoam/simpleFoam$ wmake
Making dependency list for source file mysimpleFoam.C
SOURCE=mysimpleFoam.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/mysimpleFoam.o
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 -Xlinker --add-needed Make/linuxGccDPOpt/mysimpleFoam.o -L/opt/openfoam200/platforms/linuxGccDPOpt/lib \
-lincompressibleTurbulenceModel -lincompressibleRASModels -lincompressibleTransportModels -lfiniteVolume -lOpenFOAM -ldl -lm -o /opt/openfoam200/platforms/linuxGccDPOpt/bin/mysimpleFoam
/usr/bin/ld: cannot open output file /opt/openfoam200/platforms/linuxGccDPOpt/bin/mysimpleFoam: Permission denied
collect2: ld returned 1 exit status
make: *** [/opt/openfoam200/platforms/linuxGccDPOpt/bin/mysimpleFoam] Error 1
greel is offline   Reply With Quote

Old   September 14, 2011, 02:51
Default
  #25
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
Try to replace FOAM_APPBIN in Make/files with FOAM_USER_APPBIN

The error message says that you don't have write permission in the default appbin.
Bernhard is offline   Reply With Quote

Old   September 14, 2011, 14:19
Default
  #26
Member
 
andres
Join Date: Jul 2011
Posts: 31
Rep Power: 15
greel is on a distinguished road
amazing!! I was able to compile and run a test case of the icofoam+temperature solver.
Thanks Anton!!!
greel is offline   Reply With Quote

Old   September 22, 2011, 06:37
Default
  #27
Member
 
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 15
robbirobocop 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
I downloaded those files and when I try to run the case you attached it is always telling me:

--> FOAM FATAL IO ERROR:
keyword div((nuEff*dev(T(grad(U))))) is undefined in dictionary "/home/.../incompressible/my_simpleFoam/case/system/fvSchemes::divSchemes"

file: /home/.../incompressible/my_simpleFoam/case/system/fvSchemes::divSchemes from line 32 to line 40.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 400.

FOAM exiting

Any suggestions?
robbirobocop is offline   Reply With Quote

Old   September 22, 2011, 10:39
Default
  #28
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
Hi Rob,

as the error message says you must add an entry for div((nuEff*dev(T(grad(U))))) in the fvSchemes file.

Attached is a fvSchemes file for OpenFOAM 2.0.x.

Good luck

Martin
Attached Files
File Type: gz fvSchemes.tar.gz (645 Bytes, 108 views)
solefire and Kittipos like this.
MartinB is offline   Reply With Quote

Old   September 22, 2011, 12:31
Default
  #29
Member
 
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 15
robbirobocop is on a distinguished road
Wow, that was quite simple. Sometimes you won't see the wood for trees.
The case is running now. Thank you very much.

I have yet another question. Is it possible to add two internalField scalars for the temperature?
I have 2 pipes connected to each other which swap heat directly. I need that kind of option, a nonuniform list of scalars did not work out.
robbirobocop is offline   Reply With Quote

Old   September 23, 2011, 04:28
Default Still won't work.
  #30
Member
 
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 15
robbirobocop is on a distinguished road
Yeah, actually the solver was working ( I did not get an error message ).
But unfortunately the temperature was not solved with the p and U equation. It was not even read. When I performed the 'wmake' command in the console, I got this error message:

Code:
SOURCE=my_simpleFoam.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wextra  -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository  -ftemplate-depth-100 -I/opt/openfoam201/src/turbulenceModels  -I/opt/openfoam201/src/turbulenceModels/incompressible/RAS/RASModel  -I/opt/openfoam201/src/transportModels  -I/opt/openfoam201/src/transportModels/incompressible/singlePhaseTransportModel  -I/opt/openfoam201/src/finiteVolume/lnInclude -IlnInclude -I.  -I/opt/openfoam201/src/OpenFOAM/lnInclude  -I/opt/openfoam201/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o  Make/linuxGccDPOpt/my_simpleFoam.o
In file included from /opt/openfoam201/src/finiteVolume/lnInclude/simpleControl.H:36:0,
                 from my_simpleFoam.C:54:
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControl.H: In function ‘int main(int, char**)’:
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControl.H:39:1: error: ‘namespace’ definition is not allowed here
In file included from /opt/openfoam201/src/finiteVolume/lnInclude/solutionControl.H:149:0,
                 from /opt/openfoam201/src/finiteVolume/lnInclude/simpleControl.H:36,
                 from my_simpleFoam.C:54:
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:28:38: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:29:1:  error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:34:26: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:35:1:  error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:40:19: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:41:1:  error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:46:19: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:47:1:  error: a function-definition is not allowed here before ‘{’ token
In file included from my_simpleFoam.C:54:0:
/opt/openfoam201/src/finiteVolume/lnInclude/simpleControl.H:40:1: error: ‘namespace’ definition is not allowed here
In file included from /opt/openfoam201/src/finiteVolume/lnInclude/simpleControl.H:109:0,
                 from my_simpleFoam.C:54:
/opt/openfoam201/src/finiteVolume/lnInclude/simpleControlI.H:30:19: error: ‘Foam::simpleControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/simpleControlI.H:31:1:  error: a function-definition is not allowed here before ‘{’ token
my_simpleFoam.C:80:1: error: expected ‘}’ at end of input
/opt/openfoam201/src/finiteVolume/lnInclude/initContinuityErrs.H:37:8: warning: unused variable ‘cumulativeContErr’
my_simpleFoam.C:80:1: error: expected ‘}’ at end of input
make: *** [Make/linuxGccDPOpt/my_simpleFoam.o] Fehler 1
Any kind of help would be very appreciated.
I tried to figure it out myself with no outcome.
Attached Files
File Type: gz my_simpleFoam.tar.gz (6.4 KB, 31 views)
robbirobocop is offline   Reply With Quote

Old   September 23, 2011, 05:52
Default
  #31
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
Hi Rob,

here is the solver and a case for OpenFOAM 2.0.x. Please be aware, that the name of the solver is mySimpleFoam.

Martin
Attached Files
File Type: gz mySimpleFoam.tar.gz (2.4 KB, 343 views)
File Type: gz case_of2.tar.gz (14.4 KB, 219 views)
MartinB is offline   Reply With Quote

Old   September 30, 2011, 06:34
Default
  #32
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Thank you Martin for sharing!
maddalena is offline   Reply With Quote

Old   October 3, 2011, 09:21
Default
  #33
Member
 
Tibor Nyers
Join Date: Jul 2010
Location: Hungary
Posts: 91
Rep Power: 17
Toorop is on a distinguished road
Hi,

I have recently pegged away at simpleScalarFoam as well and came up with this:
Code:
// --- Scalar Transport
    T.storePrevIter();
    for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
    {
        volScalarField DTEff = DT+turbulence->nut()/0.7;
        fvScalarMatrix TEqn
        (
        fvm::div(phi, T) - fvm::laplacian(DTEff, T)
        );
        TEqn.relax();
        TEqn.solve();
    }
The attached version is basically the wiki contribution with all the unnecessary stuff ripped off. Here's a great discussion about the issue (scalar transport) and I would draw your attention to Daniel's comment about the turbulent diffusivity.

I use these schemes for the scalar transport:
Code:
grad(T)        Gauss linear;
div(phi,T)     Gauss Gamma 1.0;
laplacian((DT+(nut|0.7)),T)     Gauss linear limited 1.0;
I'm not an expert, so feel free to correct me if I'm wrong and share your ideas!

This is quite a basic implementation, so it would be nice to add some cool feature like residence time calculation, source terms, ... If I have any progress on this, I will post it as well.
Attached Files
File Type: gz simpleScalarFoam.tar.gz (2.3 KB, 67 views)
solefire likes this.
Toorop is offline   Reply With Quote

Old   October 27, 2011, 12:16
Default Viscous Dissipation
  #34
Member
 
Nickolas P
Join Date: Oct 2010
Location: Greece
Posts: 30
Rep Power: 16
NickolasPl is on a distinguished road
Hello everybody,

I m studying polymer rheology under different types of geometry. To do that I work in simpleFoam switching off the turbulent part as the flow is creeping laminar with Re<<1. In the past I sucessfully added the temperature equation on simpleFoam by the help of Martin. However, this equation lacks of the viscous dissipation part that contributes for the frictional loss which at the moment I need to study. In the created file TEqn.H I declared the heat equation as below but I dont know how to insert the viscosity (I use a Newtonian fluid so this is actually the laminar viscosity). The file is:


fvScalarMatrix TEqn
(

fvm::div(phi, T)
- fvm::laplacian(alpha, T)
== (1/rho*Cp)*(2*(VISCOSITY??)*symm(fvc::grad(U)) && fvc::grad(U))

);

TEqn.relax();

eqnResidual = TEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);


Hoping that I ve written the equation correctly....can anybody help me out on how to insert the viscosity??I have tried to insert it as: nu(), nuEff() but it didnt work out (in each case it was reported that....'nu'or 'nuEff' is not declared in this scope).

Thanks in advance!

Nickolas
NickolasPl is offline   Reply With Quote

Old   October 28, 2011, 20:22
Default
  #35
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
Hi Nickolas,

you can try the attached solver (for OpenFOAM 2.0.x) and case.

Comments are added to the code and the case.

Increase of temperature is calculated via controlDict (4.585 K) and nearly matches to the appropriate formula for high viscous newtonian fluids (4.73 K).

Ah, and you can access the viscosity for your formula with "laminarTransport.nu()".

Martin
Attached Files
File Type: gz mySimpleFoam.tar.gz (2.8 KB, 184 views)
File Type: gz case_pipe_viscous_heating.tar.gz (3.8 KB, 125 views)
solefire, soonic, virrast and 3 others like this.
MartinB is offline   Reply With Quote

Old   January 1, 2012, 10:34
Default
  #36
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
hey,
thanks for sharing the solver .. it works really fine, the only problem I'm having is I'm not getting any T on the paraView .. when i try to view it but I'm getting the results in the folder, any suggestions... to what i could do to get the T in the paraView along with P and U which I'm getting
regards,
hasan.
Alhasan is offline   Reply With Quote

Old   January 1, 2012, 10:35
Default
  #37
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
hey,
thanks for sharing the solver .. it works really fine, the only problem I'm having is I'm not getting any T on the paraView .. when i try to view it but I'm getting the results in the folder, any suggestions... to what i could do to get the T in the paraView along with P and U which I'm getting
regards,
hasan.
Alhasan is offline   Reply With Quote

Old   January 1, 2012, 11:04
Default
  #38
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
Hi Hasan,

have you selected T in the "Volume Fields" list of the Object Inspector? See attached image...

Martin
Attached Images
File Type: jpg screenshot_T1.jpg (30.7 KB, 136 views)
MartinB is offline   Reply With Quote

Old   January 1, 2012, 11:06
Default
  #39
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Thank you .. I'm so sorry i found... it. another doubt abt boundry conditions, can i post it here..? coz there is no reply from the foundry condition forums..?
Alhasan is offline   Reply With Quote

Old   January 25, 2012, 09:39
Default
  #40
Senior Member
 
Andrea Pasquali
Join Date: Sep 2009
Location: Germany
Posts: 142
Rep Power: 17
andrea.pasquali is on a distinguished road
Hi All,
I started to use the solver buoyanSimpleFoam to simulate incompressible liquid water (or "incompressible" vapour water) with temperature field.
For this I used the basicRhoThermo type in buoyanSimpleFoam where is possible to choose the incompressible thermo type. But I found some problems I posted here:
http://www.cfd-online.com/Forums/ope...implefoam.html
My model has also a porous medium.
Surfing on the forum I found this post where TEqn is added for simpleFoam solver.
I downloaded the last Martin's solvers (thanks to share it!).
Hi have two question:
1) Is it correct to use this solver for my case (liquid water or vapour water), or is it better switch off the viscous dissipation?
2) I'd like to add a thermal prop. for the porous zones. I known in OF2.0.x there is a fixedTemperature thermo prop. that add a term in the hEqn. How can "fix" this for TEqn?

Thanks for any help

Andrea
__________________
Andrea Pasquali
andrea.pasquali is offline   Reply With Quote

Reply

Tags
simplefoam, temperature

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 21:33.