Commit c52e4b58 authored by Henry Weller's avatar Henry Weller
Browse files

thermophysicalModels: Changed specie thermodynamics from mole to mass basis

The fundamental properties provided by the specie class hierarchy were
mole-based, i.e. provide the properties per mole whereas the fundamental
properties provided by the liquidProperties and solidProperties classes are
mass-based, i.e. per unit mass.  This inconsistency made it impossible to
instantiate the thermodynamics packages (rhoThermo, psiThermo) used by the FV
transport solvers on liquidProperties.  In order to combine VoF with film and/or
Lagrangian models it is essential that the physical propertied of the three
representations of the liquid are consistent which means that it is necessary to
instantiate the thermodynamics packages on liquidProperties.  This requires
either liquidProperties to be rewritten mole-based or the specie classes to be
rewritten mass-based.  Given that most of OpenFOAM solvers operate
mass-based (solve for mass-fractions and provide mass-fractions to sub-models it
is more consistent and efficien...
parent 2f5185a0
......@@ -14,9 +14,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -39,7 +37,6 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lsolidProperties \
-lsolidMixtureProperties \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::div(phi, he)
+ (
he.name() == "e"
? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho))
: fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
)
- fvm::laplacian(turbulence->alphaEff(), he)
==
fvOptions(rho, he)
);
EEqn.relax();
fvOptions.constrain(EEqn);
EEqn.solve();
fvOptions.correct(he);
thermo.correct();
}
......@@ -67,6 +67,17 @@ dimensionedScalar rhoMin
)
);
dimensionedScalar pMin
(
dimensionedScalar::lookupOrDefault
(
"pMin",
simple.dict(),
dimPressure,
10
)
);
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
......
......@@ -83,6 +83,8 @@
/fvc::domainIntegrate(psi);
}
p = max(p, pMin);
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
......
......@@ -11,9 +11,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -39,9 +37,7 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lliquidProperties \
-lliquidMixtureProperties \
-lsolidProperties \
-lsolidMixtureProperties \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -10,9 +10,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -37,7 +35,6 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lsolidProperties \
-lsolidMixtureProperties \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -12,9 +12,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -40,9 +38,7 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lliquidProperties \
-lliquidMixtureProperties \
-lsolidProperties \
-lsolidMixtureProperties \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -12,9 +12,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -40,9 +38,7 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lliquidProperties \
-lliquidMixtureProperties \
-lsolidProperties \
-lsolidMixtureProperties \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -14,9 +14,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -38,9 +36,7 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lliquidProperties \
-lliquidMixtureProperties \
-lsolidProperties \
-lsolidMixtureProperties \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -15,9 +15,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -42,9 +40,7 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lliquidProperties \
-lliquidMixtureProperties \
-lsolidProperties \
-lsolidMixtureProperties \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -16,9 +16,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -45,9 +43,7 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lliquidProperties \
-lliquidMixtureProperties \
-lsolidProperties \
-lsolidMixtureProperties \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -3,9 +3,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......
......@@ -2,7 +2,6 @@ specie1
{
specie
{
nMoles 1;
molWeight 1;
}
......@@ -24,7 +23,6 @@ specie2
{
specie
{
nMoles 1;
molWeight 0.5;
}
......
......@@ -49,7 +49,6 @@ EXE_LIBS = \
-llagrangianSpray \
-llagrangianTurbulence \
-llaminarFlameSpeedModels \
-lliquidMixtureProperties \
-lliquidProperties \
-lmeshTools \
-lmolecularMeasurements \
......@@ -81,7 +80,6 @@ EXE_LIBS = \
-lSLGThermo \
-lsnappyHexMesh \
-lsolidChemistryModel \
-lsolidMixtureProperties \
-lsolidParticle \
-lsolidProperties \
-lsolidSpecie \
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -97,28 +97,59 @@ int main(int argc, char *argv[])
scalar stoicO2 = n + m/4.0;
scalar stoicN2 = (0.79/0.21)*(n + m/4.0);
scalar stoicN2 = (0.79/0.21)*stoicO2;
scalar stoicCO2 = n;
scalar stoicH2O = m/2.0;
thermo fuel
thermo FUEL
(
"fuel",
thermo(thermoData.subDict(fuelName))
);
Info<< "fuel " << FUEL << ';' << endl;
FUEL *= FUEL.W();
thermo O2
(
"O2",
thermo(thermoData.subDict("O2"))
);
O2 *= O2.W();
thermo N2
(
"N2",
thermo(thermoData.subDict("N2"))
);
N2 *= N2.W();
thermo CO2
(
"CO2",
thermo(thermoData.subDict("CO2"))
);
CO2 *= CO2.W();
thermo H2O
(
"H2O",
thermo(thermoData.subDict("H2O"))
);
H2O *= H2O.W();
thermo oxidant
(
"oxidant",
stoicO2*thermo(thermoData.subDict("O2"))
+ stoicN2*thermo(thermoData.subDict("N2"))
stoicO2*O2
+ stoicN2*N2
);
Info<< "oxidant " << (1/oxidant.Y())*oxidant << ';' << endl;
dimensionedScalar stoichiometricAirFuelMassRatio
(
"stoichiometricAirFuelMassRatio",
dimless,
(oxidant.W()*oxidant.nMoles())/fuel.W()
oxidant.Y()/FUEL.W()
);
Info<< "stoichiometricAirFuelMassRatio "
......@@ -138,49 +169,34 @@ int main(int argc, char *argv[])
scalar ores = max(1.0/equiv - 1.0, 0.0);
scalar fburnt = 1.0 - fres;
thermo fuel
(
"fuel",
thermo(thermoData.subDict(fuelName))
);
Info<< "fuel " << fuel << ';' << endl;
thermo oxidant
(
"oxidant",
o2*thermo(thermoData.subDict("O2"))
+ n2*thermo(thermoData.subDict("N2"))
);
Info<< "oxidant " << (1/oxidant.nMoles())*oxidant << ';' << endl;
thermo reactants
(
"reactants",
fuel + oxidant
FUEL + (1.0/equiv)*oxidant
);
Info<< "reactants " << (1/reactants.nMoles())*reactants << ';' << endl;
Info<< "reactants " << (1/reactants.Y())*reactants << ';' << endl;
thermo burntProducts
(
"burntProducts",
+ (n2 - (0.79/0.21)*ores*stoicO2)*thermo(thermoData.subDict("N2"))
+ fburnt*stoicCO2*thermo(thermoData.subDict("CO2"))
+ fburnt*stoicH2O*thermo(thermoData.subDict("H2O"))
+ (n2 - (0.79/0.21)*ores*stoicO2)*N2
+ fburnt*stoicCO2*CO2
+ fburnt*stoicH2O*H2O
);
Info<< "burntProducts "
<< (1/burntProducts.nMoles())*burntProducts << ';' << endl;
<< (1/burntProducts.Y())*burntProducts << ';' << endl;
thermo products
(
"products",
fres*fuel
+ n2*thermo(thermoData.subDict("N2"))
+ fburnt*stoicCO2*thermo(thermoData.subDict("CO2"))
+ fburnt*stoicH2O*thermo(thermoData.subDict("H2O"))
+ ores*stoicO2*thermo(thermoData.subDict("O2"))
fres*FUEL
+ n2*N2
+ fburnt*stoicCO2*CO2
+ fburnt*stoicH2O*H2O
+ ores*stoicO2*O2
);
Info<< "products " << (1/products.nMoles())*products << ';' << endl;
Info<< "products " << (1/products.Y())*products << ';' << endl;
scalar Tad = products.THa(reactants.Ha(P, T0), P, 1000.0);
Info<< "Tad = " << Tad << nl << endl;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -73,52 +73,44 @@ int main(int argc, char *argv[])
scalar P = 1e5;
scalar T = 3000.0;
const scalar P = 1e5;
const scalar T = 3000.0;
// Oxidant (mole-based)
thermo O2(thermoData.subDict("O2")); O2 *= O2.W();
thermo N2(thermoData.subDict("N2")); N2 *= N2.W();
// Intermediates (mole-based)
thermo H2(thermoData.subDict("H2")); H2 *= H2.W();
thermo OH(thermoData.subDict("OH")); OH *= OH.W();
thermo H(thermoData.subDict("H")); H *= H.W();
thermo O(thermoData.subDict("O")); O *= O.W();
// Products (mole-based)
thermo CO2(thermoData.subDict("CO2")); CO2 *= CO2.W();
thermo H2O(thermoData.subDict("H2O")); H2O *= H2O.W();
thermo CO(thermoData.subDict("CO")); CO *= CO.W();
SLPtrList<thermo> EQreactions;
EQreactions.append
(
new thermo
(
thermo(thermoData.subDict("CO2"))
==
thermo(thermoData.subDict("CO"))
+ 0.5*thermo(thermoData.subDict("O2"))
)
new thermo(CO2 == CO + 0.5*O2)
);
EQreactions.append
(
new thermo
(
thermo(thermoData.subDict("O2"))
==
2.0*thermo(thermoData.subDict("O"))
)
new thermo(O2 == 2*O)
);
EQreactions.append
(
new thermo
(
thermo(thermoData.subDict("H2O"))
==
thermo(thermoData.subDict("H2"))
+ 0.5*thermo(thermoData.subDict("O2"))
)
new thermo(H2O == H2 + 0.5*O2)
);
EQreactions.append
(
new thermo
(
thermo(thermoData.subDict("H2O"))
==
thermo(thermoData.subDict("H"))
+ thermo(thermoData.subDict("OH"))
)
new thermo(H2O == H + OH)
);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -100,25 +100,27 @@ int main(int argc, char *argv[])
Info<< nl << "Reading thermodynamic data for relevant species"
<< nl << endl;
// Reactants
thermo FUEL(thermoData.subDict(fuelName));
thermo O2(thermoData.subDict("O2"));
thermo N2(thermoData.subDict("N2"));
// Reactants (mole-based)
thermo FUEL(thermoData.subDict(fuelName)); FUEL *= FUEL.W();
// Products
thermo CO2(thermoData.subDict("CO2"));
thermo H2O(thermoData.subDict("H2O"));
// Oxidant (mole-based)
thermo O2(thermoData.subDict("O2")); O2 *= O2.W();
thermo N2(thermoData.subDict("N2")); N2 *= N2.W();
// Product fragments
thermo CO(thermoData.subDict("CO"));
thermo H2(thermoData.subDict("H2"));
// Intermediates (mole-based)
thermo H2(thermoData.subDict("H2")); H2 *= H2.W();
// Products (mole-based)
thermo CO2(thermoData.subDict("CO2")); CO2 *= CO2.W();
thermo H2O(thermoData.subDict("H2O")); H2O *= H2O.W();
thermo CO(thermoData.subDict("CO")); CO *= CO.W();
// Product dissociation reactions
thermo CO2BreakUp
(
CO2 == CO + 0.5* O2
CO2 == CO + 0.5*O2
);
thermo H2OBreakUp
......@@ -145,7 +147,7 @@ int main(int argc, char *argv[])
(
"stoichiometricAirFuelMassRatio",
dimless,
(oxidant.W()*oxidant.nMoles())/FUEL.W()
oxidant.Y()/FUEL.W()
);
Info<< "stoichiometricAirFuelMassRatio "
......@@ -209,7 +211,6 @@ int main(int argc, char *argv[])
// Iteration loop for adiabatic flame temperature
for (int j=0; j<20; j++)
{
if (j > 0)
{
co = co2*
......
......@@ -30,7 +30,6 @@ mixture // air at room temperature (293 K)
{
specie
{
nMoles 1;
molWeight 28.9;
}
thermodynamics
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -54,7 +54,6 @@ Usage
// Solid thermo
specie
{