Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -77,6 +77,4 @@ BlendedInterfacialModel/blendingMethods/noBlending/noBlending.C
|
||||
BlendedInterfacialModel/blendingMethods/linear/linear.C
|
||||
BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C
|
||||
|
||||
reactionThermo/hRefConstThermos.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libreactingPhaseSystem
|
||||
|
||||
@ -1,303 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 "rhoConst.H"
|
||||
|
||||
#include "sensibleEnthalpy.H"
|
||||
|
||||
#include "hRefConstThermo.H"
|
||||
#include "eRefConstThermo.H"
|
||||
#include "janafThermo.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
|
||||
<
|
||||
rPolynomial<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> constRefFluidHThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
eRefConstThermo
|
||||
<
|
||||
perfectGas<specie>
|
||||
>,
|
||||
sensibleInternalEnergy
|
||||
>
|
||||
> constRefGasEThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
eRefConstThermo
|
||||
<
|
||||
rPolynomial<specie>
|
||||
>,
|
||||
sensibleInternalEnergy
|
||||
>
|
||||
> constRefFluidEThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
eRefConstThermo
|
||||
<
|
||||
rhoConst<specie>
|
||||
>,
|
||||
sensibleInternalEnergy
|
||||
>
|
||||
> constRefRhoConstEThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
hRefConstThermo
|
||||
<
|
||||
rhoConst<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> constRefRhoConstHThermoPhysics;
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
janafThermo
|
||||
<
|
||||
rhoConst<specie>
|
||||
>,
|
||||
sensibleInternalEnergy
|
||||
>
|
||||
> constJanafRhoConstEThermoPhysics;
|
||||
|
||||
|
||||
// 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,
|
||||
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,
|
||||
rhoConst,
|
||||
specie
|
||||
);
|
||||
|
||||
|
||||
// multiComponentMixture, sensibleInternalEnergy:
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefGasEThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefFluidEThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefRhoConstEThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constJanafRhoConstEThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// multiComponentMixture, sensibleEnthalpy:
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefRhoConstHThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefFluidHThermoPhysics
|
||||
);
|
||||
|
||||
makeThermoPhysicsReactionThermos
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefGasHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,7 +33,9 @@ Foam::eConstThermo<EquationOfState>::eConstThermo(const dictionary& dict)
|
||||
:
|
||||
EquationOfState(dict),
|
||||
Cv_(dict.subDict("thermodynamics").lookup<scalar>("Cv")),
|
||||
Hf_(dict.subDict("thermodynamics").lookup<scalar>("Hf"))
|
||||
Hf_(dict.subDict("thermodynamics").lookup<scalar>("Hf")),
|
||||
Tref_(dict.subDict("thermodynamics").lookupOrDefault<scalar>("Tref", Tstd)),
|
||||
Esref_(dict.subDict("thermodynamics").lookupOrDefault<scalar>("Esref", 0))
|
||||
{}
|
||||
|
||||
|
||||
@ -47,6 +49,14 @@ void Foam::eConstThermo<EquationOfState>::write(Ostream& os) const
|
||||
dictionary dict("thermodynamics");
|
||||
dict.add("Cv", Cv_);
|
||||
dict.add("Hf", Hf_);
|
||||
if (Tref_ != Tstd)
|
||||
{
|
||||
dict.add("Tref", Tref_);
|
||||
}
|
||||
if (Esref_ != 0)
|
||||
{
|
||||
dict.add("Esref", Esref_);
|
||||
}
|
||||
os << indent << dict.dictName() << dict;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,8 +37,6 @@ SourceFiles
|
||||
#ifndef eConstThermo_H
|
||||
#define eConstThermo_H
|
||||
|
||||
#include "thermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -94,6 +92,12 @@ class eConstThermo
|
||||
//- Heat of formation [J/kg]
|
||||
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
|
||||
|
||||
@ -101,8 +105,10 @@ class eConstThermo
|
||||
inline eConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cv,
|
||||
const scalar hf
|
||||
const scalar Cv,
|
||||
const scalar Hf,
|
||||
const scalar Tref,
|
||||
const scalar Esref
|
||||
);
|
||||
|
||||
|
||||
@ -119,7 +125,7 @@ public:
|
||||
//- Construct and return a clone
|
||||
inline autoPtr<eConstThermo> clone() const;
|
||||
|
||||
// Selector from dictionary
|
||||
//- Selector from dictionary
|
||||
inline static autoPtr<eConstThermo> New(const dictionary& dict);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,13 +29,17 @@ template<class EquationOfState>
|
||||
inline Foam::eConstThermo<EquationOfState>::eConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cv,
|
||||
const scalar hf
|
||||
const scalar Cv,
|
||||
const scalar Hf,
|
||||
const scalar Tref,
|
||||
const scalar Esref
|
||||
)
|
||||
:
|
||||
EquationOfState(st),
|
||||
Cv_(cv),
|
||||
Hf_(hf)
|
||||
Cv_(Cv),
|
||||
Hf_(Hf),
|
||||
Tref_(Tref),
|
||||
Esref_(Esref)
|
||||
{}
|
||||
|
||||
|
||||
@ -45,12 +49,14 @@ template<class EquationOfState>
|
||||
inline Foam::eConstThermo<EquationOfState>::eConstThermo
|
||||
(
|
||||
const word& name,
|
||||
const eConstThermo<EquationOfState>& ct
|
||||
const eConstThermo& ct
|
||||
)
|
||||
:
|
||||
EquationOfState(name, ct),
|
||||
Cv_(ct.Cv_),
|
||||
Hf_(ct.Hf_)
|
||||
Hf_(ct.Hf_),
|
||||
Tref_(ct.Tref_),
|
||||
Esref_(ct.Esref_)
|
||||
{}
|
||||
|
||||
|
||||
@ -106,7 +112,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);
|
||||
}
|
||||
|
||||
|
||||
@ -146,7 +152,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::Gstd
|
||||
) const
|
||||
{
|
||||
return
|
||||
Cv_*T + Hc() + Pstd/EquationOfState::rho(Pstd, T)
|
||||
Cv_*(T - Tref_) + Esref_ + Hc() + Pstd/EquationOfState::rho(Pstd, T)
|
||||
- Cp(Pstd, T)*T*log(T/Tstd);
|
||||
}
|
||||
|
||||
@ -187,11 +193,26 @@ inline void Foam::eConstThermo<EquationOfState>::operator+=
|
||||
|
||||
if (mag(this->Y()) > small)
|
||||
{
|
||||
if
|
||||
(
|
||||
eConstThermo<EquationOfState>::debug
|
||||
&& notEqual(Tref_, ct.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << Tref_ << " for "
|
||||
<< (this->name().size() ? this->name() : "others")
|
||||
<< " != " << ct.Tref_ << " for "
|
||||
<< (ct.name().size() ? ct.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Y1 /= this->Y();
|
||||
const scalar Y2 = ct.Y()/this->Y();
|
||||
|
||||
Cv_ = Y1*Cv_ + Y2*ct.Cv_;
|
||||
Hf_ = Y1*Hf_ + Y2*ct.Hf_;
|
||||
Esref_ = Y1*Esref_ + Y2*ct.Esref_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,18 +238,37 @@ inline Foam::eConstThermo<EquationOfState> Foam::operator+
|
||||
(
|
||||
eofs,
|
||||
ct1.Cv_,
|
||||
ct1.Hf_
|
||||
ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Esref_
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if
|
||||
(
|
||||
eConstThermo<EquationOfState>::debug
|
||||
&& notEqual(ct1.Tref_, ct2.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << ct1.Tref_ << " for "
|
||||
<< (ct1.name().size() ? ct1.name() : "others")
|
||||
<< " != " << ct2.Tref_ << " for "
|
||||
<< (ct2.name().size() ? ct2.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return eConstThermo<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_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Y()/eofs.Y()*ct1.Esref_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Esref_
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -245,7 +285,9 @@ inline Foam::eConstThermo<EquationOfState> Foam::operator*
|
||||
(
|
||||
s*static_cast<const EquationOfState&>(ct),
|
||||
ct.Cv_,
|
||||
ct.Hf_
|
||||
ct.Hf_,
|
||||
ct.Tref_,
|
||||
ct.Esref_
|
||||
);
|
||||
}
|
||||
|
||||
@ -263,13 +305,30 @@ inline Foam::eConstThermo<EquationOfState> Foam::operator==
|
||||
== static_cast<const EquationOfState&>(ct2)
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
eConstThermo<EquationOfState>::debug
|
||||
&& notEqual(ct1.Tref_, ct2.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << ct1.Tref_ << " for "
|
||||
<< (ct1.name().size() ? ct1.name() : "others")
|
||||
<< " != " << ct2.Tref_ << " for "
|
||||
<< (ct2.name().size() ? ct2.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return eConstThermo<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_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct2.Y()/eofs.Y()*ct2.Esref_
|
||||
- ct1.Y()/eofs.Y()*ct1.Esref_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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_(dict.subDict("thermodynamics").lookup<scalar>("Cv")),
|
||||
Hf_(dict.subDict("thermodynamics").lookup<scalar>("Hf")),
|
||||
Tref_(dict.subDict("thermodynamics").lookup<scalar>("Tref")),
|
||||
Eref_(dict.subDict("thermodynamics").lookup<scalar>("Eref"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
void Foam::eRefConstThermo<EquationOfState>::write(Ostream& os) const
|
||||
{
|
||||
EquationOfState::write(os);
|
||||
|
||||
dictionary dict("thermodynamics");
|
||||
dict.add("Cv", Cv_);
|
||||
dict.add("Hf", Hf_);
|
||||
dict.add("Tref", Tref_);
|
||||
dict.add("Eref", Eref_);
|
||||
os << indent << dict.dictName() << dict;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const eRefConstThermo<EquationOfState>& ct
|
||||
)
|
||||
{
|
||||
ct.write(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,227 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 declaration of friend functions and operators
|
||||
|
||||
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
|
||||
|
||||
//- 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 the temperature to be in the range Tlow_ to Thigh_
|
||||
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;
|
||||
|
||||
//- 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;
|
||||
|
||||
|
||||
// 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,336 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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>::Gstd
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return
|
||||
Cv_*(T - Tref_) + Eref_ + Hc() + Pstd/EquationOfState::rho(Pstd, T)
|
||||
- Cp(Pstd, T)*T*log(T/Tstd);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
if
|
||||
(
|
||||
eRefConstThermo<EquationOfState>::debug
|
||||
&& notEqual(Tref_, ct.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << Tref_ << " for "
|
||||
<< (this->name().size() ? this->name() : "others")
|
||||
<< " != " << ct.Tref_ << " for "
|
||||
<< (ct.name().size() ? ct.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Y1 /= this->Y();
|
||||
const scalar Y2 = ct.Y()/this->Y();
|
||||
|
||||
Cv_ = Y1*Cv_ + Y2*ct.Cv_;
|
||||
Hf_ = Y1*Hf_ + Y2*ct.Hf_;
|
||||
Eref_ = Y1*Eref_ + Y2*ct.Eref_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * 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
|
||||
{
|
||||
if
|
||||
(
|
||||
eRefConstThermo<EquationOfState>::debug
|
||||
&& notEqual(ct1.Tref_, ct2.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << ct1.Tref_ << " for "
|
||||
<< (ct1.name().size() ? ct1.name() : "others")
|
||||
<< " != " << ct2.Tref_ << " for "
|
||||
<< (ct2.name().size() ? ct2.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
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.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)
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
eRefConstThermo<EquationOfState>::debug
|
||||
&& notEqual(ct1.Tref_, ct2.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << ct1.Tref_ << " for "
|
||||
<< (ct1.name().size() ? ct1.name() : "others")
|
||||
<< " != " << ct2.Tref_ << " for "
|
||||
<< (ct2.name().size() ? ct2.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
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_,
|
||||
ct1.Tref_,
|
||||
ct2.Y()/eofs.Y()*ct2.Eref_
|
||||
- ct1.Y()/eofs.Y()*ct1.Eref_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,7 +33,9 @@ Foam::hConstThermo<EquationOfState>::hConstThermo(const dictionary& dict)
|
||||
:
|
||||
EquationOfState(dict),
|
||||
Cp_(dict.subDict("thermodynamics").lookup<scalar>("Cp")),
|
||||
Hf_(dict.subDict("thermodynamics").lookup<scalar>("Hf"))
|
||||
Hf_(dict.subDict("thermodynamics").lookup<scalar>("Hf")),
|
||||
Tref_(dict.subDict("thermodynamics").lookupOrDefault<scalar>("Tref", Tstd)),
|
||||
Hsref_(dict.subDict("thermodynamics").lookupOrDefault<scalar>("Hsref", 0))
|
||||
{}
|
||||
|
||||
|
||||
@ -47,6 +49,14 @@ void Foam::hConstThermo<EquationOfState>::write(Ostream& os) const
|
||||
dictionary dict("thermodynamics");
|
||||
dict.add("Cp", Cp_);
|
||||
dict.add("Hf", Hf_);
|
||||
if (Tref_ != Tstd)
|
||||
{
|
||||
dict.add("Tref", Tref_);
|
||||
}
|
||||
if (Hsref_ != 0)
|
||||
{
|
||||
dict.add("Hsref", Hsref_);
|
||||
}
|
||||
os << indent << dict.dictName() << dict;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,6 +92,12 @@ class hConstThermo
|
||||
//- Heat of formation [J/kg]
|
||||
scalar Hf_;
|
||||
|
||||
//- Reference temperature around which to linearise [K]
|
||||
scalar Tref_;
|
||||
|
||||
//- Reference sensible enthalpy around which to linearise [J/kg]
|
||||
scalar Hsref_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -99,8 +105,10 @@ class hConstThermo
|
||||
inline hConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cp,
|
||||
const scalar hf
|
||||
const scalar Cp,
|
||||
const scalar Hf,
|
||||
const scalar Tref,
|
||||
const scalar Hsref
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,13 +29,17 @@ template<class EquationOfState>
|
||||
inline Foam::hConstThermo<EquationOfState>::hConstThermo
|
||||
(
|
||||
const EquationOfState& st,
|
||||
const scalar cp,
|
||||
const scalar hf
|
||||
const scalar Cp,
|
||||
const scalar Hf,
|
||||
const scalar Tref,
|
||||
const scalar Href
|
||||
)
|
||||
:
|
||||
EquationOfState(st),
|
||||
Cp_(cp),
|
||||
Hf_(hf)
|
||||
Cp_(Cp),
|
||||
Hf_(Hf),
|
||||
Tref_(Tref),
|
||||
Hsref_(Href)
|
||||
{}
|
||||
|
||||
|
||||
@ -50,7 +54,9 @@ inline Foam::hConstThermo<EquationOfState>::hConstThermo
|
||||
:
|
||||
EquationOfState(name, ct),
|
||||
Cp_(ct.Cp_),
|
||||
Hf_(ct.Hf_)
|
||||
Hf_(ct.Hf_),
|
||||
Tref_(ct.Tref_),
|
||||
Hsref_(ct.Hsref_)
|
||||
{}
|
||||
|
||||
|
||||
@ -106,7 +112,7 @@ inline Foam::scalar Foam::hConstThermo<EquationOfState>::Hs
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_*T + EquationOfState::H(p, T);
|
||||
return Cp_*(T - Tref_) + Hsref_ + EquationOfState::H(p, T);
|
||||
}
|
||||
|
||||
|
||||
@ -145,7 +151,7 @@ inline Foam::scalar Foam::hConstThermo<EquationOfState>::Gstd
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_*T + Hc() - Cp_*T*log(T/Tstd);
|
||||
return Cp_*(T - Tref_) + Hsref_ + Hc() - Cp_*T*log(T/Tstd);
|
||||
}
|
||||
|
||||
|
||||
@ -185,11 +191,26 @@ inline void Foam::hConstThermo<EquationOfState>::operator+=
|
||||
|
||||
if (mag(this->Y()) > small)
|
||||
{
|
||||
if
|
||||
(
|
||||
hConstThermo<EquationOfState>::debug
|
||||
&& notEqual(Tref_, ct.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << Tref_ << " for "
|
||||
<< (this->name().size() ? this->name() : "others")
|
||||
<< " != " << ct.Tref_ << " for "
|
||||
<< (ct.name().size() ? ct.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Y1 /= this->Y();
|
||||
scalar Y2 = ct.Y()/this->Y();
|
||||
const scalar Y2 = ct.Y()/this->Y();
|
||||
|
||||
Cp_ = Y1*Cp_ + Y2*ct.Cp_;
|
||||
Hf_ = Y1*Hf_ + Y2*ct.Hf_;
|
||||
Hsref_ = Y1*Hsref_ + Y2*ct.Hsref_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,18 +236,37 @@ inline Foam::hConstThermo<EquationOfState> Foam::operator+
|
||||
(
|
||||
eofs,
|
||||
ct1.Cp_,
|
||||
ct1.Hf_
|
||||
ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Hsref_
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if
|
||||
(
|
||||
hConstThermo<EquationOfState>::debug
|
||||
&& notEqual(ct1.Tref_, ct2.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << ct1.Tref_ << " for "
|
||||
<< (ct1.name().size() ? ct1.name() : "others")
|
||||
<< " != " << ct2.Tref_ << " for "
|
||||
<< (ct2.name().size() ? ct2.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return hConstThermo<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_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hf_,
|
||||
ct1.Tref_,
|
||||
ct1.Y()/eofs.Y()*ct1.Hsref_
|
||||
+ ct2.Y()/eofs.Y()*ct2.Hsref_
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -243,7 +283,9 @@ inline Foam::hConstThermo<EquationOfState> Foam::operator*
|
||||
(
|
||||
s*static_cast<const EquationOfState&>(ct),
|
||||
ct.Cp_,
|
||||
ct.Hf_
|
||||
ct.Hf_,
|
||||
ct.Tref_,
|
||||
ct.Hsref_
|
||||
);
|
||||
}
|
||||
|
||||
@ -261,13 +303,30 @@ inline Foam::hConstThermo<EquationOfState> Foam::operator==
|
||||
== static_cast<const EquationOfState&>(ct2)
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
hConstThermo<EquationOfState>::debug
|
||||
&& notEqual(ct1.Tref_, ct2.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << ct1.Tref_ << " for "
|
||||
<< (ct1.name().size() ? ct1.name() : "others")
|
||||
<< " != " << ct2.Tref_ << " for "
|
||||
<< (ct2.name().size() ? ct2.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return hConstThermo<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_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hf_,
|
||||
ct1.Tref_,
|
||||
ct2.Y()/eofs.Y()*ct2.Hsref_
|
||||
- ct1.Y()/eofs.Y()*ct1.Hsref_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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").lookup<scalar>("Cp")),
|
||||
Hf_(dict.subDict("thermodynamics").lookup<scalar>("Hf")),
|
||||
Tref_(dict.subDict("thermodynamics").lookup<scalar>("Tref")),
|
||||
Href_(dict.subDict("thermodynamics").lookup<scalar>("Href"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
void Foam::hRefConstThermo<EquationOfState>::write(Ostream& os) const
|
||||
{
|
||||
EquationOfState::write(os);
|
||||
|
||||
dictionary dict("thermodynamics");
|
||||
dict.add("Cp", Cp_);
|
||||
dict.add("Hf", Hf_);
|
||||
dict.add("Tref", Tref_);
|
||||
dict.add("Href", Href_);
|
||||
os << indent << dict.dictName() << dict;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class EquationOfState>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const hRefConstThermo<EquationOfState>& ct
|
||||
)
|
||||
{
|
||||
ct.write(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,227 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
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 the temperature to be in the range Tlow_ to Thigh_
|
||||
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;
|
||||
|
||||
//- 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;
|
||||
|
||||
|
||||
// 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,334 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 hRefConstThermo<EquationOfState>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline Foam::autoPtr<Foam::hRefConstThermo<EquationOfState>>
|
||||
Foam::hRefConstThermo<EquationOfState>::New(const dictionary& dict)
|
||||
{
|
||||
return autoPtr<hRefConstThermo<EquationOfState>>
|
||||
(
|
||||
new hRefConstThermo<EquationOfState>(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>::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>::Ha
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Hs(p, T) + Hc();
|
||||
}
|
||||
|
||||
|
||||
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>::Gstd
|
||||
(
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_*(T - Tref_) + Href_ + Hc() - Cp_*T*log(T/Tstd);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
if
|
||||
(
|
||||
hRefConstThermo<EquationOfState>::debug
|
||||
&& notEqual(Tref_, ct.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << Tref_ << " for "
|
||||
<< (this->name().size() ? this->name() : "others")
|
||||
<< " != " << ct.Tref_ << " for "
|
||||
<< (ct.name().size() ? ct.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Y1 /= this->Y();
|
||||
const scalar Y2 = ct.Y()/this->Y();
|
||||
|
||||
Cp_ = Y1*Cp_ + Y2*ct.Cp_;
|
||||
Hf_ = Y1*Hf_ + Y2*ct.Hf_;
|
||||
Href_ = Y1*Href_ + Y2*ct.Href_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * 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
|
||||
{
|
||||
if
|
||||
(
|
||||
hRefConstThermo<EquationOfState>::debug
|
||||
&& notEqual(ct1.Tref_, ct2.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << ct1.Tref_ << " for "
|
||||
<< (ct1.name().size() ? ct1.name() : "others")
|
||||
<< " != " << ct2.Tref_ << " for "
|
||||
<< (ct2.name().size() ? ct2.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
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.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)
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
hRefConstThermo<EquationOfState>::debug
|
||||
&& notEqual(ct1.Tref_, ct2.Tref_)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tref " << ct1.Tref_ << " for "
|
||||
<< (ct1.name().size() ? ct1.name() : "others")
|
||||
<< " != " << ct2.Tref_ << " for "
|
||||
<< (ct2.name().size() ? ct2.name() : "others")
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
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_,
|
||||
ct1.Tref_,
|
||||
ct2.Y()/eofs.Y()*ct2.Href_
|
||||
- ct1.Y()/eofs.Y()*ct1.Href_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -12,7 +12,7 @@ setThermoAndEnergy()
|
||||
he=${1%.*}
|
||||
phase=${1#*.}
|
||||
|
||||
foamDictionary -entry thermoType.thermo -set ${he}RefConst \
|
||||
foamDictionary -entry thermoType.thermo -set ${he}Const \
|
||||
constant/thermophysicalProperties.$phase
|
||||
|
||||
case $he in
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -38,8 +38,8 @@ mixture
|
||||
Cp 2078.4;
|
||||
Cv 1616.9;
|
||||
Tref 372.76;
|
||||
Href 128652;
|
||||
Eref -43381.7;
|
||||
Hsref 128652;
|
||||
Esref -43381.7;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -42,8 +42,8 @@ mixture
|
||||
Cv 4195;
|
||||
Cp 4195;
|
||||
Tref 372.76;
|
||||
Href 312508;
|
||||
Eref 312410;
|
||||
Hsref 312508;
|
||||
Esref 312410;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -28,15 +28,15 @@ gradSchemes
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) Gauss upwind;
|
||||
div(phid,p) Gauss upwind;
|
||||
div(phiv,p) Gauss linear;
|
||||
div(phi,K) Gauss linear;
|
||||
div(phi,e) Gauss upwind;
|
||||
div(phi,k) Gauss upwind;
|
||||
div(phi,epsilon) Gauss upwind;
|
||||
div(phi,R) Gauss upwind;
|
||||
div(phi,omega) Gauss upwind;
|
||||
div(phi,U) bounded Gauss upwind;
|
||||
div(phid,p) bounded Gauss upwind;
|
||||
div(phiv,p) bounded Gauss linear;
|
||||
div(phi,K) bounded Gauss linear;
|
||||
div(phi,e) bounded Gauss upwind;
|
||||
div(phi,k) bounded Gauss upwind;
|
||||
div(phi,epsilon) bounded Gauss upwind;
|
||||
div(phi,R) bounded Gauss upwind;
|
||||
div(phi,omega) bounded Gauss upwind;
|
||||
div((rho*R)) Gauss linear;
|
||||
div(R) Gauss linear;
|
||||
div(U) Gauss linear;
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -38,7 +38,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 1252;
|
||||
Tref 359.981;
|
||||
Eref 363410;
|
||||
Esref 363410;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -38,7 +38,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 1252;
|
||||
Tref 359.981;
|
||||
Eref 363410;
|
||||
Esref 363410;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -42,7 +42,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 1394.5;
|
||||
Tref 359.981;
|
||||
Eref 290090;
|
||||
Esref 290090;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -38,7 +38,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 1252;
|
||||
Tref 359.981;
|
||||
Eref 363410;
|
||||
Esref 363410;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -42,7 +42,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 1394.5;
|
||||
Tref 359.981;
|
||||
Eref 290090;
|
||||
Esref 290090;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -38,7 +38,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 1252;
|
||||
Tref 359.981;
|
||||
Eref 363410;
|
||||
Esref 363410;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -42,7 +42,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 1394.5;
|
||||
Tref 359.981;
|
||||
Eref 290090;
|
||||
Esref 290090;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -38,7 +38,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 1252;
|
||||
Tref 359.981;
|
||||
Eref 363410;
|
||||
Esref 363410;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -42,7 +42,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 1394.5;
|
||||
Tref 359.981;
|
||||
Eref 290090;
|
||||
Esref 290090;
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo hRefConst;
|
||||
thermo hConst;
|
||||
equationOfState perfectGas;
|
||||
specie specie;
|
||||
energy sensibleEnthalpy;
|
||||
@ -42,7 +42,7 @@ mixture
|
||||
Hf 0;
|
||||
Cp 2078.4;
|
||||
Tref 372.76;
|
||||
Href 2675500;
|
||||
Hsref 2675500;
|
||||
}
|
||||
|
||||
transport
|
||||
|
||||
@ -20,7 +20,7 @@ thermoType
|
||||
type heRhoThermo;
|
||||
mixture pureMixture;
|
||||
transport const;
|
||||
thermo eRefConst;
|
||||
thermo eConst;
|
||||
equationOfState rPolynomial;
|
||||
specie specie;
|
||||
energy sensibleInternalEnergy;
|
||||
@ -45,7 +45,7 @@ mixture
|
||||
Hf 0;
|
||||
Cv 4195;
|
||||
Tref 372.76;
|
||||
Eref 417500;
|
||||
Esref 417500;
|
||||
}
|
||||
|
||||
transport
|
||||
|
||||
Reference in New Issue
Block a user