mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Derivative of B in thermo.H (dKcdTbyKc) calculated from S and G instead of dGdT
Member function dKcdTbyKc in thermo.H is calculated from S and G at Pstd. Thus dGdT was removed from the thermos. - Add optional hRef, eRef and Tref as optional. - Use new thermo to multiphase solver icoReactingMuliPhaseFoam - Remove hRefConst and eRefConst thermos. TUT: Updated tutorials
This commit is contained in:
@ -79,6 +79,8 @@ makeBaseTurbulenceModel
|
||||
#include "Stokes.H"
|
||||
makeLaminarModel(Stokes);
|
||||
|
||||
#include "generalizedNewtonian.H"
|
||||
makeLaminarModel(generalizedNewtonian);
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// RAS models
|
||||
|
||||
@ -11,8 +11,6 @@ multiphaseSystem/multiphaseSystem.C
|
||||
multiphaseSystem/multiphaseSystemNew.C
|
||||
multiphaseSystem/multiphaseSystems.C
|
||||
|
||||
reactionThermo/hRefConstThermos.C
|
||||
|
||||
diameter = diameterModels
|
||||
$(diameter)/diameterModel/diameterModel.C
|
||||
$(diameter)/constantDiameter/constantDiameter.C
|
||||
|
||||
@ -1,351 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "makeReactionThermo.H"
|
||||
#include "makeThermo.H"
|
||||
|
||||
#include "rhoReactionThermo.H"
|
||||
#include "heRhoThermo.H"
|
||||
|
||||
#include "specie.H"
|
||||
#include "perfectGas.H"
|
||||
#include "rPolynomial.H"
|
||||
#include "perfectFluid.H"
|
||||
#include "rhoConst.H"
|
||||
|
||||
#include "sensibleEnthalpy.H"
|
||||
|
||||
#include "hRefConstThermo.H"
|
||||
#include "eRefConstThermo.H"
|
||||
|
||||
#include "constTransport.H"
|
||||
|
||||
#include "pureMixture.H"
|
||||
#include "multiComponentMixture.H"
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Thermo type typedefs:
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
hRefConstThermo
|
||||
<
|
||||
perfectGas<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> constRefGasHThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
hRefConstThermo
|
||||
<
|
||||
perfectFluid<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> constRefFluidHThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
hRefConstThermo
|
||||
<
|
||||
rPolynomial<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> constRefrPolFluidHThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
eRefConstThermo
|
||||
<
|
||||
perfectGas<specie>
|
||||
>,
|
||||
sensibleInternalEnergy
|
||||
>
|
||||
> constRefGasEThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
eRefConstThermo
|
||||
<
|
||||
perfectFluid<specie>
|
||||
>,
|
||||
sensibleInternalEnergy
|
||||
>
|
||||
> constRefFluidEThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
eRefConstThermo
|
||||
<
|
||||
rPolynomial<specie>
|
||||
>,
|
||||
sensibleInternalEnergy
|
||||
>
|
||||
> constRefrPolFluidEThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
eRefConstThermo
|
||||
<
|
||||
rhoConst<specie>
|
||||
>,
|
||||
sensibleInternalEnergy
|
||||
>
|
||||
> constRefRhoConstEThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
hRefConstThermo
|
||||
<
|
||||
rhoConst<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> constRefRhoConstHThermoPhysics;
|
||||
|
||||
|
||||
// pureMixture, sensibleEnthalpy:
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
heRhoThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
sensibleEnthalpy,
|
||||
hRefConstThermo,
|
||||
perfectGas,
|
||||
specie
|
||||
);
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
heRhoThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
sensibleEnthalpy,
|
||||
hRefConstThermo,
|
||||
rPolynomial,
|
||||
specie
|
||||
);
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
heRhoThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
sensibleEnthalpy,
|
||||
hRefConstThermo,
|
||||
perfectFluid,
|
||||
specie
|
||||
);
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
heRhoThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
sensibleEnthalpy,
|
||||
hRefConstThermo,
|
||||
rhoConst,
|
||||
specie
|
||||
);
|
||||
|
||||
|
||||
// pureMixture, sensibleInternalEnergy:
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
heRhoThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
sensibleInternalEnergy,
|
||||
eRefConstThermo,
|
||||
perfectGas,
|
||||
specie
|
||||
);
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
heRhoThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
sensibleInternalEnergy,
|
||||
eRefConstThermo,
|
||||
rPolynomial,
|
||||
specie
|
||||
);
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
heRhoThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
sensibleInternalEnergy,
|
||||
eRefConstThermo,
|
||||
perfectFluid,
|
||||
specie
|
||||
);
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
heRhoThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
sensibleInternalEnergy,
|
||||
eRefConstThermo,
|
||||
rhoConst,
|
||||
specie
|
||||
);
|
||||
|
||||
|
||||
// multiComponentMixture, sensibleInternalEnergy:
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefGasEThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefFluidEThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefrPolFluidEThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefRhoConstEThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// multiComponentMixture, sensibleEnthalpy:
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefRhoConstHThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefFluidHThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefrPolFluidHThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefGasHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -501,6 +501,18 @@ makeThermos
|
||||
specie
|
||||
);
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
heRhoThermo,
|
||||
pureMixture,
|
||||
constTransport,
|
||||
sensibleInternalEnergy,
|
||||
eConstThermo,
|
||||
perfectGas,
|
||||
specie
|
||||
);
|
||||
|
||||
makeThermos
|
||||
(
|
||||
rhoThermo,
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,7 +36,9 @@ Foam::eConstThermo<EquationOfState>::eConstThermo(const dictionary& dict)
|
||||
:
|
||||
EquationOfState(dict),
|
||||
Cv_(dict.subDict("thermodynamics").get<scalar>("Cv")),
|
||||
Hf_(dict.subDict("thermodynamics").get<scalar>("Hf"))
|
||||
Hf_(dict.subDict("thermodynamics").get<scalar>("Hf")),
|
||||
Tref_(dict.subDict("thermodynamics").getOrDefault<scalar>("Tref", Tstd)),
|
||||
Esref_(dict.subDict("thermodynamics").getOrDefault<scalar>("Eref", 0))
|
||||
{}
|
||||
|
||||
|
||||
@ -51,6 +54,8 @@ void Foam::eConstThermo<EquationOfState>::write(Ostream& os) const
|
||||
os.beginBlock("thermodynamics");
|
||||
os.writeEntry("Cv", Cv_);
|
||||
os.writeEntry("Hf", Hf_);
|
||||
os.writeEntryIfDifferent<scalar>("Tref", Tstd, Tref_);
|
||||
os.writeEntryIfDifferent<scalar>("Eref", 0, Esref_);
|
||||
os.endBlock();
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -101,6 +102,12 @@ class eConstThermo
|
||||
// Note: input in [J/kg], but internally uses [J/kmol]
|
||||
scalar Hf_;
|
||||
|
||||
//- Reference temperature around which to linearise [K]
|
||||
scalar Tref_;
|
||||
|
||||
//- Reference sensible enthalpy around which to linearise [J/kg]
|
||||
scalar Esref_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -109,7 +116,9 @@ class eConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cv,
|
||||
const scalar hf
|
||||
const scalar hf,
|
||||
const scalar Tref,
|
||||
const scalar Esref
|
||||
);
|
||||
|
||||
|
||||
@ -159,13 +168,14 @@ public:
|
||||
//- Entropy [J/(kg K)]
|
||||
inline scalar S(const scalar p, const scalar T) const;
|
||||
|
||||
//- Gibbs free energy of the mixture in the standard state [J/kg]
|
||||
inline scalar Gstd(const scalar T) const;
|
||||
|
||||
#include "EtoHthermo.H"
|
||||
|
||||
|
||||
// Derivative term used for Jacobian
|
||||
|
||||
//- Derivative of Gibbs free energy w.r.t. temperature
|
||||
inline scalar dGdT(const scalar p, const scalar T) const;
|
||||
|
||||
//- Temperature derivative of heat capacity at constant pressure
|
||||
inline scalar dCpdT(const scalar p, const scalar T) const;
|
||||
|
||||
@ -32,12 +32,16 @@ inline Foam::eConstThermo<EquationOfState>::eConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cv,
|
||||
const scalar hf
|
||||
const scalar hf,
|
||||
const scalar Tref,
|
||||
const scalar Esref
|
||||
)
|
||||
:
|
||||
EquationOfState(st),
|
||||
Cv_(cv),
|
||||
Hf_(hf)
|
||||
Hf_(hf),
|
||||
Tref_(Tref),
|
||||
Esref_(Esref)
|
||||
{}
|
||||
|
||||
|
||||
@ -52,7 +56,9 @@ inline Foam::eConstThermo<EquationOfState>::eConstThermo
|
||||
:
|
||||
EquationOfState(name, ct),
|
||||
Cv_(ct.Cv_),
|
||||
Hf_(ct.Hf_)
|
||||
Hf_(ct.Hf_),
|
||||
Tref_(ct.Tref_),
|
||||
Esref_(ct.Esref_)
|
||||
{}
|
||||
|
||||
|
||||
@ -102,7 +108,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::Es
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Cv_*T + EquationOfState::E(p, T);
|
||||
return Cv_*(T - Tref_) + Esref_ + EquationOfState::E(p, T);
|
||||
}
|
||||
|
||||
|
||||
@ -136,13 +142,14 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::S
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eConstThermo<EquationOfState>::dGdT
|
||||
inline Foam::scalar Foam::eConstThermo<EquationOfState>::Gstd
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
return
|
||||
Cv_*(T - Tref_) + Esref_ + Hc() + Pstd/EquationOfState::rho(Pstd, T)
|
||||
- S(Pstd, T)*T;
|
||||
}
|
||||
|
||||
|
||||
@ -153,6 +160,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::dCpdT
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -175,6 +183,7 @@ inline void Foam::eConstThermo<EquationOfState>::operator+=
|
||||
|
||||
Cv_ = Y1*Cv_ + Y2*ct.Cv_;
|
||||
Hf_ = Y1*Hf_ + Y2*ct.Hf_;
|
||||
Esref_ = Y1*Esref_ + Y2*ct.Esref_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +209,9 @@ inline Foam::eConstThermo<EquationOfState> Foam::operator+
|
||||
(
|
||||
eofs,
|
||||
ct1.Cv_,
|
||||
ct1.Hf_
|
||||
ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Esref_
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -211,7 +222,10 @@ inline Foam::eConstThermo<EquationOfState> Foam::operator+
|
||||
ct1.Y()/eofs.Y()*ct1.Cv_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Cv_,
|
||||
ct1.Y()/eofs.Y()*ct1.Hf_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hf_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Y()/eofs.Y()*ct1.Esref_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Esref_
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -228,7 +242,9 @@ inline Foam::eConstThermo<EquationOfState> Foam::operator*
|
||||
(
|
||||
s*static_cast<const EquationOfState&>(ct),
|
||||
ct.Cv_,
|
||||
ct.Hf_
|
||||
ct.Hf_,
|
||||
ct.Tref_,
|
||||
ct.Esref_
|
||||
);
|
||||
}
|
||||
|
||||
@ -252,7 +268,10 @@ inline Foam::eConstThermo<EquationOfState> Foam::operator==
|
||||
ct2.Y()/eofs.Y()*ct2.Cv_
|
||||
- ct1.Y()/eofs.Y()*ct1.Cv_,
|
||||
ct2.Y()/eofs.Y()*ct2.Hf_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hf_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct2.Y()/eofs.Y()*ct2.Esref_
|
||||
- ct1.Y()/eofs.Y()*ct1.Esref_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "eRefConstThermo.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
Foam::eRefConstThermo<EquationOfState>::eRefConstThermo(const dictionary& dict)
|
||||
:
|
||||
EquationOfState(dict),
|
||||
Cv_(readCoeff("Cv", dict)),
|
||||
Hf_(readCoeff("Hf", dict)),
|
||||
Tref_(readCoeff("Tref", dict)),
|
||||
Eref_(readCoeff("Eref", dict))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
void Foam::eRefConstThermo<EquationOfState>::write(Ostream& os) const
|
||||
{
|
||||
EquationOfState::write(os);
|
||||
|
||||
{
|
||||
os.beginBlock("thermodynamics");
|
||||
os.writeEntry("Cv", Cv_);
|
||||
os.writeEntry("Hf", Hf_);
|
||||
os.writeEntry("Tref", Tref_);
|
||||
os.writeEntry("Eref", Eref_);
|
||||
os.endBlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const eRefConstThermo<EquationOfState>& ct
|
||||
)
|
||||
{
|
||||
ct.write(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,234 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::eRefConstThermo
|
||||
|
||||
Description
|
||||
Constant properties thermodynamics package
|
||||
templated into the EquationOfState.
|
||||
|
||||
SourceFiles
|
||||
eRefConstThermoI.H
|
||||
eRefConstThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef eRefConstThermo_H
|
||||
#define eRefConstThermo_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
|
||||
template<class EquationOfState> class eRefConstThermo;
|
||||
|
||||
template<class EquationOfState>
|
||||
inline eRefConstThermo<EquationOfState> operator+
|
||||
(
|
||||
const eRefConstThermo<EquationOfState>&,
|
||||
const eRefConstThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
template<class EquationOfState>
|
||||
inline eRefConstThermo<EquationOfState> operator*
|
||||
(
|
||||
const scalar,
|
||||
const eRefConstThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
template<class EquationOfState>
|
||||
inline eRefConstThermo<EquationOfState> operator==
|
||||
(
|
||||
const eRefConstThermo<EquationOfState>&,
|
||||
const eRefConstThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
template<class EquationOfState>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const eRefConstThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class eRefConstThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class EquationOfState>
|
||||
class eRefConstThermo
|
||||
:
|
||||
public EquationOfState
|
||||
{
|
||||
// Private Data
|
||||
|
||||
scalar Cv_;
|
||||
scalar Hf_;
|
||||
scalar Tref_;
|
||||
scalar Eref_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Read coefficient from "thermodynamics" sub-dictionary
|
||||
inline scalar readCoeff(const word& key, const dictionary& dict)
|
||||
{
|
||||
return dict.subDict("thermodynamics").get<scalar>(key);
|
||||
}
|
||||
|
||||
|
||||
//- Construct from components
|
||||
inline eRefConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cv,
|
||||
const scalar hf,
|
||||
const scalar tref,
|
||||
const scalar eref
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
eRefConstThermo(const dictionary& dict);
|
||||
|
||||
//- Construct as named copy
|
||||
inline eRefConstThermo(const word&, const eRefConstThermo&);
|
||||
|
||||
//- Construct and return a clone
|
||||
inline autoPtr<eRefConstThermo> clone() const;
|
||||
|
||||
//- Selector from dictionary
|
||||
inline static autoPtr<eRefConstThermo> New(const dictionary& dict);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the instantiated type name
|
||||
static word typeName()
|
||||
{
|
||||
return "eRefConst<" + EquationOfState::typeName() + '>';
|
||||
}
|
||||
|
||||
//- Limit temperature to be within the range
|
||||
inline scalar limit(const scalar T) const;
|
||||
|
||||
|
||||
// Fundamental properties
|
||||
|
||||
//- Heat capacity at constant volume [J/(kg K)]
|
||||
inline scalar Cv(const scalar p, const scalar T) const;
|
||||
|
||||
//- Sensible internal energy [J/kg]
|
||||
inline scalar Es(const scalar p, const scalar T) const;
|
||||
|
||||
//- Absolute internal energy [J/kg]
|
||||
inline scalar Ea(const scalar p, const scalar T) const;
|
||||
|
||||
//- Chemical enthalpy [J/kg]
|
||||
inline scalar Hc() const;
|
||||
|
||||
//- Entropy [J/(kg K)]
|
||||
inline scalar S(const scalar p, const scalar T) const;
|
||||
|
||||
#include "EtoHthermo.H"
|
||||
|
||||
|
||||
// Derivative term used for Jacobian
|
||||
|
||||
//- Derivative of Gibbs free energy w.r.t. temperature
|
||||
inline scalar dGdT(const scalar p, const scalar T) const;
|
||||
|
||||
//- Temperature derivative of heat capacity at constant pressure
|
||||
inline scalar dCpdT(const scalar p, const scalar T) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator+=(const eRefConstThermo&);
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
friend eRefConstThermo operator+ <EquationOfState>
|
||||
(
|
||||
const eRefConstThermo&,
|
||||
const eRefConstThermo&
|
||||
);
|
||||
|
||||
friend eRefConstThermo operator* <EquationOfState>
|
||||
(
|
||||
const scalar,
|
||||
const eRefConstThermo&
|
||||
);
|
||||
|
||||
friend eRefConstThermo operator== <EquationOfState>
|
||||
(
|
||||
const eRefConstThermo&,
|
||||
const eRefConstThermo&
|
||||
);
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<< <EquationOfState>
|
||||
(
|
||||
Ostream&,
|
||||
const eRefConstThermo&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "eRefConstThermoI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "eRefConstThermo.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,276 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::eRefConstThermo<EquationOfState>::eRefConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cv,
|
||||
const scalar hf,
|
||||
const scalar tref,
|
||||
const scalar eref
|
||||
)
|
||||
:
|
||||
EquationOfState(st),
|
||||
Cv_(cv),
|
||||
Hf_(hf),
|
||||
Tref_(tref),
|
||||
Eref_(eref)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::eRefConstThermo<EquationOfState>::eRefConstThermo
|
||||
(
|
||||
const word& name,
|
||||
const eRefConstThermo& ct
|
||||
)
|
||||
:
|
||||
EquationOfState(name, ct),
|
||||
Cv_(ct.Cv_),
|
||||
Hf_(ct.Hf_),
|
||||
Tref_(ct.Tref_),
|
||||
Eref_(ct.Eref_)
|
||||
{}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::autoPtr<Foam::eRefConstThermo<EquationOfState>>
|
||||
Foam::eRefConstThermo<EquationOfState>::clone() const
|
||||
{
|
||||
return autoPtr<eRefConstThermo<EquationOfState>>
|
||||
(
|
||||
new eRefConstThermo<EquationOfState>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::autoPtr<Foam::eRefConstThermo<EquationOfState>>
|
||||
Foam::eRefConstThermo<EquationOfState>::New(const dictionary& dict)
|
||||
{
|
||||
return autoPtr<eRefConstThermo<EquationOfState>>
|
||||
(
|
||||
new eRefConstThermo<EquationOfState>(dict)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eRefConstThermo<EquationOfState>::limit
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return T;
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eRefConstThermo<EquationOfState>::Cv
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Cv_ + EquationOfState::Cv(p, T);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eRefConstThermo<EquationOfState>::Es
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return Cv_*(T - Tref_) + Eref_ + EquationOfState::E(p, T);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eRefConstThermo<EquationOfState>::Hc() const
|
||||
{
|
||||
return Hf_;
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eRefConstThermo<EquationOfState>::Ea
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return Es(p, T) + Hc();
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eRefConstThermo<EquationOfState>::S
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp(p, T)*log(T/Tstd) + EquationOfState::S(p, T);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eRefConstThermo<EquationOfState>::dGdT
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eRefConstThermo<EquationOfState>::dCpdT
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline void Foam::eRefConstThermo<EquationOfState>::operator+=
|
||||
(
|
||||
const eRefConstThermo<EquationOfState>& ct
|
||||
)
|
||||
{
|
||||
scalar Y1 = this->Y();
|
||||
|
||||
EquationOfState::operator+=(ct);
|
||||
|
||||
if (mag(this->Y()) > SMALL)
|
||||
{
|
||||
Y1 /= this->Y();
|
||||
const scalar Y2 = ct.Y()/this->Y();
|
||||
|
||||
Cv_ = Y1*Cv_ + Y2*ct.Cv_;
|
||||
Hf_ = Y1*Hf_ + Y2*ct.Hf_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::eRefConstThermo<EquationOfState> Foam::operator+
|
||||
(
|
||||
const eRefConstThermo<EquationOfState>& ct1,
|
||||
const eRefConstThermo<EquationOfState>& ct2
|
||||
)
|
||||
{
|
||||
EquationOfState eofs
|
||||
(
|
||||
static_cast<const EquationOfState&>(ct1)
|
||||
+ static_cast<const EquationOfState&>(ct2)
|
||||
);
|
||||
|
||||
if (mag(eofs.Y()) < SMALL)
|
||||
{
|
||||
return eRefConstThermo<EquationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.Cv_,
|
||||
ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Eref_
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return eRefConstThermo<EquationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.Y()/eofs.Y()*ct1.Cv_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Cv_,
|
||||
ct1.Y()/eofs.Y()*ct1.Hf_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hf_,
|
||||
ct1.Y()/eofs.Y()*ct1.Tref_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Tref_,
|
||||
ct1.Y()/eofs.Y()*ct1.Eref_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Eref_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::eRefConstThermo<EquationOfState> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const eRefConstThermo<EquationOfState>& ct
|
||||
)
|
||||
{
|
||||
return eRefConstThermo<EquationOfState>
|
||||
(
|
||||
s*static_cast<const EquationOfState&>(ct),
|
||||
ct.Cv_,
|
||||
ct.Hf_,
|
||||
ct.Tref_,
|
||||
ct.Eref_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::eRefConstThermo<EquationOfState> Foam::operator==
|
||||
(
|
||||
const eRefConstThermo<EquationOfState>& ct1,
|
||||
const eRefConstThermo<EquationOfState>& ct2
|
||||
)
|
||||
{
|
||||
EquationOfState eofs
|
||||
(
|
||||
static_cast<const EquationOfState&>(ct1)
|
||||
== static_cast<const EquationOfState&>(ct2)
|
||||
);
|
||||
|
||||
return eRefConstThermo<EquationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct2.Y()/eofs.Y()*ct2.Cv_
|
||||
- ct1.Y()/eofs.Y()*ct1.Cv_,
|
||||
ct2.Y()/eofs.Y()*ct2.Hf_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,7 +36,9 @@ Foam::hConstThermo<EquationOfState>::hConstThermo(const dictionary& dict)
|
||||
:
|
||||
EquationOfState(dict),
|
||||
Cp_(dict.subDict("thermodynamics").get<scalar>("Cp")),
|
||||
Hf_(dict.subDict("thermodynamics").get<scalar>("Hf"))
|
||||
Hf_(dict.subDict("thermodynamics").get<scalar>("Hf")),
|
||||
Tref_(dict.subDict("thermodynamics").getOrDefault<scalar>("Tref", Tstd)),
|
||||
Hsref_(dict.subDict("thermodynamics").getOrDefault<scalar>("Href", 0))
|
||||
{}
|
||||
|
||||
|
||||
@ -51,6 +54,8 @@ void Foam::hConstThermo<EquationOfState>::write(Ostream& os) const
|
||||
os.beginBlock("thermodynamics");
|
||||
os.writeEntry("Cp", Cp_);
|
||||
os.writeEntry("Hf", Hf_);
|
||||
os.writeEntryIfDifferent<scalar>("Tref", Tstd, Tref_);
|
||||
os.writeEntryIfDifferent<scalar>("Href", 0, Hsref_);
|
||||
os.endBlock();
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -94,6 +95,12 @@ class hConstThermo
|
||||
scalar Cp_;
|
||||
scalar Hf_;
|
||||
|
||||
//- Reference temperature
|
||||
scalar Tref_;
|
||||
|
||||
//- Reference sensible enthalpy
|
||||
scalar Hsref_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -102,7 +109,9 @@ class hConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cp,
|
||||
const scalar hf
|
||||
const scalar hf,
|
||||
const scalar Tref,
|
||||
const scalar Href
|
||||
);
|
||||
|
||||
|
||||
@ -152,13 +161,14 @@ public:
|
||||
//- Entropy [J/(kg K)]
|
||||
inline scalar S(const scalar p, const scalar T) const;
|
||||
|
||||
//- Gibbs free energy of the mixture in the standard state [J/kg]
|
||||
inline scalar Gstd(const scalar T) const;
|
||||
|
||||
#include "HtoEthermo.H"
|
||||
|
||||
|
||||
// Derivative term used for Jacobian
|
||||
|
||||
//- Derivative of Gibbs free energy w.r.t. temperature
|
||||
inline scalar dGdT(const scalar p, const scalar T) const;
|
||||
|
||||
//- Temperature derivative of heat capacity at constant pressure
|
||||
inline scalar dCpdT(const scalar p, const scalar T) const;
|
||||
|
||||
@ -32,12 +32,16 @@ inline Foam::hConstThermo<EquationOfState>::hConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cp,
|
||||
const scalar hf
|
||||
const scalar hf,
|
||||
const scalar Tref,
|
||||
const scalar Href
|
||||
)
|
||||
:
|
||||
EquationOfState(st),
|
||||
Cp_(cp),
|
||||
Hf_(hf)
|
||||
Hf_(hf),
|
||||
Tref_(Tref),
|
||||
Hsref_(Href)
|
||||
{}
|
||||
|
||||
|
||||
@ -52,7 +56,9 @@ inline Foam::hConstThermo<EquationOfState>::hConstThermo
|
||||
:
|
||||
EquationOfState(name, ct),
|
||||
Cp_(ct.Cp_),
|
||||
Hf_(ct.Hf_)
|
||||
Hf_(ct.Hf_),
|
||||
Tref_(ct.Tref_),
|
||||
Hsref_(ct.Hsref_)
|
||||
{}
|
||||
|
||||
|
||||
@ -111,7 +117,7 @@ inline Foam::scalar Foam::hConstThermo<EquationOfState>::Hs
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_*T + EquationOfState::H(p, T);
|
||||
return Cp_*(T - Tref_) + Hsref_ + EquationOfState::H(p, T);
|
||||
}
|
||||
|
||||
|
||||
@ -133,12 +139,12 @@ inline Foam::scalar Foam::hConstThermo<EquationOfState>::S
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hConstThermo<EquationOfState>::dGdT
|
||||
inline Foam::scalar Foam::hConstThermo<EquationOfState>::Gstd
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
return Cp_*(T - Tref_) + Hsref_ + Hc() - Cp_*T*log(T/Tstd);
|
||||
}
|
||||
|
||||
|
||||
@ -170,6 +176,7 @@ inline void Foam::hConstThermo<EquationOfState>::operator+=
|
||||
|
||||
Cp_ = Y1*Cp_ + Y2*ct.Cp_;
|
||||
Hf_ = Y1*Hf_ + Y2*ct.Hf_;
|
||||
Hsref_ = Y1*Hsref_ + Y2*ct.Hsref_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +202,9 @@ inline Foam::hConstThermo<EquationOfState> Foam::operator+
|
||||
(
|
||||
eofs,
|
||||
ct1.Cp_,
|
||||
ct1.Hf_
|
||||
ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Hsref_
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -206,7 +215,10 @@ inline Foam::hConstThermo<EquationOfState> Foam::operator+
|
||||
ct1.Y()/eofs.Y()*ct1.Cp_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Cp_,
|
||||
ct1.Y()/eofs.Y()*ct1.Hf_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hf_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Y()/eofs.Y()*ct1.Hsref_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hsref_
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -223,7 +235,9 @@ inline Foam::hConstThermo<EquationOfState> Foam::operator*
|
||||
(
|
||||
s*static_cast<const EquationOfState&>(ct),
|
||||
ct.Cp_,
|
||||
ct.Hf_
|
||||
ct.Hf_,
|
||||
ct.Tref_,
|
||||
ct.Hsref_
|
||||
);
|
||||
}
|
||||
|
||||
@ -247,7 +261,10 @@ inline Foam::hConstThermo<EquationOfState> Foam::operator==
|
||||
ct2.Y()/eofs.Y()*ct2.Cp_
|
||||
- ct1.Y()/eofs.Y()*ct1.Cp_,
|
||||
ct2.Y()/eofs.Y()*ct2.Hf_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hf_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct2.Y()/eofs.Y()*ct2.Hsref_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hsref_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -212,14 +212,15 @@ public:
|
||||
//- Entropy [J/(kg K)]
|
||||
inline scalar S(const scalar p, const scalar T) const;
|
||||
|
||||
//- Gibbs free energy of the mixture in the standard state [J/kg]
|
||||
inline scalar Gstd(const scalar T) const;
|
||||
|
||||
|
||||
#include "HtoEthermo.H"
|
||||
|
||||
|
||||
// Derivative term used for Jacobian
|
||||
|
||||
//- Derivative of Gibbs free energy w.r.t. temperature
|
||||
inline scalar dGdT(const scalar p, const scalar T) const;
|
||||
|
||||
//- Temperature derivative of heat capacity at constant pressure
|
||||
inline scalar dCpdT(const scalar p, const scalar T) const;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -129,18 +130,12 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::S
|
||||
|
||||
|
||||
template<class EquationOfState, int PolySize>
|
||||
inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::dGdT
|
||||
inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::Gstd
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
hCoeffs_.derivative(T)
|
||||
- T*sCoeffs_.derivative(T)
|
||||
- sCoeffs_.value(T)
|
||||
);
|
||||
return hCoeffs_.value(T) - sCoeffs_.value(T)*T;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -173,14 +174,15 @@ public:
|
||||
//- Entropy [J/(kg K)]
|
||||
inline scalar S(const scalar p, const scalar T) const;
|
||||
|
||||
//- Gibbs free energy of the mixture in the standard state [J/kg]
|
||||
inline scalar Gstd(const scalar T) const;
|
||||
|
||||
|
||||
#include "HtoEthermo.H"
|
||||
|
||||
|
||||
// Derivative term used for Jacobian
|
||||
|
||||
//- Derivative of Gibbs free energy w.r.t. temperature
|
||||
inline scalar dGdT(const scalar p, const scalar T) const;
|
||||
|
||||
//- Temperature derivative of heat capacity at constant pressure
|
||||
inline scalar dCpdT(const scalar p, const scalar T) const;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -161,14 +162,15 @@ inline Foam::scalar Foam::hPowerThermo<EquationOfState>::S
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hPowerThermo<EquationOfState>::dGdT
|
||||
inline Foam::scalar Foam::hPowerThermo<EquationOfState>::Gstd
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
// To be implemented
|
||||
NotImplemented;
|
||||
return 0;
|
||||
return
|
||||
c0_*(pow(T, n0_ + 1) - pow(Tstd, n0_ + 1))/(pow(Tref_, n0_)*(n0_ + 1))
|
||||
+ Hc()
|
||||
- c0_*(pow(T, n0_) - pow(Tstd, n0_))*T/(pow(Tref_, n0_)*n0_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "hRefConstThermo.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
Foam::hRefConstThermo<EquationOfState>::hRefConstThermo(const dictionary& dict)
|
||||
:
|
||||
EquationOfState(dict),
|
||||
Cp_(dict.subDict("thermodynamics").get<scalar>("Cp")),
|
||||
Hf_(dict.subDict("thermodynamics").get<scalar>("Hf")),
|
||||
Tref_(dict.subDict("thermodynamics").get<scalar>("Tref")),
|
||||
Href_(dict.subDict("thermodynamics").get<scalar>("Href"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
void Foam::hRefConstThermo<EquationOfState>::write(Ostream& os) const
|
||||
{
|
||||
EquationOfState::write(os);
|
||||
|
||||
// Entries in dictionary format
|
||||
{
|
||||
os.beginBlock("thermodynamics");
|
||||
os.writeEntry("Cp", Cp_);
|
||||
os.writeEntry("Hf", Hf_);
|
||||
os.writeEntry("Tref", Tref_);
|
||||
os.writeEntry("Href", Href_);
|
||||
os.endBlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const hRefConstThermo<EquationOfState>& ct
|
||||
)
|
||||
{
|
||||
ct.write(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,229 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::hRefConstThermo
|
||||
|
||||
Group
|
||||
grpSpecieThermo
|
||||
|
||||
Description
|
||||
Constant properties thermodynamics package
|
||||
templated into the EquationOfState.
|
||||
|
||||
SourceFiles
|
||||
hRefConstThermoI.H
|
||||
hRefConstThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef hRefConstThermo_H
|
||||
#define hRefConstThermo_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class EquationOfState> class hRefConstThermo;
|
||||
|
||||
template<class EquationOfState>
|
||||
inline hRefConstThermo<EquationOfState> operator+
|
||||
(
|
||||
const hRefConstThermo<EquationOfState>&,
|
||||
const hRefConstThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
template<class EquationOfState>
|
||||
inline hRefConstThermo<EquationOfState> operator*
|
||||
(
|
||||
const scalar,
|
||||
const hRefConstThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
template<class EquationOfState>
|
||||
inline hRefConstThermo<EquationOfState> operator==
|
||||
(
|
||||
const hRefConstThermo<EquationOfState>&,
|
||||
const hRefConstThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
template<class EquationOfState>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const hRefConstThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class hRefConstThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class EquationOfState>
|
||||
class hRefConstThermo
|
||||
:
|
||||
public EquationOfState
|
||||
{
|
||||
// Private Data
|
||||
|
||||
scalar Cp_;
|
||||
scalar Hf_;
|
||||
scalar Tref_;
|
||||
scalar Href_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Construct from components
|
||||
inline hRefConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cp,
|
||||
const scalar hf,
|
||||
const scalar tref,
|
||||
const scalar href
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
hRefConstThermo(const dictionary& dict);
|
||||
|
||||
//- Construct as named copy
|
||||
inline hRefConstThermo(const word&, const hRefConstThermo&);
|
||||
|
||||
//- Construct and return a clone
|
||||
inline autoPtr<hRefConstThermo> clone() const;
|
||||
|
||||
//- Selector from dictionary
|
||||
inline static autoPtr<hRefConstThermo> New(const dictionary& dict);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the instantiated type name
|
||||
static word typeName()
|
||||
{
|
||||
return "hRefConst<" + EquationOfState::typeName() + '>';
|
||||
}
|
||||
|
||||
//- Limit temperature to be within the range
|
||||
inline scalar limit(const scalar T) const;
|
||||
|
||||
|
||||
// Fundamental properties
|
||||
|
||||
//- Heat capacity at constant pressure [J/(kg K)]
|
||||
inline scalar Cp(const scalar p, const scalar T) const;
|
||||
|
||||
//- Absolute Enthalpy [J/kg]
|
||||
inline scalar Ha(const scalar p, const scalar T) const;
|
||||
|
||||
//- Sensible enthalpy [J/kg]
|
||||
inline scalar Hs(const scalar p, const scalar T) const;
|
||||
|
||||
//- Chemical enthalpy [J/kg]
|
||||
inline scalar Hc() const;
|
||||
|
||||
//- Entropy [J/(kg K)]
|
||||
inline scalar S(const scalar p, const scalar T) const;
|
||||
|
||||
#include "HtoEthermo.H"
|
||||
|
||||
|
||||
// Derivative term used for Jacobian
|
||||
|
||||
//- Derivative of Gibbs free energy w.r.t. temperature
|
||||
inline scalar dGdT(const scalar p, const scalar T) const;
|
||||
|
||||
//- Temperature derivative of heat capacity at constant pressure
|
||||
inline scalar dCpdT(const scalar p, const scalar T) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator+=(const hRefConstThermo&);
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
friend hRefConstThermo operator+ <EquationOfState>
|
||||
(
|
||||
const hRefConstThermo&,
|
||||
const hRefConstThermo&
|
||||
);
|
||||
|
||||
friend hRefConstThermo operator* <EquationOfState>
|
||||
(
|
||||
const scalar,
|
||||
const hRefConstThermo&
|
||||
);
|
||||
|
||||
friend hRefConstThermo operator== <EquationOfState>
|
||||
(
|
||||
const hRefConstThermo&,
|
||||
const hRefConstThermo&
|
||||
);
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<< <EquationOfState>
|
||||
(
|
||||
Ostream&,
|
||||
const hRefConstThermo&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "hRefConstThermoI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "hRefConstThermo.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,270 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::hRefConstThermo<EquationOfState>::hRefConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cp,
|
||||
const scalar hf,
|
||||
const scalar tref,
|
||||
const scalar href
|
||||
)
|
||||
:
|
||||
EquationOfState(st),
|
||||
Cp_(cp),
|
||||
Hf_(hf),
|
||||
Tref_(tref),
|
||||
Href_(href)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::hRefConstThermo<EquationOfState>::hRefConstThermo
|
||||
(
|
||||
const word& name,
|
||||
const hRefConstThermo& ct
|
||||
)
|
||||
:
|
||||
EquationOfState(name, ct),
|
||||
Cp_(ct.Cp_),
|
||||
Hf_(ct.Hf_),
|
||||
Tref_(ct.Tref_),
|
||||
Href_(ct.Href_)
|
||||
{}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::autoPtr<Foam::hRefConstThermo<EquationOfState>>
|
||||
Foam::hRefConstThermo<EquationOfState>::clone() const
|
||||
{
|
||||
return autoPtr<hRefConstThermo<EquationOfState>>::New(*this);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::autoPtr<Foam::hRefConstThermo<EquationOfState>>
|
||||
Foam::hRefConstThermo<EquationOfState>::New(const dictionary& dict)
|
||||
{
|
||||
return autoPtr<hRefConstThermo<EquationOfState>>::New(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hRefConstThermo<EquationOfState>::limit
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return T;
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hRefConstThermo<EquationOfState>::Cp
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_ + EquationOfState::Cp(p, T);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hRefConstThermo<EquationOfState>::Ha
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return Hs(p, T) + Hc();
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hRefConstThermo<EquationOfState>::Hs
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_*(T-Tref_) + Href_ + EquationOfState::H(p, T);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hRefConstThermo<EquationOfState>::Hc() const
|
||||
{
|
||||
return Hf_;
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hRefConstThermo<EquationOfState>::S
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_*log(T/Tstd) + EquationOfState::S(p, T);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hRefConstThermo<EquationOfState>::dGdT
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hRefConstThermo<EquationOfState>::dCpdT
|
||||
(
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline void Foam::hRefConstThermo<EquationOfState>::operator+=
|
||||
(
|
||||
const hRefConstThermo<EquationOfState>& ct
|
||||
)
|
||||
{
|
||||
scalar Y1 = this->Y();
|
||||
|
||||
EquationOfState::operator+=(ct);
|
||||
|
||||
if (mag(this->Y()) > SMALL)
|
||||
{
|
||||
Y1 /= this->Y();
|
||||
const scalar Y2 = ct.Y()/this->Y();
|
||||
|
||||
Cp_ = Y1*Cp_ + Y2*ct.Cp_;
|
||||
Hf_ = Y1*Hf_ + Y2*ct.Hf_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::hRefConstThermo<EquationOfState> Foam::operator+
|
||||
(
|
||||
const hRefConstThermo<EquationOfState>& ct1,
|
||||
const hRefConstThermo<EquationOfState>& ct2
|
||||
)
|
||||
{
|
||||
EquationOfState eofs
|
||||
(
|
||||
static_cast<const EquationOfState&>(ct1)
|
||||
+ static_cast<const EquationOfState&>(ct2)
|
||||
);
|
||||
|
||||
if (mag(eofs.Y()) < SMALL)
|
||||
{
|
||||
return hRefConstThermo<EquationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.Cp_,
|
||||
ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Href_
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return hRefConstThermo<EquationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.Y()/eofs.Y()*ct1.Cp_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Cp_,
|
||||
ct1.Y()/eofs.Y()*ct1.Hf_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hf_,
|
||||
ct1.Y()/eofs.Y()*ct1.Tref_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Tref_,
|
||||
ct1.Y()/eofs.Y()*ct1.Href_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Href_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::hRefConstThermo<EquationOfState> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const hRefConstThermo<EquationOfState>& ct
|
||||
)
|
||||
{
|
||||
return hRefConstThermo<EquationOfState>
|
||||
(
|
||||
s*static_cast<const EquationOfState&>(ct),
|
||||
ct.Cp_,
|
||||
ct.Hf_,
|
||||
ct.Tref_,
|
||||
ct.Href_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::hRefConstThermo<EquationOfState> Foam::operator==
|
||||
(
|
||||
const hRefConstThermo<EquationOfState>& ct1,
|
||||
const hRefConstThermo<EquationOfState>& ct2
|
||||
)
|
||||
{
|
||||
EquationOfState eofs
|
||||
(
|
||||
static_cast<const EquationOfState&>(ct1)
|
||||
== static_cast<const EquationOfState&>(ct2)
|
||||
);
|
||||
|
||||
return hRefConstThermo<EquationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct2.Y()/eofs.Y()*ct2.Cp_
|
||||
- ct1.Y()/eofs.Y()*ct1.Cp_,
|
||||
ct2.Y()/eofs.Y()*ct2.Hf_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -112,9 +112,6 @@ class hTabulatedThermo
|
||||
//- Specific heat at constant pressure table [J/kg/K]
|
||||
integratedNonUniformTable Cp_;
|
||||
|
||||
//- Enthalphy uniform table;
|
||||
//nonUniformTable hCoeffs_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -157,15 +154,15 @@ public:
|
||||
//- Entropy [J/kg/K]
|
||||
inline scalar S(const scalar p, const scalar T) const;
|
||||
|
||||
//- Gibbs free energy of the mixture in the standard state [J/kg]
|
||||
inline scalar Gstd(const scalar T) const;
|
||||
|
||||
|
||||
#include "HtoEthermo.H"
|
||||
|
||||
|
||||
// Derivative term used for Jacobian
|
||||
|
||||
//- Derivative of Gibbs free energy w.r.t. temperature
|
||||
inline scalar dGdT(const scalar p, const scalar T) const;
|
||||
|
||||
//- Temperature derivative of heat capacity at constant pressure
|
||||
inline scalar dCpdT(const scalar p, const scalar T) const;
|
||||
|
||||
|
||||
@ -108,26 +108,15 @@ inline Foam::scalar Foam::hTabulatedThermo<EquationOfState>::S
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hTabulatedThermo<EquationOfState>::dGdT
|
||||
inline Foam::scalar Foam::hTabulatedThermo<EquationOfState>::Gstd
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
return Cp_.intfdT(Pstd, T) + Hf_ - (Cp_.intfByTdT(Pstd, T) + Sf_)*T;
|
||||
}
|
||||
|
||||
|
||||
// template<class EquationOfState>
|
||||
// inline Foam::scalar Foam::hTabulatedThermo<EquationOfState>::Gstd
|
||||
// (
|
||||
// const scalar T
|
||||
// ) const
|
||||
// {
|
||||
// return Cp_.intfdT(Pstd, T) + Hf_ - (Cp_.intfByTdT(Pstd, T) + Sf_)*T;
|
||||
// }
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::hTabulatedThermo<EquationOfState>::dCpdT
|
||||
(
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -190,13 +191,14 @@ public:
|
||||
//- Entropy [J/(kg K)]
|
||||
inline scalar S(const scalar p, const scalar T) const;
|
||||
|
||||
//- Gibbs free energy of the mixture in the standard state [J/kg]
|
||||
inline scalar Gstd(const scalar T) const;
|
||||
|
||||
#include "HtoEthermo.H"
|
||||
|
||||
|
||||
// Derivative term used for Jacobian
|
||||
|
||||
//- Derivative of Gibbs free energy w.r.t. temperature
|
||||
inline scalar dGdT(const scalar p, const scalar T) const;
|
||||
|
||||
//- Temperature derivative of heat capacity at constant pressure
|
||||
inline scalar dCpdT(const scalar p, const scalar T) const;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -240,14 +241,21 @@ inline Foam::scalar Foam::janafThermo<EquationOfState>::S
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::janafThermo<EquationOfState>::dGdT
|
||||
inline Foam::scalar Foam::janafThermo<EquationOfState>::Gstd
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
const coeffArray& a = coeffs(T);
|
||||
return -((a[0] + a[5]/T)/T + a[1]/2 + T*(a[2]/3 + T*(a[3]/4 + T*a[4]/5)));
|
||||
return
|
||||
(
|
||||
(
|
||||
a[0]*(1 - log(T))
|
||||
- (((a[4]/20.0*T + a[3]/12.0)*T + a[2]/6.0)*T + a[1]/2.0)*T
|
||||
- a[6]
|
||||
)*T
|
||||
+ a[5]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -440,15 +441,17 @@ Foam::species::thermo<Thermo, Type>::dKcdTbyKc
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
const scalar nm = this->Y()/this->W();
|
||||
const scalar dKcdTbyKc =
|
||||
(this->S(Pstd, T) + this->Gstd(T)/T)*this->Y()/(RR*T);
|
||||
|
||||
const scalar nm = this->Y()/this->W();
|
||||
if (equal(nm, SMALL))
|
||||
{
|
||||
return -this->dGdT(Pstd, T)*this->Y()/RR;
|
||||
return dKcdTbyKc;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -(nm/T + this->dGdT(Pstd, T)*this->Y()/RR);
|
||||
return dKcdTbyKc - nm/T;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo hRefConst;
|
||||
thermo hConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleEnthalpy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo hRefConst;
|
||||
thermo hConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleEnthalpy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo hRefConst;
|
||||
thermo hConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleEnthalpy;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState perfectFluid;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
|
||||
Reference in New Issue
Block a user