CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How does the function"he=thermo.he()"work in EEqn.H with OpenFOAM2.2.1 (http://www.cfd-online.com/Forums/openfoam-programming-development/125369-how-does-function-he-thermo-he-work-eeqn-h-openfoam2-2-1-a.html)

zqlhzx October 24, 2013 05:34

How does the function"he=thermo.he()"work in EEqn.H with OpenFOAM2.2.1
 
Hi Foamers:
I am confused with how does the function " thermo.he()"work?in other word,how to abtain Enthalpy in EEqn.H with OF2.2.1 ?
In EEqn.H,Enthalpy can be availabled with the code:
Code:

volScalarField& he = thermo.he();
where is the function "thermo.he()"?
I think it is in the file "thermoI.H".I found the codes in "thermoI.H".
Code:

template<class Thermo, template<class> class Type>
inline Foam::scalar
Foam::species::thermo<Thermo, Type>::he(const scalar p, const scalar T) const
{
    return Type<thermo<Thermo, Type> >::he(*this, p, T);

But where is the function "Type<thermo<Thermo, Type> >::he(*this, p, T);"?
I understand "Type<thermo<Thermo, Type> >::he(*this, p, T);" as following:
If I use janafThermo,the function "he(*this, p, T)" is in the "janafThermoI.H".We can see the following codes in "janafThermoI.H":
Code:

template<class EquationOfState>
inline Foam::scalar Foam::janafThermo<EquationOfState>::ha
(
    const scalar p,
    const scalar T
) const
{
    const coeffArray& a = coeffs(T);
    return this->RR*
    (
        ((((a[4]/5.0*T + a[3]/4.0)*T + a[2]/3.0)*T + a[1]/2.0)*T + a[0])*T
      + a[5]
    );
}
 
template<class EquationOfState>
inline Foam::scalar Foam::janafThermo<EquationOfState>::hs
(
    const scalar p,
    const scalar T
) const
{
    return ha(p, T) - hc();
}
 
template<class EquationOfState>
inline Foam::scalar Foam::janafThermo<EquationOfState>::hc() const
{
    const coeffArray& a = lowCpCoeffs_;
    const scalar Tstd = specie::Tstd;
    return this->RR*
    (
        (
            (((a[4]/5.0*Tstd + a[3]/4.0)*Tstd + a[2]/3.0)*Tstd + a[1]/2.0)*Tstd
          + a[0]
        )*Tstd + a[5]
    );
}
 
template<class EquationOfState>
inline Foam::scalar Foam::janafThermo<EquationOfState>::s
(
    const scalar p,
    const scalar T
) const
{
    const coeffArray& a = coeffs(T);
    return
    this->RR*
    (
        (((a[4]/4.0*T + a[3]/3.0)*T + a[2]/2.0)*T + a[1])*T + a[0]*::log(T)
      + a[6]
    );
}

If I use absoluteEnthalpy,then the function "he(*this, p, T)" is corresponding to
Code:

template<class EquationOfState>
inline Foam::scalar Foam::janafThermo<EquationOfState>::ha
(
const scalar p,
const scalar T
) const
{
const coeffArray& a = coeffs(T);
return this->RR*
(
((((a[4]/5.0*T + a[3]/4.0)*T + a[2]/3.0)*T + a[1]/2.0)*T + a[0])*T
+ a[5]
);
}

And if I use sensible Enthalpy ,then the function "he(*this, p, T)" is corresponding to
Code:

template<class EquationOfState>
inline Foam::scalar Foam::janafThermo<EquationOfState>::hs
(
const scalar p,
const scalar T
) const
{
return ha(p, T) - hc();
}

Does my understanding right?If it is wrong,how should understander
Code:

volScalarField& he = thermo.he();
and How does it work?
Thanks in advance!Any reply will be appreciated!

Lisandro Maders September 11, 2015 18:58

Hello,

were you correct in your analysis? I have similar doubts regarding to this..

Thanks!

Lisandro


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