CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How is the turbulence model called in openfoam? (https://www.cfd-online.com/Forums/openfoam/109441-how-turbulence-model-called-openfoam.html)

hz283 November 17, 2012 18:10

How is the turbulence model called in openfoam?
 
Hi,

I am looking into how the RAS models are called (for example how k and epsilon equations are called to be solved in pisofoam). I had some questions about this.

Take PISOFOAM as an example, I know that turbulence->correct(); is used to solve the k and epsilon equations and correct the turbulent viscosity. And then turbulence is defined in creatFields. H as follows:

00039 autoPtr<incompressible::turbulenceModel> turbulence
00040 (
00041 incompressible::turbulenceModel::New(U, phi, laminarTransport)
00042 );

in the class turbulenceModel, the function correct appears as follows:

00127 void turbulenceModel::correct()
00128 {
00129 transportModel_.correct();
00130 }

In fact, in transportModel, there is no function defination for correction(). Thus I do not know how the main solver, PISOFOAM, continue to call the k and epsilon equations. I really appreciate it if anyone can give me some help with this problem.

hz283

jona November 18, 2012 00:11

Hi hz283,

Foam::incompressible::turbulenceModel is an abstract class where the function correct() is virtual, so the child class, e.g. RASmodel, has to redefine it.

RASmodel declares it also as a virtual method, so the next child, e.g. kEpsilon, has to redefine it as well.

In the definition of correct() in kEpsilon finally the additional two equations for k and epsilon are solved.

References:
http://foam.sourceforge.net/docs/cpp/a02160.html
http://foam.sourceforge.net/docs/cpp/a01654.html
http://foam.sourceforge.net/docs/cpp/a00971.html

explanation of virtual functions:
http://www.cplusplus.com/doc/tutorial/polymorphism/
(see Virtual Members)

Have fun,

Jörn

hz283 November 18, 2012 05:08

Hi Jorn,

Thank you so much for your help.

hz283

TsinghuaBoiler May 4, 2017 21:20

Hi jona,

I am confused about the class 'incompressible'. I think it should be a parent class of 'turbulenceModel', but in the declaration of the child class 'turbulenceModel' there is no statement saying that it is a child of 'incompressible'. Additionally, I cannot find any class with the name 'incompressible'. Could you explain the meaning of this 'incompressible' for me?

Thank you!
Zengrong


All times are GMT -4. The time now is 18:21.