diff --git a/src/thermophysicalModels/radiation/submodels/sootModel/MossBrookesSoot/MossBrookesSoot.C b/src/thermophysicalModels/radiation/submodels/sootModel/MossBrookesSoot/MossBrookesSoot.C index 0e786f22b..2d9682851 100644 --- a/src/thermophysicalModels/radiation/submodels/sootModel/MossBrookesSoot/MossBrookesSoot.C +++ b/src/thermophysicalModels/radiation/submodels/sootModel/MossBrookesSoot/MossBrookesSoot.C @@ -23,11 +23,42 @@ License \*---------------------------------------------------------------------------*/ -#include "fvmLaplacian.H" -#include "fvmDiv.H" -#include "linear.H" #include "MossBrookesSoot.H" -#include "reactingMixture.H" +#include "fvm.H" +#include "basicSpecieMixture.H" + + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + + +template +const Foam::basicSpecieMixture& +Foam::radiation::MossBrookesSoot::checkThermo +( + const fluidThermo& thermo +) +{ + if (isA(thermo)) + { + return dynamic_cast + ( + thermo + ); + } + else + { + FatalErrorInFunction + << "Inconsistent thermo package for " << thermo.type() + << "Please select a thermo package based on " + << "basicSpecieMixture" << exit(FatalError); + + return dynamic_cast + ( + thermo + ); + } + +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -91,6 +122,7 @@ Foam::radiation::MossBrookesSoot::MossBrookesSoot ), coeffsDict_(dict.subOrEmptyDict(modelType + "Coeffs")), thermo_(mesh.lookupObject(basicThermo::dictName)), + mixture_(checkThermo(thermo_)), Snet_ ( IOobject @@ -236,8 +268,7 @@ Foam::radiation::MossBrookesSoot::MossBrookesSoot Boltzmann(readScalar(coeffsDict_.lookup("BoltzmannConst"))), radiationActive_(readBool(coeffsDict_.lookup("Radiationeffect"))), cliqueNuc(readScalar(coeffsDict_.lookup("NucExpCorrectConstant"))), - cliqueMassGrow(readScalar(coeffsDict_.lookup("MassGrowCorrectConstant"))), - chemistryPtr_(CombThermoType::New(mesh)) + cliqueMassGrow(readScalar(coeffsDict_.lookup("MassGrowCorrectConstant"))) { } @@ -252,50 +283,6 @@ Foam::radiation::MossBrookesSoot::~MossBrookesSoot() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -Foam::tmp -Foam::radiation::MossBrookesSoot::U() const -{ - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::MossBrookesSoot::nut() const -{ - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::MossBrookesSoot::XPrec() const -{ - word precSpecie(coeffsDict_.lookup("Precursor")); - const word *precspecie; - precspecie = &precSpecie; - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::MossBrookesSoot::XSgs() const -{ - word sgsSpecie(coeffsDict_.lookup("SurfaceGrowSpecie")); - const word *sgsspecie; - sgsspecie = &sgsSpecie; - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::MossBrookesSoot::XOxid() const -{ - word oxSpecie(coeffsDict_.lookup("SootOxidizerSpecie")); - const word *oxspecie; - oxspecie = &oxSpecie; - return Foam::tmp(NULL); -} - template Foam::tmp Foam::radiation::MossBrookesSoot::a(const label bandI) const @@ -354,43 +341,30 @@ void Foam::radiation::MossBrookesSoot::correct() const volScalarField rho_ = thermo_.rho(); - const volVectorField U_ = U(); + const volScalarField &nut_ = turbulence().nut(); - const volScalarField nut_ = nut(); - - const surfaceScalarField phi_ - ( - IOobject - ( - "phi_for_soot", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - linearInterpolate(rho_*U_) & mesh().Sf() - ); + const surfaceScalarField phi_ (turbulence().phi()); fvScalarMatrix SootEqn ( fvm::div(phi_, soot_) - - fvm::laplacian((rho_*nut_/PrtSoot), soot_) - == + - fvm::laplacian((rho_*nut_/PrtSoot), soot_) + == Snet_ ); - fvScalarMatrix NucConcEqn - ( - fvm::div(phi_, NucConc_) - - fvm::laplacian((rho_*nut_/PrtSoot), NucConc_) - == - NSnet_ - ); - SootEqn.relax(); SootEqn.solve(); + fvScalarMatrix NucConcEqn + ( + fvm::div(phi_, NucConc_) + - fvm::laplacian((rho_*nut_/PrtSoot), NucConc_) + == + NSnet_ + ); + NucConcEqn.relax(); NucConcEqn.solve(); @@ -433,52 +407,17 @@ void Foam::radiation::MossBrookesSoot::calcSource() const volScalarField T_ = thermo_.T(); const volScalarField p_ = thermo_.p(); - const volScalarField XPrec_ = XPrec(); + const scalar precI = mixture_.species()[coeffsDict_.lookup("Precursor")]; + const scalar growI = mixture_.species()[coeffsDict_.lookup("SurfaceGrowSpecie")]; + const scalar oxidI = mixture_.species()[coeffsDict_.lookup("SootOxidizerSpecie")]; - const volScalarField XSgs_ = XSgs(); + const volScalarField &Yprec_ = mixture_.Y(precI); + const volScalarField &Ygrow_ = mixture_.Y(growI); + const volScalarField &Yoxid_ = mixture_.Y(oxidI); - const volScalarField XOxid_ = XOxid(); - - scalar ErrorIndex_p = 0; - scalar ErrorIndex_rho = 0; - scalar ErrorIndex_T = 0; - scalar ErrorIndex_precursor = 0; - scalar ErrorIndex_oxidizer = 0; - - forAll(rho_, celli) - { - if (p_[celli] < 0) { - ErrorIndex_p = 1; - } - if (rho_[celli] < 0) { - ErrorIndex_rho = 1; - } - if (T_[celli] < 0) { - ErrorIndex_T = 1; - } - if (XPrec_[celli] < 0) { - ErrorIndex_precursor = 1; - } - if (XOxid_[celli] < 0) { - ErrorIndex_oxidizer = 1; - } - } - - if (ErrorIndex_p == 1){ - Info<<"Warning! Improper pressure field value has been fed into the soot calculation!"< chemistryPtr_; - // Protected Member Functions - //- Return velocity field U - tmp U() const; - - //- Return nut - tmp nut() const; - - //- Return mole fraction of soot precursor - tmp XPrec() const; - - //- Return mole fraction of soot surface growth specie - tmp XSgs() const; - - //- Return mole fraction of soot oxidation specie - tmp XOxid() const; - public: //- Runtime type information diff --git a/src/thermophysicalModels/radiation/submodels/sootModel/khanGreeveSoot/khanGreeveSoot.C b/src/thermophysicalModels/radiation/submodels/sootModel/khanGreeveSoot/khanGreeveSoot.C index 122f7167b..2354cbf92 100644 --- a/src/thermophysicalModels/radiation/submodels/sootModel/khanGreeveSoot/khanGreeveSoot.C +++ b/src/thermophysicalModels/radiation/submodels/sootModel/khanGreeveSoot/khanGreeveSoot.C @@ -23,11 +23,41 @@ License \*---------------------------------------------------------------------------*/ -#include "fvmLaplacian.H" -#include "fvmDiv.H" -#include "linear.H" #include "khanGreeveSoot.H" -#include "reactingMixture.H" +#include "fvm.H" +#include "basicSpecieMixture.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + + +template +const Foam::basicSpecieMixture& +Foam::radiation::khanGreeveSoot::checkThermo +( + const fluidThermo& thermo +) +{ + if (isA(thermo)) + { + return dynamic_cast + ( + thermo + ); + } + else + { + FatalErrorInFunction + << "Inconsistent thermo package for " << thermo.type() + << "Please select a thermo package based on " + << "basicSpecieMixture" << exit(FatalError); + + return dynamic_cast + ( + thermo + ); + } + +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -68,6 +98,7 @@ Foam::radiation::khanGreeveSoot::khanGreeveSoot ), coeffsDict_(dict.subOrEmptyDict(modelType + "Coeffs")), thermo_(mesh.lookupObject(basicThermo::dictName)), + mixture_(checkThermo(thermo_)), Snet_ ( IOobject @@ -156,8 +187,7 @@ Foam::radiation::khanGreeveSoot::khanGreeveSoot ), eqvMax(readScalar(coeffsDict_.lookup("EquivalenceRatioMax"))), eqvMin(readScalar(coeffsDict_.lookup("EquivalenceRatioMin"))), - radiationActive_(readBool(coeffsDict_.lookup("Radiationeffect"))), - chemistryPtr_(CombThermoType::New(mesh)) + radiationActive_(readBool(coeffsDict_.lookup("Radiationeffect"))) { } @@ -173,64 +203,6 @@ Foam::radiation::khanGreeveSoot::~khanGreeveSoot() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -Foam::tmp -Foam::radiation::khanGreeveSoot::Yox() const -{ - word oxidSpecie(coeffsDict_.lookup("Oxidizer")); - const word *oxidspecie; - oxidspecie = &oxidSpecie; - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::khanGreeveSoot::Yfuel() const -{ - word fuelSpecie(coeffsDict_.lookup("Fuel")); - const word *fuelspecie; - fuelspecie = &fuelSpecie; - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::khanGreeveSoot::Xfuel() const -{ - word fuelSpecie(coeffsDict_.lookup("Fuel")); - const word *fuelspecie; - fuelspecie = &fuelSpecie; - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::khanGreeveSoot::epsilon() const -{ - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::khanGreeveSoot::k() const -{ - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::khanGreeveSoot::U() const -{ - return Foam::tmp(NULL); -} - -template -Foam::tmp -Foam::radiation::khanGreeveSoot::nut() const -{ - return Foam::tmp(NULL); -} - template Foam::tmp Foam::radiation::khanGreeveSoot::a(const label bandI) const @@ -269,6 +241,7 @@ Foam::radiation::khanGreeveSoot::a(const label bandI return tas; } + template Foam::tmp Foam::radiation::khanGreeveSoot::e(const label bandI) const @@ -277,36 +250,25 @@ Foam::radiation::khanGreeveSoot::e(const label bandI return a(bandI); } + template void Foam::radiation::khanGreeveSoot::correct() { calcSource(); - const volScalarField rho_ = thermo_.rho(); + const volScalarField &rho_ = thermo_.rho(); - const volVectorField U_ = U(); + const volScalarField &nut_ = turbulence().nut(); - const volScalarField nut_ = nut(); - - const surfaceScalarField phi_ - ( - IOobject - ( - "phi_for_soot", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - linearInterpolate(rho_*U_) & mesh().Sf() - ); + const surfaceScalarField phi_ (turbulence().phi()); fvScalarMatrix SootEqn ( - fvm::div(phi_, soot_) - - fvm::laplacian((rho_*nut_/PrtSoot), soot_) - == + fvm::ddt(rho_, soot_) + + fvm::div(phi_, soot_) + - fvm::laplacian((rho_*nut_/PrtSoot), soot_) + == Snet_ ); @@ -334,15 +296,19 @@ void Foam::radiation::khanGreeveSoot::calcSource() const volScalarField T_ = thermo_.T(); const volScalarField p_ = thermo_.p(); - const volScalarField Yox_ = Yox(); + const scalar oxI = mixture_.species()[coeffsDict_.lookup("Oxidizer")]; - const volScalarField Yfuel_ = Yfuel(); + const scalar fuelI = mixture_.species()[coeffsDict_.lookup("Fuel")]; - const volScalarField Xfuel_ = Xfuel(); + const volScalarField &Yox_ = mixture_.Y(oxI); - const volScalarField epsilon_ = epsilon(); + const volScalarField &Yfuel_ = mixture_.Y(fuelI); - const volScalarField k_ = k(); + const volScalarField Xfuel_(mixture_.W()*Yfuel_/mixture_.W(fuelI)); + + const volScalarField &epsilon_ = turbulence().epsilon(); + + const volScalarField &k_ = turbulence().k(); forAll(rho_, celli) { diff --git a/src/thermophysicalModels/radiation/submodels/sootModel/khanGreeveSoot/khanGreeveSoot.H b/src/thermophysicalModels/radiation/submodels/sootModel/khanGreeveSoot/khanGreeveSoot.H index a4b7819ed..daf22166c 100644 --- a/src/thermophysicalModels/radiation/submodels/sootModel/khanGreeveSoot/khanGreeveSoot.H +++ b/src/thermophysicalModels/radiation/submodels/sootModel/khanGreeveSoot/khanGreeveSoot.H @@ -64,9 +64,7 @@ SourceFiles #include "HashTable.H" #include "fluidThermo.H" -#include "Reaction.H" -#include "autoPtr.H" -#include "psiChemistryModel.H" +#include "basicSpecieMixture.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -86,6 +84,15 @@ class khanGreeveSoot { + // Static functions + + //- Check mixture in thermo + static const basicSpecieMixture& checkThermo + ( + const fluidThermo& + ); + + // Private data //- Soot mass fraction @@ -100,6 +107,9 @@ class khanGreeveSoot //- Thermo package const fluidThermo& thermo_; + //- Composition + const basicSpecieMixture& mixture_; + //- Net rate of soot generation volScalarField Snet_; @@ -151,36 +161,6 @@ class khanGreeveSoot //- Soot radiative effect on/off flag bool radiationActive_; -protected: - - // Protected data - - //- Pointer to chemistry model - autoPtr chemistryPtr_; - - // Protected Member Functions - - //- Return the oxidizer mass fraction - tmp Yox() const; - - //- Return the fuel mass fraction - tmp Yfuel() const; - - //- Return the mole fraction of the fuel - tmp Xfuel() const; - - //- Return the epsilon - tmp epsilon() const; - - //- Return the k - tmp k() const; - - //- Return the velocity field U - tmp U() const; - - //- Return the nut - tmp nut() const; - public: //- Runtime type information diff --git a/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModel.C b/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModel.C index b30e6a61b..d997bbcd3 100644 --- a/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModel.C +++ b/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModel.C @@ -46,7 +46,8 @@ Foam::radiation::sootModel::sootModel ) : dict_(dict), - mesh_(mesh) + mesh_(mesh), + turbulence_(mesh.lookupObject(turbulenceModel::propertiesName)) {} diff --git a/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModel.H b/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModel.H index d00b77d38..b506051fc 100644 --- a/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModel.H +++ b/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModel.H @@ -66,7 +66,7 @@ protected: const fvMesh& mesh_; //- Reference to the turbulence model - compressibleTurbulenceModel* turbulencePtr_; + const compressibleTurbulenceModel &turbulence_; public: @@ -164,12 +164,6 @@ public: //- Return access to turbulence inline const compressibleTurbulenceModel& turbulence() const; - //- Set turbulence - inline void setTurbulence - ( - compressibleTurbulenceModel& turbModel - ); - }; diff --git a/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModelI.H b/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModelI.H index 6e091c8fd..5b84103fe 100644 --- a/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModelI.H +++ b/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModelI.H @@ -30,29 +30,7 @@ License inline const Foam::compressibleTurbulenceModel& Foam::radiation::sootModel::turbulence() const { - if (turbulencePtr_) - { - return *turbulencePtr_; - } - else - { - FatalErrorInFunction - << "turbulencePtr_ is empty. Please use " - << "sootModel::setTurbulence " - << "(compressibleTurbulenceModel& )" - << abort(FatalError); - - return *turbulencePtr_; - } -} - - -inline void Foam::radiation::sootModel::setTurbulence -( - compressibleTurbulenceModel& turbModel -) -{ - turbulencePtr_ = &turbModel; + return turbulence_; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //