diff --git a/applications/test/thermoMixture/Make/files b/applications/test/thermoMixture/Make/files
new file mode 100644
index 0000000000..ffef737866
--- /dev/null
+++ b/applications/test/thermoMixture/Make/files
@@ -0,0 +1,3 @@
+Test-thermoMixture.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-thermoMixture
diff --git a/applications/test/thermoMixture/Make/options b/applications/test/thermoMixture/Make/options
new file mode 100644
index 0000000000..98bf79aaa4
--- /dev/null
+++ b/applications/test/thermoMixture/Make/options
@@ -0,0 +1,5 @@
+EXE_INC = \
+ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude
+
+EXE_LIBS = \
+ -lspecie
diff --git a/applications/test/thermoMixture/Test-thermoMixture.C b/applications/test/thermoMixture/Test-thermoMixture.C
new file mode 100644
index 0000000000..1a2883cb0a
--- /dev/null
+++ b/applications/test/thermoMixture/Test-thermoMixture.C
@@ -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 .
+
+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 >,
+ 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;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/thermoMixture/thermoDict b/applications/test/thermoMixture/thermoDict
new file mode 100644
index 0000000000..426ae0a9f3
--- /dev/null
+++ b/applications/test/thermoMixture/thermoDict
@@ -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;
+ }
+}
diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C
index bd942515e9..a004ed0e62 100644
--- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C
+++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C
@@ -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::eConstThermo(Istream& is)
Hf_(readScalar(is))
{
is.check("eConstThermo::eConstThermo(Istream&)");
+
+ Cv_ *= this->W();
+ Hf_ *= this->W();
}
@@ -45,7 +48,10 @@ Foam::eConstThermo::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::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(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;
diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H
index 7e0781cc40..fea19e2cc6 100644
--- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H
+++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H
@@ -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_;
diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H
index b465f80497..687ebae355 100644
--- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H
+++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H
@@ -106,7 +106,7 @@ inline Foam::scalar Foam::eConstThermo::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::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::hs
template
inline Foam::scalar Foam::eConstThermo::hc() const
{
- return Hf_*this->W();
+ return Hf_;
}
diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C
index 3f2a7cf1c4..b117f82bc7 100644
--- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C
+++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C
@@ -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::hConstThermo(Istream& is)
Hf_(readScalar(is))
{
is.check("hConstThermo::hConstThermo(Istream& is)");
+
+ Cp_ *= this->W();
+ Hf_ *= this->W();
}
@@ -45,7 +48,10 @@ Foam::hConstThermo::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::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(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;
diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H
index b7eda522b4..3fda6268c3 100644
--- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H
+++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H
@@ -106,7 +106,7 @@ inline Foam::scalar Foam::hConstThermo::cp
const scalar T
) const
{
- return Cp_*this->W();
+ return Cp_;
}
@@ -116,7 +116,7 @@ inline Foam::scalar Foam::hConstThermo::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::hs
const scalar p, const scalar T
) const
{
- return Cp_*T*this->W();
+ return Cp_*T;
}
template
inline Foam::scalar Foam::hConstThermo::hc() const
{
- return Hf_*this->W();
+ return Hf_;
}
diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C
index 5543878eea..4824b997d5 100644
--- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C
+++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C
@@ -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::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) + '>'),