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

Why is tmp<> sometimes used and sometimes not?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By jherb

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 23, 2019, 12:39
Default Why is tmp<> sometimes used and sometimes not?
  #1
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22
jherb is on a distinguished road
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));  

}
and here it is not:
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)); 
 }
Does it matter? Is there a reason for it? Which rules should be followed?


Thank you very much for any help.
raumpolizei likes this.
jherb is offline   Reply With Quote

Reply


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



All times are GMT -4. The time now is 02:43.