CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   the difference between rho() and rho_ and rho? (https://www.cfd-online.com/Forums/openfoam-programming-development/224302-difference-between-rho-rho_-rho.html)

qi.yang@polimi.it February 13, 2020 06:22

the difference between rho() and rho_ and rho?
 
Hi guys,

please help me to understand why in the k-epsilon source code there are so many simbols which may represent the same thing. For example, rho() and rho_ and rho. What do they mean?

tmp<fvScalarMatrix> epsEqn
(
fvm::ddt(alpha, rho, epsilon_)
+ fvm::div(alphaRhoPhi, epsilon_)
- fvm::laplacian(alpha*rho*DepsilonEff(), epsilon_)
==
C1_*alpha()*rho()*G*epsilon_()/k_()
//- fvm::SuSp(((2.0/3.0)*C1_ - C3_)*alpha()*rho()*divU, epsilon_)
- fvm::Sp(C2_*alpha()*rho()*epsilon_()/k_(), epsilon_)
+ epsilonSource()
+ fvOptions(alpha, rho, epsilon_)
);

Thanks!

HPE February 13, 2020 16:28

- Wherever you see a tailing underscore in OF source code, that means the object is 'local' to the class.
- rho is 'volScalarField' type object for fluid density. This object includes 'internalField' and 'boundaryField' info.
- rho() in the source terms is 'volScalarField::Internal' type object wherein the boundary information is absent. This is fairly new functionality, and it is useful to reduce computational costs for parallel computations by reducing parallel communications which are mostly needed for boundaryFields rather than internalFields.

For a given 'vol*Field', say 'Object', '()' operator is defined, and you can call it by appending it to the given field, like 'Object()'. This 'Internal' field is only usable for sources on the right hand side of a constructed equation.

qi.yang@polimi.it February 14, 2020 03:30

Quote:

Originally Posted by HPE (Post 758068)
- Wherever you see a tailing underscore in OF source code, that means the object is 'local' to the class.
- rho is 'volScalarField' type object for fluid density. This object includes 'internalField' and 'boundaryField' info.
- rho() in the source terms is 'volScalarField::Internal' type object wherein the boundary information is absent. This is fairly new functionality, and it is useful to reduce computational costs for parallel computations by reducing parallel communications which are mostly needed for boundaryFields rather than internalFields.

For a given 'vol*Field', say 'Object', '()' operator is defined, and you can call it by appending it to the given field, like 'Object()'. This 'Internal' field is only usable for sources on the right hand side of a constructed equation.

Thanks. So if I write rho(), rho or rho_ will lead the results different only in the boundary?

HPE February 14, 2020 15:16

What do you mean by "results"? These objects are implementation details, and allowing tricks to reduce comp costs. Apart from that, all three objects represent the same information eventually: fluid density.


All times are GMT -4. The time now is 14:17.