mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Thermodynamics: Changed internal representation of thermo properties in hConst/eConstThermo to mole-based
This commit is contained in:
3
applications/test/thermoMixture/Make/files
Normal file
3
applications/test/thermoMixture/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-thermoMixture.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-thermoMixture
|
||||
5
applications/test/thermoMixture/Make/options
Normal file
5
applications/test/thermoMixture/Make/options
Normal file
@ -0,0 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lspecie
|
||||
79
applications/test/thermoMixture/Test-thermoMixture.C
Normal file
79
applications/test/thermoMixture/Test-thermoMixture.C
Normal file
@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 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/>.
|
||||
|
||||
Application
|
||||
ThermoMixture
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "IFstream.H"
|
||||
#include "specie.H"
|
||||
#include "perfectGas.H"
|
||||
#include "hConstThermo.H"
|
||||
#include "sensibleEnthalpy.H"
|
||||
#include "thermo.H"
|
||||
#include "constTransport.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
typedef constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
hConstThermo<perfectGas<specie> >,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> ThermoType;
|
||||
|
||||
dictionary dict(IFstream("thermoDict")());
|
||||
|
||||
ThermoType t1(dict.subDict("specie1"));
|
||||
ThermoType t2(dict.subDict("specie2"));
|
||||
|
||||
Info<< "Checking Cp of mixture of hConstThermo" << endl;
|
||||
|
||||
Info<< "W 1, 2, (1 + 2) = " << t1.W() << " " << t2.W() << " "
|
||||
<< (t1 + t2).W() << endl;
|
||||
|
||||
Info<< "Cp 1, 2, 1 + 2 = " << t1.cp(1, 1) << " " << t2.cp(1, 1) << " "
|
||||
<< (t1 + t2).cp(1, 1) << endl;
|
||||
|
||||
ThermoType t3(t1);
|
||||
t3 += t2;
|
||||
Info<< "Cp (1 += 2) = " << t3.cp(1, 1) << endl;
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
43
applications/test/thermoMixture/thermoDict
Normal file
43
applications/test/thermoMixture/thermoDict
Normal file
@ -0,0 +1,43 @@
|
||||
specie1
|
||||
{
|
||||
specie
|
||||
{
|
||||
nMoles 1;
|
||||
molWeight 1;
|
||||
}
|
||||
|
||||
thermodynamics
|
||||
{
|
||||
Cp 1;
|
||||
Cv 1;
|
||||
Hf 0;
|
||||
}
|
||||
|
||||
transport
|
||||
{
|
||||
mu 1;
|
||||
Pr 1;
|
||||
}
|
||||
}
|
||||
|
||||
specie2
|
||||
{
|
||||
specie
|
||||
{
|
||||
nMoles 1;
|
||||
molWeight 0.5;
|
||||
}
|
||||
|
||||
thermodynamics
|
||||
{
|
||||
Cp 2;
|
||||
Cv 2;
|
||||
Hf 0;
|
||||
}
|
||||
|
||||
transport
|
||||
{
|
||||
mu 1;
|
||||
Pr 1;
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,6 +36,9 @@ Foam::eConstThermo<EquationOfState>::eConstThermo(Istream& is)
|
||||
Hf_(readScalar(is))
|
||||
{
|
||||
is.check("eConstThermo<EquationOfState>::eConstThermo(Istream&)");
|
||||
|
||||
Cv_ *= this->W();
|
||||
Hf_ *= this->W();
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +48,10 @@ Foam::eConstThermo<EquationOfState>::eConstThermo(const dictionary& dict)
|
||||
EquationOfState(dict),
|
||||
Cv_(readScalar(dict.subDict("thermodynamics").lookup("Cv"))),
|
||||
Hf_(readScalar(dict.subDict("thermodynamics").lookup("Hf")))
|
||||
{}
|
||||
{
|
||||
Cv_ *= this->W();
|
||||
Hf_ *= this->W();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -56,8 +62,8 @@ void Foam::eConstThermo<EquationOfState>::write(Ostream& os) const
|
||||
EquationOfState::write(os);
|
||||
|
||||
dictionary dict("thermodynamics");
|
||||
dict.add("Cv", Cv_);
|
||||
dict.add("Hf", Hf_);
|
||||
dict.add("Cv", Cv_/this->W());
|
||||
dict.add("Hf", Hf_/this->W());
|
||||
os << indent << dict.dictName() << dict;
|
||||
}
|
||||
|
||||
@ -72,7 +78,7 @@ Foam::Ostream& Foam::operator<<
|
||||
)
|
||||
{
|
||||
os << static_cast<const EquationOfState&>(ct) << tab
|
||||
<< ct.Cv_ << tab << ct.Hf_;
|
||||
<< ct.Cv_/ct.W() << tab << ct.Hf_/ct.W();
|
||||
|
||||
os.check("Ostream& operator<<(Ostream&, const eConstThermo&)");
|
||||
return os;
|
||||
|
||||
@ -95,7 +95,12 @@ class eConstThermo
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Heat capacity at constant volume
|
||||
// Note: input in [J/(kg K)], but internally uses [J/(kmol K)]
|
||||
scalar Cv_;
|
||||
|
||||
//- Heat of formation
|
||||
// Note: input in [J/kg], but internally uses [J/kmol]
|
||||
scalar Hf_;
|
||||
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::cp
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Cv_*this->W() + this->cpMcv(p, T);
|
||||
return Cv_ + this->cpMcv(p, T);
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::ha
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return cp(p, T)*T + Hf_*this->W();
|
||||
return cp(p, T)*T + Hf_;
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::hs
|
||||
template<class EquationOfState>
|
||||
inline Foam::scalar Foam::eConstThermo<EquationOfState>::hc() const
|
||||
{
|
||||
return Hf_*this->W();
|
||||
return Hf_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,6 +36,9 @@ Foam::hConstThermo<equationOfState>::hConstThermo(Istream& is)
|
||||
Hf_(readScalar(is))
|
||||
{
|
||||
is.check("hConstThermo::hConstThermo(Istream& is)");
|
||||
|
||||
Cp_ *= this->W();
|
||||
Hf_ *= this->W();
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +48,10 @@ Foam::hConstThermo<equationOfState>::hConstThermo(const dictionary& dict)
|
||||
equationOfState(dict),
|
||||
Cp_(readScalar(dict.subDict("thermodynamics").lookup("Cp"))),
|
||||
Hf_(readScalar(dict.subDict("thermodynamics").lookup("Hf")))
|
||||
{}
|
||||
{
|
||||
Cp_ *= this->W();
|
||||
Hf_ *= this->W();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -56,8 +62,8 @@ void Foam::hConstThermo<equationOfState>::write(Ostream& os) const
|
||||
equationOfState::write(os);
|
||||
|
||||
dictionary dict("thermodynamics");
|
||||
dict.add("Cp", Cp_);
|
||||
dict.add("Hf", Hf_);
|
||||
dict.add("Cp", Cp_/this->W());
|
||||
dict.add("Hf", Hf_/this->W());
|
||||
os << indent << dict.dictName() << dict;
|
||||
}
|
||||
|
||||
@ -72,7 +78,7 @@ Foam::Ostream& Foam::operator<<
|
||||
)
|
||||
{
|
||||
os << static_cast<const equationOfState&>(ct) << tab
|
||||
<< ct.Cp_ << tab << ct.Hf_;
|
||||
<< ct.Cp_/ct.W() << tab << ct.Hf_/ct.W();
|
||||
|
||||
os.check("Ostream& operator<<(Ostream& os, const hConstThermo& ct)");
|
||||
return os;
|
||||
|
||||
@ -106,7 +106,7 @@ inline Foam::scalar Foam::hConstThermo<equationOfState>::cp
|
||||
const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_*this->W();
|
||||
return Cp_;
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ inline Foam::scalar Foam::hConstThermo<equationOfState>::ha
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return (Cp_*T + Hf_)*this->W();
|
||||
return Cp_*T + Hf_;
|
||||
}
|
||||
|
||||
|
||||
@ -126,14 +126,14 @@ inline Foam::scalar Foam::hConstThermo<equationOfState>::hs
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return Cp_*T*this->W();
|
||||
return Cp_*T;
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::hConstThermo<equationOfState>::hc() const
|
||||
{
|
||||
return Hf_*this->W();
|
||||
return Hf_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -101,8 +101,8 @@ void Foam::hPolynomialThermo<EquationOfState, PolySize>::write
|
||||
EquationOfState::write(os);
|
||||
|
||||
dictionary dict("thermodynamics");
|
||||
dict.add("Hf", Hf_);
|
||||
dict.add("Sf", Sf_);
|
||||
dict.add("Hf", Hf_/this->W());
|
||||
dict.add("Sf", Sf_/this->W());
|
||||
dict.add
|
||||
(
|
||||
word("CpCoeffs<" + Foam::name(PolySize) + '>'),
|
||||
|
||||
Reference in New Issue
Block a user