|
[Sponsors] |
Why is tmp<> sometimes used and sometimes not? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 23, 2019, 12:39 |
Why is tmp<> sometimes used and sometimes not?
|
#1 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
I would like to ask, why in some occasions in the following source file of a turbulence model the tmp<> mechanism is used and sometimes not:
https://github.com/OpenFOAM/OpenFOAM.../LienCubicKE.C This is just an example, I would like to understand the concept. I have read the explanation at the wiki: https://openfoamwiki.net/index.php/OpenFOAM_guide/tmp Here it is used, even though it is just a temporary variable in a method: Code:
tmp<volScalarField> LienCubicKE::f2() const { tmp<volScalarField> Rt = sqr(k_)/(nu()*epsilon_); return scalar(1) - 0.3*exp(-sqr(Rt)); } Code:
tmp<volScalarField> LienCubicKE::E(const volScalarField& f2) const { const volScalarField yStar(sqrt(k_)*y_/nu()); const volScalarField le ( kappa_*y_/(scalar(1) + (2*kappa_/(pow(Cmu_, 0.75))/(yStar + small))) ); return ( Ceps2_*pow(Cmu_, 0.75)) *(f2*sqrt(k_)*epsilon_/le)*exp(-AE_*sqr(yStar)); } Thank you very much for any help. |
|
|
|