View Issue Details

IDProjectCategoryView StatusLast Update
0002760OpenFOAMBugpublic2017-11-15 14:26
Reporterkrikre Assigned Tohenry  
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformGNU/LinuxOSCentOS release 6.6, Rocks 6.2OS Version(please specify)
Product Versiondev 
Fixed in Versiondev 
Summary0002760: heThermo::kappa() calling Cp() instead of Cpv()
DescriptionheThermo calculates kappa as Cp()*alpha_, but alpha_ is calculated as kappa/Cpv() which results in a discrepancy in kappa() when Cpv is Cv (with sensibleInternalEnergy).

[heThermo.C]
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::kappa() const
{
    tmp<Foam::volScalarField> kappa(Cp()*this->alpha_);
    kappa.ref().rename("kappa");
    return kappa;
}


[polynomialTransportI.H]
template<class Thermo, int PolySize>
inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alphah
(
    const scalar p, const scalar T
) const
{
    return kappa(p, T)/this->Cpv(p, T);
}



Steps To ReproduceDebug a solver where thermo.kappa() is called. Inspect the value of kappa().

Foam::heThermo<Foam::mojRhoThermo, Foam::pureMixture<Foam::myTransportModel<Foam::species::mojThermo<Foam::hPolynomialThermo<Foam::EquationOfState<Foam::specie>, 8>, Foam::sensibleInternalEnergy> > > >::kappa() const () at /export/home/user/OpenFOAM/OpenFOAM-3.0.1/src/thermophysicalModels/basic/lnInclude/heThermo.C:710
710 tmp<Foam::volScalarField> kappa(Cp()*this->alpha_);

Some classes are custom. Also, this was on an older version of OpenFOAM, but the code is the same in the dev version. The submitted patch was produced on the dev version.
Additional InformationPatch for OpenFOAM-dev attached.
Tagsthermo

Activities

krikre

2017-11-15 13:30

reporter  

fix-heThermo-kappa-Cp.patch (1,722 bytes)   
From 1839d6eabffdef1f38e3b8350de69dda13231e5d Mon Sep 17 00:00:00 2001
From: Kristjan <krebeljk@gmail.com>
Date: Wed, 15 Nov 2017 13:57:01 +0100
Subject: [PATCH] heThermo: fix kappa() Cp() to Cpv()

---
 src/thermophysicalModels/basic/heThermo/heThermo.C | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C
index c06ffb7..0e000e2 100644
--- a/src/thermophysicalModels/basic/heThermo/heThermo.C
+++ b/src/thermophysicalModels/basic/heThermo/heThermo.C
@@ -724,7 +724,7 @@ template<class BasicThermo, class MixtureType>
 Foam::tmp<Foam::volScalarField>
 Foam::heThermo<BasicThermo, MixtureType>::kappa() const
 {
-    tmp<Foam::volScalarField> kappa(Cp()*this->alpha_);
+    tmp<Foam::volScalarField> kappa(Cpv()*this->alpha_);
     kappa.ref().rename("kappa");
     return kappa;
 }
@@ -737,7 +737,7 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::kappa
 ) const
 {
     return
-        Cp
+        Cpv
         (
             this->p_.boundaryField()[patchi],
             this->T_.boundaryField()[patchi],
@@ -753,7 +753,7 @@ Foam::heThermo<BasicThermo, MixtureType>::kappaEff
     const volScalarField& alphat
 ) const
 {
-    tmp<Foam::volScalarField> kappaEff(Cp()*(this->alpha_ + alphat));
+    tmp<Foam::volScalarField> kappaEff(Cpv()*(this->alpha_ + alphat));
     kappaEff.ref().rename("kappaEff");
     return kappaEff;
 }
@@ -768,7 +768,7 @@ Foam::heThermo<BasicThermo, MixtureType>::kappaEff
 ) const
 {
     return
-        Cp
+        Cpv
         (
             this->p_.boundaryField()[patchi],
             this->T_.boundaryField()[patchi],
-- 
2.4.4

fix-heThermo-kappa-Cp.patch (1,722 bytes)   

henry

2017-11-15 13:45

manager   ~0009037

I am confused by your report, while you quote

[polynomialTransportI.H]
template<class Thermo, int PolySize>
inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alphah
(
    const scalar p, const scalar T
) const
{
    return kappa(p, T)/this->Cpv(p, T);
}


in OpenFOAM-dev the code is actually

[polynomialTransportI.H]
template<class Thermo, int PolySize>
inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alphah
(
    const scalar p, const scalar T
) const
{
    return kappa(p, T)/this->Cp(p, T);
}

henry

2017-11-15 13:46

manager   ~0009038

See:

commit 7acfa95ea0416e6e3f070465d802cd42142d68d8
Author: Henry Weller <http://cfd.direct>
Date: Wed May 3 14:59:07 2017 +0100

    thermophysicalModels: Corrected alphah to be enthalpy based
    
    in
    
    solidSpecie/transport/const/constAnIsoSolidTransport
    solidSpecie/transport/const/constIsoSolidTransport
    solidSpecie/transport/exponential/exponentialSolidTransport
    solidSpecie/transport/polynomial/polynomialSolidTransport
    specie/transport/logPolynomial/logPolynomialTransport
    specie/transport/polynomial/polynomialTransport
    specie/transport/sutherland/sutherlandTransport
    
    Resolves bug-report https://bugs.openfoam.org/view.php?id=2532

krikre

2017-11-15 14:08

reporter   ~0009039

I'm actually using OpenFOAM-3.0.1 and only checked the heThermo where I saw no changes. It didn't occur to me that it might have been resolved in the transport models. I guess it's sorted out than. Sorry for the confusion.

Issue History

Date Modified Username Field Change
2017-11-15 13:30 krikre New Issue
2017-11-15 13:30 krikre File Added: fix-heThermo-kappa-Cp.patch
2017-11-15 13:30 krikre Tag Attached: thermo
2017-11-15 13:45 henry Note Added: 0009037
2017-11-15 13:46 henry Note Added: 0009038
2017-11-15 14:08 krikre Note Added: 0009039
2017-11-15 14:26 henry Assigned To => henry
2017-11-15 14:26 henry Status new => closed
2017-11-15 14:26 henry Resolution open => no change required
2017-11-15 14:26 henry Fixed in Version => dev