ENH: Aligning solid thermo mixing with gas mixing and solid reaction

This commit is contained in:
sergio
2012-10-31 17:13:03 +00:00
parent 3083282e21
commit 92d2bc1b76
92 changed files with 1725 additions and 865559 deletions

View File

@ -7,6 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
@ -28,4 +29,5 @@ LIB_LIBS = \
-lcompressibleLESModels \
-lLESdeltas \
-lregionModels \
-lradiationModels
-lradiationModels \
-lreactionThermophysicalModels

View File

@ -1,7 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \

View File

@ -4,6 +4,7 @@ makeType=${1:-libso}
set -x
wmake $makeType specie
wmake $makeType solidSpecie
wmake $makeType thermophysicalFunctions
./properties/Allwmake $*
@ -15,7 +16,7 @@ wmake $makeType barotropicCompressibilityModel
wmake $makeType thermalPorousZone
wmake $makeType SLGThermo
wmake $makeType solidSpecie
wmake $makeType solidThermo
wmake $makeType solidChemistryModel

View File

@ -87,6 +87,27 @@ public:
return mixture_;
}
const ThermoType& cellVolMixture
(
const scalar,
const scalar,
const label
) const
{
return mixture_;
}
const ThermoType& patchFaceVolMixture
(
const scalar,
const scalar,
const label,
const label
) const
{
return mixture_;
}
//- Read dictionary
void read(const dictionary&);
};

View File

@ -27,7 +27,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "unitConversion.H"
#include "zeroGradientFvPatchFields.H"
#include "basicSolidMixture.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -71,7 +71,7 @@ greyMeanSolidAbsorptionEmission::X(const word specie) const
}
}
const scalarField& Yj = mixture_.Y(specie);
const label mySpecieI = mixture_.components()[specie];
const label mySpecieI = mixture_.species()[specie];
forAll(Xj, iCell)
{
Xj[iCell] = Yj[iCell]/mixture_.rho(mySpecieI, p[iCell], T[iCell]);
@ -93,10 +93,10 @@ greyMeanSolidAbsorptionEmission
coeffsDict_((dict.subDict(typeName + "Coeffs"))),
thermo_(mesh.lookupObject<solidThermo>("thermophysicalProperties")),
speciesNames_(0),
mixture_(dynamic_cast<const basicSolidMixture&>(thermo_)),
mixture_(dynamic_cast<const basicMultiComponentMixture&>(thermo_)),
solidData_(mixture_.Y().size())
{
if (!isA<basicSolidMixture>(thermo_))
if (!isA<basicMultiComponentMixture>(thermo_))
{
FatalErrorIn
(

View File

@ -90,7 +90,7 @@ private:
HashTable<label> speciesNames_;
//- Basic multicomponent mixture
const basicSolidMixture& mixture_;
const basicMultiComponentMixture& mixture_;
//- List of solid species data
List<FixedList<scalar, 2> > solidData_;

View File

@ -1,7 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude
LIB_LIBS = \
-lfiniteVolume

View File

@ -25,6 +25,7 @@ License
#include "makeReactionThermo.H"
#include "thermoPhysicsTypes.H"
#include "solidThermoPhysicsTypes.H"
#include "chemistryReader.H"
#include "foamChemistryReader.H"
@ -41,6 +42,8 @@ makeChemistryReader(gasThermoPhysics);
makeChemistryReader(constIncompressibleGasThermoPhysics);
makeChemistryReader(incompressibleGasThermoPhysics);
makeChemistryReader(icoPoly8ThermoPhysics);
makeChemistryReader(hConstSolidThermoPhysics);
makeChemistryReader(hExponentialSolidThermoPhysics);
makeChemistryReaderType(foamChemistryReader, constGasThermoPhysics);
makeChemistryReaderType(foamChemistryReader, gasThermoPhysics);
@ -51,6 +54,8 @@ makeChemistryReaderType
);
makeChemistryReaderType(foamChemistryReader, incompressibleGasThermoPhysics);
makeChemistryReaderType(foamChemistryReader, icoPoly8ThermoPhysics);
makeChemistryReaderType(foamChemistryReader, hConstSolidThermoPhysics);
makeChemistryReaderType(foamChemistryReader, hExponentialSolidThermoPhysics);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -41,6 +41,7 @@ License
#include "powerSeriesReactionRate.H"
#include "addToRunTimeSelectionTable.H"
/* * * * * * * * * * * * * * * * * Static data * * * * * * * * * * * * * * * */
namespace Foam
@ -178,7 +179,8 @@ void Foam::chemkinReader::addReactionType
{
reactions_.append
(
new IrreversibleReaction<gasThermoPhysics, ReactionRateType>
new IrreversibleReaction
<Reaction, gasThermoPhysics, ReactionRateType>
(
Reaction<gasThermoPhysics>
(
@ -197,7 +199,8 @@ void Foam::chemkinReader::addReactionType
{
reactions_.append
(
new ReversibleReaction<gasThermoPhysics, ReactionRateType>
new ReversibleReaction
<Reaction, gasThermoPhysics, ReactionRateType>
(
Reaction<gasThermoPhysics>
(
@ -496,7 +499,7 @@ void Foam::chemkinReader::addReaction
reactions_.append
(
new NonEquilibriumReversibleReaction
<gasThermoPhysics, ArrheniusReactionRate>
<Reaction, gasThermoPhysics, ArrheniusReactionRate>
(
Reaction<gasThermoPhysics>
(
@ -549,7 +552,11 @@ void Foam::chemkinReader::addReaction
reactions_.append
(
new NonEquilibriumReversibleReaction
<gasThermoPhysics, thirdBodyArrheniusReactionRate>
<
Reaction,
gasThermoPhysics,
thirdBodyArrheniusReactionRate
>
(
Reaction<gasThermoPhysics>
(
@ -654,7 +661,7 @@ void Foam::chemkinReader::addReaction
reactions_.append
(
new NonEquilibriumReversibleReaction
<gasThermoPhysics, LandauTellerReactionRate>
<Reaction, gasThermoPhysics, LandauTellerReactionRate>
(
Reaction<gasThermoPhysics>
(

View File

@ -77,7 +77,8 @@ Foam::multiComponentMixture<ThermoType>::multiComponentMixture
:
basicMultiComponentMixture(thermoDict, specieNames, mesh),
speciesData_(species_.size()),
mixture_("mixture", *thermoData[specieNames[0]])
mixture_("mixture", *thermoData[specieNames[0]]),
mixtureVol_("volMixture", *thermoData[specieNames[0]])
{
forAll(species_, i)
{
@ -101,7 +102,8 @@ Foam::multiComponentMixture<ThermoType>::multiComponentMixture
:
basicMultiComponentMixture(thermoDict, thermoDict.lookup("species"), mesh),
speciesData_(species_.size()),
mixture_("mixture", constructSpeciesData(thermoDict))
mixture_("mixture", constructSpeciesData(thermoDict)),
mixtureVol_("volMixture", speciesData_[0])
{
correctMassFractions();
}
@ -148,6 +150,78 @@ const ThermoType& Foam::multiComponentMixture<ThermoType>::patchFaceMixture
}
template<class ThermoType>
const ThermoType& Foam::multiComponentMixture<ThermoType>::cellVolMixture
(
const scalar p,
const scalar T,
const label celli
) const
{
scalar rhoInv = 0.0;
forAll(speciesData_, i)
{
rhoInv += Y_[i][celli]/speciesData_[i].rho(p, T);
}
mixtureVol_ =
Y_[0][celli]
/ speciesData_[0].rho(p, T)
/ rhoInv
/ speciesData_[0].W()
* speciesData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixtureVol_ +=
Y_[n][celli]
/ speciesData_[n].rho(p, T)
/ rhoInv
/ speciesData_[n].W()
* speciesData_[n];
}
return mixtureVol_;
}
template<class ThermoType>
const ThermoType& Foam::multiComponentMixture<ThermoType>::
patchFaceVolMixture
(
const scalar p,
const scalar T,
const label patchi,
const label facei
) const
{
scalar rhoInv = 0.0;
forAll(speciesData_, i)
{
rhoInv += Y_[i].boundaryField()[patchi][facei]/speciesData_[i].rho(p, T);
}
mixtureVol_ =
Y_[0].boundaryField()[patchi][facei]
/ speciesData_[0].rho(p, T)
/ rhoInv
/ speciesData_[0].W()
* speciesData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixtureVol_ +=
Y_[n].boundaryField()[patchi][facei]
/ speciesData_[n].rho(p,T)
/ rhoInv
/ speciesData_[n].W()
* speciesData_[n];
}
return mixtureVol_;
}
template<class ThermoType>
void Foam::multiComponentMixture<ThermoType>::read
(

View File

@ -60,6 +60,10 @@ class multiComponentMixture
//- Temporary storage for the cell/face mixture thermo data
mutable ThermoType mixture_;
//- Temporary storage for the volume weighted
// cell/face mixture thermo data
mutable ThermoType mixtureVol_;
// Private Member Functions
@ -110,6 +114,21 @@ public:
const label facei
) const;
const ThermoType& cellVolMixture
(
const scalar p,
const scalar T,
const label celli
) const;
const ThermoType& patchFaceVolMixture
(
const scalar p,
const scalar T,
const label patchi,
const label facei
) const;
//- Return the raw specie thermodynamic data
const PtrList<ThermoType>& speciesData() const
{

View File

@ -12,4 +12,5 @@ EXE_INC = \
LIB_LIBS = \
-lchemistryModel \
-lfiniteVolume \
-lODE
-lODE\
-lreactionThermophysicalModels

View File

@ -24,7 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "ODESolidChemistryModel.H"
#include "reactingSolidMixture.H"
#include "reactingMixture.H"
#include "solidReaction.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -38,24 +39,20 @@ ODESolidChemistryModel
CompType(mesh),
ODE(),
Ys_(this->solidThermo().composition().Y()),
pyrolisisGases_
(
mesh.lookupObject<dictionary>
("chemistryProperties").lookup("species")
),
reactions_
(
dynamic_cast<const reactingSolidMixture<SolidThermo>& >
dynamic_cast<const reactingMixture<SolidThermo>& >
(
this->solidThermo()
)
),
pyrolisisGases_(reactions_[0].gasSpecies()),
solidThermo_
(
dynamic_cast<const reactingSolidMixture<SolidThermo>& >
dynamic_cast<const reactingMixture<SolidThermo>& >
(
this->solidThermo()
).solidData()
).speciesData()
),
gasThermo_(pyrolisisGases_.size()),
nGases_(pyrolisisGases_.size()),
@ -183,7 +180,7 @@ ODESolidChemistryModel
dictionary thermoDict =
mesh.lookupObject<dictionary>
(
"chemistryProperties"
"thermophysicalProperties"
).subDict(pyrolisisGases_[gasI]);
gasThermo_.set
@ -193,14 +190,13 @@ ODESolidChemistryModel
);
}
Info<< "ODESolidChemistryModel: Number of solids = " << nSolids_
<< " and reactions = " << nReaction_ << endl;
Info<< "solidChemistryModel: Number of solids = " << nSolids_ << endl;
Info<< "Number of gases from pyrolysis = " << nGases_ << endl;
Info<< "solidChemistryModel: Number of gases = " << nGases_ << endl;
forAll(reactions_, i)
{
Info<< indent << "Reaction " << i << nl << reactions_[i] << nl;
Info<< indent << reactions_[i] << nl;
}
}
@ -235,23 +231,23 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
forAll(reactions_, i)
{
const solidReaction& R = reactions_[i];
const Reaction<SolidThermo>& R = reactions_[i];
scalar omegai = omega
(
R, c, T, p, pf, cf, lRef, pr, cr, rRef
);
scalar rhoL = 0.0;
forAll(R.slhs(), s)
forAll(R.lhs(), s)
{
label si = R.slhs()[s];
label si = R.lhs()[s].index;
om[si] -= omegai;
rhoL = solidThermo_[si].rho(p, T);
}
scalar sr = 0.0;
forAll(R.srhs(), s)
forAll(R.rhs(), s)
{
label si = R.srhs()[s];
label si = R.rhs()[s].index;
scalar rhoR = solidThermo_[si].rho(p, T);
sr = rhoR/rhoL;
om[si] += sr*omegai;
@ -263,7 +259,7 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
}
forAll(R.grhs(), g)
{
label gi = R.grhs()[g];
label gi = R.grhs()[g].index;
om[gi + nSolids_] += (1.0 - sr)*omegai;
}
}
@ -276,7 +272,7 @@ template<class CompType, class SolidThermo, class GasThermo>
Foam::scalar
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
(
const solidReaction& R,
const Reaction<SolidThermo>& R,
const scalarField& c,
const scalar T,
const scalar p,
@ -299,16 +295,17 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
scalar kf = R.kf(p, T, c1);
const scalar exponent = R.nReact();
//const scalar exponent = R.nReact();
const label Nl = R.slhs().size();
const label Nl = R.lhs().size();
for (label s=0; s<Nl; s++)
{
label si = R.slhs()[s];
label si = R.lhs()[s].index;
const scalar exp = R.lhs()[si].exponent;
kf *=
pow(c1[si]/Ys0_[si][cellI], exponent)
pow(c1[si]/Ys0_[si][cellI], exp)
*(Ys0_[si][cellI]);
}
@ -390,18 +387,18 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
for (label ri=0; ri<reactions_.size(); ri++)
{
const solidReaction& R = reactions_[ri];
const Reaction<SolidThermo>& R = reactions_[ri];
scalar kf0 = R.kf(p, T, c2);
forAll(R.slhs(), j)
forAll(R.lhs(), j)
{
label sj = R.slhs()[j];
label sj = R.lhs()[j].index;
scalar kf = kf0;
forAll(R.slhs(), i)
forAll(R.lhs(), i)
{
label si = R.slhs()[i];
scalar exp = R.nReact();
label si = R.lhs()[i].index;
scalar exp = R.lhs()[i].exponent;
if (i == j)
{
if (exp < 1.0)
@ -428,14 +425,14 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
}
}
forAll(R.slhs(), i)
forAll(R.lhs(), i)
{
label si = R.slhs()[i];
label si = R.lhs()[i].index;
dfdc[si][sj] -= kf;
}
forAll(R.srhs(), i)
forAll(R.rhs(), i)
{
label si = R.srhs()[i];
label si = R.rhs()[i].index;
dfdc[si][sj] += kf;
}
}
@ -551,7 +548,8 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nEqns() const
template<class CompType, class SolidThermo, class GasThermo>
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::calculate()
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
calculate()
{
if (!this->chemistry_)
{

View File

@ -38,7 +38,7 @@ SourceFiles
#ifndef ODESolidChemistryModel_H
#define ODESolidChemistryModel_H
#include "solidReaction.H"
#include "Reaction.H"
#include "ODE.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
@ -72,12 +72,12 @@ protected:
//- Reference to solid mass fractions
PtrList<volScalarField>& Ys_;
//- Reactions
const PtrList<Reaction<SolidThermo> >& reactions_;
//- List of gas species present in reaction system
speciesTable pyrolisisGases_;
//- Reactions
const PtrList<solidReaction>& reactions_;
//- Thermodynamic data of solids
const PtrList<SolidThermo>& solidThermo_;
@ -149,7 +149,7 @@ public:
// Member Functions
//- The reactions
inline const PtrList<solidReaction>& reactions() const;
inline const PtrList<Reaction<SolidThermo> >& reactions() const;
//- Thermodynamic data of gases
inline const PtrList<GasThermo>& gasThermo() const;
@ -180,7 +180,7 @@ public:
// species and charateristic times
virtual scalar omega
(
const solidReaction& r,
const Reaction<SolidThermo>& r,
const scalarField& c,
const scalar T,
const scalar p,

View File

@ -45,7 +45,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg()
template<class CompType, class SolidThermo, class GasThermo>
inline const Foam::PtrList<Foam::solidReaction>&
inline const Foam::PtrList<Foam::Reaction<SolidThermo> >&
Foam::ODESolidChemistryModel<CompType, SolidThermo,GasThermo>::reactions() const
{
return reactions_;

View File

@ -53,6 +53,7 @@ namespace Foam
hExponentialSolidThermoPhysics,
gasThermoPhysics
)
}

View File

@ -1,4 +1,4 @@
reaction/Reactions/solidReaction/solidReaction.C
solidSpecie/solidSpecie.C
reaction/reactions/makeSolidReactions.C
LIB = $(FOAM_LIBBIN)/libsolidSpecie

View File

@ -1,2 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude
LIB_LIBS = \
-lspecie

View File

@ -32,7 +32,7 @@ Description
#ifndef solidThermoPhysicsTypes_H
#define solidThermoPhysicsTypes_H
#include "specie.H"
#include "solidSpecie.H"
#include "rhoConst.H"
#include "hConstThermo.H"
#include "hExponentialThermo.H"
@ -53,7 +53,7 @@ namespace Foam
<
hConstThermo
<
rhoConst<specie>
rhoConst<solidSpecie>
>,
sensibleEnthalpy
>
@ -67,7 +67,7 @@ namespace Foam
<
hExponentialThermo
<
rhoConst<specie>
rhoConst<solidSpecie>
>,
sensibleEnthalpy
>

View File

@ -1,92 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
\*---------------------------------------------------------------------------*/
#include "IrreversibleSolidReaction.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ReactionRate>
Foam::IrreversibleSolidReaction<ReactionRate>::IrreversibleSolidReaction
(
const solidReaction& reaction,
const ReactionRate& k,
const scalar nReact
)
:
solidReaction(reaction),
k_(k),
nReact_(nReact)
{}
template<class ReactionRate>
Foam::IrreversibleSolidReaction<ReactionRate>::IrreversibleSolidReaction
(
const speciesTable& components,
Istream& is,
const speciesTable& pyrolysisGases
)
:
solidReaction(components, is, pyrolysisGases),
k_(components, is),
nReact_(readScalar(is))
{
is.readEnd("solidArrheniusReactionRate(Istream&)");
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ReactionRate>
Foam::scalar Foam::IrreversibleSolidReaction<ReactionRate>::kf
(
const scalar p,
const scalar T,
const scalarField& c
) const
{
return k_(p, T, c);
}
template<class ReactionRate>
Foam::scalar Foam::IrreversibleSolidReaction<ReactionRate>::nReact() const
{
return nReact_;
}
template<class ReactionRate>
void Foam::IrreversibleSolidReaction<ReactionRate>::write
(
Ostream& os
) const
{
solidReaction::write(os);
os << token::SPACE << "Reaction order: " << nReact_ << nl << k_;
}
// ************************************************************************* //

View File

@ -26,299 +26,118 @@ License
#include "solidReaction.H"
#include "DynamicList.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
defineTypeNameAndDebug(solidReaction, 0);
defineRunTimeSelectionTable(solidReaction, Istream);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidReaction::solidReaction
template<class ReactionThermo>
Foam::solidReaction<ReactionThermo>::solidReaction
(
const speciesTable& componets,
const Reaction<ReactionThermo>& reaction,
const speciesTable& pyrolisisGases,
const List<label>& slhs,
const List<label>& srhs,
const List<label>& grhs
const List<specieCoeffs>& glhs,
const List<specieCoeffs>& grhs
)
:
components_(componets),
Reaction<ReactionThermo>(reaction),
pyrolisisGases_(pyrolisisGases),
slhs_(slhs),
srhs_(srhs),
glhs_(glhs),
grhs_(grhs)
{}
Foam::solidReaction::solidReaction
template<class ReactionThermo>
Foam::solidReaction<ReactionThermo>::solidReaction
(
const solidReaction& r,
const speciesTable& componets,
const solidReaction<ReactionThermo>& r,
const speciesTable& pyrolisisGases
)
:
components_(componets),
Reaction<ReactionThermo>(r),
pyrolisisGases_(pyrolisisGases),
slhs_(r.slhs_),
srhs_(r.srhs_),
glhs_(r.glhs_),
grhs_(r.grhs_)
{}
Foam::solidReaction::solidReaction
(
const speciesTable& components,
Istream& is,
const speciesTable& pyrolisisGases
)
:
components_(components),
pyrolisisGases_(pyrolisisGases)
{
setLRhs(is);
}
Foam::label Foam::solidReaction::componentIndex
(
bool& isGas,
Istream& is
)
{
token t(is);
if (t.isWord())
{
word componentName = t.wordToken();
size_t i = componentName.find('=');
if (i != word::npos)
{
string exponentStr = componentName
(
i + 1,
componentName.size() - i - 1
);
componentName = componentName(0, i);
}
if (components_.contains(componentName))
{
isGas = false;
return (components_[componentName]);
}
else if (pyrolisisGases_.contains(componentName))
{
isGas = true;
return (pyrolisisGases_[componentName]);
}
else
{
FatalIOErrorIn
(
"solidReaction::componentIndex(bool&, Istream& is)",
is
)
<< "Cannot find component" << componentName
<< "in tables :" << pyrolisisGases_ << " or "
<< components_
<< exit(FatalIOError);
return -1;
}
}
else
{
FatalIOErrorIn("solidReaction::componentIndex(bool&, Istream& is)", is)
<< "Expected a word but found " << t.info()
<< exit(FatalIOError);
return -1;
}
}
void Foam::solidReaction::setLRhs(Istream& is)
{
DynamicList<label> dlsrhs;
label index = 0;
while (is)
{
bool isGas = false;
index = componentIndex(isGas, is);
if (index != -1)
{
dlsrhs.append(index);
token t(is);
if (t.isPunctuation())
{
if (t == token::ADD)
{
if (isGas)
{
grhs_ = dlsrhs.shrink();
dlsrhs.clear();
//is.putBack(t);
//return;
}
else
{
srhs_ = dlsrhs.shrink();
dlsrhs.clear(); //is.putBack(t);
//return;
}
}
else if (t == token::ASSIGN)
{
if (isGas)
{
Info << "Pyrolysis Gases should appear on lhs of the"
"reaction" << endl;
}
else
{
slhs_ = dlsrhs.shrink();
dlsrhs.clear();
}
}
else if (isGas)
{
grhs_ = dlsrhs.shrink();
is.putBack(t);
return;
}
else
{
srhs_ = dlsrhs.shrink();
is.putBack(t);
return;
}
}
else if (isGas)
{
grhs_ = dlsrhs.shrink();
is.putBack(t);
return;
}
else
{
srhs_ = dlsrhs.shrink();
is.putBack(t);
return;
}
}
else
{
FatalIOErrorIn("solidReaction::lsrhs(Istream& is)", is)
<< "Cannot find component in tables"
<< exit(FatalIOError);
}
}
FatalIOErrorIn("solidReaction::lsrhs(Istream& is)", is)
<< "Cannot continue reading reaction data from stream"
<< exit(FatalIOError);
}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::solidReaction> Foam::solidReaction::New
template<class ReactionThermo>
Foam::solidReaction<ReactionThermo>::solidReaction
(
const speciesTable& species,
Istream& is,
const speciesTable& pyrolisisGases
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
)
:
Reaction<ReactionThermo>(species, thermoDatabase, is),
pyrolisisGases_(),
glhs_(),
grhs_()
{
if (is.eof())
{
FatalIOErrorIn
(
"solidReaction::New(const speciesTable& species,"
" const HashPtrTable& thermoDatabase, Istream&)",
is
) << "solidReaction type not specified" << nl << nl
<< "Valid solidReaction types are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
const word reactionTypeName(is);
IstreamConstructorTable::iterator cstrIter
= IstreamConstructorTablePtr_->find(reactionTypeName);
if (cstrIter == IstreamConstructorTablePtr_->end())
{
FatalIOErrorIn
(
"solidReaction::New(const speciesTable& species,"
" const HashPtrTable& thermoDatabase, Istream&)",
is
) << "Unknown reaction type "
<< reactionTypeName << nl << nl
<< "Valid reaction types are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
return autoPtr<solidReaction>
notImplemented
(
cstrIter()(species, is, pyrolisisGases)
"template<class ReactionThermo>"
"Foam::solidReaction<ReactionThermo>::solidReaction"
"("
" const speciesTable& species,"
" const HashPtrTable<ReactionThermo>& thermoDatabase,"
" Istream& is"
")"
);
}
template<class ReactionThermo>
Foam::solidReaction<ReactionThermo>::solidReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
const dictionary& dict
)
:
Reaction<ReactionThermo>(species, thermoDatabase, dict),
pyrolisisGases_(dict.parent().parent().lookup("gaseousSpecies")),
glhs_(),
grhs_()
{
this->setLRhs
(
IStringStream(dict.lookup("reaction"))(),
pyrolisisGases_,
glhs_,
grhs_
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::solidReaction::write(Ostream& os) const
template<class ReactionThermo>
const Foam::List<typename Foam::solidReaction<ReactionThermo>::specieCoeffs>&
Foam::solidReaction<ReactionThermo>::glhs() const
{
os << type() << nl << " ";
forAll(slhs_, i)
{
os << components_[slhs_[i]];
}
os << " = ";
forAll(srhs_, i)
{
os << components_[srhs_[i]];
}
os << " + ";
forAll(grhs_, i)
{
os << pyrolisisGases_[grhs_[i]];
}
os << endl << " ";
return glhs_;
}
Foam::scalar Foam::solidReaction::kf
(
const scalar p,
const scalar T,
const scalarField& c
) const
template<class ReactionThermo>
const Foam::List<typename Foam::Reaction<ReactionThermo>::specieCoeffs>&
Foam::solidReaction<ReactionThermo>::grhs() const
{
return 0.0;
return grhs_;
}
Foam::scalar Foam::solidReaction::nReact() const
template<class ReactionThermo>
const Foam::speciesTable& Foam::solidReaction<ReactionThermo>::
gasSpecies() const
{
return 1.0;
return pyrolisisGases_;
}
template<class ReactionThermo>
void Foam::solidReaction<ReactionThermo>::write(Ostream& os) const
{
Reaction<ReactionThermo>::write(os);
}

View File

@ -38,9 +38,7 @@ SourceFiles
#define solidReaction_H
#include "speciesTable.H"
#include "scalarField.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
#include "Reaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,44 +46,40 @@ namespace Foam
{
// Forward declaration of friend functions and operators
template<class ReactionThermo>
class solidReaction;
inline Ostream& operator<<(Ostream&, const solidReaction&);
template<class ReactionThermo>
inline Ostream& operator<<(Ostream&, const solidReaction<ReactionThermo>&);
/*---------------------------------------------------------------------------*\
Class solidReaction Declaration
\*---------------------------------------------------------------------------*/
template<class ReactionThermo>
class solidReaction
:
public Reaction<ReactionThermo>
{
private:
// Private data
//- List of solid names present in reaction system
const speciesTable& components_;
typedef typename Reaction<ReactionThermo>::specieCoeffs specieCoeffs;
//- List of gas species present in reaction system
speciesTable pyrolisisGases_;
//- Solid components index for the left-hand-side of the reaction
List<label> slhs_;
//- Gas specie index for the left-hand-side of the reaction
List<specieCoeffs> glhs_;
//- Solid components index for the right-hand-side of the reaction
List<label> srhs_;
//- Specie index for the right-hand-side of the reaction
List<label> grhs_;
//- Gas specie index for the right-hand-side of the reaction
List<specieCoeffs> grhs_;
// Private Member Functions
//- Set rhs and lhs of the reaction
void setLRhs(Istream&);
//- Look for the component index in the reaction
label componentIndex(bool& isGas, Istream& is);
//- Disallow default bitwise assignment
void operator=(const solidReaction&);
@ -94,58 +88,7 @@ private:
public:
//- Runtime type information
TypeName("Reaction");
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
solidReaction,
Istream,
(
const speciesTable& components,
Istream& is,
const speciesTable& pyrolysisGases
),
(components, is, pyrolysisGases)
);
// Public classes
//- Class used for the read-construction of PtrLists of reaction
class iNew
{
const speciesTable& components_;
speciesTable pyrolisisGases_;
public:
iNew
(
const speciesTable& components,
Istream& pyrolisisGases
)
:
components_(components),
pyrolisisGases_(pyrolisisGases)
{}
autoPtr<solidReaction> operator()(Istream& is) const
{
return autoPtr<solidReaction>
(
solidReaction::New
(
components_,
is,
pyrolisisGases_
)
);
}
};
TypeName("SolidReaction");
// Constructors
@ -153,48 +96,59 @@ public:
//- Construct from components
solidReaction
(
const speciesTable& components,
const Reaction<ReactionThermo>& reaction,
const speciesTable& pyrolisisGases,
const List<label>& slhs,
const List<label>& srhs,
const List<label>& grhs
const List<specieCoeffs>& glhs,
const List<specieCoeffs>& grhs
);
//- Construct as copy given new speciesTable
solidReaction
(
const solidReaction&,
const speciesTable& components,
const solidReaction<ReactionThermo>&,
const speciesTable& pyrolisisGases
);
//- Construct from Istream
solidReaction
(
const speciesTable& components,
Istream& is,
const speciesTable& pyrolisisGases
const speciesTable& pyrolisisGases,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
);
//- Construct from dictionary
solidReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
const dictionary& dict
);
//- Construct and return a clone
virtual autoPtr<solidReaction > clone() const
virtual autoPtr<Reaction<ReactionThermo> > clone() const
{
return autoPtr<solidReaction >
return autoPtr<Reaction<ReactionThermo> >
(
new solidReaction(*this)
new solidReaction<ReactionThermo>(*this)
);
}
// Selectors
//- Return a pointer to a new patchField created on freestore from input
static autoPtr<solidReaction > New
//- Construct and return a clone with new speciesTable
virtual autoPtr<Reaction<ReactionThermo> > clone
(
const speciesTable& components,
Istream&,
const speciesTable& pyrolisisGases
);
const speciesTable& species
) const
{
return autoPtr<Reaction<ReactionThermo> >
(
new solidReaction<ReactionThermo>(*this, species)
);
}
//- Destructor
@ -206,23 +160,13 @@ public:
// Access
inline const List<label>& slhs() const;
inline const List<label>& srhs() const;
inline const List<label>& grhs() const;
inline const speciesTable& pyrolisisGases() const;
// - Acces to gas components of the reaction
virtual const List<specieCoeffs>& grhs() const;
virtual const List<specieCoeffs>& glhs() const;
// solidReaction rate coefficients
virtual scalar kf
(
const scalar p,
const scalar T,
const scalarField& c
) const;
virtual scalar nReact() const;
// - Access to gas specie list
virtual const speciesTable& gasSpecies() const;
//- Write
@ -231,10 +175,10 @@ public:
// Ostream Operator
friend Ostream& operator<<
friend Ostream& operator<< <ReactionThermo>
(
Ostream&,
const solidReaction&
const solidReaction<ReactionThermo>&
);
};
@ -249,6 +193,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "solidReaction.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -30,38 +30,13 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const List<label>& solidReaction::slhs() const
{
return slhs_;
}
inline const List<label>& solidReaction::srhs() const
{
return srhs_;
}
inline const List<label>& solidReaction::grhs() const
{
return grhs_;
}
inline const speciesTable& solidReaction::pyrolisisGases() const
{
return pyrolisisGases_;
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class ReactionThermo>
inline Ostream& operator<<
(
Ostream& os,
const solidReaction& r
const solidReaction<ReactionThermo>& r
)
{
r.write(os);

View File

@ -75,13 +75,25 @@ public:
Istream& is
);
//- Construct from dictionary
inline solidArrheniusReactionRate
(
const speciesTable& species,
const dictionary& dict
);
//- Destructor
virtual ~solidArrheniusReactionRate()
{}
// Member Functions
//- Return the type name
static word type()
{
return "SolidArrhenius";
return "Arrhenius";
}
inline scalar operator()
@ -92,6 +104,10 @@ public:
) const;
//- Write to stream
inline void write(Ostream& os) const;
// Ostream Operator
inline friend Ostream& operator<<

View File

@ -30,6 +30,7 @@ inline Foam::solidArrheniusReactionRate::solidArrheniusReactionRate
const scalar A,
const scalar Ta,
const scalar Tcrit
//const scalar nReact
)
:
A_(A),
@ -50,6 +51,18 @@ inline Foam::solidArrheniusReactionRate::solidArrheniusReactionRate
{}
inline Foam::solidArrheniusReactionRate::solidArrheniusReactionRate
(
const speciesTable&,
const dictionary& dict
)
:
A_(readScalar(dict.lookup("A"))),
Ta_(readScalar(dict.lookup("Ta"))),
Tcrit_(readScalar(dict.lookup("Tcrit")))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::scalar Foam::solidArrheniusReactionRate::operator()
@ -74,6 +87,14 @@ inline Foam::scalar Foam::solidArrheniusReactionRate::operator()
}
inline void Foam::solidArrheniusReactionRate::write(Ostream& os) const
{
os.writeKeyword("A") << A_ << token::END_STATEMENT << nl;
os.writeKeyword("Ta") << Ta_ << token::END_STATEMENT << nl;
os.writeKeyword("Tcrit") << Tcrit_ << token::END_STATEMENT << nl;
}
inline Foam::Ostream& Foam::operator<<
(
Ostream& os,

View File

@ -33,7 +33,9 @@ Description
#define makeSolidReactionThermo_H
#include "solidReaction.H"
#include "IrreversibleSolidReaction.H"
#include "IrreversibleReaction.H"
#include "Reaction.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,32 +45,46 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeReaction(ReactionType, ReactionRate) \
#define makeSolidReaction(ReactionType, Thermo, ReactionRate) \
\
typedef solidReaction Reaction; \
typedef solidReaction<Thermo> solidReaction##Thermo; \
\
typedef ReactionType<ReactionRate> \
ReactionType##ReactionRate; \
typedef Reaction<Thermo> Reaction##Thermo; \
\
typedef ReactionType<solidReaction, Thermo, ReactionRate> \
ReactionType##Thermo##ReactionRate; \
\
defineTemplateRunTimeSelectionTable(Reaction##Thermo, Istream); \
defineTemplateRunTimeSelectionTable(Reaction##Thermo, dictionary); \
\
defineTemplateTypeNameAndDebug(solidReaction##Thermo, 0); \
defineTemplateTypeNameAndDebug(Reaction##Thermo, 0); \
\
template<> \
const word ReactionType##ReactionRate::typeName \
const word ReactionType##Thermo##ReactionRate::typeName \
( \
ReactionType::typeName_() \
+ ReactionRate::type() \
+ Reaction::typeName_() \
+ solidReaction##Thermo::typeName_() \
); \
\
addToRunTimeSelectionTable \
( \
Reaction, \
ReactionType##ReactionRate, \
Reaction##Thermo, \
ReactionType##Thermo##ReactionRate, \
Istream \
); \
\
addToRunTimeSelectionTable \
( \
Reaction##Thermo, \
ReactionType##Thermo##ReactionRate, \
dictionary \
);
#define makeIRReactions(ReactionRate) \
#define makeSolidIRReactions(Thermo, ReactionRate) \
\
makeReaction(IrreversibleSolidReaction, ReactionRate)
makeSolidReaction(IrreversibleReaction, Thermo, ReactionRate)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -25,6 +25,7 @@ License
#include "makeSolidReaction.H"
#include "solidArrheniusReactionRate.H"
#include "solidThermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -33,7 +34,13 @@ namespace Foam
// * * * * * * * * * * * * * Make Solid reactions * * * * * * * * * * * * //
makeIRReactions(solidArrheniusReactionRate)
makeSolidIRReactions(hConstSolidThermoPhysics, solidArrheniusReactionRate)
makeSolidIRReactions
(
hExponentialSolidThermoPhysics,
solidArrheniusReactionRate
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,45 +23,43 @@ License
\*---------------------------------------------------------------------------*/
#include "reactingSolidMixture.H"
#include "fvMesh.H"
#include "solidSpecie.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ThermoSolidType>
Foam::reactingSolidMixture<ThermoSolidType>::reactingSolidMixture
(
const dictionary& thermoDict,
const fvMesh& mesh
)
Foam::solidSpecie::solidSpecie(const dictionary& dict)
:
multiComponentSolidMixture<ThermoSolidType>
specie
(
thermoDict,
mesh
),
PtrList<solidReaction>
(
mesh.lookupObject<dictionary>
("chemistryProperties").lookup("reactions"),
solidReaction::iNew
(
this->components_,
mesh.lookupObject<dictionary>
("chemistryProperties").lookup("species")
)
dict.dictName(),
readScalar(dict.subDict("solidSpecie").lookup("nMoles")),
scalar(1.0)
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ThermoSolidType>
void Foam::reactingSolidMixture<ThermoSolidType>::read
(
const dictionary& thermoDict
)
{}
void Foam::solidSpecie::write(Ostream& os) const
{
dictionary dict("solidSpecie");
dict.add("nMoles", nMoles());
os << indent << dict.dictName() << dict;
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const solidSpecie& st)
{
os << st.name() << tab
<< st.nMoles();
os.check("Ostream& operator<<(Ostream& os, const solidSpecie& st)");
return os;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,103 +22,114 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::IrreversibleSolidReaction
Foam::solidSpecie
Description
Simple extension of Reaction to handle reversible reactions
Base class of the solid thermophysical property types.
SourceFiles
IrreversibleSolidReaction.C
solidSpecieI.H
solidSpecie.C
\*---------------------------------------------------------------------------*/
#ifndef IrreversibleSolidReaction_H
#define IrreversibleSolidReaction_H
#ifndef solidSpecie_H
#define solidSpecie_H
#include "solidReaction.H"
#include "word.H"
#include "scalar.H"
#include "dictionary.H"
#include "specie.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class Istream;
class Ostream;
/*---------------------------------------------------------------------------*\
Class IrreversibleSolidReaction Declaration
Class solidSpecie Declaration
\*---------------------------------------------------------------------------*/
template<class ReactionRate>
class IrreversibleSolidReaction
class solidSpecie
:
public solidReaction
public specie
{
// Private data
// Reaction rate
ReactionRate k_;
// Reaction order
scalar nReact_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=
(
const IrreversibleSolidReaction<ReactionRate>&
);
//- Construct from components without name
inline solidSpecie(const scalar nMoles, const scalar molWeight);
public:
//- Runtime type information
TypeName("irreversible");
ClassName("solidSpecie");
// Constructors
//- Construct from components
IrreversibleSolidReaction
//- Construct from components with name
inline solidSpecie
(
const solidReaction& reaction,
const ReactionRate& reactionRate,
const scalar nReact
const word& name,
const scalar nMoles,
const scalar molWeight
);
//- Construct as copy
inline solidSpecie(const solidSpecie&);
//- Construct from Istream
IrreversibleSolidReaction
(
const speciesTable& components,
Istream& is,
const speciesTable& pyrolysisGases
);
//- Construct as named copy
inline solidSpecie(const word& name, const solidSpecie&);
//- Destructor
virtual ~IrreversibleSolidReaction()
{}
//- Construct from dictionary
solidSpecie(const dictionary& dict);
// Member Functions
// IrreversibleSolidReaction rate coefficients
//- Forward rate constant
virtual scalar kf
(
const scalar p,
const scalar T,
const scalarField& c
) const;
// I-O
//- Write to Ostream
void write(Ostream& os) const;
//- Reaction order
virtual scalar nReact() const;
// Member operators
inline void operator=(const solidSpecie&);
inline void operator+=(const solidSpecie&);
inline void operator-=(const solidSpecie&);
inline void operator*=(const scalar);
//- Write
virtual void write(Ostream&) const;
// Friend operators
inline friend solidSpecie operator+
(
const solidSpecie&, const solidSpecie&
);
inline friend solidSpecie operator-
(
const solidSpecie&, const solidSpecie&
);
inline friend solidSpecie operator*(const scalar, const solidSpecie&);
inline friend solidSpecie operator==
(
const solidSpecie&, const solidSpecie&
);
// Ostream Operator
friend Ostream& operator<<(Ostream&, const solidSpecie&);
};
@ -128,9 +139,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "IrreversibleSolidReaction.C"
#endif
#include "solidSpecieI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "solidSpecie.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline solidSpecie::solidSpecie
(
const word& name,
const scalar nMoles,
const scalar molWeight
)
:
specie(name, nMoles, scalar(1))
{}
inline solidSpecie::solidSpecie
(
const scalar nMoles, const scalar molWeight
)
:
specie(nMoles, molWeight)
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline solidSpecie::solidSpecie(const solidSpecie& st)
:
specie(st.name(), st.nMoles(), scalar(1))
{}
inline solidSpecie::solidSpecie(const word& name, const solidSpecie& st)
:
specie(name, st.nMoles(), scalar(1))
{}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void solidSpecie::operator=(const solidSpecie& st)
{
specie::operator=(st);
}
inline void solidSpecie::operator+=(const solidSpecie& st)
{
specie::operator+=(st);
}
inline void solidSpecie::operator-=(const solidSpecie& st)
{
specie::operator-=(st);
}
inline void solidSpecie::operator*=(const scalar s)
{
specie::operator*=(s);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
inline solidSpecie operator+(const solidSpecie& st1, const solidSpecie& st2)
{
scalar sumNmoles = max(st1.nMoles() + st2.nMoles(), SMALL);
return solidSpecie
(
sumNmoles,
st1.nMoles()/sumNmoles*st1.W()
+ st2.nMoles()/sumNmoles*st2.W()
);
}
inline solidSpecie operator-(const solidSpecie& st1, const solidSpecie& st2)
{
scalar diffNmoles = st1.nMoles() - st2.nMoles();
if (mag(diffNmoles) < SMALL)
{
diffNmoles = SMALL;
}
return solidSpecie
(
diffNmoles,
st1.nMoles()/diffNmoles*st1.W()
- st2.nMoles()/diffNmoles*st2.W()
);
}
inline solidSpecie operator*(const scalar s, const solidSpecie& st)
{
return solidSpecie
(
s*st.nMoles(),
st.W()
);
}
inline solidSpecie operator==(const solidSpecie& st1, const solidSpecie& st2)
{
return st2 - st1;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,7 +26,7 @@ Class
Description
Constant properties Transport package.
Templated into a given thermodynamics package (needed for thermal
Templated into a given Thermodynamics package (needed for thermal
conductivity).
SourceFiles
@ -44,20 +44,20 @@ SourceFiles
namespace Foam
{
template<class thermo> class constAnIsoSolidTransport;
template<class Thermo> class constAnIsoSolidTransport;
template<class thermo>
inline constAnIsoSolidTransport<thermo> operator*
template<class Thermo>
inline constAnIsoSolidTransport<Thermo> operator*
(
const scalar,
const constAnIsoSolidTransport<thermo>&
const constAnIsoSolidTransport<Thermo>&
);
template<class thermo>
template<class Thermo>
Ostream& operator<<
(
Ostream&,
const constAnIsoSolidTransport<thermo>&
const constAnIsoSolidTransport<Thermo>&
);
@ -65,10 +65,10 @@ Ostream& operator<<
Class constAnIsoSolidTransport Declaration
\*---------------------------------------------------------------------------*/
template<class thermo>
template<class Thermo>
class constAnIsoSolidTransport
:
public thermo
public Thermo
{
// Private data
@ -79,7 +79,7 @@ class constAnIsoSolidTransport
// Private Member Functions
//- Construct from components
inline constAnIsoSolidTransport(const thermo& t, const vector kappa);
inline constAnIsoSolidTransport(const Thermo& t, const vector kappa);
public:
@ -93,18 +93,36 @@ public:
const constAnIsoSolidTransport&
);
//- Construct from Istream
//constAnIsoSolidTransport(Istream&);
//- Construct from dictionary
constAnIsoSolidTransport(const dictionary&);
// Selector from dictionary
inline static autoPtr<constAnIsoSolidTransport> New
(
const dictionary& dict
);
// Member functions
//- Return the instantiated type name
static word typeName()
{
return "constAnIso<" + Thermo::typeName() + '>';
}
//- Isotropic thermal conductivity [W/mK]
inline scalar kappa(const scalar T) const;
inline scalar kappa(const scalar p, const scalar T) const;
//- Un-isotropic thermal conductivity [W/mK]
inline vector Kappa(const scalar T) const;
inline vector Kappa(const scalar p, const scalar T) const;
//- Dynamic viscosity [kg/ms]
inline scalar mu(const scalar p, const scalar T) const;
//- Thermal diffusivity of enthalpy [kg/ms]
inline vector alphah(const scalar p, const scalar T) const;
//- Write to Ostream
void write(Ostream& os) const;
@ -121,7 +139,7 @@ public:
// Friend operators
friend constAnIsoSolidTransport operator* <thermo>
friend constAnIsoSolidTransport operator* <Thermo>
(
const scalar,
const constAnIsoSolidTransport&
@ -130,7 +148,7 @@ public:
// Ostream Operator
friend Ostream& operator<< <thermo>
friend Ostream& operator<< <Thermo>
(
Ostream&,
const constAnIsoSolidTransport&

View File

@ -25,53 +25,89 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constAnIsoSolidTransport<thermo>::constAnIsoSolidTransport
template<class Thermo>
inline Foam::constAnIsoSolidTransport<Thermo>::constAnIsoSolidTransport
(
const thermo& t,
const Thermo& t,
const vector kappa
)
:
thermo(t),
Thermo(t),
kappa_(kappa)
{}
template<class thermo>
inline Foam::constAnIsoSolidTransport<thermo>::constAnIsoSolidTransport
template<class Thermo>
inline Foam::constAnIsoSolidTransport<Thermo>::constAnIsoSolidTransport
(
const word& name,
const constAnIsoSolidTransport& ct
)
:
thermo(name, ct),
Thermo(name, ct),
kappa_(ct.kappa_)
{}
template<class Thermo>
inline Foam::autoPtr<Foam::constAnIsoSolidTransport<Thermo> >
Foam::constAnIsoSolidTransport<Thermo>::New
(
const dictionary& dict
)
{
return autoPtr<constAnIsoSolidTransport<Thermo> >
(
new constAnIsoSolidTransport<Thermo>(dict)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class thermo>
inline Foam::scalar Foam::constAnIsoSolidTransport<thermo>::
kappa(const scalar T) const
template<class Thermo>
inline Foam::scalar Foam::constAnIsoSolidTransport<Thermo>::
kappa(const scalar p, const scalar T) const
{
return mag(kappa_);
}
template<class thermo>
inline Foam::vector Foam::constAnIsoSolidTransport<thermo>::
Kappa(const scalar T) const
template<class Thermo>
inline Foam::vector Foam::constAnIsoSolidTransport<Thermo>::
Kappa(const scalar p, const scalar T) const
{
return kappa_;
}
template<class Thermo>
inline Foam::scalar Foam::constAnIsoSolidTransport<Thermo>::
mu(const scalar p, const scalar T) const
{
notImplemented
(
"Foam::scalar Foam::constAnIsoSolidTransport<Thermo>mu::"
"("
" const scalar p, const scalar T"
") const"
);
return scalar(0);
}
template<class Thermo>
inline Foam::vector Foam::constAnIsoSolidTransport<Thermo>::
alphah(const scalar p, const scalar T) const
{
return kappa_/this->Cpv(p, T);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constAnIsoSolidTransport<thermo>&
Foam::constAnIsoSolidTransport<thermo>::operator=
template<class Thermo>
inline Foam::constAnIsoSolidTransport<Thermo>&
Foam::constAnIsoSolidTransport<Thermo>::operator=
(
const constAnIsoSolidTransport<thermo>& ct
const constAnIsoSolidTransport<Thermo>& ct
)
{
kappa_ = ct.kappa_;
@ -80,10 +116,10 @@ Foam::constAnIsoSolidTransport<thermo>::operator=
}
template<class thermo>
inline void Foam::constAnIsoSolidTransport<thermo>::operator+=
template<class Thermo>
inline void Foam::constAnIsoSolidTransport<Thermo>::operator+=
(
const constAnIsoSolidTransport<thermo>& ct
const constAnIsoSolidTransport<Thermo>& ct
)
{
scalar molr1 = this->nMoles();
@ -95,10 +131,10 @@ inline void Foam::constAnIsoSolidTransport<thermo>::operator+=
}
template<class thermo>
inline void Foam::constAnIsoSolidTransport<thermo>::operator-=
template<class Thermo>
inline void Foam::constAnIsoSolidTransport<Thermo>::operator-=
(
const constAnIsoSolidTransport<thermo>& ct
const constAnIsoSolidTransport<Thermo>& ct
)
{
scalar molr1 = this->nMoles();
@ -113,16 +149,16 @@ inline void Foam::constAnIsoSolidTransport<thermo>::operator-=
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class thermo>
inline Foam::constAnIsoSolidTransport<thermo> Foam::operator*
template<class Thermo>
inline Foam::constAnIsoSolidTransport<Thermo> Foam::operator*
(
const scalar s,
const constAnIsoSolidTransport<thermo>& ct
const constAnIsoSolidTransport<Thermo>& ct
)
{
return constAnIsoSolidTransport<thermo>
return constAnIsoSolidTransport<Thermo>
(
s*static_cast<const thermo&>(ct),
s*static_cast<const Thermo&>(ct),
ct.kappa_
);
}

View File

@ -28,26 +28,26 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class thermo>
Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport
template<class Thermo>
Foam::constIsoSolidTransport<Thermo>::constIsoSolidTransport
(
const dictionary& dict
)
:
thermo(dict),
Thermo(dict),
kappa_(readScalar(dict.subDict("transport").lookup("kappa")))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class thermo>
void Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport::write
template<class Thermo>
void Foam::constIsoSolidTransport<Thermo>::constIsoSolidTransport::write
(
Ostream& os
) const
{
thermo::write(os);
Thermo::write(os);
dictionary dict("transport");
dict.add("kappa", kappa_);
@ -57,14 +57,14 @@ void Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport::write
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class thermo>
template<class Thermo>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const constIsoSolidTransport<thermo>& ct
const constIsoSolidTransport<Thermo>& ct
)
{
operator<<(os, static_cast<const thermo&>(ct));
operator<<(os, static_cast<const Thermo&>(ct));
os << tab << ct.kappa_;
os.check

View File

@ -97,6 +97,12 @@ public:
//- Construct from Istream
constIsoSolidTransport(const dictionary& dict);
// Selector from dictionary
inline static autoPtr<constIsoSolidTransport> New
(
const dictionary& dict
);
// Member functions
@ -107,10 +113,17 @@ public:
}
//- Isotropic thermal conductivity [W/mK]
inline scalar kappa(const scalar T) const;
inline scalar kappa(const scalar p, const scalar T) const;
//- Un-isotropic thermal conductivity [W/mK]
inline vector Kappa(const scalar T) const;
inline vector Kappa(const scalar p, const scalar T) const;
//- Dynamic viscosity [kg/ms]
inline scalar mu(const scalar p, const scalar T) const;
//- Thermal diffusivity of enthalpy [kg/ms]
inline scalar alphah(const scalar p, const scalar T) const;
//- Write to Ostream
void write(Ostream& os) const;

View File

@ -49,23 +49,58 @@ inline Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport
{}
template<class Thermo>
inline Foam::autoPtr<Foam::constIsoSolidTransport<Thermo> >
Foam::constIsoSolidTransport<Thermo>::New
(
const dictionary& dict
)
{
return autoPtr<constIsoSolidTransport<Thermo> >
(
new constIsoSolidTransport<Thermo>(dict)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class thermo>
inline Foam::scalar Foam::constIsoSolidTransport<thermo>::
kappa(const scalar T) const
kappa(const scalar p, const scalar T) const
{
return kappa_;
}
template<class thermo>
inline Foam::vector Foam::constIsoSolidTransport<thermo>::
Kappa(const scalar T) const
Kappa(const scalar p, const scalar T) const
{
return vector(kappa_, kappa_, kappa_);
}
template<class thermo>
inline Foam::scalar Foam::constIsoSolidTransport<thermo>::
mu(const scalar p, const scalar T) const
{
notImplemented
(
"Foam::scalar Foam::constIsoSolidTransport<thermo>mu::"
"("
" const scalar p, const scalar T"
") const"
);
return scalar(0);
}
template<class thermo>
inline Foam::scalar Foam::constIsoSolidTransport<thermo>::
alphah(const scalar p, const scalar T) const
{
return kappa_/this->Cpv(p, T);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class thermo>

View File

@ -103,10 +103,15 @@ public:
const exponentialSolidTransport&
);
//- Construct from dictionary
exponentialSolidTransport(const dictionary&);
// Selector from dictionary
inline static autoPtr<exponentialSolidTransport> New
(
const dictionary& dict
);
// Member functions
@ -117,10 +122,16 @@ public:
}
//- Thermal conductivity [W/mK]
inline scalar kappa(const scalar T) const;
inline scalar kappa(const scalar p, const scalar T) const;
//- Thermal conductivity [W/mK]
inline vector Kappa(const scalar T) const;
inline vector Kappa(const scalar p, const scalar T) const;
//- Dynamic viscosity [kg/ms]
inline scalar mu(const scalar p, const scalar T) const;
//- Thermal diffusivity of enthalpy [kg/ms]
inline scalar alphah(const scalar p, const scalar T) const;
//- Write to Ostream
void write(Ostream& os) const;

View File

@ -55,12 +55,25 @@ inline Foam::exponentialSolidTransport<thermo>::exponentialSolidTransport
{}
template<class Thermo>
inline Foam::autoPtr<Foam::exponentialSolidTransport<Thermo> >
Foam::exponentialSolidTransport<Thermo>::New
(
const dictionary& dict
)
{
return autoPtr<exponentialSolidTransport<Thermo> >
(
new exponentialSolidTransport<Thermo>(dict)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class thermo>
inline Foam::scalar Foam::exponentialSolidTransport<thermo>::kappa
(
const scalar T
const scalar p, const scalar T
) const
{
return (kappa0_*pow(T/Tref_, n0_));
@ -70,7 +83,7 @@ inline Foam::scalar Foam::exponentialSolidTransport<thermo>::kappa
template<class thermo>
inline Foam::vector Foam::exponentialSolidTransport<thermo>::Kappa
(
const scalar T
const scalar p, const scalar T
) const
{
const scalar kappa(kappa0_*pow(T/Tref_, n0_));
@ -78,6 +91,28 @@ inline Foam::vector Foam::exponentialSolidTransport<thermo>::Kappa
}
template<class thermo>
inline Foam::scalar Foam::exponentialSolidTransport<thermo>::
mu(const scalar p, const scalar T) const
{
notImplemented
(
"Foam::scalar Foam::exponentialSolidTransport<thermo>mu::"
"("
" const scalar p, const scalar T"
") const"
);
return scalar(0);
}
template<class thermo>
inline Foam::scalar Foam::exponentialSolidTransport<thermo>::
alphah(const scalar p, const scalar T) const
{
return kappa(p, T)/this->Cpv(p, T);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //

View File

@ -1,7 +1,6 @@
solidThermo/solidThermo.C
solidThermo/solidThermos.C
mixtures/basicSolidMixture/basicSolidMixture.C
solidReactionThermo/solidReactionThermo.C
solidReactionThermo/solidReactionThermos.C

View File

@ -3,11 +3,13 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude
LIB_LIBS = \
-lmeshTools \
-lfiniteVolume \
-lspecie \
-lsolidSpecie \
-lfluidThermophysicalModels
-lfluidThermophysicalModels \
-lreactionThermophysicalModels

View File

@ -1,105 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
\*---------------------------------------------------------------------------*/
#include "basicSolidMixture.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicSolidMixture::basicSolidMixture
(
const wordList& solidNames,
const fvMesh& mesh
)
:
components_(solidNames),
Y_(components_.size())
{
forAll(components_, i)
{
IOobject header
(
"Y" + components_[i],
mesh.time().timeName(),
mesh,
IOobject::NO_READ
);
// check if field exists and can be read
if (header.headerOk())
{
Y_.set
(
i,
new volScalarField
(
IOobject
(
"Y" + components_[i],
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
}
else
{
volScalarField Ydefault
(
IOobject
(
"Ydefault",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
Y_.set
(
i,
new volScalarField
(
IOobject
(
"Y" + components_[i],
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Ydefault
)
);
}
}
}
// ************************************************************************* //

View File

@ -1,214 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
Class
Foam::basicSolidMixture
Description
Foam::basicSolidMixture
\*---------------------------------------------------------------------------*/
#ifndef basicSolidMixture_H
#define basicSolidMixture_H
#include "volFields.H"
#include "speciesTable.H"
#include "PtrList.H"
#include "error.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicSolidMixture Declaration
\*---------------------------------------------------------------------------*/
class basicSolidMixture
{
protected:
// Protected data
typedef speciesTable solidsTable;
//- The names of the solids
solidsTable components_;
//- Solid mass fractions
PtrList<volScalarField> Y_;
public:
//- The base class of the mixture
typedef basicSolidMixture basicMixtureType;
// Constructors
//- Construct from word list and mesh
basicSolidMixture
(
const wordList& solidNames,
const fvMesh&
);
//- Destructor
virtual ~basicSolidMixture()
{}
// Member Functions
//- Return the solid table
const solidsTable& components() const
{
return components_;
}
//- 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;
//- Does the mixture include this specie?
inline bool contains(const word& specieName) const;
// Per specie thermo properties
//- Heat capacity at constant pressure [J/(kg K)]
virtual scalar Cp
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Heat capacity at constant volume [J/(kg K)]
virtual scalar Cv
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Absolute enthalpy [J/kg]
virtual scalar Ha
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Sensible enthalpy [J/kg]
virtual scalar Hs
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Chemical enthalpy [J/kg]
virtual scalar Hc(const label specieI) const = 0;
//- Density [Kg/m3]
virtual scalar rho
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
// Per specie transport properties
//- Thermal conductivity [W/m/K]
virtual scalar kappa
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- An-isotropic thermal conductivity [W/m/K]
virtual vector Kappa
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
//- Thermal diffusivity of enthalpy/internal energy [kg/m/s]
virtual scalar alpha
(
const label specieI,
const scalar p,
const scalar T
) const = 0;
// Cell based properties with on the run mixture calculation
//- Density
virtual scalar rho(scalar p, scalar T, label celli) const = 0;
//- Thermal conductivity
virtual scalar kappa(scalar p, scalar T, label celli) const = 0;
//- Specific heat capacity
virtual scalar Cp(scalar p, scalar T, label celli) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "basicSolidMixtureI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,76 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
\*---------------------------------------------------------------------------*/
inline Foam::PtrList<Foam::volScalarField>& Foam::basicSolidMixture::Y()
{
return Y_;
}
inline const Foam::PtrList<Foam::volScalarField>& Foam::basicSolidMixture::Y()
const
{
return Y_;
}
inline Foam::volScalarField& Foam::basicSolidMixture::Y(const label i)
{
return Y_[i];
}
inline const Foam::volScalarField& Foam::basicSolidMixture::Y
(
const label i
) const
{
return Y_[i];
}
inline Foam::volScalarField& Foam::basicSolidMixture::Y(const word& specieName)
{
return Y_[components_[specieName]];
}
inline const Foam::volScalarField& Foam::basicSolidMixture::Y
(
const word& specieName
) const
{
return Y_[components_[specieName]];
}
inline bool Foam::basicSolidMixture::contains(const word& specieName) const
{
return components_.contains(specieName);
}
// ************************************************************************* //

View File

@ -1,108 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
Description
Mixture instantiation
\*---------------------------------------------------------------------------*/
#include "basicMixture.H"
#include "makeBasicMixture.H"
#include "rhoConst.H"
#include "hConstThermo.H"
#include "hExponentialThermo.H"
#include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H"
#include "sensibleInternalEnergy.H"
#include "sensibleEnthalpy.H"
#include "thermo.H"
#include "pureSolidMixture.H"
#include "multiComponentSolidMixture.H"
#include "reactingSolidMixture.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicMixture
(
pureSolidMixture,
constIsoSolidTransport,
sensibleEnthalpy,
hConstThermo,
rhoConst
);
makeBasicMixture
(
pureSolidMixture,
constAnIsoSolidTransport,
sensibleEnthalpy,
hConstThermo,
rhoConst
);
makeBasicMixture
(
pureSolidMixture,
exponentialSolidTransport,
sensibleEnthalpy,
hExponentialThermo,
rhoConst
);
makeBasicMixture
(
multiComponentSolidMixture,
constIsoSolidTransport,
sensibleEnthalpy,
hConstThermo,
rhoConst
);
makeBasicMixture
(
reactingSolidMixture,
constIsoSolidTransport,
sensibleEnthalpy,
hConstThermo,
rhoConst
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,363 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
\*---------------------------------------------------------------------------*/
#include "multiComponentSolidMixture.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::
constructSolidData
(
const dictionary& thermoSolidDict
)
{
forAll(components_, i)
{
solidData_.set
(
i,
new ThermoType
(
thermoSolidDict.subDict(components_[i] + "Coeffs")
)
);
}
return solidData_[0];
}
template<class ThermoType>
void Foam::multiComponentSolidMixture<ThermoType>::correctMassFractions()
{
volScalarField Yt("Yt", Y_[0]);
for (label n=1; n<Y_.size(); n++)
{
Yt += Y_[n];
}
forAll(Y_, n)
{
Y_[n] /= Yt;
}
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::X
(
label specieI, label celli, scalar p, scalar T
) const
{
scalar rhoInv = 0.0;
forAll(solidData_, i)
{
rhoInv += Y_[i][celli]/solidData_[i].rho(p, T);
}
scalar X = Y_[specieI][celli]/solidData_[specieI].rho(p, T);
return (X/rhoInv);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ThermoType>
Foam::multiComponentSolidMixture<ThermoType>::multiComponentSolidMixture
(
const dictionary& thermoSolidDict,
const fvMesh& mesh
)
:
basicSolidMixture
(
thermoSolidDict.lookup("solidComponents"),
mesh
),
solidData_(components_.size()),
mixture_("mixture", constructSolidData(thermoSolidDict)),
mixtureVol_("mixture", constructSolidData(thermoSolidDict))
{
correctMassFractions();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::cellVolMixture
(
const scalar p,
const scalar T,
const label celli
) const
{
scalar rhoInv = 0.0;
forAll(solidData_, i)
{
rhoInv += Y_[i][celli]/solidData_[i].rho(p, T);
}
mixtureVol_ = Y_[0][celli]/solidData_[0].rho(p, T)/rhoInv*solidData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixtureVol_ +=
Y_[n][celli]/solidData_[n].rho(p, T)/rhoInv*solidData_[n];
}
return mixtureVol_;
}
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::cellMixture
(
const label celli
) const
{
mixture_ = Y_[0][celli]*solidData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixture_ += Y_[n][celli]*solidData_[n];
}
return mixture_;
}
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::
patchFaceVolMixture
(
const scalar p,
const scalar T,
const label patchi,
const label facei
) const
{
scalar rhoInv = 0.0;
forAll(solidData_, i)
{
rhoInv += Y_[i].boundaryField()[patchi][facei]/solidData_[i].rho(p, T);
}
mixtureVol_ =
Y_[0].boundaryField()[patchi][facei]
/ solidData_[0].rho(p, T)
/ rhoInv
* solidData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixtureVol_ +=
Y_[n].boundaryField()[patchi][facei]
/ solidData_[n].rho(p,T)
/ rhoInv
* solidData_[n];
}
return mixtureVol_;
}
template<class ThermoType>
const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::
patchFaceMixture
(
const label patchi,
const label facei
) const
{
mixture_ =
Y_[0].boundaryField()[patchi][facei]*solidData_[0];
for (label n=1; n<Y_.size(); n++)
{
mixture_ += Y_[n].boundaryField()[patchi][facei]*solidData_[n];
}
return mixture_;
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Cp
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Cp(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Cv
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Cv(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Ha
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Ha(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Hs
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Hs(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Hc
(
const label specieI
) const
{
return solidData_[specieI].Hc();
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::rho
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].rho(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::kappa
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].kappa(T);
}
template<class ThermoType>
Foam::vector Foam::multiComponentSolidMixture<ThermoType>::Kappa
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].Kappa(T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::alpha
(
const label specieI, const scalar p, const scalar T
) const
{
return solidData_[specieI].kappa(T)/solidData_[specieI].Cpv(p, T);
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::rho
(
scalar p, scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].rho(p, T)*X(i, celli, p, T);
}
return tmp;
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::kappa
(
scalar p, scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].kappa(T)*X(i, celli, p, T);
}
return tmp;
}
template<class ThermoType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Cp
(
scalar p, scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].Cp(p, T)*Y_[i][celli];
}
return tmp;
}
template<class ThermoType>
void Foam::multiComponentSolidMixture<ThermoType>::read
(
const dictionary& thermoDict
)
{
forAll(components_, i)
{
solidData_[i] =
ThermoType(thermoDict.subDict(components_[i] + "Coeffs"));
}
}
// ************************************************************************* //

View File

@ -1,233 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
Class
Foam::multiComponentSolidMixture
Description
Foam::multiComponentSolidMixture
\*---------------------------------------------------------------------------*/
#ifndef multiComponentSolidMixture_H
#define multiComponentSolidMixture_H
#include "PtrList.H"
#include "autoPtr.H"
#include "basicSolidMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiComponentSolidMixture Declaration
\*---------------------------------------------------------------------------*/
template<class ThermoType>
class multiComponentSolidMixture
:
public basicSolidMixture
{
// Private data
//- Solid data
PtrList<ThermoType> solidData_;
//- Temporary storage for the mass cell/face mixture thermo data
mutable ThermoType mixture_;
//- Temporary storage for the volume weighted
// cell/face mixture thermo data
mutable ThermoType mixtureVol_;
// Private Member Functions
//- Correct the mass fractions to sum to 1
void correctMassFractions();
//- Return molar fraction for specieI in celli
scalar X(label specieI, label celli, scalar p, scalar T) const;
//- Construct solid data
const ThermoType& constructSolidData(const dictionary&);
public:
//- The type of thermodynamics this mixture is instantiated for
typedef ThermoType thermoType;
// Constructors
//- Construct from dictionary and mesh
multiComponentSolidMixture(const dictionary&, const fvMesh&);
//- Destructor
virtual ~multiComponentSolidMixture()
{}
// Member Functions
const ThermoType& cellMixture(const label celli) const;
const ThermoType& patchFaceMixture
(
const label patchi,
const label facei
) const;
const ThermoType& cellVolMixture
(
const scalar p,
const scalar T,
const label celli
) const;
const ThermoType& patchFaceVolMixture
(
const scalar p,
const scalar T,
const label patchi,
const label facei
) const;
//- Return the raw solid data
const PtrList<ThermoType>& solidData() const
{
return solidData_;
}
//- Read dictionary
void read(const dictionary&);
// Per specie thermo properties
//- Heat capacity at constant pressure [J/(kg K)]
virtual scalar Cp
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Heat capacity at constant volume [J/(kg K)]
virtual scalar Cv
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Absolute enthalpy [J/kg]
virtual scalar Ha
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Sensible enthalpy [J/kg]
virtual scalar Hs
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Chemical enthalpy [J/kg]
virtual scalar Hc(const label specieI) const;
//- Density [Kg/m3]
virtual scalar rho
(
const label specieI,
const scalar p,
const scalar T
) const;
// Per specie transport properties
//- Thermal conductivity [W/m/K]
virtual scalar kappa
(
const label specieI,
const scalar p,
const scalar T
) const;
//- An-isotropic thermal conductivity [W/m/K]
virtual vector Kappa
(
const label specieI,
const scalar p,
const scalar T
) const;
//- Thermal diffusivity of enthalpy/internal energy [kg/m/s]
virtual scalar alpha
(
const label specieI,
const scalar p,
const scalar T
) const;
// Cell based properties with on the run mixture calculation.
//- Density
virtual scalar rho(scalar p, scalar T, label celli) const;
//- Thermal conductivity
virtual scalar kappa(scalar p, scalar T, label celli) const;
//- Specific heat capacity
virtual scalar Cp(scalar p, scalar T, label celli) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "multiComponentSolidMixture.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,68 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
\*---------------------------------------------------------------------------*/
#include "pureSolidMixture.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ThermoType>
pureSolidMixture<ThermoType>::pureSolidMixture
(
const dictionary& thermoDict,
const fvMesh& mesh
)
:
basicMixture(thermoDict, mesh),
mixture_(thermoDict.subDict("mixture"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ThermoType>
pureSolidMixture<ThermoType>::~pureSolidMixture()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ThermoType>
void pureSolidMixture<ThermoType>::read(const dictionary& thermoDict)
{
mixture_ = ThermoType(thermoDict.subDict("mixture"));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,134 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
Class
Foam::pureSolidMixture
Description
Foam::pureSolidMixture
SourceFiles
pureSolidMixture.C
\*---------------------------------------------------------------------------*/
#ifndef pureSolidMixture_H
#define pureSolidMixture_H
#include "basicMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pureSolidMixture Declaration
\*---------------------------------------------------------------------------*/
template<class ThermoType>
class pureSolidMixture
:
public basicMixture
{
// Private data
ThermoType mixture_;
//- Construct as copy (not implemented)
pureSolidMixture(const pureSolidMixture<ThermoType>&);
public:
//- The type of thermodynamics this mixture is instantiated for
typedef ThermoType thermoType;
// Constructors
//- Construct from dictionary and mesh
pureSolidMixture(const dictionary&, const fvMesh&);
//- Destructor
virtual ~pureSolidMixture();
// Member functions
const ThermoType& cellMixture(const label) const
{
return mixture_;
}
const ThermoType& cellVolMixture
(
const scalar,
const scalar,
const label
) const
{
return mixture_;
}
const ThermoType& patchFaceMixture
(
const label,
const label
) const
{
return mixture_;
}
const ThermoType& patchFaceVolMixture
(
const scalar,
const scalar,
const label,
const label
) const
{
return mixture_;
}
//- Read dictionary
void read(const dictionary&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#ifdef NoRepository
# include "pureSolidMixture.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,103 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
Class
Foam::reactingSolidMixture
Description
Foam::reactingSolidMixture
SourceFiles
reactingSolidMixture.C
\*---------------------------------------------------------------------------*/
#ifndef reactingSolidMixture_H
#define reactingSolidMixture_H
#include "multiComponentSolidMixture.H"
#include "solidReaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class reactingSolidMixture Declaration
\*---------------------------------------------------------------------------*/
template<class ThermoSolidType>
class reactingSolidMixture
:
public multiComponentSolidMixture<ThermoSolidType>,
public PtrList<solidReaction>
{
// Private Member Functions
//- Disallow default bitwise copy construct
reactingSolidMixture(const reactingSolidMixture&);
//- Disallow default bitwise assignment
void operator=(const reactingSolidMixture&);
public:
//- The type of thermo package this mixture is instantiated for
typedef ThermoSolidType thermoType;
// Constructors
//- Construct from dictionary and mesh
reactingSolidMixture(const dictionary&, const fvMesh&);
//- Destructor
virtual ~reactingSolidMixture()
{}
// Member functions
//- Read dictionary
void read(const dictionary&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "reactingSolidMixture.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
InClass
Foam::solidThermo
Description
Macros for creating reacting solid thermo packages
\*---------------------------------------------------------------------------*/
#ifndef makeReactingSolidThermo_H
#define makeReactingSolidThermo_H
#include "addToRunTimeSelectionTable.H"
#include "SpecieMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeSolidReactionMixtureThermo(BaseThermo,Cthermo,Mixture,ThermoPhys) \
\
typedef SpecieMixture \
< \
Mixture \
< \
ThermoPhys \
> \
> SpecieMixture##Mixture##ThermoPhys; \
\
typedef \
heThermo \
< \
BaseThermo, \
SpecieMixture##Mixture##ThermoPhys \
> heThermo##Mixture##ThermoPhys; \
\
typedef \
Cthermo \
< \
BaseThermo, \
SpecieMixture##Mixture##ThermoPhys \
> Cthermo##Mixture##ThermoPhys; \
\
\
defineTemplateTypeNameAndDebugWithName \
( \
Cthermo##Mixture##ThermoPhys, \
( \
#Cthermo"<"#Mixture"<" \
+ ThermoPhys::typeName() \
+ ">>" \
).c_str(), \
0 \
); \
\
addToRunTimeSelectionTable \
( \
basicThermo, \
Cthermo##Mixture##ThermoPhys, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
BaseThermo, \
Cthermo##Mixture##ThermoPhys, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
BaseThermo, \
Cthermo##Mixture##ThermoPhys, \
dictionary \
);
#define makeReactingSolidThermo(BaseThermo,CThermo,Mixture,Transport,Type,Thermo,EqnOfState,Specie) \
\
typedef \
Transport \
< \
species::thermo \
< \
Thermo \
< \
EqnOfState \
< \
Specie \
> \
>, \
Type \
> \
> Transport##Type##Thermo##EqnOfState##Specie; \
\
makeSolidReactionMixtureThermo \
( \
BaseThermo, \
CThermo, \
Mixture, \
Transport##Type##Thermo##EqnOfState##Specie \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef solidReactionThermo_H
#define solidReactionThermo_H
#include "basicSolidMixture.H"
#include "basicMultiComponentMixture.H"
#include "solidThermo.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
@ -109,10 +109,11 @@ public:
// Member functions
//- Return the composition of the multi-component mixture
virtual basicSolidMixture& composition() = 0;
virtual basicMultiComponentMixture& composition() = 0;
//- Return the composition of the multi-component mixture
virtual const basicSolidMixture& composition() const = 0;
virtual const basicMultiComponentMixture& composition() const = 0;
};

View File

@ -23,18 +23,21 @@ License
\*---------------------------------------------------------------------------*/
#include "makeSolidThermo.H"
#include "makeReactingSolidThermo.H"
#include "solidReactionThermo.H"
#include "heSolidThermo.H"
#include "specie.H"
#include "solidSpecie.H"
#include "rhoConst.H"
#include "hConstThermo.H"
#include "hExponentialThermo.H"
#include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H"
#include "reactingSolidMixture.H"
#include "reactingMixture.H"
#include "multiComponentMixture.H"
#include "sensibleEnthalpy.H"
#include "thermo.H"
@ -46,16 +49,29 @@ namespace Foam
/* * * * * * * * * * * * * * * * * Enthalpy-based * * * * * * * * * * * * * */
makeSolidThermo
makeReactingSolidThermo
(
solidReactionThermo,
heSolidThermo,
reactingSolidMixture,
reactingMixture,
constIsoSolidTransport,
sensibleEnthalpy,
hConstThermo,
rhoConst,
specie
solidSpecie
);
makeReactingSolidThermo
(
solidThermo,
heSolidThermo,
multiComponentMixture,
constIsoSolidTransport,
sensibleEnthalpy,
hConstThermo,
rhoConst,
solidSpecie
);

View File

@ -56,7 +56,7 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate()
rhoCells[celli] = volMixture_.rho(pCells[celli], TCells[celli]);
alphaCells[celli] =
volMixture_.kappa(TCells[celli])
volMixture_.kappa(pCells[celli], TCells[celli])
/
mixture_.Cpv(pCells[celli], TCells[celli]);
}
@ -86,10 +86,12 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate()
facei
);
ph[facei] = mixture_.HE(pp[facei], pT[facei]);
prho[facei] = volMixture_.rho(pp[facei], pT[facei]);
palpha[facei] =
volMixture_.kappa(pT[facei])
volMixture_.kappa(pp[facei], pT[facei])
/ mixture_.Cpv(pp[facei], pT[facei]);
}
}
@ -111,8 +113,9 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate()
pT[facei] = mixture_.THE(ph[facei], pp[facei] ,pT[facei]);
prho[facei] = volMixture_.rho(pp[facei], pT[facei]);
palpha[facei] =
volMixture_.kappa(pT[facei])
volMixture_.kappa(pp[facei], pT[facei])
/ mixture_.Cpv(pp[facei], pT[facei]);
}
}
@ -204,7 +207,7 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::Kappa() const
pCells[celli],
TCells[celli],
celli
).Kappa(TCells[celli]);
).Kappa(pCells[celli], TCells[celli]);
}
forAll(Kappa.boundaryField(), patchi)
@ -222,7 +225,7 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::Kappa() const
pT[facei],
patchi,
facei
).Kappa(pT[facei]);
).Kappa(pp[facei], pT[facei]);
}
}
@ -252,7 +255,7 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::Kappa
Tp[facei],
patchi,
facei
).Kappa(Tp[facei]);
).Kappa(pp[facei], Tp[facei]);
}
return tKappa;

View File

@ -32,31 +32,55 @@ Description
#ifndef makeSolidThermo_H
#define makesolidThermo_H
#include "makeThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeSolidThermo(BaseThermo,Cthermo,Mixture,Transport,Type,Thermo,EqnOfState,Specie)\
\
makeThermoTypedefs \
( \
BaseThermo, \
Cthermo, \
Mixture, \
Transport, \
Type, \
Thermo, \
EqnOfState, \
Specie \
) \
\
addToRunTimeSelectionTable \
typedef \
Transport \
< \
species::thermo \
< \
Thermo \
< \
EqnOfState \
< \
Specie \
> \
>, \
Type \
> \
> Transport##Type##Thermo##EqnOfState##Specie; \
\
typedef \
heThermo \
< \
BaseThermo, \
Mixture<Transport##Type##Thermo##EqnOfState##Specie> \
> heThermo##Mixture##Transport##Type##Thermo##EqnOfState##Specie; \
\
typedef \
Cthermo \
< \
BaseThermo, \
Mixture<Transport##Type##Thermo##EqnOfState##Specie> \
> Cthermo##Mixture##Transport##Type##Thermo##EqnOfState##Specie; \
\
\
defineTemplateTypeNameAndDebugWithName \
( \
basicThermo, \
Cthermo##Mixture##Transport##Type##Thermo##EqnOfState##Specie, \
fvMesh \
( \
#Cthermo"<"#Mixture"<" \
+ Transport##Type##Thermo##EqnOfState##Specie::typeName() \
+ ">>" \
).c_str(), \
0 \
); \
\
\
addToRunTimeSelectionTable \
( \
BaseThermo, \

View File

@ -40,7 +40,6 @@ SourceFiles
#include "fvMesh.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "basicSolidMixture.H"
#include "basicThermo.H"
#include "autoPtr.H"

View File

@ -27,16 +27,14 @@ License
#include "solidThermo.H"
#include "heSolidThermo.H"
#include "specie.H"
#include "solidSpecie.H"
#include "rhoConst.H"
#include "hConstThermo.H"
#include "hExponentialThermo.H"
#include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H"
#include "pureSolidMixture.H"
#include "multiComponentSolidMixture.H"
#include "reactingSolidMixture.H"
#include "pureMixture.H"
#include "sensibleEnthalpy.H"
#include "sensibleInternalEnergy.H"
#include "thermo.H"
@ -53,51 +51,38 @@ makeSolidThermo
(
solidThermo,
heSolidThermo,
pureSolidMixture,
pureMixture,
constIsoSolidTransport,
sensibleEnthalpy,
hConstThermo,
rhoConst,
specie
solidSpecie
);
makeSolidThermo
(
solidThermo,
heSolidThermo,
pureSolidMixture,
pureMixture,
constAnIsoSolidTransport,
sensibleEnthalpy,
hConstThermo,
rhoConst,
specie
solidSpecie
);
makeSolidThermo
(
solidThermo,
heSolidThermo,
pureSolidMixture,
pureMixture,
exponentialSolidTransport,
sensibleEnthalpy,
hExponentialThermo,
rhoConst,
specie
solidSpecie
);
makeSolidThermo
(
solidThermo,
heSolidThermo,
multiComponentSolidMixture,
constIsoSolidTransport,
sensibleEnthalpy,
hConstThermo,
rhoConst,
specie
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -27,60 +27,94 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ReactionThermo, class ReactionRate>
Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
IrreversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionType<ReactionThermo>& reaction,
const ReactionRate& k
)
:
Reaction<ReactionThermo>(reaction),
ReactionType<ReactionThermo>(reaction),
k_(k)
{}
template<class ReactionThermo, class ReactionRate>
Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
IrreversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
)
:
Reaction<ReactionThermo>(species, thermoDatabase, is),
ReactionType<ReactionThermo>(species, thermoDatabase, is),
k_(species, is)
{}
template<class ReactionThermo, class ReactionRate>
Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
IrreversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
const dictionary& dict
)
:
Reaction<ReactionThermo>(species, thermoDatabase, dict),
ReactionType<ReactionThermo>(species, thermoDatabase, dict),
k_(species, dict)
{}
template<class ReactionThermo, class ReactionRate>
Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
IrreversibleReaction
(
const IrreversibleReaction<ReactionThermo, ReactionRate>& irr,
const IrreversibleReaction<ReactionType, ReactionThermo,ReactionRate>& irr,
const speciesTable& species
)
:
Reaction<ReactionThermo>(irr, species),
ReactionType<ReactionThermo>(irr, species),
k_(irr.k_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ReactionThermo, class ReactionRate>
Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::kf
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kf
(
const scalar p,
const scalar T,
@ -91,13 +125,19 @@ Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::kf
}
template<class ReactionThermo, class ReactionRate>
void Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::write
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
void Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
write
(
Ostream& os
) const
{
Reaction<ReactionThermo>::write(os);
ReactionType<ReactionThermo>::write(os);
k_.write(os);
}

View File

@ -47,10 +47,15 @@ namespace Foam
Class IrreversibleReaction Declaration
\*---------------------------------------------------------------------------*/
template<class ReactionThermo, class ReactionRate>
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
class IrreversibleReaction
:
public Reaction<ReactionThermo>
public ReactionType<ReactionThermo>
{
// Private data
@ -62,7 +67,12 @@ class IrreversibleReaction
//- Disallow default bitwise assignment
void operator=
(
const IrreversibleReaction<ReactionThermo, ReactionRate>&
const IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>&
);
@ -77,14 +87,19 @@ public:
//- Construct from components
IrreversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionType<ReactionThermo>& reaction,
const ReactionRate& reactionRate
);
//- Construct as copy given new speciesTable
IrreversibleReaction
(
const IrreversibleReaction<ReactionThermo, ReactionRate>&,
const IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>&,
const speciesTable& species
);
@ -109,7 +124,12 @@ public:
{
return autoPtr<Reaction<ReactionThermo> >
(
new IrreversibleReaction<ReactionThermo, ReactionRate>(*this)
new IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>(*this)
);
}
@ -121,7 +141,12 @@ public:
{
return autoPtr<Reaction<ReactionThermo> >
(
new IrreversibleReaction<ReactionThermo, ReactionRate>
new IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>
(
*this,
species

View File

@ -27,24 +27,44 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ReactionThermo, class ReactionRate>
Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::
NonEquilibriumReversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionType<ReactionThermo>& reaction,
const ReactionRate& forwardReactionRate,
const ReactionRate& reverseReactionRate
)
:
Reaction<ReactionThermo>(reaction),
ReactionType<ReactionThermo>(reaction),
fk_(forwardReactionRate),
rk_(reverseReactionRate)
{}
template<class ReactionThermo, class ReactionRate>
Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::
NonEquilibriumReversibleReaction
(
const speciesTable& species,
@ -52,14 +72,24 @@ NonEquilibriumReversibleReaction
Istream& is
)
:
Reaction<ReactionThermo>(species, thermoDatabase, is),
ReactionType<ReactionThermo>(species, thermoDatabase, is),
fk_(species, is),
rk_(species, is)
{}
template<class ReactionThermo, class ReactionRate>
Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::
NonEquilibriumReversibleReaction
(
const speciesTable& species,
@ -67,21 +97,36 @@ NonEquilibriumReversibleReaction
const dictionary& dict
)
:
Reaction<ReactionThermo>(species, thermoDatabase, dict),
ReactionType<ReactionThermo>(species, thermoDatabase, dict),
fk_(species, dict.subDict("forward")),
rk_(species, dict.subDict("reverse"))
{}
template<class ReactionThermo, class ReactionRate>
Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::
NonEquilibriumReversibleReaction
(
const NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>& nerr,
const NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>& nerr,
const speciesTable& species
)
:
Reaction<ReactionThermo>(nerr, species),
ReactionType<ReactionThermo>(nerr, species),
fk_(nerr.fk_),
rk_(nerr.rk_)
{}
@ -89,9 +134,19 @@ NonEquilibriumReversibleReaction
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ReactionThermo, class ReactionRate>
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar
Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kf
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kf
(
const scalar p,
const scalar T,
@ -102,9 +157,19 @@ Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kf
}
template<class ReactionThermo, class ReactionRate>
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar
Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
(
const scalar,
const scalar p,
@ -116,9 +181,19 @@ Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr
}
template<class ReactionThermo, class ReactionRate>
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar
Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
(
const scalar p,
const scalar T,
@ -129,13 +204,23 @@ Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr
}
template<class ReactionThermo, class ReactionRate>
void Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::write
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
void Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::write
(
Ostream& os
) const
{
Reaction<ReactionThermo>::write(os);
ReactionType<ReactionThermo>::write(os);
os << indent << "forward" << nl;
os << indent << token::BEGIN_BLOCK << nl;

View File

@ -47,10 +47,15 @@ namespace Foam
Class NonEquilibriumReversibleReaction Declaration
\*---------------------------------------------------------------------------*/
template<class ReactionThermo, class ReactionRate>
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
class NonEquilibriumReversibleReaction
:
public Reaction<ReactionThermo>
public ReactionType<ReactionThermo>
{
// Private data
@ -64,7 +69,7 @@ class NonEquilibriumReversibleReaction
void operator=
(
const NonEquilibriumReversibleReaction
<ReactionThermo, ReactionRate>&
<ReactionType, ReactionThermo, ReactionRate>&
);
@ -79,7 +84,7 @@ public:
//- Construct from components
NonEquilibriumReversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionType<ReactionThermo>& reaction,
const ReactionRate& forwardReactionRate,
const ReactionRate& reverseReactionRate
);
@ -88,7 +93,7 @@ public:
NonEquilibriumReversibleReaction
(
const NonEquilibriumReversibleReaction
<ReactionThermo, ReactionRate>&,
<ReactionType, ReactionThermo, ReactionRate>&,
const speciesTable& species
);
@ -109,25 +114,25 @@ public:
);
//- Construct and return a clone
virtual autoPtr<Reaction<ReactionThermo> > clone() const
virtual autoPtr<ReactionType<ReactionThermo> > clone() const
{
return autoPtr<Reaction<ReactionThermo> >
return autoPtr<ReactionType<ReactionThermo> >
(
new NonEquilibriumReversibleReaction
<ReactionThermo, ReactionRate>(*this)
<ReactionType, ReactionThermo, ReactionRate>(*this)
);
}
//- Construct and return a clone with new speciesTable
virtual autoPtr<Reaction<ReactionThermo> > clone
virtual autoPtr<ReactionType<ReactionThermo> > clone
(
const speciesTable& species
) const
{
return autoPtr<Reaction<ReactionThermo> >
return autoPtr<ReactionType<ReactionThermo> >
(
new NonEquilibriumReversibleReaction
<ReactionThermo, ReactionRate>
<ReactionType, ReactionThermo, ReactionRate>
(*this, species)
);
}

View File

@ -63,6 +63,25 @@ Foam::string Foam::Reaction<ReactionThermo>::reactionStr() const
}
}
for (label i = 0; i < glhs().size(); ++i)
{
reaction << " + ";
if (i > 0)
{
reaction << " + ";
}
if (mag(glhs()[i].stoichCoeff - 1) > SMALL)
{
reaction << glhs()[i].stoichCoeff;
}
reaction << species_[glhs()[i].index];
if (mag(glhs()[i].exponent - glhs()[i].stoichCoeff) > SMALL)
{
reaction << "^" << glhs()[i].exponent;
}
}
reaction << " = ";
for (label i = 0; i < rhs_.size(); ++i)
@ -82,29 +101,49 @@ Foam::string Foam::Reaction<ReactionThermo>::reactionStr() const
}
}
for (label i = 0; i < grhs().size(); ++i)
{
reaction << " + ";
if (i > 0)
{
reaction << " + ";
}
if (mag(grhs()[i].stoichCoeff - 1) > SMALL)
{
reaction << grhs()[i].stoichCoeff;
}
reaction << species_[grhs()[i].index];
if (mag(grhs()[i].exponent - grhs()[i].stoichCoeff) > SMALL)
{
reaction << "^" << grhs()[i].exponent;
}
}
return reaction.str();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ReactionThermo>
void Foam::Reaction<ReactionThermo>::setThermo
(
const HashPtrTable<ReactionThermo>& thermoDatabase
)
{
ReactionThermo::operator=
(
rhs_[0].stoichCoeff*(*thermoDatabase[species_[rhs_[0].index]])
);
for (label i=1; i<rhs_.size(); ++i)
if (rhs_.size() > 0)
{
this->operator+=
ReactionThermo::operator=
(
rhs_[i].stoichCoeff*(*thermoDatabase[species_[rhs_[i].index]])
rhs_[0].stoichCoeff*(*thermoDatabase[species_[rhs_[0].index]])
);
for (label i=1; i<rhs_.size(); ++i)
{
this->operator+=
(
rhs_[i].stoichCoeff*(*thermoDatabase[species_[rhs_[i].index]])
);
}
}
forAll(lhs_, i)
@ -117,6 +156,9 @@ void Foam::Reaction<ReactionThermo>::setThermo
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ReactionThermo>
Foam::Reaction<ReactionThermo>::Reaction
(
@ -159,7 +201,6 @@ Foam::Reaction<ReactionThermo>::specieCoeffs::specieCoeffs
)
{
token t(is);
if (t.isNumber())
{
stoichCoeff = t.number();
@ -189,7 +230,14 @@ Foam::Reaction<ReactionThermo>::specieCoeffs::specieCoeffs
specieName = specieName(0, i);
}
index = species[specieName];
if (species.contains(specieName))
{
index = species[specieName];
}
else
{
index = -1;
}
}
else
{
@ -201,38 +249,79 @@ Foam::Reaction<ReactionThermo>::specieCoeffs::specieCoeffs
template<class ReactionThermo>
void Foam::Reaction<ReactionThermo>::setLRhs(Istream& is)
void Foam::Reaction<ReactionThermo>::setLRhs
(
Istream& is,
const speciesTable& species,
List<specieCoeffs>& lhs,
List<specieCoeffs>& rhs
)
{
DynamicList<specieCoeffs> dlrhs;
while (is)
while (is.good())
{
dlrhs.append(specieCoeffs(species_, is));
dlrhs.append(specieCoeffs(species, is));
token t(is);
if (t.isPunctuation())
if (dlrhs.last().index != -1)
{
if (t == token::ADD)
token t(is);
if (t.isPunctuation())
{
}
else if (t == token::ASSIGN)
{
lhs_ = dlrhs.shrink();
dlrhs.clear();
if (t == token::ADD)
{
}
else if (t == token::ASSIGN)
{
lhs = dlrhs.shrink();
dlrhs.clear();
}
else
{
rhs = dlrhs.shrink();
is.putBack(t);
return;
}
}
else
{
rhs_ = dlrhs.shrink();
rhs = dlrhs.shrink();
is.putBack(t);
return;
}
}
else
{
rhs_ = dlrhs.shrink();
is.putBack(t);
return;
dlrhs.remove();
if (is.good())
{
token t(is);
if (t.isPunctuation())
{
if (t == token::ADD)
{
}
else if (t == token::ASSIGN)
{
lhs = dlrhs.shrink();
dlrhs.clear();
}
else
{
rhs = dlrhs.shrink();
is.putBack(t);
return;
}
}
}
else
{
if (!dlrhs.empty())
{
rhs = dlrhs.shrink();
}
return;
}
}
}
@ -254,7 +343,7 @@ Foam::Reaction<ReactionThermo>::Reaction
name_("un-named-reaction" + Foam::name(getNewReactionID())),
species_(species)
{
setLRhs(is);
setLRhs(is, species, lhs_, rhs_);
setThermo(thermoDatabase);
}
@ -271,7 +360,13 @@ Foam::Reaction<ReactionThermo>::Reaction
name_(dict.dictName()),
species_(species)
{
setLRhs(IStringStream(dict.lookup("reaction"))());
setLRhs
(
IStringStream(dict.lookup("reaction"))(),
species_,
lhs_,
rhs_
);
setThermo(thermoDatabase);
}
@ -410,4 +505,48 @@ Foam::scalar Foam::Reaction<ReactionThermo>::kr
}
template<class ReactionThermo>
const Foam::speciesTable& Foam::Reaction<ReactionThermo>::species() const
{
return species_;
}
template<class ReactionThermo>
const Foam::speciesTable& Foam::Reaction<ReactionThermo>::gasSpecies() const
{
notImplemented
(
"const speciesTable& gasSpecies() const"
" for this reaction"
);
return *reinterpret_cast<speciesTable*>(0);
}
template<class ReactionThermo>
const Foam::List<typename Foam::Reaction<ReactionThermo>::specieCoeffs>&
Foam::Reaction<ReactionThermo>::glhs() const
{
notImplemented
(
"inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&"
"Reaction<ReactionThermo>::glhs()"
);
return *reinterpret_cast<List<specieCoeffs>*>(0);
}
template<class ReactionThermo>
const Foam::List<typename Foam::Reaction<ReactionThermo>::specieCoeffs>&
Foam::Reaction<ReactionThermo>::grhs() const
{
notImplemented
(
"inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&"
"Reaction<ReactionThermo>::grhs()"
);
return *reinterpret_cast<List<specieCoeffs>*>(0);
}
// ************************************************************************* //

View File

@ -136,9 +136,6 @@ private:
//- Return string representation of reaction
string reactionStr() const;
//- Construct the left- and right-hand-side reaction coefficients
void setLRhs(Istream&);
//- Construct reaction thermo
void setThermo(const HashPtrTable<ReactionThermo>& thermoDatabase);
@ -245,7 +242,7 @@ public:
);
//- Construct and return a clone
virtual autoPtr<Reaction<ReactionThermo> > clone() const
virtual autoPtr<Reaction<ReactionThermo> > clone() const //
{
return autoPtr<Reaction<ReactionThermo> >
(
@ -297,9 +294,29 @@ public:
inline word& name();
inline const word& name() const;
// - Access to basic components of the reaction
inline const List<specieCoeffs>& lhs() const;
inline const List<specieCoeffs>& rhs() const;
// - Access to gas components of the reaction
virtual const List<specieCoeffs>& grhs() const;
virtual const List<specieCoeffs>& glhs() const;
// - Access to specie list
const speciesTable& species() const;
// - Access to gas specie list
virtual const speciesTable& gasSpecies() const;
//- Construct the left- and right-hand-side reaction coefficients
void setLRhs
(
Istream&,
const speciesTable&,
List<specieCoeffs>& lhs,
List<specieCoeffs>& rhs
);
// Reaction rate coefficients

View File

@ -67,6 +67,9 @@ Reaction<ReactionThermo>::rhs() const
template<class ReactionThermo>
inline Ostream& operator<<(Ostream& os, const Reaction<ReactionThermo>& r)
{
//os.writeKeyword("reaction")
// << r.reactionStr()<< token::END_STATEMENT <<nl;
os << r.type() << nl << " ";
forAll(r.lhs_, i)

View File

@ -27,60 +27,94 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ReactionThermo, class ReactionRate>
Foam::ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
ReversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionType<ReactionThermo>& reaction,
const ReactionRate& k
)
:
Reaction<ReactionThermo>(reaction),
ReactionType<ReactionThermo>(reaction),
k_(k)
{}
template<class ReactionThermo, class ReactionRate>
Foam::ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
ReversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
)
:
Reaction<ReactionThermo>(species, thermoDatabase, is),
ReactionType<ReactionThermo>(species, thermoDatabase, is),
k_(species, is)
{}
template<class ReactionThermo, class ReactionRate>
Foam::ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
ReversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
const dictionary& dict
)
:
Reaction<ReactionThermo>(species, thermoDatabase, dict),
ReactionType<ReactionThermo>(species, thermoDatabase, dict),
k_(species, dict)
{}
template<class ReactionThermo, class ReactionRate>
Foam::ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
ReversibleReaction
(
const ReversibleReaction<ReactionThermo, ReactionRate>& rr,
const ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>& rr,
const speciesTable& species
)
:
Reaction<ReactionThermo>(rr, species),
ReactionType<ReactionThermo>(rr, species),
k_(rr.k_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ReactionThermo, class ReactionRate>
Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kf
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kf
(
const scalar p,
const scalar T,
@ -91,8 +125,18 @@ Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kf
}
template<class ReactionThermo, class ReactionRate>
Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
(
const scalar kfwd,
const scalar p,
@ -104,8 +148,18 @@ Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr
}
template<class ReactionThermo, class ReactionRate>
Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
(
const scalar p,
const scalar T,
@ -116,8 +170,18 @@ Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr
}
template<class ReactionThermo, class ReactionRate>
void Foam::ReversibleReaction<ReactionThermo, ReactionRate>::write
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
void Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::write
(
Ostream& os
) const

View File

@ -47,10 +47,15 @@ namespace Foam
Class ReversibleReaction Declaration
\*---------------------------------------------------------------------------*/
template<class ReactionThermo, class ReactionRate>
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
class ReversibleReaction
:
public Reaction<ReactionThermo>
public ReactionType<ReactionThermo>
{
// Private data
@ -60,7 +65,15 @@ class ReversibleReaction
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const ReversibleReaction<ReactionThermo, ReactionRate>&);
void operator=
(
const ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>&
);
public:
@ -74,14 +87,19 @@ public:
//- Construct from components
ReversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionType<ReactionThermo>& reaction,
const ReactionRate& k
);
//- Construct as copy given new speciesTable
ReversibleReaction
(
const ReversibleReaction<ReactionThermo, ReactionRate>&,
const ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>&,
const speciesTable& species
);
@ -102,23 +120,29 @@ public:
);
//- Construct and return a clone
virtual autoPtr<Reaction<ReactionThermo> > clone() const
virtual autoPtr<ReactionType<ReactionThermo> > clone() const
{
return autoPtr<Reaction<ReactionThermo> >
return autoPtr<ReactionType<ReactionThermo> >
(
new ReversibleReaction<ReactionThermo, ReactionRate>(*this)
new ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>(*this)
);
}
//- Construct and return a clone with new speciesTable
virtual autoPtr<Reaction<ReactionThermo> > clone
virtual autoPtr<ReactionType<ReactionThermo> > clone
(
const speciesTable& species
) const
{
return autoPtr<Reaction<ReactionThermo> >
return autoPtr<ReactionType<ReactionThermo> >
(
new ReversibleReaction<ReactionThermo, ReactionRate>
new ReversibleReaction
<ReactionType, ReactionThermo, ReactionRate>
(
*this,
species
@ -154,8 +178,8 @@ public:
) const;
//- Reverse rate constant.
// Note this evaluates the forward rate constant and divides by the
// equilibrium constant
// Note this evaluates the forward rate constant and divides by
// the equilibrium constant
virtual scalar kr
(
const scalar p,

View File

@ -61,7 +61,7 @@ namespace Foam
\
typedef Reaction<Thermo> Reaction##Thermo; \
\
typedef ReactionType<Thermo, ReactionRate> \
typedef ReactionType<Reaction, Thermo, ReactionRate> \
ReactionType##Thermo##ReactionRate; \
\
template<> \

View File

@ -66,12 +66,6 @@ class specie
scalar molWeight_;
// Private Member Functions
//- Construct from components without name
inline specie(const scalar nMoles, const scalar molWeight);
public:
//- Runtime type information
@ -94,6 +88,10 @@ public:
// Constructors
//- Construct from components without name
inline specie(const scalar nMoles, const scalar molWeight);
//- Construct from components with name
inline specie
(

View File

@ -17,7 +17,7 @@ FoamFile
dimensions [0 0 0 1 0 0 0];
internalField uniform 298.15;
internalField uniform 500;//298.15;
boundaryField
{

View File

@ -11,13 +11,13 @@ FoamFile
format ascii;
class volScalarField;
location "0";
object Ydefault;
object char;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 1;
internalField uniform 0.5;
boundaryField
{

View File

@ -11,7 +11,7 @@ FoamFile
format ascii;
class volScalarField;
location "0";
object Yv;
object v;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -8,7 +8,7 @@
FoamFile
{
version 2.0;
format binary;
format ascii;
class dictionary;
location "constant";
object chemistryProperties;
@ -31,39 +31,4 @@ odeCoeffs
eps 0.05;
}
species
(
gas
);
reactions
(
irreversibleSolidArrheniusReaction
v = gas + char
(7.83e10 15274.57 400 4.86)
);
gas
{
specie
{
nMoles 1;
molWeight 18.0153;
}
thermodynamics
{
Tlow 200;
Thigh 5000;
Tcommon 1000;
highCpCoeffs ( 2.67215 0.00305629 -8.73026e-07 1.20100e-10 -6.39162e-15 -29899.2 6.86282 );
lowCpCoeffs ( 3.38684 0.00347498 -6.35470e-06 6.96858e-09 -2.50659e-12 -30208.1 2.59023 );
}
transport
{
As 1.67212e-06;
Ts 170.672;
}
}
// ************************************************************************* //

View File

@ -1,21 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class regIOobject;
location "constant/polyMesh";
object faceZones;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
0
()
// ************************************************************************* //

View File

@ -1,21 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class regIOobject;
location "constant/polyMesh";
object pointZones;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
0
()
// ************************************************************************* //

View File

@ -0,0 +1,23 @@
species
(
v
char
);
gaseousSpecies
(
gas
);
reactions
{
charReaction
{
type irreversibleArrheniusSolidReaction;
reaction "v^4.86 = char + gas";
A 7.83e10;
Ta 15274.57;
Tcrit 400;
}
}

View File

@ -8,14 +8,53 @@
FoamFile
{
version 2.0;
format ascii;
class regIOobject;
location "constant/polyMesh";
object cellZones;
format binary;
class dictionary;
location "constant";
object thermo.solid;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
0
()
v
{
solidSpecie
{
nMoles 1;
}
transport
{
kappa 0.135;
}
thermodynamics
{
Cp 696;
Hf -1.41e6;
}
equationOfState
{
rho 114.7;
}
};
char
{
solidSpecie
{
nMoles 1;
}
transport
{
kappa 0.4;
}
thermodynamics
{
Cp 611;
Hf 0;
}
equationOfState
{
rho 11.5;
}
};
// ************************************************************************* //

View File

@ -17,61 +17,42 @@ FoamFile
thermoType
{
type heSolidThermo;
mixture reactingSolidMixture;
mixture reactingMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
specie solidSpecie;
energy sensibleEnthalpy;
}
solidComponents
(
v char
);
chemistryReader foamChemistryReader;
vCoeffs
foamChemistryFile "$FOAM_CASE/constant/panelRegion/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/panelRegion/thermo.solid";
gas
{
specie
{
nMoles 1;
molWeight 100;
}
transport
{
kappa 0.135;
nMoles 1;
molWeight 18.0153;
}
thermodynamics
{
Cp 696;
Hf -1.41e6;
Tlow 200;
Thigh 5000;
Tcommon 1000;
highCpCoeffs ( 2.67215 0.00305629 -8.73026e-07 1.20100e-10 -6.39162e-15 -29899.2 6.86282 );
lowCpCoeffs ( 3.38684 0.00347498 -6.35470e-06 6.96858e-09 -2.50659e-12 -30208.1 2.59023 );
}
equationOfState
transport
{
rho 114.7;
As 1.67212e-06;
Ts 170.672;
}
};
}
charCoeffs
{
specie
{
nMoles 1;
molWeight 50;
}
transport
{
kappa 0.4;
}
thermodynamics
{
Cp 611;
Hf 0;
}
equationOfState
{
rho 11.5;
}
};
// ************************************************************************* //

View File

@ -17,20 +17,19 @@ FoamFile
thermoType
{
type heSolidThermo;
mixture pureSolidMixture;
mixture pureMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
specie solidSpecie;
energy sensibleEnthalpy;
}
mixture
{
specie
solidSpecie
{
nMoles 1;
molWeight 12;
}
transport
@ -50,17 +49,16 @@ mixture
}
}
solidComponents
species
(
pmma char
);
pmmaCoeffs
pmma
{
specie
solidSpecie
{
nMoles 1;
molWeight 100;
}
transport
@ -80,13 +78,13 @@ pmmaCoeffs
}
}
charCoeffs
char
{
specie
solidSpecie
{
nMoles 1;
molWeight 50;
}
transport
{
kappa 0.4;

View File

@ -17,20 +17,19 @@ FoamFile
thermoType
{
type heSolidThermo;
mixture pureSolidMixture;
mixture pureMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
specie solidSpecie;
energy sensibleEnthalpy;
}
mixture
{
specie
solidSpecie
{
nMoles 1;
molWeight 12;
}
transport
@ -50,17 +49,16 @@ mixture
}
}
solidComponents
species
(
pmma char
);
pmmaCoeffs
pmma
{
specie
solidSpecie
{
nMoles 1;
molWeight 100;
}
transport
@ -80,9 +78,9 @@ pmmaCoeffs
}
}
charCoeffs
char
{
specie
solidSpecie
{
nMoles 1;
molWeight 50;

View File

@ -17,20 +17,19 @@ FoamFile
thermoType
{
type heSolidThermo;
mixture pureSolidMixture;
mixture pureMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
specie solidSpecie;
energy sensibleEnthalpy;
}
mixture
{
specie
solidSpecie
{
nMoles 1;
molWeight 12;
}
transport
@ -50,17 +49,16 @@ mixture
}
}
solidComponents
species
(
pmma char
);
pmmaCoeffs
pmma
{
specie
solidSpecie
{
nMoles 1;
molWeight 100;
}
transport
@ -80,9 +78,9 @@ pmmaCoeffs
}
}
charCoeffs
char
{
specie
solidSpecie
{
nMoles 1;
molWeight 50;

View File

@ -59,7 +59,7 @@ dictionaryReplacement
}
}
Ypmma
pmma
{
internalField uniform 0.5;
@ -75,7 +75,7 @@ dictionaryReplacement
}
Ychar
char
{
internalField uniform 0.5;

View File

@ -50,7 +50,7 @@ dictionaryReplacement
}
}
Ypmma
pmma
{
internalField uniform 0.5;
@ -66,7 +66,7 @@ dictionaryReplacement
}
Ychar
char
{
internalField uniform 0.5;

View File

@ -50,7 +50,7 @@ dictionaryReplacement
}
}
Ypmma
pmma
{
internalField uniform 0.5;
@ -66,7 +66,7 @@ dictionaryReplacement
}
Ychar
char
{
internalField uniform 0.5;