View Issue Details

IDProjectCategoryView StatusLast Update
0001411OpenFOAMBugpublic2016-02-25 10:27
Reporterdkxls Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
PlatformLinux x86_64OSopenSUSEOS Version13.1
Summary0001411: [janafThermo]: Incorrect expression for entropy
DescriptionThe entropy values obtained by evaluating the NASA polynomials account for the temperature dependency of the entropy only.
Unlike enthalpy, the entropy of an ideal gas varies with pressure as well as the temperature. The variation of entropy with pressure needs to be accounted for by an additional term.
To my understanding, the correct expression would hence be:
s(T,p) = s(T) - R*log(p/p_ref),
where, R is the gas constant, p pressure and s(T) obtained from the NASA polynomials as implemented in the janafThermo class.
References for further reading are listed below.
Additional InformationReferences:
Cengel, Yunus A., and M. A. Boles. Thermodynamics: An Engineering Approach. 5th ed. McGraw-Hill Science/Engineering/Math, 2004.

Poling, B.E., J.M. Prausnitz, and J.P. O’Connell. The Properties of Gases and Liquids. McGraw-Hill, 2001.
Tagsentropy, thermo

Activities

henry

2015-03-07 15:44

manager   ~0004001

The janafThermo package provides only the temperature dependency for entropy, the pressure dependency is a function of the equation of state which is selected independently of the thermodynamics.

One option would be to provide an entropy function for each equation of state to handle the pressure dependency and add that contribution to the thermal contribution:


template<class EquationOfState>
inline Foam::scalar Foam::janafThermo<EquationOfState>::s
(
    const scalar p,
    const scalar T
) const
{
    const coeffArray& a = coeffs(T);
    return
    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]
    )
  + EquationOfState::s(p, T);
}

for which we need the entropy functions corresponding to each equation of state.

If you are happy to dig-up the appropriate entropy expression for each of

adiabaticPerfectFluid incompressiblePerfectGas PengRobinsonGas perfectGas
icoPolynomial linear perfectFluid rhoConst

I will implement them all.

henry

2015-03-07 21:52

manager   ~0004005

This work is nearly complete in OpenFOAM-dev:

commit cb6f22edcf78b1db274d0ade0d1aab6eaa002056
Author: Henry <Henry>
Date: Sat Mar 7 21:47:04 2015 +0000

    thermophysicalModels/specie: Added entropy function to equations of state
    Added the pressure dependent part of the entropy from the equation of
    state to that returned by the thermo entropy function.
    
    TODO: Add entropy defect to the PengRobinsonGas::s(p, T) function.

dkxls

2015-03-09 18:47

reporter   ~0004062

I have been a bit short-sighted with my initial report and didn't consider all the different implementations for an equation of state.

However, I see you have fixed already the perfect gas equation and it's variants.

For the real gas equation (i.e. Peng-Robinson), the situation is unfortunately a bit more involved as there not only the entropy, but also the enthalpy and hence heat capacity require correction terms.
In literature these correction terms are often referred to as departure functions:
http://en.wikipedia.org/wiki/Departure_function

I can have a look at the code/literature and see if I can dig-up the respective expressions in the next couple of days.

henry

2015-03-09 19:04

manager   ~0004063

There is already support for the cp-cv function: cpMcv

but currently no support for the pressure effect departure function for this, cp or enthalpy. We could add any or all of these as required.

henry

2016-02-25 10:27

manager   ~0005979

cp, enthalpy and entropy now support departure functions:

commit e538f281b8d7e489c57b0805131810693fdf4657
Author: Henry Weller <http://cfd.direct>
Date: Wed Feb 17 10:48:30 2016 +0000

    thermophysicalModels: Added support for thermodynamic departure functions

and these have been implemented for the Peng-Robinson EoS:

commit ab3ed6d75ea30e696b5fea3c77045d7f9bb732e6
Author: Henry Weller <http://cfd.direct>
Date: Wed Feb 17 15:17:52 2016 +0000

    PengRobinsonGas: Added thermodynamic departure functions

Issue History

Date Modified Username Field Change
2014-10-07 19:24 dkxls New Issue
2014-10-30 12:48 dkxls Tag Attached: thermo
2014-10-30 12:48 dkxls Tag Attached: entropy
2015-03-07 15:44 henry Note Added: 0004001
2015-03-07 21:52 henry Note Added: 0004005
2015-03-09 18:47 dkxls Note Added: 0004062
2015-03-09 19:04 henry Note Added: 0004063
2015-03-24 00:17 liuhuafei Issue cloned: 0001626
2015-10-22 10:06 henry Status new => closed
2015-10-22 10:06 henry Assigned To => henry
2015-10-22 10:06 henry Resolution open => fixed
2016-02-25 10:27 henry Note Added: 0005979