thermophysicalModels: Refactored mixtures
to separate those based on pure species from the simplified combustion mixtures based on composite reactant and product pseudo species.
This commit is contained in:
@ -7,7 +7,7 @@ autoPtr<psiuReactionThermo> pThermo
|
||||
psiuReactionThermo& thermo = pThermo();
|
||||
thermo.validate(args.executable(), "ha", "ea");
|
||||
|
||||
basicSpecieMixture& composition = thermo.composition();
|
||||
basicCombustionMixture& composition = thermo.composition();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
|
||||
@ -7,7 +7,7 @@ autoPtr<psiuReactionThermo> pThermo
|
||||
psiuReactionThermo& thermo = pThermo();
|
||||
thermo.validate(args.executable(), "ha", "ea");
|
||||
|
||||
basicSpecieMixture& composition = thermo.composition();
|
||||
basicCombustionMixture& composition = thermo.composition();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
rhoReactionThermo& thermo = thermoFluid[i];
|
||||
thermo.validate(args.executable(), "h", "e");
|
||||
|
||||
basicMultiComponentMixture& composition = thermo.composition();
|
||||
basicSpecieMixture& composition = thermo.composition();
|
||||
PtrList<volScalarField>& Y = composition.Y();
|
||||
|
||||
label inertIndex = -1;
|
||||
|
||||
@ -98,7 +98,7 @@ Foam::radiationModels::sootModels::mixtureFraction<ThermoType>::mixtureFraction
|
||||
const label speciei = reaction.rhs()[i].index;
|
||||
const scalar stoichCoeff = reaction.rhs()[i].stoichCoeff;
|
||||
Xi[i] = mag(stoichCoeff)/totalMol;
|
||||
Wm += Xi[i]*mixture.speciesData()[speciei].W();
|
||||
Wm += Xi[i]*mixture.specieThermos()[speciei].W();
|
||||
}
|
||||
|
||||
scalarList Yprod0(mixture.species().size(), 0.0);
|
||||
@ -106,7 +106,7 @@ Foam::radiationModels::sootModels::mixtureFraction<ThermoType>::mixtureFraction
|
||||
forAll(reaction.rhs(), i)
|
||||
{
|
||||
const label speciei = reaction.rhs()[i].index;
|
||||
Yprod0[speciei] = mixture.speciesData()[speciei].W()/Wm*Xi[i];
|
||||
Yprod0[speciei] = mixture.specieThermos()[speciei].W()/Wm*Xi[i];
|
||||
}
|
||||
|
||||
const scalar XSoot = nuSoot_/totalMol;
|
||||
|
||||
@ -39,14 +39,14 @@ template<class ReactionThermo, class ThermoType>
|
||||
void singleStepCombustion<ReactionThermo, ThermoType>::calculateqFuel()
|
||||
{
|
||||
const Reaction<ThermoType>& reaction = reaction_();
|
||||
const scalar Wu = mixture_.speciesData()[fuelIndex_].W();
|
||||
const scalar Wu = mixture_.specieThermos()[fuelIndex_].W();
|
||||
|
||||
forAll(reaction.lhs(), i)
|
||||
{
|
||||
const label speciei = reaction.lhs()[i].index;
|
||||
const scalar stoichCoeff = reaction.lhs()[i].stoichCoeff;
|
||||
specieStoichCoeffs_[speciei] = -stoichCoeff;
|
||||
qFuel_.value() += mixture_.speciesData()[speciei].hc()*stoichCoeff/Wu;
|
||||
qFuel_.value() += mixture_.specieThermos()[speciei].hc()*stoichCoeff/Wu;
|
||||
}
|
||||
|
||||
forAll(reaction.rhs(), i)
|
||||
@ -54,7 +54,7 @@ void singleStepCombustion<ReactionThermo, ThermoType>::calculateqFuel()
|
||||
const label speciei = reaction.rhs()[i].index;
|
||||
const scalar stoichCoeff = reaction.rhs()[i].stoichCoeff;
|
||||
specieStoichCoeffs_[speciei] = stoichCoeff;
|
||||
qFuel_.value() -= mixture_.speciesData()[speciei].hc()*stoichCoeff/Wu;
|
||||
qFuel_.value() -= mixture_.specieThermos()[speciei].hc()*stoichCoeff/Wu;
|
||||
specieProd_[speciei] = -1;
|
||||
}
|
||||
|
||||
@ -66,17 +66,17 @@ template<class ReactionThermo, class ThermoType>
|
||||
void singleStepCombustion<ReactionThermo, ThermoType>:: massAndAirStoichRatios()
|
||||
{
|
||||
const label O2Index = mixture_.species()["O2"];
|
||||
const scalar Wu = mixture_.speciesData()[fuelIndex_].W();
|
||||
const scalar Wu = mixture_.specieThermos()[fuelIndex_].W();
|
||||
|
||||
stoicRatio_ =
|
||||
(mixture_.speciesData()[inertIndex_].W()
|
||||
(mixture_.specieThermos()[inertIndex_].W()
|
||||
* specieStoichCoeffs_[inertIndex_]
|
||||
+ mixture_.speciesData()[O2Index].W()
|
||||
+ mixture_.specieThermos()[O2Index].W()
|
||||
* mag(specieStoichCoeffs_[O2Index]))
|
||||
/ (Wu*mag(specieStoichCoeffs_[fuelIndex_]));
|
||||
|
||||
s_ =
|
||||
(mixture_.speciesData()[O2Index].W()
|
||||
(mixture_.specieThermos()[O2Index].W()
|
||||
* mag(specieStoichCoeffs_[O2Index]))
|
||||
/ (Wu*mag(specieStoichCoeffs_[fuelIndex_]));
|
||||
|
||||
@ -105,13 +105,13 @@ void singleStepCombustion<ReactionThermo, ThermoType>:: calculateMaxProducts()
|
||||
{
|
||||
const label speciei = reaction.rhs()[i].index;
|
||||
Xi[i] = mag(specieStoichCoeffs_[speciei])/totalMol;
|
||||
Wm += Xi[i]*mixture_.speciesData()[speciei].W();
|
||||
Wm += Xi[i]*mixture_.specieThermos()[speciei].W();
|
||||
}
|
||||
|
||||
forAll(reaction.rhs(), i)
|
||||
{
|
||||
const label speciei = reaction.rhs()[i].index;
|
||||
Yprod0_[speciei] = mixture_.speciesData()[speciei].W()/Wm*Xi[i];
|
||||
Yprod0_[speciei] = mixture_.specieThermos()[speciei].W()/Wm*Xi[i];
|
||||
}
|
||||
|
||||
Info << "Maximum products mass concentrations:" << nl;
|
||||
@ -128,8 +128,8 @@ void singleStepCombustion<ReactionThermo, ThermoType>:: calculateMaxProducts()
|
||||
{
|
||||
specieStoichCoeffs_[i] =
|
||||
specieStoichCoeffs_[i]
|
||||
* mixture_.speciesData()[i].W()
|
||||
/ (mixture_.speciesData()[fuelIndex_].W()
|
||||
* mixture_.specieThermos()[i].W()
|
||||
/ (mixture_.specieThermos()[fuelIndex_].W()
|
||||
* mag(specieStoichCoeffs_[fuelIndex_]));
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ singleStepCombustion<ReactionThermo, ThermoType>::singleStepCombustion
|
||||
Reaction<ThermoType>::New
|
||||
(
|
||||
mixture_.species(),
|
||||
mixture_.speciesData(),
|
||||
mixture_.specieThermos(),
|
||||
this->subDict("reaction")
|
||||
)
|
||||
),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,6 +42,7 @@ namespace Foam
|
||||
|
||||
class fvMesh;
|
||||
class dictionary;
|
||||
class word;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class basicMixture Declaration
|
||||
|
||||
@ -39,10 +39,10 @@ Foam::StandardChemistryModel<ReactionThermo, ThermoType>::StandardChemistryModel
|
||||
BasicChemistryModel<ReactionThermo>(thermo),
|
||||
ODESystem(),
|
||||
Y_(this->thermo().composition().Y()),
|
||||
specieThermo_
|
||||
specieThermos_
|
||||
(
|
||||
dynamic_cast<const multiComponentMixture<ThermoType>&>
|
||||
(this->thermo()).speciesData()
|
||||
(this->thermo()).specieThermos()
|
||||
),
|
||||
reactions_
|
||||
(
|
||||
@ -50,7 +50,7 @@ Foam::StandardChemistryModel<ReactionThermo, ThermoType>::StandardChemistryModel
|
||||
(
|
||||
this->thermo()
|
||||
).species(),
|
||||
specieThermo_,
|
||||
specieThermos_,
|
||||
this->mesh(),
|
||||
*this
|
||||
),
|
||||
@ -175,21 +175,21 @@ void Foam::StandardChemistryModel<ReactionThermo, ThermoType>::derivatives
|
||||
scalar cSum = 0;
|
||||
for (label i = 0; i < nSpecie_; i++)
|
||||
{
|
||||
const scalar W = specieThermo_[i].W();
|
||||
const scalar W = specieThermos_[i].W();
|
||||
cSum += c_[i];
|
||||
rho += W*c_[i];
|
||||
}
|
||||
scalar cp = 0;
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
cp += c_[i]*specieThermo_[i].cp(p, T);
|
||||
cp += c_[i]*specieThermos_[i].cp(p, T);
|
||||
}
|
||||
cp /= rho;
|
||||
|
||||
scalar dT = 0;
|
||||
for (label i = 0; i < nSpecie_; i++)
|
||||
{
|
||||
const scalar hi = specieThermo_[i].ha(p, T);
|
||||
const scalar hi = specieThermos_[i].ha(p, T);
|
||||
dT += hi*dcdt[i];
|
||||
}
|
||||
dT /= rho*cp;
|
||||
@ -228,8 +228,8 @@ void Foam::StandardChemistryModel<ReactionThermo, ThermoType>::jacobian
|
||||
scalarField cpi(nSpecie_);
|
||||
for (label i = 0; i < nSpecie_; i++)
|
||||
{
|
||||
hi[i] = specieThermo_[i].ha(p, T);
|
||||
cpi[i] = specieThermo_[i].cp(p, T);
|
||||
hi[i] = specieThermos_[i].ha(p, T);
|
||||
cpi[i] = specieThermos_[i].cp(p, T);
|
||||
}
|
||||
scalar omegaI = 0;
|
||||
List<label> dummy;
|
||||
@ -248,7 +248,7 @@ void Foam::StandardChemistryModel<ReactionThermo, ThermoType>::jacobian
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
cpMean += c_[i]*cpi[i]; // J/(m^3 K)
|
||||
dcpdTMean += c_[i]*specieThermo_[i].dcpdT(p, T);
|
||||
dcpdTMean += c_[i]*specieThermos_[i].dcpdT(p, T);
|
||||
}
|
||||
scalar dTdt = 0.0;
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
@ -320,7 +320,7 @@ Foam::StandardChemistryModel<ReactionThermo, ThermoType>::tc() const
|
||||
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
c_[i] = rhoi*Y_[i][celli]/specieThermo_[i].W();
|
||||
c_[i] = rhoi*Y_[i][celli]/specieThermos_[i].W();
|
||||
cSum += c_[i];
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ Foam::StandardChemistryModel<ReactionThermo, ThermoType>::Qdot() const
|
||||
{
|
||||
forAll(Qdot, celli)
|
||||
{
|
||||
const scalar hi = specieThermo_[i].Hf();
|
||||
const scalar hi = specieThermos_[i].Hf();
|
||||
Qdot[celli] -= hi*RR_[i][celli];
|
||||
}
|
||||
}
|
||||
@ -416,7 +416,7 @@ Foam::StandardChemistryModel<ReactionThermo, ThermoType>::calculateRR
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
const scalar Yi = Y_[i][celli];
|
||||
c_[i] = rhoi*Yi/specieThermo_[i].W();
|
||||
c_[i] = rhoi*Yi/specieThermos_[i].W();
|
||||
}
|
||||
|
||||
const Reaction<ThermoType>& R = reactions_[ri];
|
||||
@ -441,7 +441,7 @@ Foam::StandardChemistryModel<ReactionThermo, ThermoType>::calculateRR
|
||||
}
|
||||
}
|
||||
|
||||
RR[celli] *= specieThermo_[si].W();
|
||||
RR[celli] *= specieThermos_[si].W();
|
||||
}
|
||||
|
||||
return tRR;
|
||||
@ -471,14 +471,14 @@ void Foam::StandardChemistryModel<ReactionThermo, ThermoType>::calculate()
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
const scalar Yi = Y_[i][celli];
|
||||
c_[i] = rhoi*Yi/specieThermo_[i].W();
|
||||
c_[i] = rhoi*Yi/specieThermos_[i].W();
|
||||
}
|
||||
|
||||
omega(pi, Ti, c_, celli, dcdt_);
|
||||
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
RR_[i][celli] = dcdt_[i]*specieThermo_[i].W();
|
||||
RR_[i][celli] = dcdt_[i]*specieThermos_[i].W();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -519,7 +519,7 @@ Foam::scalar Foam::StandardChemistryModel<ReactionThermo, ThermoType>::solve
|
||||
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
c_[i] = rhoi*Y_[i][celli]/specieThermo_[i].W();
|
||||
c_[i] = rhoi*Y_[i][celli]/specieThermos_[i].W();
|
||||
c0[i] = c_[i];
|
||||
}
|
||||
|
||||
@ -542,7 +542,7 @@ Foam::scalar Foam::StandardChemistryModel<ReactionThermo, ThermoType>::solve
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
RR_[i][celli] =
|
||||
(c_[i] - c0[i])*specieThermo_[i].W()/deltaT[celli];
|
||||
(c_[i] - c0[i])*specieThermos_[i].W()/deltaT[celli];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -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
|
||||
@ -80,7 +80,7 @@ protected:
|
||||
const PtrList<volScalarField>& Y_;
|
||||
|
||||
//- Thermodynamic data of the species
|
||||
const PtrList<ThermoType>& specieThermo_;
|
||||
const PtrList<ThermoType>& specieThermos_;
|
||||
|
||||
//- Reactions
|
||||
const ReactionList<ThermoType> reactions_;
|
||||
@ -136,7 +136,7 @@ public:
|
||||
inline const PtrList<Reaction<ThermoType>>& reactions() const;
|
||||
|
||||
//- Thermodynamic data of the species
|
||||
inline const PtrList<ThermoType>& specieThermo() const;
|
||||
inline const PtrList<ThermoType>& specieThermos() const;
|
||||
|
||||
//- The number of species
|
||||
virtual inline label nSpecie() const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,9 +55,9 @@ Foam::StandardChemistryModel<ReactionThermo, ThermoType>::reactions() const
|
||||
|
||||
template<class ReactionThermo, class ThermoType>
|
||||
inline const Foam::PtrList<ThermoType>&
|
||||
Foam::StandardChemistryModel<ReactionThermo, ThermoType>::specieThermo() const
|
||||
Foam::StandardChemistryModel<ReactionThermo, ThermoType>::specieThermos() const
|
||||
{
|
||||
return specieThermo_;
|
||||
return specieThermos_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -351,7 +351,7 @@ void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::derivatives
|
||||
scalar rho = 0;
|
||||
for (label i=0; i<this->c_.size(); i++)
|
||||
{
|
||||
const scalar W = this->specieThermo_[i].W();
|
||||
const scalar W = this->specieThermos_[i].W();
|
||||
rho += W*this->c_[i];
|
||||
}
|
||||
|
||||
@ -359,7 +359,7 @@ void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::derivatives
|
||||
for (label i=0; i<this->c_.size(); i++)
|
||||
{
|
||||
// cp function returns [J/kmol/K]
|
||||
cp += this->c_[i]*this->specieThermo_[i].cp(p, T);
|
||||
cp += this->c_[i]*this->specieThermos_[i].cp(p, T);
|
||||
}
|
||||
cp /= rho;
|
||||
|
||||
@ -380,7 +380,7 @@ void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::derivatives
|
||||
}
|
||||
|
||||
// ha function returns [J/kmol]
|
||||
const scalar hi = this->specieThermo_[si].ha(p, T);
|
||||
const scalar hi = this->specieThermos_[si].ha(p, T);
|
||||
dT += hi*dcdt[i];
|
||||
}
|
||||
dT /= rho*cp;
|
||||
@ -434,8 +434,8 @@ void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::jacobian
|
||||
scalarField cpi(this->c_.size());
|
||||
forAll(hi, i)
|
||||
{
|
||||
hi[i] = this->specieThermo_[i].ha(p, T);
|
||||
cpi[i] = this->specieThermo_[i].cp(p, T);
|
||||
hi[i] = this->specieThermos_[i].ha(p, T);
|
||||
cpi[i] = this->specieThermos_[i].cp(p, T);
|
||||
}
|
||||
|
||||
scalar omegaI = 0;
|
||||
@ -485,7 +485,7 @@ void Foam::TDACChemistryModel<ReactionThermo, ThermoType>::jacobian
|
||||
{
|
||||
cpMean += this->c_[i]*cpi[i]; // J/(m^3 K)
|
||||
// Already multiplied by rho
|
||||
dcpdTMean += this->c_[i]*this->specieThermo_[i].dcpdT(p, T);
|
||||
dcpdTMean += this->c_[i]*this->specieThermos_[i].dcpdT(p, T);
|
||||
}
|
||||
|
||||
scalar dTdt = 0;
|
||||
@ -608,7 +608,7 @@ Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::solve
|
||||
|
||||
for (label i=0; i<this->nSpecie_; i++)
|
||||
{
|
||||
c[i] = rhoi*this->Y_[i][celli]/this->specieThermo_[i].W();
|
||||
c[i] = rhoi*this->Y_[i][celli]/this->specieThermos_[i].W();
|
||||
c0[i] = c[i];
|
||||
phiq[i] = this->Y()[i][celli];
|
||||
}
|
||||
@ -636,7 +636,7 @@ Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::solve
|
||||
// Retrieved solution stored in Rphiq
|
||||
for (label i=0; i<this->nSpecie(); i++)
|
||||
{
|
||||
c[i] = rhoi*Rphiq[i]/this->specieThermo_[i].W();
|
||||
c[i] = rhoi*Rphiq[i]/this->specieThermos_[i].W();
|
||||
}
|
||||
|
||||
searchISATCpuTime_ += clockTime_.timeIncrement();
|
||||
@ -702,7 +702,7 @@ Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::solve
|
||||
{
|
||||
forAll(c, i)
|
||||
{
|
||||
Rphiq[i] = c[i]/rhoi*this->specieThermo_[i].W();
|
||||
Rphiq[i] = c[i]/rhoi*this->specieThermos_[i].W();
|
||||
}
|
||||
if (tabulation_->variableTimeStep())
|
||||
{
|
||||
@ -746,7 +746,7 @@ Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::solve
|
||||
for (label i=0; i<this->nSpecie_; i++)
|
||||
{
|
||||
this->RR_[i][celli] =
|
||||
(c[i] - c0[i])*this->specieThermo_[i].W()/deltaT[celli];
|
||||
(c[i] - c0[i])*this->specieThermos_[i].W()/deltaT[celli];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -238,7 +238,7 @@ Foam::chemistryReductionMethods::DAC<CompType, ThermoType>::DAC
|
||||
}
|
||||
}
|
||||
scalar curMm =
|
||||
this->chemistry_.specieThermo()[fuelSpeciesID_[i]].W();
|
||||
this->chemistry_.specieThermos()[fuelSpeciesID_[i]].W();
|
||||
Mmtot += fuelSpeciesProp_[i]/curMm;
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ Foam::chemistryReductionMethods::DAC<CompType, ThermoType>::DAC
|
||||
forAll(fuelSpecies_, i)
|
||||
{
|
||||
label curID = fuelSpeciesID_[i];
|
||||
scalar curMm = this->chemistry_.specieThermo()[curID].W();
|
||||
scalar curMm = this->chemistry_.specieThermos()[curID].W();
|
||||
|
||||
nbC += fuelSpeciesProp_[i]*Mmtot/curMm*sC_[curID];
|
||||
nbO += fuelSpeciesProp_[i]*Mmtot/curMm*sO_[curID];
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -353,7 +353,7 @@ void Foam::chemistryTabulationMethods::ISAT<CompType, ThermoType>::computeA
|
||||
{
|
||||
s2c = this->chemistry_.simplifiedToCompleteIndex()[i];
|
||||
}
|
||||
Rcq[i] = rhoi*Rphiq[s2c]/this->chemistry_.specieThermo()[s2c].W();
|
||||
Rcq[i] = rhoi*Rphiq[s2c]/this->chemistry_.specieThermos()[s2c].W();
|
||||
}
|
||||
Rcq[speciesNumber] = Rphiq[Rphiq.size() - nAdditionalEqns_];
|
||||
Rcq[speciesNumber + 1] = Rphiq[Rphiq.size() - nAdditionalEqns_ + 1];
|
||||
@ -393,16 +393,16 @@ void Foam::chemistryTabulationMethods::ISAT<CompType, ThermoType>::computeA
|
||||
sj = this->chemistry_.simplifiedToCompleteIndex()[j];
|
||||
}
|
||||
A(i, j) *=
|
||||
-dt*this->chemistry_.specieThermo()[si].W()
|
||||
/this->chemistry_.specieThermo()[sj].W();
|
||||
-dt*this->chemistry_.specieThermos()[si].W()
|
||||
/this->chemistry_.specieThermos()[sj].W();
|
||||
}
|
||||
|
||||
A(i, i) += 1;
|
||||
// Columns for pressure and temperature
|
||||
A(i, speciesNumber) *=
|
||||
-dt*this->chemistry_.specieThermo()[si].W()/rhoi;
|
||||
-dt*this->chemistry_.specieThermos()[si].W()/rhoi;
|
||||
A(i, speciesNumber + 1) *=
|
||||
-dt*this->chemistry_.specieThermo()[si].W()/rhoi;
|
||||
-dt*this->chemistry_.specieThermos()[si].W()/rhoi;
|
||||
}
|
||||
|
||||
// For the temperature and pressure lines, ddc(dTdt)
|
||||
@ -416,9 +416,9 @@ void Foam::chemistryTabulationMethods::ISAT<CompType, ThermoType>::computeA
|
||||
}
|
||||
|
||||
A(speciesNumber, i) *=
|
||||
-dt*rhoi/this->chemistry_.specieThermo()[si].W();
|
||||
-dt*rhoi/this->chemistry_.specieThermos()[si].W();
|
||||
A(speciesNumber + 1, i) *=
|
||||
-dt*rhoi/this->chemistry_.specieThermo()[si].W();
|
||||
-dt*rhoi/this->chemistry_.specieThermos()[si].W();
|
||||
}
|
||||
|
||||
A(speciesNumber, speciesNumber) = -dt*A(speciesNumber, speciesNumber) + 1;
|
||||
|
||||
@ -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
|
||||
@ -111,11 +111,11 @@ void Foam::EulerImplicit<ChemistryModel>::solve
|
||||
const scalar cTot = sum(c);
|
||||
typename ChemistryModel::thermoType mixture
|
||||
(
|
||||
(this->specieThermo_[0].W()*c[0])*this->specieThermo_[0]
|
||||
(this->specieThermos_[0].W()*c[0])*this->specieThermos_[0]
|
||||
);
|
||||
for (label i=1; i<nSpecie; i++)
|
||||
{
|
||||
mixture += (this->specieThermo_[i].W()*c[i])*this->specieThermo_[i];
|
||||
mixture += (this->specieThermos_[i].W()*c[i])*this->specieThermos_[i];
|
||||
}
|
||||
const scalar ha = mixture.Ha(p, T);
|
||||
const scalar deltaTEst = min(deltaT, subDeltaT);
|
||||
@ -189,10 +189,10 @@ void Foam::EulerImplicit<ChemistryModel>::solve
|
||||
}
|
||||
|
||||
// Update the temperature
|
||||
mixture = (this->specieThermo_[0].W()*c[0])*this->specieThermo_[0];
|
||||
mixture = (this->specieThermos_[0].W()*c[0])*this->specieThermos_[0];
|
||||
for (label i=1; i<nSpecie; i++)
|
||||
{
|
||||
mixture += (this->specieThermo_[i].W()*c[i])*this->specieThermo_[i];
|
||||
mixture += (this->specieThermos_[i].W()*c[i])*this->specieThermos_[i];
|
||||
}
|
||||
T = mixture.THa(ha, p, T);
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C
|
||||
mixtures/basicSpecieMixture/basicSpecieMixture.C
|
||||
mixtures/basicCombustionMixture/basicCombustionMixture.C
|
||||
|
||||
|
||||
@ -28,7 +28,6 @@ License
|
||||
|
||||
#include "makeThermo.H"
|
||||
#include "SpecieMixture.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Per specie properties
|
||||
// Specie properties
|
||||
|
||||
//- Molecular weight of the given specie [kg/kmol]
|
||||
virtual scalar Wi(const label speciei) const;
|
||||
@ -112,9 +112,6 @@ public:
|
||||
//- Enthalpy of formation [J/kg]
|
||||
virtual scalar Hf(const label speciei) const;
|
||||
|
||||
|
||||
// Per specie thermo properties
|
||||
|
||||
//- Density [kg/m^3]
|
||||
virtual scalar rho
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,8 +43,30 @@ Foam::basicCombustionMixture::basicCombustionMixture
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
basicSpecieMixture(thermoDict, specieNames, mesh, phaseName)
|
||||
{}
|
||||
basicMixture(thermoDict, mesh, phaseName),
|
||||
species_(specieNames),
|
||||
Y_(species_.size())
|
||||
{
|
||||
forAll(species_, i)
|
||||
{
|
||||
Y_.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::basicCombustionMixture
|
||||
|
||||
Description
|
||||
Specialization of the basicSpecieMixture for combustion.
|
||||
Specialization of the basicMixture for combustion.
|
||||
|
||||
SourceFiles
|
||||
basicCombustionMixture.C
|
||||
@ -35,7 +35,10 @@ SourceFiles
|
||||
#ifndef basicCombustionMixture_H
|
||||
#define basicCombustionMixture_H
|
||||
|
||||
#include "basicSpecieMixture.H"
|
||||
#include "volFields.H"
|
||||
#include "PtrList.H"
|
||||
#include "basicMixture.H"
|
||||
#include "speciesTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -48,9 +51,20 @@ namespace Foam
|
||||
|
||||
class basicCombustionMixture
|
||||
:
|
||||
public basicSpecieMixture
|
||||
public basicMixture
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Table of specie names
|
||||
speciesTable species_;
|
||||
|
||||
//- Species mass fractions
|
||||
PtrList<volScalarField> Y_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run time type information
|
||||
@ -80,6 +94,15 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Does the mixture include this specie?
|
||||
inline bool contains(const word& specieName) const;
|
||||
|
||||
//- Return the mass-fraction field for a specie given by name
|
||||
inline volScalarField& Y(const word& specieName);
|
||||
|
||||
//- Return the const mass-fraction field for a specie given by name
|
||||
inline const volScalarField& Y(const word& specieName) const;
|
||||
|
||||
inline scalar fres(const scalar ft, const scalar stoicRatio) const;
|
||||
|
||||
inline tmp<volScalarField> fres
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,6 +23,33 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
inline bool Foam::basicCombustionMixture::contains
|
||||
(
|
||||
const word& specieName
|
||||
) const
|
||||
{
|
||||
return species_.found(specieName);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::volScalarField& Foam::basicCombustionMixture::Y
|
||||
(
|
||||
const word& specieName
|
||||
)
|
||||
{
|
||||
return Y_[species_[specieName]];
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::volScalarField& Foam::basicCombustionMixture::Y
|
||||
(
|
||||
const word& specieName
|
||||
) const
|
||||
{
|
||||
return Y_[species_[specieName]];
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::basicCombustionMixture::fres
|
||||
(
|
||||
const scalar ft,
|
||||
|
||||
@ -1,154 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 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 "basicMultiComponentMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(basicMultiComponentMixture, 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::basicMultiComponentMixture::basicMultiComponentMixture
|
||||
(
|
||||
const dictionary& thermoDict,
|
||||
const wordList& specieNames,
|
||||
const fvMesh& mesh,
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
basicMixture(thermoDict, mesh, phaseName),
|
||||
species_(specieNames),
|
||||
active_(species_.size(), true),
|
||||
Y_(species_.size())
|
||||
{
|
||||
tmp<volScalarField> tYdefault;
|
||||
|
||||
forAll(species_, i)
|
||||
{
|
||||
IOobject header
|
||||
(
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
// check if field exists and can be read
|
||||
if (header.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
Y_.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read Ydefault if not already read
|
||||
if (!tYdefault.valid())
|
||||
{
|
||||
word YdefaultName(IOobject::groupName("Ydefault", phaseName));
|
||||
|
||||
IOobject timeIO
|
||||
(
|
||||
YdefaultName,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
IOobject constantIO
|
||||
(
|
||||
YdefaultName,
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
IOobject time0IO
|
||||
(
|
||||
YdefaultName,
|
||||
Time::timeName(0),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (timeIO.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
tYdefault = new volScalarField(timeIO, mesh);
|
||||
}
|
||||
else if (constantIO.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
tYdefault = new volScalarField(constantIO, mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
tYdefault = new volScalarField(time0IO, mesh);
|
||||
}
|
||||
}
|
||||
|
||||
Y_.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
tYdefault()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Do not enforce constraint of sum of mass fractions to equal 1 here
|
||||
// - not applicable to all models
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,154 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-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::basicMultiComponentMixture
|
||||
|
||||
Description
|
||||
Multi-component mixture.
|
||||
|
||||
Provides a list of mass fraction fields and helper functions to
|
||||
query mixture composition.
|
||||
|
||||
SourceFiles
|
||||
basicMultiComponentMixture.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef basicMultiComponentMixture_H
|
||||
#define basicMultiComponentMixture_H
|
||||
|
||||
#include "volFields.H"
|
||||
#include "PtrList.H"
|
||||
#include "basicMixture.H"
|
||||
#include "speciesTable.H"
|
||||
#include "typeInfo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class basicMultiComponentMixture Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class basicMultiComponentMixture
|
||||
:
|
||||
public basicMixture
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Table of specie names
|
||||
speciesTable species_;
|
||||
|
||||
//- List of specie active flags
|
||||
mutable List<bool> active_;
|
||||
|
||||
//- Species mass fractions
|
||||
PtrList<volScalarField> Y_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run time type information
|
||||
TypeName("basicMultiComponentMixture");
|
||||
|
||||
|
||||
//- The base class of the mixture
|
||||
typedef basicMultiComponentMixture basicMixtureType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary, species names, mesh and phase name
|
||||
basicMultiComponentMixture
|
||||
(
|
||||
const dictionary&,
|
||||
const wordList& specieNames,
|
||||
const fvMesh&,
|
||||
const word&
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~basicMultiComponentMixture()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the table of species
|
||||
inline const speciesTable& species() const;
|
||||
|
||||
//- Does the mixture include this specie?
|
||||
inline bool contains(const word& specieName) const;
|
||||
|
||||
//- Return true for active species
|
||||
inline bool active(label speciei) const;
|
||||
|
||||
//- Return the bool list of active species
|
||||
inline const List<bool>& active() const;
|
||||
|
||||
//- Set speciei active
|
||||
inline void setActive(label speciei) const;
|
||||
|
||||
//- Set speciei inactive
|
||||
inline void setInactive(label speciei) const;
|
||||
|
||||
//- Return the mass-fraction fields
|
||||
inline PtrList<volScalarField>& Y();
|
||||
|
||||
//- Return the const mass-fraction fields
|
||||
inline const PtrList<volScalarField>& Y() const;
|
||||
|
||||
//- Return the mass-fraction field for a specie given by index
|
||||
inline volScalarField& Y(const label i);
|
||||
|
||||
//- Return the const mass-fraction field for a specie given by index
|
||||
inline const volScalarField& Y(const label i) const;
|
||||
|
||||
//- Return the mass-fraction field for a specie given by name
|
||||
inline volScalarField& Y(const word& specieName);
|
||||
|
||||
//- Return the const mass-fraction field for a specie given by name
|
||||
inline const volScalarField& Y(const word& specieName) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "basicMultiComponentMixtureI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,8 +43,113 @@ Foam::basicSpecieMixture::basicSpecieMixture
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
basicMultiComponentMixture(thermoDict, specieNames, mesh, phaseName)
|
||||
{}
|
||||
basicMixture(thermoDict, mesh, phaseName),
|
||||
species_(specieNames),
|
||||
active_(species_.size(), true),
|
||||
Y_(species_.size())
|
||||
{
|
||||
tmp<volScalarField> tYdefault;
|
||||
|
||||
forAll(species_, i)
|
||||
{
|
||||
IOobject header
|
||||
(
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
// check if field exists and can be read
|
||||
if (header.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
Y_.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read Ydefault if not already read
|
||||
if (!tYdefault.valid())
|
||||
{
|
||||
word YdefaultName(IOobject::groupName("Ydefault", phaseName));
|
||||
|
||||
IOobject timeIO
|
||||
(
|
||||
YdefaultName,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
IOobject constantIO
|
||||
(
|
||||
YdefaultName,
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
IOobject time0IO
|
||||
(
|
||||
YdefaultName,
|
||||
Time::timeName(0),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (timeIO.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
tYdefault = new volScalarField(timeIO, mesh);
|
||||
}
|
||||
else if (constantIO.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
tYdefault = new volScalarField(constantIO, mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
tYdefault = new volScalarField(time0IO, mesh);
|
||||
}
|
||||
}
|
||||
|
||||
Y_.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
tYdefault()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Do not enforce constraint of sum of mass fractions to equal 1 here
|
||||
// - not applicable to all models
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -25,8 +25,8 @@ Class
|
||||
Foam::basicSpecieMixture
|
||||
|
||||
Description
|
||||
Specialization of basicMultiComponentMixture for a mixture consisting
|
||||
of a number for molecular species.
|
||||
Specialization of basicMixture for a mixture consisting of a number for
|
||||
molecular species.
|
||||
|
||||
SourceFiles
|
||||
basicSpecieMixture.C
|
||||
@ -36,7 +36,10 @@ SourceFiles
|
||||
#ifndef basicSpecieMixture_H
|
||||
#define basicSpecieMixture_H
|
||||
|
||||
#include "basicMultiComponentMixture.H"
|
||||
#include "volFields.H"
|
||||
#include "PtrList.H"
|
||||
#include "basicMixture.H"
|
||||
#include "speciesTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -49,9 +52,23 @@ namespace Foam
|
||||
|
||||
class basicSpecieMixture
|
||||
:
|
||||
public basicMultiComponentMixture
|
||||
public basicMixture
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Table of specie names
|
||||
speciesTable species_;
|
||||
|
||||
//- List of specie active flags
|
||||
mutable List<bool> active_;
|
||||
|
||||
//- Species mass fractions
|
||||
PtrList<volScalarField> Y_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run time type information
|
||||
@ -80,7 +97,44 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Per specie properties
|
||||
//- Return the table of species
|
||||
inline const speciesTable& species() const;
|
||||
|
||||
//- Does the mixture include this specie?
|
||||
inline bool contains(const word& specieName) const;
|
||||
|
||||
//- Return true for active species
|
||||
inline bool active(label speciei) const;
|
||||
|
||||
//- Return the bool list of active species
|
||||
inline const List<bool>& active() const;
|
||||
|
||||
//- Set speciei active
|
||||
inline void setActive(label speciei) const;
|
||||
|
||||
//- Set speciei inactive
|
||||
inline void setInactive(label speciei) const;
|
||||
|
||||
//- Return the mass-fraction fields
|
||||
inline PtrList<volScalarField>& Y();
|
||||
|
||||
//- Return the const mass-fraction fields
|
||||
inline const PtrList<volScalarField>& Y() const;
|
||||
|
||||
//- Return the mass-fraction field for a specie given by index
|
||||
inline volScalarField& Y(const label i);
|
||||
|
||||
//- Return the const mass-fraction field for a specie given by index
|
||||
inline const volScalarField& Y(const label i) const;
|
||||
|
||||
//- Return the mass-fraction field for a specie given by name
|
||||
inline volScalarField& Y(const word& specieName);
|
||||
|
||||
//- Return the const mass-fraction field for a specie given by name
|
||||
inline const volScalarField& Y(const word& specieName) const;
|
||||
|
||||
|
||||
// Specie properties
|
||||
|
||||
//- Molecular weight of the given specie [kg/kmol]
|
||||
virtual scalar Wi(const label speciei) const = 0;
|
||||
@ -89,7 +143,7 @@ public:
|
||||
virtual scalar Hf(const label speciei) const = 0;
|
||||
|
||||
|
||||
// Per specie thermo properties
|
||||
// Specie thermo properties
|
||||
|
||||
//- Density [kg/m^3]
|
||||
virtual scalar rho
|
||||
@ -188,7 +242,7 @@ public:
|
||||
) const = 0;
|
||||
|
||||
|
||||
// Per specie transport properties
|
||||
// Specie transport properties
|
||||
|
||||
//- Dynamic viscosity [kg/m/s]
|
||||
virtual scalar mu
|
||||
@ -246,6 +300,10 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "basicSpecieMixtureI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -23,69 +23,64 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
inline const Foam::speciesTable&
|
||||
Foam::basicMultiComponentMixture::species() const
|
||||
inline const Foam::speciesTable& Foam::basicSpecieMixture::species() const
|
||||
{
|
||||
return species_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::basicMultiComponentMixture::contains
|
||||
(
|
||||
const word& specieName
|
||||
) const
|
||||
inline bool Foam::basicSpecieMixture::contains(const word& specieName) const
|
||||
{
|
||||
return species_.found(specieName);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::basicMultiComponentMixture::active(label speciei) const
|
||||
inline bool Foam::basicSpecieMixture::active(label speciei) const
|
||||
{
|
||||
return active_[speciei];
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::List<bool>& Foam::basicMultiComponentMixture::active() const
|
||||
inline const Foam::List<bool>& Foam::basicSpecieMixture::active() const
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::basicMultiComponentMixture::setActive(label speciei) const
|
||||
inline void Foam::basicSpecieMixture::setActive(label speciei) const
|
||||
{
|
||||
active_[speciei] = true;
|
||||
const_cast<volScalarField&>(Y_[speciei]).writeOpt() = IOobject::AUTO_WRITE;
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::basicMultiComponentMixture::setInactive(label speciei) const
|
||||
inline void Foam::basicSpecieMixture::setInactive(label speciei) const
|
||||
{
|
||||
active_[speciei] = false;
|
||||
const_cast<volScalarField&>(Y_[speciei]).writeOpt() = IOobject::NO_WRITE;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::PtrList<Foam::volScalarField>&
|
||||
Foam::basicMultiComponentMixture::Y()
|
||||
inline Foam::PtrList<Foam::volScalarField>& Foam::basicSpecieMixture::Y()
|
||||
{
|
||||
return Y_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::PtrList<Foam::volScalarField>&
|
||||
Foam::basicMultiComponentMixture::Y() const
|
||||
Foam::basicSpecieMixture::Y() const
|
||||
{
|
||||
return Y_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::volScalarField& Foam::basicMultiComponentMixture::Y(const label i)
|
||||
inline Foam::volScalarField& Foam::basicSpecieMixture::Y(const label i)
|
||||
{
|
||||
return Y_[i];
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::volScalarField& Foam::basicMultiComponentMixture::Y
|
||||
inline const Foam::volScalarField& Foam::basicSpecieMixture::Y
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
@ -94,7 +89,7 @@ inline const Foam::volScalarField& Foam::basicMultiComponentMixture::Y
|
||||
}
|
||||
|
||||
|
||||
inline Foam::volScalarField& Foam::basicMultiComponentMixture::Y
|
||||
inline Foam::volScalarField& Foam::basicSpecieMixture::Y
|
||||
(
|
||||
const word& specieName
|
||||
)
|
||||
@ -103,7 +98,7 @@ inline Foam::volScalarField& Foam::basicMultiComponentMixture::Y
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::volScalarField& Foam::basicMultiComponentMixture::Y
|
||||
inline const Foam::volScalarField& Foam::basicSpecieMixture::Y
|
||||
(
|
||||
const word& specieName
|
||||
) const
|
||||
@ -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
|
||||
@ -34,18 +34,18 @@ Foam::multiComponentMixture<ThermoType>::readSpeciesData
|
||||
const dictionary& thermoDict
|
||||
) const
|
||||
{
|
||||
PtrList<ThermoType> speciesData(species_.size());
|
||||
PtrList<ThermoType> specieThermos(species_.size());
|
||||
|
||||
forAll(species_, i)
|
||||
{
|
||||
speciesData.set
|
||||
specieThermos.set
|
||||
(
|
||||
i,
|
||||
new ThermoType(thermoDict.subDict(species_[i]))
|
||||
);
|
||||
}
|
||||
|
||||
return speciesData;
|
||||
return specieThermos;
|
||||
}
|
||||
|
||||
|
||||
@ -146,10 +146,10 @@ Foam::multiComponentMixture<ThermoType>::multiComponentMixture
|
||||
mesh,
|
||||
phaseName
|
||||
),
|
||||
speciesData_(readSpeciesData(thermoDict)),
|
||||
specieThermos_(readSpeciesData(thermoDict)),
|
||||
speciesComposition_(readSpeciesComposition(thermoDict, species())),
|
||||
mixture_("mixture", speciesData_[0]),
|
||||
mixtureVol_("volMixture", speciesData_[0])
|
||||
mixture_("mixture", specieThermos_[0]),
|
||||
mixtureVol_("volMixture", specieThermos_[0])
|
||||
{
|
||||
correctMassFractions();
|
||||
}
|
||||
@ -163,11 +163,11 @@ const ThermoType& Foam::multiComponentMixture<ThermoType>::cellMixture
|
||||
const label celli
|
||||
) const
|
||||
{
|
||||
mixture_ = Y_[0][celli]*speciesData_[0];
|
||||
mixture_ = Y_[0][celli]*specieThermos_[0];
|
||||
|
||||
for (label n=1; n<Y_.size(); n++)
|
||||
{
|
||||
mixture_ += Y_[n][celli]*speciesData_[n];
|
||||
mixture_ += Y_[n][celli]*specieThermos_[n];
|
||||
}
|
||||
|
||||
return mixture_;
|
||||
@ -181,11 +181,11 @@ const ThermoType& Foam::multiComponentMixture<ThermoType>::patchFaceMixture
|
||||
const label facei
|
||||
) const
|
||||
{
|
||||
mixture_ = Y_[0].boundaryField()[patchi][facei]*speciesData_[0];
|
||||
mixture_ = Y_[0].boundaryField()[patchi][facei]*specieThermos_[0];
|
||||
|
||||
for (label n=1; n<Y_.size(); n++)
|
||||
{
|
||||
mixture_ += Y_[n].boundaryField()[patchi][facei]*speciesData_[n];
|
||||
mixture_ += Y_[n].boundaryField()[patchi][facei]*specieThermos_[n];
|
||||
}
|
||||
|
||||
return mixture_;
|
||||
@ -201,18 +201,18 @@ const ThermoType& Foam::multiComponentMixture<ThermoType>::cellVolMixture
|
||||
) const
|
||||
{
|
||||
scalar rhoInv = 0.0;
|
||||
forAll(speciesData_, i)
|
||||
forAll(specieThermos_, i)
|
||||
{
|
||||
rhoInv += Y_[i][celli]/speciesData_[i].rho(p, T);
|
||||
rhoInv += Y_[i][celli]/specieThermos_[i].rho(p, T);
|
||||
}
|
||||
|
||||
mixtureVol_ =
|
||||
Y_[0][celli]/speciesData_[0].rho(p, T)/rhoInv*speciesData_[0];
|
||||
Y_[0][celli]/specieThermos_[0].rho(p, T)/rhoInv*specieThermos_[0];
|
||||
|
||||
for (label n=1; n<Y_.size(); n++)
|
||||
{
|
||||
mixtureVol_ +=
|
||||
Y_[n][celli]/speciesData_[n].rho(p, T)/rhoInv*speciesData_[n];
|
||||
Y_[n][celli]/specieThermos_[n].rho(p, T)/rhoInv*specieThermos_[n];
|
||||
}
|
||||
|
||||
return mixtureVol_;
|
||||
@ -230,21 +230,21 @@ patchFaceVolMixture
|
||||
) const
|
||||
{
|
||||
scalar rhoInv = 0.0;
|
||||
forAll(speciesData_, i)
|
||||
forAll(specieThermos_, i)
|
||||
{
|
||||
rhoInv +=
|
||||
Y_[i].boundaryField()[patchi][facei]/speciesData_[i].rho(p, T);
|
||||
Y_[i].boundaryField()[patchi][facei]/specieThermos_[i].rho(p, T);
|
||||
}
|
||||
|
||||
mixtureVol_ =
|
||||
Y_[0].boundaryField()[patchi][facei]/speciesData_[0].rho(p, T)/rhoInv
|
||||
* speciesData_[0];
|
||||
Y_[0].boundaryField()[patchi][facei]/specieThermos_[0].rho(p, T)/rhoInv
|
||||
* specieThermos_[0];
|
||||
|
||||
for (label n=1; n<Y_.size(); n++)
|
||||
{
|
||||
mixtureVol_ +=
|
||||
Y_[n].boundaryField()[patchi][facei]/speciesData_[n].rho(p,T)
|
||||
/ rhoInv*speciesData_[n];
|
||||
Y_[n].boundaryField()[patchi][facei]/specieThermos_[n].rho(p,T)
|
||||
/ rhoInv*specieThermos_[n];
|
||||
}
|
||||
|
||||
return mixtureVol_;
|
||||
@ -259,7 +259,7 @@ void Foam::multiComponentMixture<ThermoType>::read
|
||||
{
|
||||
forAll(species_, i)
|
||||
{
|
||||
speciesData_[i] = ThermoType(thermoDict.subDict(species_[i]));
|
||||
specieThermos_[i] = ThermoType(thermoDict.subDict(species_[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -55,8 +55,8 @@ class multiComponentMixture
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Species data
|
||||
PtrList<ThermoType> speciesData_;
|
||||
//- List of specie thermo
|
||||
PtrList<ThermoType> specieThermos_;
|
||||
|
||||
typedef HashTable<List<specieElement>> speciesCompositionTable;
|
||||
|
||||
@ -119,9 +119,9 @@ public:
|
||||
}
|
||||
|
||||
//- Return the raw specie thermodynamic data
|
||||
const PtrList<ThermoType>& speciesData() const
|
||||
const PtrList<ThermoType>& specieThermos() const
|
||||
{
|
||||
return speciesData_;
|
||||
return specieThermos_;
|
||||
}
|
||||
|
||||
//- Return the table of species composition
|
||||
@ -159,7 +159,7 @@ public:
|
||||
//- Return thermo based on index
|
||||
inline const ThermoType& specieThermo(const label speciei) const
|
||||
{
|
||||
return speciesData_[speciei];
|
||||
return specieThermos_[speciei];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
#include "psiThermo.H"
|
||||
#include "basicSpecieMixture.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -106,7 +106,7 @@ psiuReactionThermo::psiuReactionThermo
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
psiReactionThermo(mesh, phaseName)
|
||||
psiThermo(mesh, phaseName)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -36,7 +36,8 @@ SourceFiles
|
||||
#ifndef psiuReactionThermo_H
|
||||
#define psiuReactionThermo_H
|
||||
|
||||
#include "psiReactionThermo.H"
|
||||
#include "psiThermo.H"
|
||||
#include "basicCombustionMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,12 +45,12 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class psiuReactionThermo Declaration
|
||||
Class psiuReactionThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class psiuReactionThermo
|
||||
:
|
||||
public psiReactionThermo
|
||||
public psiThermo
|
||||
{
|
||||
|
||||
protected:
|
||||
@ -106,6 +107,12 @@ public:
|
||||
//- Update properties
|
||||
virtual void correct() = 0;
|
||||
|
||||
//- Return the composition of the combustion mixture
|
||||
virtual basicCombustionMixture& composition() = 0;
|
||||
|
||||
//- Return the composition of the combustion mixture
|
||||
virtual const basicCombustionMixture& composition() const = 0;
|
||||
|
||||
|
||||
// Access to thermodynamic state variables.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user