diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index 4882f36e0a..44d371fdef 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -68,8 +68,12 @@ submodels/addOns/radiation/scatter/cloudScatter/cloudScatter.C /* integration schemes */ IntegrationScheme/makeIntegrationSchemes.C +/* phase properties */ +phaseProperties/phaseProperties/phaseProperties.C +phaseProperties/phaseProperties/phasePropertiesIO.C +phaseProperties/phasePropertiesList/phasePropertiesList.C -/* Data entries */ +/* data entries */ submodels/IO/DataEntry/makeDataEntries.C diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index a77a843eee..640ce508d5 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -52,9 +52,6 @@ void Foam::ReactingCloud::addNewParcel d, U, nParticles, - composition().YGas0(), - composition().YLiquid0(), - composition().YSolid0(), composition().YMixture0(), constProps_ ); @@ -120,12 +117,12 @@ Foam::ReactingCloud::ReactingCloud ( IOobject ( - this->name() + "rhoTrans" + Foam::name(i), - this->db().time().timeName(), - this->db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false + this->name() + "rhoTrans" + Foam::name(i), + this->db().time().timeName(), + this->db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false ), this->mesh(), dimensionedScalar("zero", dimMass, 0.0) diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index 7f32fd7d26..79a0581acd 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -43,6 +43,10 @@ void Foam::ReactingMultiphaseCloud::addNewParcel const scalar lagrangianDt ) { + label idGas = this->composition().idGas(); + label idLiquid = this->composition().idLiquid(); + label idSolid = this->composition().idSolid(); + ParcelType* pPtr = new ParcelType ( *this, @@ -52,9 +56,9 @@ void Foam::ReactingMultiphaseCloud::addNewParcel d, U, nParticles, - this->composition().YGas0(), - this->composition().YLiquid0(), - this->composition().YSolid0(), + this->composition().Y0(idGas), + this->composition().Y0(idLiquid), + this->composition().Y0(idSolid), this->composition().YMixture0(), constProps_ ); @@ -112,9 +116,9 @@ void Foam::ReactingMultiphaseCloud::resetSourceTerms() template void Foam::ReactingMultiphaseCloud::evolve() { - const volScalarField& T = carrierThermo_.T(); - const volScalarField cp = carrierThermo_.Cp(); - const volScalarField& p = carrierThermo_.p(); + const volScalarField& T = this->carrierThermo().T(); + const volScalarField cp = this->carrierThermo().Cp(); + const volScalarField& p = this->carrierThermo().p(); autoPtr > rhoInterp = interpolation::New ( diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H index 9409d12a49..0feece303f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H @@ -68,12 +68,6 @@ class ReactingMultiphaseCloud //- Parcel constant properties typename ParcelType::constantProperties constProps_; - //- Thermodynamics package (combustion) - hCombustionThermo& carrierThermo_; - - //- Gas phase properties - PtrList& gases_; - // References to the cloud sub-models @@ -85,13 +79,6 @@ class ReactingMultiphaseCloud devolatilisationModel_; - - // Sources - - //- Mass transfer fields - one per carrier phase specie - PtrList > rhoTrans_; - - // Private Member Functions //- Disallow default bitwise copy construct @@ -125,16 +112,6 @@ public: // Access - //- Return const access to carrier phase thermo package - inline const hCombustionThermo& carrierThermo() const; - - //- Return access to carrier phase thermo package - inline hCombustionThermo& carrierThermo(); - - //- Gas phase properties - inline const PtrList& gases() const; - - // Sub-models //- Return reference to devolatilisation model @@ -145,29 +122,6 @@ public: devolatilisation() const; - // Sources - - //- Mass - - //- Return reference to mass source for field i - inline DimensionedField& - rhoTrans(const label i); - - //- Return reference to mass source fields - inline PtrList >& - rhoTrans(); - - //- Return tmp mass source for field i - // Fully explicit - inline tmp > - Srho1(const label i) const; - - //- Return tmp total mass source for carrier phase - // Fully explicit - inline tmp > - Srho1() const; - - // Cloud evolution functions //- Add new parcel diff --git a/src/lagrangian/intermediate/clouds/derived/basicReactingMultiphaseCloud/basicReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/derived/basicReactingMultiphaseCloud/basicReactingMultiphaseCloud.C index a532276dee..c83cf4a20d 100644 --- a/src/lagrangian/intermediate/clouds/derived/basicReactingMultiphaseCloud/basicReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/derived/basicReactingMultiphaseCloud/basicReactingMultiphaseCloud.C @@ -46,7 +46,7 @@ Foam::basicReactingMultiphaseCloud::basicReactingMultiphaseCloud PtrList& gases ) : - ReactingCloud + ReactingMultiphaseCloud ( cloudType, rho, diff --git a/src/lagrangian/intermediate/clouds/derived/basicReactingMultiphaseCloud/basicReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/derived/basicReactingMultiphaseCloud/basicReactingMultiphaseCloud.H index fb1b946e1d..7ccdc7a7ae 100644 --- a/src/lagrangian/intermediate/clouds/derived/basicReactingMultiphaseCloud/basicReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/basicReactingMultiphaseCloud/basicReactingMultiphaseCloud.H @@ -36,7 +36,7 @@ SourceFiles #ifndef basicReactingMultiphaseCloud_H #define basicReactingMultiphaseCloud_H -#include "ReactingCloud.H" +#include "ReactingMultiphaseCloud.H" #include "basicReactingMultiphaseParcel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,7 +50,7 @@ namespace Foam class basicReactingMultiphaseCloud : - public ReactingCloud + public ReactingMultiphaseCloud { // Private Member Functions diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index c25a24163a..35d969714f 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -58,7 +58,11 @@ void Foam::ReactingMultiphaseParcel::calcCoupled const scalar cp0 = this->cp_; const scalar np0 = this->nParticle_; const scalar T0 = this->T_; - scalarList& YMix = this->YMixture_; + scalarField& YMix = this->YMixture_; + + label idGas = td.cloud().composition().idGas(); + label idLiquid = td.cloud().composition().idLiquid(); + label idSolid = td.cloud().composition().idSolid(); // ~~~~~~~~~~~~~~~~~~~~~~~~~ // Initialise transfer terms @@ -96,7 +100,7 @@ void Foam::ReactingMultiphaseParcel::calcCoupled // ~~~~~~~~~~~~~~~~~~~~~~ // Calculate phase change // ~~~~~~~~~~~~~~~~~~~~~~ - calcPhaseChange(td, dt, T0, T1, dMassMT); + calcPhaseChange(td, dt, T0, dMassMT); // ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -104,7 +108,6 @@ void Foam::ReactingMultiphaseParcel::calcCoupled // ~~~~~~~~~~~~~~~~~~~~~~~~~~ calcDevolatilisation(td, dt, T0, T1, dMassMT); - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Calculate surface reactions // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -132,12 +135,12 @@ void Foam::ReactingMultiphaseParcel::calcCoupled // Correct dhTrans to account for enthalpy of evolved volatiles dhTrans += sum(dMassMT) - *td.cloud().composition().HGas(YGas_, 0.5*(T0 + T1)); + *td.cloud().composition().H(idGas, YGas_, this->pc_, 0.5*(T0 + T1)); // Correct dhTrans to account for enthalpy of consumed solids dhTrans += sum(dMassSR) - *td.cloud().composition().HSolid(YSolid_, 0.5*(T0 + T1)); + *td.cloud().composition().H(idSolid, YSolid_, this->pc_, 0.5*(T0 + T1)); // ~~~~~~~~~~~~~~~~~~~~~~~ @@ -179,8 +182,10 @@ void Foam::ReactingMultiphaseParcel::calcCoupled td.cloud().hTrans()[celli] += np0*mass1 *( - YMix[0]*td.cloud().composition().HGas(YGas_, T1) - + YMix[2]*td.cloud().composition().HSolid(YSolid_, T1) + YMix[0] + *td.cloud().composition().H(idGas, YGas_, this->pc_, T1) + + YMix[2] + *td.cloud().composition().H(idSolid, YSolid_, this->pc_, T1) ); td.cloud().UTrans()[celli] += np0*mass1*U1; } @@ -192,9 +197,9 @@ void Foam::ReactingMultiphaseParcel::calcCoupled this->U_ = U1; this->T_ = T1; this->cp_ = - YMix[0]*td.cloud().composition().cpGas(YGas_, T1) - + YMix[1]*td.cloud().composition().cpLiquid(YLiquid_, this->pc_, T1) - + YMix[2]*td.cloud().composition().cpSolid(YSolid_); + YMix[0]*td.cloud().composition().cp(idGas, YGas_, this->pc_, T1) + + YMix[1]*td.cloud().composition().cp(idLiquid, YLiquid_, this->pc_, T1) + + YMix[2]*td.cloud().composition().cp(idSolid, YSolid_, this->pc_, T1); // Update particle density or diameter if (td.constProps().constantVolume()) @@ -224,7 +229,11 @@ void Foam::ReactingMultiphaseParcel::calcUncoupled const scalar T0 = this->T_; const scalar mass0 = this->mass(); const scalar cp0 = this->cp_; - scalarList& YMix = this->YMixture_; + scalarField& YMix = this->YMixture_; + + label idGas = td.cloud().composition().idGas(); + label idLiquid = td.cloud().composition().idLiquid(); + label idSolid = td.cloud().composition().idSolid(); // ~~~~~~~~~~~~~~~~~~~~~~~~~ // Initialise transfer terms @@ -262,7 +271,7 @@ void Foam::ReactingMultiphaseParcel::calcUncoupled // ~~~~~~~~~~~~~~~~~~~~~~ // Calculate phase change // ~~~~~~~~~~~~~~~~~~~~~~ - calcPhaseChange(td, dt, T0, T1, dMassMT); + calcPhaseChange(td, dt, T0, dMassMT); // ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -285,9 +294,9 @@ void Foam::ReactingMultiphaseParcel::calcUncoupled // New specific heat capacity const scalar cp1 = - YMix[0]*td.cloud().composition().cpGas(YGas_, T1) - + YMix[1]*td.cloud().composition().cpLiquid(YLiquid_, this->pc_, T1) - + YMix[2]*td.cloud().composition().cpSolid(YSolid_); + YMix[0]*td.cloud().composition().cp(idGas, YGas_, this->pc_, T1) + + YMix[1]*td.cloud().composition().cp(idLiquid, YLiquid_, this->pc_, T1) + + YMix[2]*td.cloud().composition().cp(idSolid, YSolid_, this->pc_, T1); // Add retained enthalpy to particle T1 += dhRet/(mass0*0.5*(cp0 + cp1)); @@ -364,7 +373,7 @@ void Foam::ReactingMultiphaseParcel::calcDevolatilisation // Determine mass to add to carrier phase const scalar mass = this->mass(); - scalarList& YMix = this->YMixture_; + scalarField& YMix = this->YMixture_; const scalar dMassTot = td.cloud().devolatilisation().calculate ( dt, @@ -382,9 +391,10 @@ void Foam::ReactingMultiphaseParcel::calcDevolatilisation YMix[2] = 1.0 - YMix[0] - YMix[1]; // Add to cummulative mass transfer + label idGas = td.cloud().composition().idGas(); forAll (YGas_, i) { - label id = td.cloud().composition().gasGlobalIds()[i]; + label id = td.cloud().composition().globalIds(idGas)[i]; // Volatiles mass transfer scalar volatileMass = YGas_[i]*dMassTot; diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index 6c93a116db..416dc63d8b 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -40,6 +40,7 @@ SourceFiles #define ReactingMultiphaseParcel_H #include "ReactingParcel.H" +#include "ReactingMultiphaseCloud.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -110,6 +111,9 @@ public: { // Private data + //- Reference to the cloud containing this particle + ReactingMultiphaseCloud& cloud_; + //- Particle constant properties const constantProperties& constProps_; @@ -121,7 +125,7 @@ public: //- Construct from components inline trackData ( - ReactingCloud& cloud, + ReactingMultiphaseCloud& cloud, const constantProperties& constProps, const interpolation& rhoInterp, const interpolation& UInterp, @@ -135,6 +139,9 @@ public: // Member functions + //- Return access to the owner cloud + inline ReactingMultiphaseCloud& cloud(); + //- Return const access to the constant properties inline const constantProperties& constProps() const; }; @@ -201,7 +208,7 @@ public: //- Construct from components inline ReactingMultiphaseParcel ( - ReactingCloud& owner, + ReactingMultiphaseCloud& owner, const label typeId, const vector& position, const label celli, @@ -292,10 +299,13 @@ public: // I-O //- Read - static void readFields(ReactingCloud& c); + static void readFields(ReactingMultiphaseCloud& c); //- Write - static void writeFields(const ReactingCloud& c); + static void writeFields + ( + const ReactingMultiphaseCloud& c + ); // Ostream Operator diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H index 87a7cb2d8c..7becf84d6c 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H @@ -43,7 +43,7 @@ constantProperties template inline Foam::ReactingMultiphaseParcel::trackData::trackData ( - ReactingCloud& cloud, + ReactingMultiphaseCloud& cloud, const constantProperties& constProps, const interpolation& rhoInterp, const interpolation& UInterp, @@ -65,14 +65,16 @@ inline Foam::ReactingMultiphaseParcel::trackData::trackData CpInterp, pInterp, g - ) + ), + cloud_(cloud), + constProps_(constProps) {} template inline Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel ( - ReactingCloud& owner, + ReactingMultiphaseCloud& owner, const label typeId, const vector& position, const label celli, @@ -132,6 +134,14 @@ Foam::ReactingMultiphaseParcel::constantProperties::Ldevol() const // * * * * * * * * * * * trackData Member Functions * * * * * * * * * * * * // +template +inline Foam::ReactingMultiphaseCloud& +Foam::ReactingMultiphaseParcel::trackData::cloud() +{ + return cloud_; +} + + template inline const typename Foam::ReactingMultiphaseParcel:: constantProperties& diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C index bc1e46336e..bb53f10a20 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C @@ -44,32 +44,34 @@ Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel { if (readFields) { - const ReactingCloud& cR = - dynamic_cast& >(cloud); + const ReactingMultiphaseCloud& cR = + dynamic_cast& >(cloud); - const label nGas = cR.composition().gasNames().size(); - const label nLiquid = cR.composition().liquidNames().size(); - const label nSolid = cR.composition().solidNames().size(); + const label idGas = cR.composition().idGas(); + const label nGas = cR.composition().componentNames(idGas).size(); + const label idLiquid = cR.composition().idLiquid(); + const label nLiquid = cR.composition().componentNames(idLiquid).size(); + const label idSolid = cR.composition().idGas(); + const label nSolid = cR.composition().componentNames(idSolid).size(); YGas_.setSize(nGas); YLiquid_.setSize(nLiquid); YSolid_.setSize(nSolid); - const scalarField& YMix = this->YMixture_; if (is.format() == IOstream::ASCII) { is >> YGas_ >> YLiquid_ >> YSolid_; - YGas_ /= YMix[0] + VSMALL; - YLiquid_ /= YMix[1] + VSMALL; - YSolid_ /= YMix[2] + VSMALL; } else { is >> YGas_ >> YLiquid_ >> YSolid_; - YGas_ /= YMix[0] + VSMALL; - YLiquid_ /= YMix[1] + VSMALL; - YSolid_ /= YMix[2] + VSMALL; } + + // scale the mass fractions + const scalarField& YMix = this->YMixture_; + YGas_ /= YMix[0] + ROOTVSMALL; + YLiquid_ /= YMix[1] + ROOTVSMALL; + YSolid_ /= YMix[2] + ROOTVSMALL; } // Check state of Istream @@ -88,7 +90,7 @@ Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel template void Foam::ReactingMultiphaseParcel::readFields ( - ReactingCloud& c + ReactingMultiphaseCloud& c ) { if (!c.size()) @@ -99,20 +101,20 @@ void Foam::ReactingMultiphaseParcel::readFields ReactingParcel::readFields(c); // Get names and sizes for each Y... - const wordList gasNames = c.composition().gasNames(); - const wordList liquidNames = c.composition().liquidNames(); - const wordList solidNames = c.composition().solidNames(); - const label nGas = gasNames.size(); - const label nLiquid = liquidNames.size(); - const label nSolid = solidNames.size(); + const label idGas = c.composition().idGas(); + const wordList gasNames = c.composition().componentNames(idGas); + const label idLiquid = c.composition().idLiquid(); + const wordList liquidNames = c.composition().componentNames(idLiquid); + const label idSolid = c.composition().idSolid(); + const wordList solidNames = c.composition().componentNames(idSolid); // Set storage for each Y... for each parcel forAllIter(typename Cloud, c, iter) { ReactingMultiphaseParcel& p = iter(); - p.YGas_.setSize(nGas, 0.0); - p.YLiquid_.setSize(nLiquid, 0.0); - p.YSolid_.setSize(nSolid, 0.0); + p.YGas_.setSize(gasNames.size(), 0.0); + p.YLiquid_.setSize(liquidNames.size(), 0.0); + p.YSolid_.setSize(solidNames.size(), 0.0); } // Populate YGas for each parcel @@ -127,7 +129,7 @@ void Foam::ReactingMultiphaseParcel::readFields forAllIter(typename Cloud, c, iter) { ReactingMultiphaseParcel& p = iter(); - p.YGas_[j] = YGas[i++]/p.YMixture()[0]; + p.YGas_[j] = YGas[i++]/(p.YMixture()[0] + ROOTVSMALL); } } // Populate YLiquid for each parcel @@ -142,7 +144,7 @@ void Foam::ReactingMultiphaseParcel::readFields forAllIter(typename Cloud, c, iter) { ReactingMultiphaseParcel& p = iter(); - p.YLiquid_[j] = YLiquid[i++]/p.YMixture()[1]; + p.YLiquid_[j] = YLiquid[i++]/(p.YMixture()[1] + ROOTVSMALL); } } // Populate YSolid for each parcel @@ -157,7 +159,7 @@ void Foam::ReactingMultiphaseParcel::readFields forAllIter(typename Cloud, c, iter) { ReactingMultiphaseParcel& p = iter(); - p.YSolid_[j] = YSolid[i++]/p.YMixture()[2]; + p.YSolid_[j] = YSolid[i++]/(p.YMixture()[2] + ROOTVSMALL); } } } @@ -166,7 +168,7 @@ void Foam::ReactingMultiphaseParcel::readFields template void Foam::ReactingMultiphaseParcel::writeFields ( - const ReactingCloud& c + const ReactingMultiphaseCloud& c ) { ReactingParcel::writeFields(c); @@ -176,7 +178,8 @@ void Foam::ReactingMultiphaseParcel::writeFields // Write the composition fractions if (np > 0) { - const wordList& gasNames = c.composition().gasNames(); + const label idGas = c.composition().idGas(); + const wordList gasNames = c.composition().componentNames(idGas); forAll(gasNames, j) { IOField YGas @@ -194,7 +197,8 @@ void Foam::ReactingMultiphaseParcel::writeFields YGas.write(); } - const wordList& liquidNames = c.composition().liquidNames(); + const label idLiquid = c.composition().idLiquid(); + const wordList liquidNames = c.composition().componentNames(idLiquid); forAll(liquidNames, j) { IOField YLiquid @@ -212,7 +216,8 @@ void Foam::ReactingMultiphaseParcel::writeFields YLiquid.write(); } - const wordList& solidNames = c.composition().solidNames(); + const label idSolid = c.composition().idSolid(); + const wordList solidNames = c.composition().componentNames(idSolid); forAll(solidNames, j) { IOField YSolid @@ -248,14 +253,14 @@ Foam::Ostream& Foam::operator<< scalarField YSolidLoc = p.YSolid()*p.YMixture()[2]; if (os.format() == IOstream::ASCII) { - os << static_cast& >(p) + os << static_cast& >(p) << token::SPACE << YGasLoc << token::SPACE << YLiquidLoc << token::SPACE << YSolidLoc; } else { - os << static_cast& >(p); + os << static_cast& >(p); os << YGasLoc << YLiquidLoc << YSolidLoc; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index a2ae89a504..daaa9ac66a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -97,7 +97,7 @@ void Foam::ReactingParcel::calcCoupled // ~~~~~~~~~~~~~~~~~~~~~~ // Calculate phase change // ~~~~~~~~~~~~~~~~~~~~~~ - calcPhaseChange(td, dt, T0, T1, dMassMT); + calcPhaseChange(td, dt, T, dMassMT); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -117,6 +117,7 @@ void Foam::ReactingParcel::calcCoupled T1 += dhRet/(0.5*(mass0 + mass1)*cp0); dhTrans -= dhRet; + // ~~~~~~~~~~~~~~~~~~~~~~~ // Accumulate source terms // ~~~~~~~~~~~~~~~~~~~~~~~ @@ -134,7 +135,6 @@ void Foam::ReactingParcel::calcCoupled td.cloud().UCoeff()[celli] += np0*mass0*Cud; // Update enthalpy transfer - // - enthalpy of lost solids already accounted for td.cloud().hTrans()[celli] += np0*dhTrans; // Accumulate coefficient to be applied in carrier phase enthalpy coupling @@ -229,7 +229,7 @@ void Foam::ReactingParcel::calcUncoupled // ~~~~~~~~~~~~~~~~~~~~~~ // Calculate phase change // ~~~~~~~~~~~~~~~~~~~~~~ - calcPhaseChange(td, dt, T0, T1, dMassMT); + calcPhaseChange(td, dt, T, dMassMT); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -285,16 +285,17 @@ void Foam::ReactingParcel::calcPhaseChange ( TrackData& td, const scalar dt, - const scalar T0, - const scalar T1, + const scalar T, scalarList& dMassMT ) { - // if (!td.cloud().phaseChange().active()) + if (!td.cloud().phaseChange().active()) { return; } + // TODO: separate treatment for boiling + /* // Determine mass to add to carrier phase const scalar mass = this->mass(); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index 92da3160cc..763f1e2a6c 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -174,8 +174,7 @@ protected: ( TrackData& td, const scalar dt, - const scalar T0, - const scalar T1, + const scalar T, scalarList& dMassMT ); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C index 0a81cdfd3f..98076d4b27 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C @@ -47,7 +47,7 @@ Foam::ReactingParcel::ReactingParcel const ReactingCloud& cR = dynamic_cast& >(cloud); - const label nMixture = cR.composition().compositionNames().size(); + const label nMixture = cR.composition().phaseTypes().size(); YMixture_.setSize(nMixture); if (is.format() == IOstream::ASCII) @@ -102,22 +102,22 @@ void Foam::ReactingParcel::readFields } // Get names and sizes for each Y... - const wordList compositionNames = c.composition().compositionNames(); - const label nComposition = compositionNames.size(); + const wordList phaseTypes = c.composition().phaseTypes(); + const label nPhases = phaseTypes.size(); // Set storage for each Y... for each parcel forAllIter(typename Cloud, c, iter) { ReactingParcel& p = iter(); - p.YMixture_.setSize(nComposition, 0.0); + p.YMixture_.setSize(nPhases, 0.0); } // Populate YMixture for each parcel - forAll(compositionNames, j) + forAll(phaseTypes, j) { IOField YMixture ( - c.fieldIOobject("Y" + compositionNames[j], IOobject::MUST_READ) + c.fieldIOobject("Y" + phaseTypes[j], IOobject::MUST_READ) ); label i = 0; @@ -154,12 +154,12 @@ void Foam::ReactingParcel::writeFields // Write the composition fractions if (np > 0) { - const wordList compositionNames = c.composition().compositionNames(); - forAll(compositionNames, j) + const wordList phaseTypes = c.composition().phaseTypes(); + forAll(phaseTypes, j) { IOField YMixture ( - c.fieldIOobject("Y" + compositionNames[j], IOobject::NO_READ), + c.fieldIOobject("Y" + phaseTypes[j], IOobject::NO_READ), np ); @@ -196,6 +196,7 @@ Foam::Ostream& Foam::operator<< os << static_cast& >(p); os.write ( + reinterpret_cast(&p.mass0_), sizeof(p.mass0()) ); diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.C index 8d9c68b8f6..99d4ec05b0 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.C @@ -40,7 +40,7 @@ namespace Foam Foam::basicReactingMultiphaseParcel::basicReactingMultiphaseParcel ( - ReactingCloud& owner, + ReactingMultiphaseCloud& owner, const label typeId, const vector& position, const label celli, diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.H index 7009ca98e0..c39fae262e 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.H @@ -63,7 +63,7 @@ public: //- Construct from components basicReactingMultiphaseParcel ( - ReactingCloud& owner, + ReactingMultiphaseCloud& owner, const label typeId, const vector& position, const label celli, diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/defineBasicReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/defineBasicReactingMultiphaseParcel.C index 487b0f852d..5278c5e0f5 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/defineBasicReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/defineBasicReactingMultiphaseParcel.C @@ -61,50 +61,37 @@ namespace Foam ReactingParcel, 0 ); + defineParcelTypeNameAndDebug + ( + ReactingMultiphaseParcel, + 0 + ); + defineTemplateTypeNameAndDebug + ( + ReactingMultiphaseParcel, + 0 + ); defineParcelTypeNameAndDebug ( KinematicCloud, 0 ); -// defineTemplateTypeNameAndDebug -// ( -// KinematicCloud, -// 0 -// ); - defineParcelTypeNameAndDebug ( ThermoCloud, 0 ); -// defineTemplateTypeNameAndDebug -// ( -// ThermoCloud, -// 0 -// ); - defineParcelTypeNameAndDebug ( ReactingCloud, 0 ); -// defineTemplateTypeNameAndDebug -// ( -// ReactingCloud, -// 0 -// ); - defineParcelTypeNameAndDebug ( ReactingMultiphaseCloud, 0 ); -// defineTemplateTypeNameAndDebug -// ( -// ReactingMultiphaseCloud, -// 0 -// ); }; diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelCompositionModels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelCompositionModels.C index b2f9ae5714..786fa74ddc 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelCompositionModels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelCompositionModels.C @@ -27,7 +27,7 @@ License #include "basicReactingParcel.H" #include "ReactingCloud.H" -#include "SingleMixtureFraction.H" +#include "SinglePhaseMixture.H" namespace Foam { @@ -36,7 +36,7 @@ namespace Foam // Add instances of composition model to the table makeCompositionModelType ( - SingleMixtureFraction, + SinglePhaseMixture, ReactingCloud, basicReactingParcel ); diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C new file mode 100644 index 0000000000..afec996210 --- /dev/null +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C @@ -0,0 +1,305 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "phaseProperties.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* Foam::NamedEnum::names[] = +{ + "gas", + "liquid", + "solid", + "unknown" +}; + + +const Foam::NamedEnum + Foam::phaseProperties::phaseTypeNames_; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::phaseProperties::setGlobalGasIds +( + const PtrList& YGas +) +{ + forAll(names_, i) + { + forAll (YGas, j) + { + word specieName = YGas[j].name(); + + if (specieName == names_[i]) + { + globalIds_[i] = j; + break; + } + } + if (globalIds_[i] == -1) + { + wordList globalGasNames(YGas.size()); + + forAll (YGas, k) + { + globalGasNames[k] = YGas[k].name(); + } + + FatalErrorIn + ( + "void phaseProperties::setGlobalGasIds\n" + "(\n" + " const PtrList&\n" + ")" + ) << "Could not find gas species " << names_[i] + << " in species list" << nl + << "Available species are: " << nl << globalGasNames << nl + << exit(FatalError); + } + } +} + + +void Foam::phaseProperties::setGlobalIds(const wordList& globalNames) +{ + forAll(names_, i) + { + forAll(globalNames, j) + { + if (globalNames[j] == names_[i]) + { + globalIds_[i] = j; + break; + } + } + if (globalIds_[i] == -1) + { + FatalErrorIn + ( + "void Foam::phaseProperties::setGlobalIds(const wordList&)" + ) << "Could not find specie " << names_[i] + << " in species list" << nl + << "Available species are: " << nl << globalNames << nl + << exit(FatalError); + } + } +} + + +void Foam::phaseProperties::checkTotalMassFraction() const +{ + scalar total = 0.0; + forAll(Y_, cmptI) + { + total += Y_[cmptI]; + } + + if (Y_.size() != 0 && mag(total - 1.0) > SMALL) + { + FatalErrorIn + ( + "void Foam::phaseProperties::checkTotalMassFraction() const" + ) << "Component fractions must total to unity for phase " + << phaseTypeNames_[phase_] << nl + << "Components: " << nl << names_ << nl << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseProperties::phaseProperties() +: + phase_(UNKNOWN), + names_(0), + Y_(0), + globalIds_(0) +{} + + +Foam::phaseProperties::phaseProperties(const phaseProperties& pp) +: + phase_(pp.phase_), + names_(pp.names_), + Y_(pp.Y_), + globalIds_(pp.globalIds_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phaseProperties::~phaseProperties() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::phaseProperties::initialiseGlobalIds +( + const PtrList& YGas, + const wordList& liquidNames, + const wordList& solidNames +) +{ + // determine the addressing to map between components listed in the phase + // with those given in the (main) thermo properties + switch (phase_) + { + case GAS: + { + setGlobalGasIds(YGas); + break; + } + case LIQUID: + { + setGlobalIds(liquidNames); + break; + } + case SOLID: + { + setGlobalIds(solidNames); + break; + } + default: + { + FatalErrorIn + ( + "Foam::phaseProperties::setGlobalIds\n" + "(\n" + " const PtrList&,\n" + " const wordList&,\n" + " const wordList&\n" + ")" + ) << "Invalid phase: " << phaseTypeNames_[phase_] << nl + << " phase must be gas, liquid or solid" << nl + << exit(FatalError); + } + } +} + + +Foam::phaseProperties::phaseType Foam::phaseProperties::phase() const +{ + return phase_; +} + + +Foam::word Foam::phaseProperties::phaseTypeName() const +{ + return phaseTypeNames_[phase_]; +} + + +const Foam::List& Foam::phaseProperties::names() const +{ + return names_; +} + + +const Foam::word& Foam::phaseProperties::name(const label cmptI) const +{ + if (cmptI >= names_.size()) + { + FatalErrorIn + ( + "const Foam::word& Foam::phaseProperties::name" + "(" + "const label cmptI" + ") const" + ) << "Requested component " << cmptI << "out of range" << nl + << "Available phase components:" << nl << names_ << nl + << exit(FatalError); + } + + return names_[cmptI]; +} + + +const Foam::scalarField& Foam::phaseProperties::Y() const +{ + return Y_; +} + + +Foam::scalar& Foam::phaseProperties::Y(const label cmptI) +{ + if (cmptI >= Y_.size()) + { + FatalErrorIn + ( + "const Foam::scalar& Foam::phaseProperties::Y" + "(" + "const label cmptI" + ") const" + ) << "Requested component " << cmptI << "out of range" << nl + << "Available phase components:" << nl << names_ << nl + << exit(FatalError); + } + + return Y_[cmptI]; +} + + +Foam::label Foam::phaseProperties::globalId(const word& cmptName) const +{ + label id = this->id(cmptName); + + if (id < 0) + { + return id; + } + else + { + return globalIds_[id]; + } + +} + + +const Foam::labelList& Foam::phaseProperties::globalIds() const +{ + return globalIds_; +} + + +Foam::label Foam::phaseProperties::id(const word& cmptName) const +{ + forAll(names_, cmptI) + { + if (names_[cmptI] == cmptName) + { + return cmptI; + } + } + + return -1; +} + + +// ************************************************************************* // + diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C.bakNew b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C.bakNew new file mode 100644 index 0000000000..fe690e0ab6 --- /dev/null +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C.bakNew @@ -0,0 +1,357 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "phaseProperties.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* Foam::NamedEnum::names[] = +{ + "gas", + "liquid", + "solid", + "unknown" +}; + + +const Foam::NamedEnum + Foam::phaseProperties::phaseTypeNames_; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::phaseProperties::setGlobalGasIds +( + const PtrList& YGas +) +{ + forAll(components_, i) + { + forAll (YGas, j) + { + word specieName = YGas[j].name(); + + if (specieName == components_[i].first()) + { + globalIds_[i] = j; + break; + } + } + if (globalIds_[i] == -1) + { + wordList globalGasNames(YGas.size()); + + forAll (YGas, k) + { + globalGasNames[k] = YGas[k].name(); + } + + FatalErrorIn + ( + "void phaseProperties::setGlobalGasIds" + "(" + " const hCombustionThermo&" + ")" + ) << "Could not find gas species " << components_[i].first() + << " in species list" << nl + << "Available species are: " << nl << globalGasNames << nl + << exit(FatalError); + } + } +} + + +void Foam::phaseProperties::setGlobalIds(const wordList& globalNames) +{ + forAll(components_, i) + { + forAll(globalNames, j) + { + if (globalNames[j] == components_[i].first()) + { + globalIds_[i] = j; + break; + } + } + if (globalIds_[i] == -1) + { + FatalErrorIn + ( + "void Foam::phaseProperties::setGlobalGasIds\n" + "(\n" + " const PtrList& YGas\n" + ")" + ) << "Could not find specie " << components_[i].first() + << " in species list" << nl + << "Available species are: " << nl << globalNames << nl + << exit(FatalError); + } + } +} + + +void Foam::phaseProperties::checkTotalMassFraction() const +{ + scalar total = 0.0; + forAll(fractions_, cmptI) + { + total += fractions_[cmptI]; + } + + if (mag(total - 1.0) > SMALL) + { + FatalErrorIn + ( + "void Foam::phaseProperties::checkTotalMassFraction() const" + ) << "Component fractions must total to unity" << nl + << "Components: " << nl << components_ << nl << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseProperties::phaseProperties() +: + phase_(UNKNOWN), + names_(0), + fractions_(0), + globalIds_(0) +{} + + +Foam::phaseProperties::phaseProperties(Istream& is) +: + phase_(UNKNOWN), + names_(0), + fractions_(0), + globalIds_(0) +{ + is.check("Foam::phaseProperties::phaseProperties(Istream& is)"); + + Tuple2 > > components(is); + + phase_ = phaseTypeNames_.read(components.first()); + + label nComponents = components.second().size(); + names_.setSize(nComponents); + fractions_.setSize(nComponents); + + forAll(components.second(), cmptI) + { + names_[cmptI] = components.second()[cmptI].first(); + fractions_[cmptI] = components.second()[cmptI].second(); + } + + // initialise global ids to -1 + globalIds_.setSize(nComponents, -1); + + checkTotalMassFraction(); +} + + +Foam::phaseProperties::phaseProperties(const phaseProperties& pp) +: + phase_(pp.phase_), + names_(pp.names_), + fractions_(pp.fractions_), + globalIds_(pp.globalIds_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phaseProperties::~phaseProperties() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::phaseProperties::initialiseGlobalIds +( + const PtrList& YGas, + const wordList& liquidNames, + const wordList& solidNames +) +{ + // determine the addressing to map between components listed in the phase + // with those given in the (main) thermo properties + switch (phase_) + { + case GAS: + { + setGlobalGasIds(YGas); + break; + } + case LIQUID: + { + setGlobalIds(liquidNames); + break; + } + case SOLID: + { + setGlobalIds(solidNames); + break; + } + default: + { + FatalErrorIn + ( + "Foam::phaseProperties::setGlobalIds\n" + "(\n" + " const PtrList& gases,\n" + " const wordList& liquidNames,\n" + " const wordList& solidNames\n" + ")" + ) << "Invalid phase: " << phaseTypeNames_[phase_] << nl + << " phase must be gas, liquid or solid" << nl + << exit(FatalError); + } +} + + +Foam::phaseProperties::phaseType Foam::phaseProperties::phase() const +{ + return phase_; +} + + +Foam::word Foam::phaseProperties::phaseTypeName() const +{ + return phaseTypeNames_[phase_]; +} + + +const Foam::List >& +Foam::phaseProperties::components() const +{ + return components_; +} + + +const Foam::word& Foam::phaseProperties::name(const label cmptI) const +{ + if (cmptI >= components_.size()) + { + FatalErrorIn + ( + "const Foam::word& Foam::phaseProperties::name" + "(" + " const label cmptI" + ") const" + ) << "Requested component " << cmptI << "out of range" << nl + << "Available phase components:" << nl << components_ << nl + << exit(FatalError); + } + + return components_[cmptI].first(); +} + + +const Foam::wordList Foam::phaseProperties::names() const +{ + wordList cmptNames(components_.size()); + + forAll(components_, cmptI) + { + cmptNames[cmptI] = components_[cmptI].first(); + } + + return cmptNames; +} + + +Foam::label Foam::phaseProperties::id(const word& cmptName) const +{ + forAll(components_, cmptI) + { + if (components_[cmptI].first() == cmptName) + { + return cmptI; + } + } + + return -1; +} + + +Foam::label Foam::phaseProperties::globalId(const word& cmptName) const +{ + label id = this->id(cmptName); + + if (id < 0) + { + return id; + } + else + { + return globalIds_[id]; + } + +} + + +const Foam::labelList& Foam::phaseProperties::globalIds() const +{ + return globalIds_; +} + + +Foam::scalar& Foam::phaseProperties::Y(const label cmptI) +{ + if (cmptI >= components_.size()) + { + FatalErrorIn + ( + "const Foam::scalar& Foam::phaseProperties::Y" + "(" + " const label cmptI" + ") const" + ) << "Requested component " << cmptI << "out of range" << nl + << "Available phase components:" << nl << components_ << nl + << exit(FatalError); + } + + return components_[cmptI].second(); +} + + +const Foam::scalarList Foam::phaseProperties::Y() const +{ + scalarList cmptYs(components_.size(), 0.0); + + forAll(cmptYs, i) + { + cmptYs[i] = components_[i].second(); + } + + return cmptYs; +} + + +// ************************************************************************* // + diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H new file mode 100644 index 0000000000..258d0069ae --- /dev/null +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::phaseProperties + +Description + Helper class to manage multi-component phase properties + +SourceFiles + phaseProperties.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseProperties_H +#define phaseProperties_H + +#include "NamedEnum.H" +#include "Tuple2.H" +#include "PtrList.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class phaseProperties Declaration +\*---------------------------------------------------------------------------*/ + +class phaseProperties +{ +public: + + // Public data + + //- Phase type enumeration + enum phaseType + { + GAS, + LIQUID, + SOLID, + UNKNOWN + }; + + //- Corresponding word representations for phase type enumerations + static const NamedEnum phaseTypeNames_; + + +private: + + // Private data + + //- Phase type + phaseType phase_; + + //- List of component names + List names_; + + //- List of component mass fractions + scalarField Y_; + + //- Global ids + labelList globalIds_; + + + // Private member functions + + //- Set global ids - specialisation for carrier gas phases + void setGlobalGasIds(const PtrList& YGas); + + //- Set global ids - liquid and solid phases + void setGlobalIds(const wordList& globalNames); + + //- Check the total mass fraction + void checkTotalMassFraction() const; + + +public: + + // Constructors + + //- Null constructor + phaseProperties(); + + //- Construct from Istream + phaseProperties(Istream&); + + //- Construct as copy + phaseProperties(const phaseProperties&); + + + //- Destructor + ~phaseProperties(); + + + // Public member functions + + //- Initialise the global ids + void initialiseGlobalIds + ( + const PtrList& YGas, + const wordList& liquidNames, + const wordList& solidNames + ); + + + // Access + + //- Return const access to the phase type + phaseType phase() const; + + //- Return word representation of the phase type + word phaseTypeName() const; + + //- Return the list of component names + const List& names() const; + + //- Return const access to a component name + const word& name(const label cmptI) const; + + //- Return const access to all component mass fractions + const scalarField& Y() const; + + //- Return non-const access to a component mass fraction + scalar& Y(const label cmptI); + + //- Return const acccess to the global ids + const labelList& globalIds() const; + + //- Return the global id of a component in the local list by name + // Returns -1 if not found + label globalId(const word& cmptName) const; + + //- Return the id of a component in the local list by name + // Returns -1 if not found + label id(const word& cmptName) const; + + + // IOstream Operators + + friend Istream& operator>>(Istream&, phaseProperties&); + friend Ostream& operator<<(Ostream&, const phaseProperties&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H.bakNew b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H.bakNew new file mode 100644 index 0000000000..b7ca428715 --- /dev/null +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H.bakNew @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::phaseProperties + +Description + Helper class to manage multi-component phase properties + +SourceFiles + phaseProperties.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseProperties_H +#define phaseProperties_H + +#include "NamedEnum.H" +#include "Tuple2.H" +#include "PtrList.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class phaseProperties Declaration +\*---------------------------------------------------------------------------*/ + +class phaseProperties +{ +public: + + // Public data + + //- Phase type enumeration + enum phaseType + { + GAS, + LIQUID, + SOLID, + UNKNOWN + }; + + //- Corresponding word representations for phase type enumerations + static const NamedEnum phaseTypeNames_; + + +private: + + // Private data + + //- Phase type + phaseType phase_; + + //- List of component names + List names_; + + //- List of component mass fractions + List fractions_; + + //- Global ids + labelList globalIds_; + + + // Private member functions + + //- Set global ids - specialisation for carrier gas phases + void setGlobalGasIds(const PtrList& YGas); + + //- Set global ids - liquid and solid phases + void setGlobalIds(const wordList& globalNames); + + //- Check the total mass fraction + void checkTotalMassFraction() const; + + +public: + + // Constructors + + //- Null constructor + phaseProperties(); + + //- Construct from Istream + phaseProperties(Istream&); + + //- Construct as copy + phaseProperties(const phaseProperties&); + + + //- Destructor + ~phaseProperties(); + + + // Public member functions + + //- Initialise the global ids + void initialiseGlobalIds + ( + const PtrList& YGas, + const wordList& liquidNames, + const wordList& solidNames + ); + + //- Return const access to the phase type + phaseType phase() const; + + //- Return word representation of the phase type + word phaseTypeName() const; + + //- Return const access to the component name vs mass fraction list + const List >& components() const; + + //- Return const access to a component name + const word& name(const label cmptI) const; + + //- Return a list of component names + const wordList names() const; + + //- Return the id of a component in the local list by name + // Returns -1 if not found + label id(const word& cmptName) const; + + //- Return the global id of a component in the local list by name + // Returns -1 if not found + label globalId(const word& cmptName) const; + + //- Return const acccess to the global ids + const labelList& globalIds() const; + + //- Return non-const access to a component mass fraction + scalar& Y(const label cmptI); + + //- Return const access to all component mass fractions + const scalarList Y() const; + + + // IOstream Operators + + friend Istream& operator>>(Istream&, phaseProperties&); + friend Ostream& operator<<(Ostream&, const phaseProperties&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C new file mode 100644 index 0000000000..34641fe4d4 --- /dev/null +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "phaseProperties.H" +#include "dictionaryEntry.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +Foam::phaseProperties::phaseProperties(Istream& is) +: + phase_(UNKNOWN), + names_(0), + Y_(0), + globalIds_(0) +{ + is.check("Foam::phaseProperties::phaseProperties(Istream& is)"); + + dictionaryEntry phaseInfo(dictionary::null, is); + + if (!phaseInfo.isDict()) + { + FatalErrorIn("Foam::phaseProperties::phaseProperties(Istream& is)") + << "Phase properties should be given in dictionary entries" + << nl << exit(FatalError); + } + + label nComponents = phaseInfo.size(); + names_.setSize(nComponents); + Y_.setSize(nComponents); + + phase_ = phaseTypeNames_[phaseInfo.keyword()]; + + label cmptI = 0; + forAllConstIter(IDLList, phaseInfo, iter) + { + names_[cmptI] = iter().keyword(); + Y_[cmptI] = readScalar(phaseInfo.lookup(names_[cmptI])); + cmptI++; + } + + // initialise global ids to -1 + globalIds_.setSize(nComponents, -1); + + checkTotalMassFraction(); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp) +{ + is.check + ( + "Foam::Istream& Foam::operator>>" + "(Foam::Istream&, Foam::phaseProperties&)" + ); + + dictionaryEntry phaseInfo(dictionary::null, is); + + if (!phaseInfo.isDict()) + { + FatalErrorIn + ( + "Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)" + ) << "Phase properties should be given in dictionary entries" + << nl << exit(FatalError); + } + + label nComponents = phaseInfo.size(); + pp.names_.setSize(nComponents); + pp.Y_.setSize(nComponents); + + pp.phase_ = pp.phaseTypeNames_[phaseInfo.keyword()]; + + label cmptI = 0; + forAllConstIter(IDLList, phaseInfo, iter) + { + pp.names_[cmptI] = iter().keyword(); + pp.Y_[cmptI] = readScalar(phaseInfo.lookup(pp.names_[cmptI])); + cmptI++; + } + + // initialise global ids to -1 + pp.globalIds_.setSize(nComponents, -1); + + pp.checkTotalMassFraction(); + + return is; +} + + +Foam::Ostream& Foam::operator<<(Ostream& os, const phaseProperties& pp) +{ + os.check + ( + "Foam::Ostream& Foam::operator<<" + "(Foam::Ostream&, const Foam::phaseProperties&)" + ); + + os << pp.phaseTypeNames_[pp.phase_] << nl << token::BEGIN_BLOCK << nl + << incrIndent; + + forAll(pp.names_, cmptI) + { + os.writeKeyword(pp.names_[cmptI]) << pp.Y_[cmptI] + << token::END_STATEMENT << nl; + } + + os << decrIndent << token::END_BLOCK << nl; + + os.check + ( + "Foam::Ostream& Foam::operator<<" + "(Foam::Ostream&, const Foam::phaseProperties&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudThermoTypes.H b/src/lagrangian/intermediate/phaseProperties/phasePropertiesList/phasePropertiesList.C similarity index 53% rename from src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudThermoTypes.H rename to src/lagrangian/intermediate/phaseProperties/phasePropertiesList/phasePropertiesList.C index 2341e65aa0..9e5aeb69c3 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudThermoTypes.H +++ b/src/lagrangian/intermediate/phaseProperties/phasePropertiesList/phasePropertiesList.C @@ -22,44 +22,68 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Typedefs - Foam::cloudThermoTypes - -Description - \*---------------------------------------------------------------------------*/ -#ifndef ReactingCloudThermoTypes_H -#define ReactingCloudThermoTypes_H +#include "phasePropertiesList.H" -#include "sutherlandTransport.H" -#include "multiComponentMixture.H" -#include "specie.H" -#include "constTransport.H" -#include "specieThermo.H" -#include "hConstThermo.H" -#include "janafThermo.H" -#include "perfectGas.H" +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam +Foam::phasePropertiesList::phasePropertiesList +( + Istream& is, + const PtrList& YGas, + const wordList& liquidNames, + const wordList& solidNames +) +: + props_(is), + phaseTypeNames_() { -// typedef multiComponentMixture > > > specieProperties; -// typedef hConstThermo specieProperties; + forAll(props_, i) + { + props_[i].initialiseGlobalIds(YGas, liquidNames, solidNames); + } -// typedef sutherlandTransport > > -// specieProperties; - - typedef sutherlandTransport > > - specieReactingProperties; - - typedef constTransport > > - specieConstProperties; + phaseTypeNames_.setSize(props_.size()); + forAll(phaseTypeNames_, i) + { + phaseTypeNames_[i] = props_[i].phaseTypeName(); + } } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#endif +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phasePropertiesList::~phasePropertiesList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::List& +Foam::phasePropertiesList::props() const +{ + return props_; +} + + +const Foam::wordList& Foam::phasePropertiesList::phaseTypes() const +{ + return phaseTypeNames_; +} + + +Foam::label Foam::phasePropertiesList::size() const +{ + return props_.size(); +} + + +const Foam::phaseProperties& +Foam::phasePropertiesList::operator[](const label phaseI) const +{ + return props_[phaseI]; +} + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/phaseProperties/phasePropertiesList/phasePropertiesList.H b/src/lagrangian/intermediate/phaseProperties/phasePropertiesList/phasePropertiesList.H new file mode 100644 index 0000000000..80e8f5c859 --- /dev/null +++ b/src/lagrangian/intermediate/phaseProperties/phasePropertiesList/phasePropertiesList.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::phasePropertiesList + +Description + Simple container for a list of phase properties + +SourceFiles + phasePropertiesList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phasePropertiesList_H +#define phasePropertiesList_H + +#include "Istream.H" +#include "volFields.H" +#include "wordList.H" +#include "phaseProperties.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class phasePropertiesList Declaration +\*---------------------------------------------------------------------------*/ + +class phasePropertiesList +{ + // Private data + + //- List of phase properties + List props_; + + //- List of word representation of phase types + wordList phaseTypeNames_; + + +public: + + //- Constructor + phasePropertiesList + ( + Istream& is, + const PtrList& YGas, + const wordList& liquidNames, + const wordList& solidNames + ); + + //- Destructor + ~phasePropertiesList(); + + + // Public member functions + + //- Return the list of phase properties + const List& props() const; + + //- Return the list of word representation of phase types + const wordList& phaseTypes() const; + + //- Return the size (number of phases) + label size() const; + + + // Member operators + + const phaseProperties& operator[](const label) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C index 651b041538..5d1de160e8 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C @@ -46,7 +46,7 @@ Foam::CompositionModel::CompositionModel ( owner.mesh().objectRegistry::lookupObject ( - "thermophysicalProperties" + carrierThermo_.name() ) ) ), @@ -56,9 +56,16 @@ Foam::CompositionModel::CompositionModel ( owner.mesh().objectRegistry::lookupObject ( - "thermophysicalProperties" + carrierThermo_.name() ) ) + ), + phaseProps_ + ( + coeffDict_.lookup("phases"), + carrierThermo_.composition().Y(), + liquids_().components(), + solids_().components() ) {} @@ -123,6 +130,240 @@ const Foam::solidMixture& Foam::CompositionModel::solids() const } +template +const Foam::phasePropertiesList& +Foam::CompositionModel::phaseProps() const +{ + return phaseProps_; +} + + +template +Foam::label Foam::CompositionModel::nPhase() const +{ + return phaseProps_.size(); +} + + +template +const Foam::wordList& +Foam::CompositionModel::phaseTypes() const +{ + // if only 1 phase, return the constituent component names + if (phaseProps_.size() == 1) + { + return phaseProps_[0].names(); + } + else + { + return phaseProps_.phaseTypes(); + } +} + + +template +const Foam::wordList& +Foam::CompositionModel::componentNames(const label phaseI) const +{ + return phaseProps_[phaseI].names(); +} + + +template +Foam::label Foam::CompositionModel::globalId +( + const label phaseI, + const word& cmptName +) const +{ + label id = phaseProps_[phaseI].globalId(cmptName); + + if (id < 0) + { + FatalErrorIn + ( + "Foam::label Foam::CompositionModel::globalId\n" + "(\n" + " const label phaseI,\n" + " const word& cmptName\n" + ") const" + ) << "Unable to determine global id for requested component " + << cmptName << nl << abort(FatalError); + } + + return id; +} + + +template +const Foam::labelList& Foam::CompositionModel::globalIds +( + const label phaseI +) const +{ + return phaseProps_[phaseI].globalIds(); +} + + +template +Foam::label Foam::CompositionModel::localId +( + const label phaseI, + const word& cmptName +) const +{ + label id = phaseProps_[phaseI].id(cmptName); + + if (id < 0) + { + FatalErrorIn + ( + "Foam::label Foam::CompositionModel::localId\n" + "(\n" + " const label phaseI,\n" + " const word& cmptName\n" + ") const" + ) << "Unable to determine local id for component " << cmptName + << nl << abort(FatalError); + } + + return id; +} + + +template +const Foam::scalarField& Foam::CompositionModel::Y0 +( + const label phaseI +) const +{ + return phaseProps_[phaseI].Y(); +} + + +template +Foam::scalar Foam::CompositionModel::H +( + const label phaseI, + const scalarField& Y, + const scalar p, + const scalar T +) const +{ + const phaseProperties& props = phaseProps_[phaseI]; + scalar HMixture = 0.0; + switch (props.phase()) + { + case phaseProperties::GAS: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + HMixture += Y[i]*this->gases()[gid].H(T); + } + break; + } + case phaseProperties::LIQUID: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + HMixture += Y[i]*this->liquids().properties()[gid].h(p, T); + } + break; + } + case phaseProperties::SOLID: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + HMixture += + Y[i] + *( + this->solids().properties()[gid].Hf() + + this->solids().properties()[gid].cp()*T + ); + } + break; + } + default: + { + FatalErrorIn + ( + "Foam::scalar Foam::CompositionModel::H\n" + "(\n" + " const label phaseI,\n" + " const scalarField& Y," + " const scalar p,\n" + " const scalar T\n" + ") const" + ) << "Unknown phase enumeration" << nl << abort(FatalError); + } + } + + return HMixture; +} + + +template +Foam::scalar Foam::CompositionModel::cp +( + const label phaseI, + const scalarField& Y, + const scalar p, + const scalar T +) const +{ + const phaseProperties& props = phaseProps_[phaseI]; + scalar cpMixture = 0.0; + switch (props.phase()) + { + case phaseProperties::GAS: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + cpMixture += Y[i]*this->gases()[gid].Cp(T); + } + break; + } + case phaseProperties::LIQUID: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + cpMixture += Y[i]*this->liquids().properties()[gid].cp(p, T); + } + break; + } + case phaseProperties::SOLID: + { + forAll(Y, i) + { + label gid = props.globalIds()[i]; + cpMixture += Y[i]*this->solids().properties()[gid].cp(); + } + break; + } + default: + { + FatalErrorIn + ( + "Foam::scalar Foam::CompositionModel::cp\n" + "(\n" + " const label phaseI,\n" + " const scalarField& Y," + " const scalar p,\n" + " const scalar T\n" + ") const" + ) << "Unknown phase enumeration" << nl << abort(FatalError); + } + } + + return cpMixture; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "NewCompositionModel.C" diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H index e5b5021fdf..9dd21529c8 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H @@ -25,7 +25,6 @@ License Class Foam::CompositionModel - Description Templated reacting parcel composition model class Consists of gases (via thermo package), liquids and solids @@ -49,6 +48,8 @@ SourceFiles #include "liquidMixture.H" #include "solidMixture.H" +#include "phasePropertiesList.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -84,6 +85,9 @@ class CompositionModel //- Global solid properties data autoPtr solids_; + //- List of phase properties + phasePropertiesList phaseProps_; + public: @@ -143,103 +147,85 @@ public: //- Return the carrier phase thermo package const hCombustionThermo& carrierThermo() const; - //- Return the gases - const PtrList& gases() const; - //- Return the global liquids - const liquidMixture& liquids() const; + // Composition lists - //- Return the global solids - const solidMixture& solids() const; + //- Return the gases + const PtrList& gases() const; - //- Return the list of composition names - virtual const wordList compositionNames() const = 0; + //- Return the global liquids + const liquidMixture& liquids() const; - //- Return the list of gas names - virtual const wordList& gasNames() const = 0; + //- Return the global solids + const solidMixture& solids() const; - //- Return local id of gas based on gasName - virtual label gasLocalId(const word& gasName) const = 0; + //- Return the list of phase properties + const phasePropertiesList& phaseProps() const; - //- Return global id of gas based on gasName - virtual label gasGlobalId(const word& gasName) const = 0; + //- Return the number of phases + label nPhase() const; - //- Return the list indices of gases in global thermo list - virtual const labelList& gasGlobalIds() const = 0; - //- Return the list of gas mass fractions - virtual const scalarField& YGas0() const = 0; + // Phase properties - //- Return the list of liquid names - virtual const wordList& liquidNames() const = 0; + //- Return the list of phase type names + // If only 1 phase, return the component names of that phase + const wordList& phaseTypes() const; - //- Return local id of liquid based on liquidName - virtual label liquidLocalId(const word& liquidName) const = 0; + //- Return the list of component names for phaseI + const wordList& componentNames(const label phaseI) const; - //- Return global id of liquid based on liquidName - virtual label liquidGlobalId(const word& liquidName) const = 0; + //- Return global id of component cmptName in phase phaseI + label globalId(const label phaseI, const word& cmptName) const; - //- Return the list indices of liquid in global thermo list - virtual const labelList& liquidGlobalIds() const = 0; + //- Return global ids of for phase phaseI + const labelList& globalIds(const label phaseI) const; - //- Return the list of liquid mass fractions - virtual const scalarField& YLiquid0() const = 0; + //- Return local id of component cmptName in phase phaseI + label localId(const label phaseI, const word& cmptName) const; - //- Return the list of solid names - virtual const wordList& solidNames() const = 0; + //- Return the list of phase phaseI mass fractions + const scalarField& Y0(const label phaseI) const; - //- Return local id of solid based on solidName - virtual label solidLocalId(const word& solidName) const = 0; - //- Return global id of solid based on solidName - virtual label solidGlobalId(const word& solidName) const = 0; + // Mixture properties - //- Return the list indices of solids in global thermo list - virtual const labelList& solidGlobalIds() const = 0; + //- Return the list of mixture mass fractions + // If only 1 phase, return component fractions of that phase + virtual const scalarField& YMixture0() const = 0; - //- Return the list of solid mass fractions - virtual const scalarField& YSolid0() const = 0; + // Indices of gas, liquid and solid phases in phase properties + // list - returns -1 if not applicable - //- Return the list of mixture mass fractions - virtual const scalarField& YMixture0() const = 0; + //- Gas id + virtual label idGas() const = 0; - //- Return the gas constant for the gas mixture - virtual scalar RGas(const scalarField& YGas) const = 0; + //- Liquid id + virtual label idLiquid() const = 0; - //- Return enthalpy for the gas mixture [energy per unit mass] - virtual scalar HGas + //- Solid id + virtual label idSolid() const = 0; + + + // Evaluation + + //- Return enthalpy for the phase phaseI + virtual scalar H ( - const scalarField& YGas, - const scalar T - ) const = 0; - - //- Return enthalpy for the solid mixture [energy per unit mass] - virtual scalar HSolid - ( - const scalarField& YSolid, - const scalar T - ) const = 0; - - //- Return specific heat caparcity for the gas mixture - virtual scalar cpGas - ( - const scalarField& YGas, - const scalar T - ) const = 0; - - //- Return specific heat caparcity for the liquid mixture - virtual scalar cpLiquid - ( - const scalarField& YLiquid, + const label phaseI, + const scalarField& Y, const scalar p, const scalar T - ) const = 0; + ) const; - //- Return specific heat caparcity for the solid mixture - virtual scalar cpSolid + //- Return cp for the phase phaseI + virtual scalar cp ( - const scalarField& YSolid - ) const = 0; + const label phaseI, + const scalarField& Y, + const scalar p, + const scalar T + ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/NewCompositionModel.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/NewCompositionModel.C index 7fd051cd73..707c158cc6 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/NewCompositionModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/NewCompositionModel.C @@ -36,34 +36,32 @@ Foam::CompositionModel::New CloudType& owner ) { - word ReactingCompositionModelType - ( - dict.lookup("CompositionModel") - ); + word CompositionModelType(dict.lookup("CompositionModel")); - Info<< "Selecting CompositionModel " - << ReactingCompositionModelType << endl; + Info<< "Selecting CompositionModel " << CompositionModelType << endl; typename dictionaryConstructorTable::iterator cstrIter = - dictionaryConstructorTablePtr_->find(ReactingCompositionModelType); + dictionaryConstructorTablePtr_->find(CompositionModelType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { FatalErrorIn ( - "CompositionModel::New" - "(const dictionary&, CloudType&)" + "CompositionModel::New\n" + "(\n" + " const dictionary&,\n" + " CloudType&\n" + ")" ) - << "Unknown ReactingCompositionModelType type " - << ReactingCompositionModelType + << "Unknown CompositionModelType type " + << CompositionModelType << ", constructor not in hash table" << nl << nl << " Valid CompositionModel types are :" << nl - << dictionaryConstructorTablePtr_->toc() + << dictionaryConstructorTablePtr_->toc() << nl << exit(FatalError); } - return autoPtr > - (cstrIter()(dict, owner)); + return autoPtr >(cstrIter()(dict, owner)); } diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.C index afbaef7395..9f5eed2c7c 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.C @@ -26,6 +26,62 @@ License #include "SingleMixtureFraction.H" +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::SingleMixtureFraction::constructIds() +{ + forAll(this->phaseProps(), phaseI) + { + switch (this->phaseProps()[phaseI].phase()) + { + case phaseProperties::GAS: + { + idGas_ = phaseI; + break; + } + case phaseProperties::LIQUID: + { + idLiquid_ = phaseI; + break; + } + case phaseProperties::SOLID: + { + idSolid_ = phaseI; + break; + } + default: + { + FatalErrorIn + ( + "void Foam::SingleMixtureFraction::" + "constructIds()" + ) << "Unknown phase enumeration" << nl << abort(FatalError); + } + } + } + + if (idGas_ < 0) + { + FatalErrorIn("Foam::SingleMixtureFraction::constructIds()") + << "No gas phase found in phase list:" << nl + << this->phaseTypes() << nl << endl; + } + if (idLiquid_ < 0) + { + FatalErrorIn("Foam::SingleMixtureFraction::constructIds()") + << "No liquid phase found in phase list:" << nl + << this->phaseTypes() << nl << endl; + } + if (idSolid_ < 0) + { + FatalErrorIn("Foam::SingleMixtureFraction::constructIds()") + << "No solid phase found in phase list:" << nl + << this->phaseTypes() << nl << endl; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -37,181 +93,45 @@ Foam::SingleMixtureFraction::SingleMixtureFraction : CompositionModel(dict, owner, typeName), - gasNames_(this->coeffDict().lookup("gasNames")), - gasGlobalIds_(gasNames_.size(), -1), - YGas0_(this->coeffDict().lookup("YGas0")), - YGasTot0_(readScalar(this->coeffDict().lookup("YGasTot0"))), - - liquidNames_(this->coeffDict().lookup("liquidNames")), - liquidGlobalIds_(liquidNames_.size(), -1), - YLiquid0_(this->coeffDict().lookup("YLiquid0")), - YLiquidTot0_(readScalar(this->coeffDict().lookup("YLiquidTot0"))), - - solidNames_(this->coeffDict().lookup("solidNames")), - solidGlobalIds_(solidNames_.size(), -1), - YSolid0_(this->coeffDict().lookup("YSolid0")), - YSolidTot0_(readScalar(this->coeffDict().lookup("YSolidTot0"))), + idGas_(-1), + idLiquid_(-1), + idSolid_(-1), YMixture0_(3) { - // Construct gasGlobalIds_ list - forAll(gasNames_, i) - { - forAll (this->carrierThermo().composition().Y(), j) - { - word specieName(this->carrierThermo().composition().Y()[j].name()); + constructIds(); - if (specieName == gasNames_[i]) - { - gasGlobalIds_[i] = j; - break; - } - } - if (gasGlobalIds_[i] == -1) - { - Info<< "\nThermo package species composition comprises:" << endl; - forAll (this->carrierThermo().composition().Y(), k) - { - Info<< this->carrierThermo().composition().Y()[k].name() - << endl; - } - - FatalErrorIn - ( - "Foam::SingleMixtureFraction::SingleMixtureFraction" - "(const dictionary&, CloudType&)" - ) << "Could not find gas species " << gasNames_[i] - << " in species list" << exit(FatalError); - } - } - - // Construct liquidGlobalIds_ list - forAll(liquidNames_, i) - { - forAll (this->liquids().components(), j) - { - word specieName(this->liquids().components()[j]); - - if (specieName == liquidNames_[i]) - { - liquidGlobalIds_[i] = j; - break; - } - } - if (liquidGlobalIds_[i] == -1) - { - Info<< "\nLiquid mixture species composition comprises:" << endl; - forAll (this->liquids().components(), k) - { - Info<< this->liquids().components()[k] << endl; - } - - FatalErrorIn - ( - "Foam::SingleMixtureFraction::SingleMixtureFraction" - "(const dictionary&, CloudType&)" - ) << "Could not find liquid species " << liquidNames_[i] - << " in species list" << exit(FatalError); - } - } - - // Construct solidGlobalIds_ list - forAll(solidNames_, i) - { - forAll (this->solids().components(), j) - { - word specieName(this->solids().components()[j]); - - if (specieName == solidNames_[i]) - { - solidGlobalIds_[i] = j; - break; - } - } - if (solidGlobalIds_[i] == -1) - { - Info<< "\nSolid mixture species composition comprises:" << endl; - forAll (this->solids().components(), k) - { - Info<< this->solids().components()[k] << endl; - } - - FatalErrorIn - ( - "Foam::SingleMixtureFraction::SingleMixtureFraction" - "(const dictionary&, CloudType&)" - ) << "Could not find solid species " << solidNames_[i] - << " in species list" << exit(FatalError); - } - } - - // Set mixture fractions - YMixture0_[0] = YGasTot0_; - YMixture0_[1] = YLiquidTot0_; - YMixture0_[2] = YSolidTot0_; - - // Check that total mass fractions = 1 - - if (YGas0_.size()) - { - if (mag(sum(YGas0_) - 1) > SMALL) - { - FatalErrorIn - ( - "Foam::SingleMixtureFraction::SingleMixtureFraction" - "(const dictionary&, CloudType&)" - )<< "Mass fractions of YGas0 must sum to unity" - << exit(FatalError); - } - } - else - { - YMixture0_[0] = 0.0; - } - - if (YLiquid0_.size()) - { - if (mag(sum(YLiquid0_) - 1) > SMALL) - { - FatalErrorIn - ( - "Foam::SingleMixtureFraction::SingleMixtureFraction" - "(const dictionary&, CloudType&)" - )<< "Mass fractions of YLiquid0 must sum to unity" - << exit(FatalError); - } - } - else - { - YMixture0_[1] = 0.0; - } - - if (YSolid0_.size()) - { - if (mag(sum(YSolid0_) - 1) > SMALL) - { - FatalErrorIn - ( - "Foam::SingleMixtureFraction::SingleMixtureFraction" - "(const dictionary&, CloudType&)" - )<< "Mass fractions of YSolid0 must sum to unity" - << exit(FatalError); - } - } - else - { - YMixture0_[2] = 0.0; - } - - // Check total mixture fraction sums to 1 - if (mag(sum(YMixture0_) - 1) > SMALL) + if (this->phaseProps().size() != 3) { FatalErrorIn ( - "Foam::SingleMixtureFraction::SingleMixtureFraction" - "(const dictionary&, CloudType&)" - ) << "Mass fractions YGasTot0 + YSolidTot0 + YSolidTot0 must sum " - << "to unity" << exit(FatalError); + "Foam::SingleMixtureFraction::" + "SingleMixtureFraction\n" + "(\n" + " const dictionary&,\n" + " CloudType&\n" + ")\n" + ) << "Incorrect numebr of phases: " << nl + << " Please specify 1 gas, 1 liquid and 1 solid" << nl + << exit(FatalError); + } + + this->coeffDict().lookup("YGasTot0") >> YMixture0_[idGas_]; + this->coeffDict().lookup("YLiquidTot0") >> YMixture0_[idLiquid_]; + this->coeffDict().lookup("YSolidTot0") >> YMixture0_[idSolid_]; + + if (mag(sum(YMixture0_) - 1.0) > SMALL) + { + FatalErrorIn + ( + "Foam::SingleMixtureFraction::" + "SingleMixtureFraction\n" + "(\n" + " const dictionary&,\n" + " CloudType&\n" + ")\n" + ) << "Sum of phases should be 1. Phase fractions:" << nl + << YMixture0_ << nl << exit(FatalError); } } @@ -225,157 +145,11 @@ Foam::SingleMixtureFraction::~SingleMixtureFraction() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -const Foam::wordList -Foam::SingleMixtureFraction::compositionNames() const -{ - wordList names(3); - names[0] = "Gas"; - names[1] = "Liquid"; - names[2] = "Solid"; - return names; -} - -template -const Foam::wordList& -Foam::SingleMixtureFraction::gasNames() const -{ - return gasNames_; -} - - -template -Foam::label -Foam::SingleMixtureFraction::gasLocalId(const word& gasName) const -{ - forAll(gasNames_, i) - { - if (gasName == gasNames_[i]) - { - return i; - } - } - - WarningIn - ( - "Foam::label SingleMixtureFraction::" - "gasLocalId(const word& gasName) const" - )<< "Gas name " << gasName << " not found in gasNames_" - << endl; - - return -1; -} - - -template -Foam::label -Foam::SingleMixtureFraction::gasGlobalId(const word& gasName) const -{ - forAll(gasNames_, i) - { - if (gasName == gasNames_[i]) - { - return gasGlobalIds_[i]; - } - } - - WarningIn - ( - "Foam::label SingleMixtureFraction::" - "gasGlobalId(const word& gasName) const" - )<< "Gas name " << gasName << " not found in gasNames_" - << endl; - - return -1; -} - - -template -const Foam::labelList& -Foam::SingleMixtureFraction::gasGlobalIds() const -{ - return gasGlobalIds_; -} - - template const Foam::scalarField& Foam::SingleMixtureFraction::YGas0() const { - return YGas0_; -} - - -template -Foam::scalar Foam::SingleMixtureFraction::YGasTot0() const -{ - return YGasTot0_; -} - - -template -const Foam::wordList& -Foam::SingleMixtureFraction::liquidNames() const -{ - return liquidNames_; -} - - -template -Foam::label Foam::SingleMixtureFraction::liquidLocalId -( - const word& liquidName -) const -{ - forAll(liquidNames_, i) - { - if (liquidName == liquidNames_[i]) - { - return i; - } - } - - WarningIn - ( - "Foam::label SingleMixtureFraction::" - "liquidLocalId(const word& liquidName) const" - )<< "Liquid name " << liquidName << " not found in liquidNames_" - << endl; - - return -1; -} - - -template -Foam::label Foam::SingleMixtureFraction::liquidGlobalId -( - const word& liquidName -) const -{ - forAll(liquidNames_, i) - { - if (liquidName == liquidNames_[i]) - { - return liquidGlobalIds_[i]; - } - } - - WarningIn - ( - "Foam::label SingleMixtureFraction::" - "liquidGlobalId(const word& liquidName) const" - )<< "Liquid name " << liquidName << " not found in liquidNames_" - << endl; - - return -1; -} - - -template -const Foam::labelList& -Foam::SingleMixtureFraction::liquidGlobalIds() const -{ - return liquidGlobalIds_; + return this->phaseProps()[idGas_].Y(); } @@ -383,81 +157,7 @@ template const Foam::scalarField& Foam::SingleMixtureFraction::YLiquid0() const { - return YLiquid0_; -} - - -template -Foam::scalar Foam::SingleMixtureFraction::YLiquidTot0() const -{ - return YLiquidTot0_; -} - - -template -const Foam::wordList& -Foam::SingleMixtureFraction::solidNames() const -{ - return solidNames_; -} - - -template -Foam::label Foam::SingleMixtureFraction::solidLocalId -( - const word& solidName -) const -{ - forAll(solidNames_, i) - { - if (solidName == solidNames_[i]) - { - return i; - } - } - - WarningIn - ( - "Foam::label SingleMixtureFraction::" - "SolididLocalId(const word& solidName) const" - )<< "Solid name " << solidName << " not found in solidNames_" - << endl; - - return -1; -} - - -template -Foam::label -Foam::SingleMixtureFraction::solidGlobalId -( - const word& solidName -) const -{ - forAll(solidNames_, i) - { - if (solidName == solidNames_[i]) - { - return solidGlobalIds_[i]; - } - } - - WarningIn - ( - "Foam::label SingleMixtureFraction::" - "solidGlobalId(const word& solidName) const" - )<< "Solid name " << solidName << " not found in solidNames_" - << endl; - - return -1; -} - - -template -const Foam::labelList& -Foam::SingleMixtureFraction::solidGlobalIds() const -{ - return solidGlobalIds_; + return this->phaseProps()[idLiquid_].Y(); } @@ -465,15 +165,7 @@ template const Foam::scalarField& Foam::SingleMixtureFraction::YSolid0() const { - return YSolid0_; -} - - -template -Foam::scalar -Foam::SingleMixtureFraction::YSolidTot0() const -{ - return YSolidTot0_; + return this->phaseProps()[idSolid_].Y(); } @@ -486,115 +178,23 @@ Foam::SingleMixtureFraction::YMixture0() const template -Foam::scalar Foam::SingleMixtureFraction::RGas -( - const scalarField& YGas -) const +Foam::label Foam::SingleMixtureFraction::idGas() const { - scalar RGasMixture = 0.0; - forAll(YGas, i) - { - label id = gasGlobalIds_[i]; - RGasMixture += YGas[i]*this->gases()[id].R(); - } - return RGasMixture; + return idGas_; } template -Foam::scalar Foam::SingleMixtureFraction::HGas -( - const scalarField& YGas, - const scalar T -) -const +Foam::label Foam::SingleMixtureFraction::idLiquid() const { - scalar HMixture = 0.0; - forAll(YGas, i) - { - label id = gasGlobalIds_[i]; - HMixture += YGas[i]*this->gases()[id].H(T); - } - return HMixture; + return idLiquid_; } template -Foam::scalar Foam::SingleMixtureFraction::HSolid -( - const scalarField& YSolid, - const scalar T -) -const +Foam::label Foam::SingleMixtureFraction::idSolid() const { - scalar HMixture = 0.0; - forAll(YSolid, i) - { - label id = solidGlobalIds_[i]; - HMixture += - YSolid[i] - *( - this->solids().properties()[id].Hf() - + this->solids().properties()[id].cp()*T - ); - } - return HMixture; -} - - -template -Foam::scalar Foam::SingleMixtureFraction::cpGas -( - const scalarField& YGas, - const scalar T -) -const -{ - scalar cpMixture = 0.0; - forAll(YGas, i) - { - label id = gasGlobalIds_[i]; - cpMixture += YGas[i]*this->gases()[id].Cp(T); - } - return cpMixture; -} - - -template -Foam::scalar Foam::SingleMixtureFraction::cpLiquid -( - const scalarField& YLiquid, - const scalar p, - const scalar T -) -const -{ - scalar cpMixture = 0.0; - forAll(YLiquid, i) - { - label id = liquidGlobalIds_[i]; - cpMixture += YLiquid[i]*this->liquids().properties()[id].cp(p, T); - } - - return cpMixture; -} - - -template -Foam::scalar Foam::SingleMixtureFraction::cpSolid -( - const scalarField& YSolid -) -const -{ - scalar cpMixture = 0.0; - forAll(YSolid, i) - { - label id = solidGlobalIds_[i]; - cpMixture += YSolid[i]*this->solids().properties()[id].cp(); - } - - return cpMixture; + return idSolid_; } diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.H b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.H index 57d3535881..c2b7198a25 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.H +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.H @@ -25,10 +25,8 @@ License Class Foam::SingleMixtureFraction - Description - Templated parcel single mixture fraction class - - Each phase sums to a mass fraction of 1 + Templated parcel multi-phase, multi-component class SourceFiles SingleMixtureFraction.C @@ -56,67 +54,31 @@ class SingleMixtureFraction { // Private data - //- Parcel properties + // Indices of the phases - //- List of gas names - const wordList gasNames_; + //- Gas + label idGas_; - //- Return local id of gas based on gasName - label gasLocalId(const word& gasName) const; + //- Liquid + label idLiquid_; - //- Return global id of gas based on gasName - label gasGlobalId(const word& gasName) const; + //- Solid + label idSolid_; - //- List of IDs of gases in global list - labelList gasGlobalIds_; - //- Initial mass fractions of gases - const scalarField YGas0_; + // Mixture properties - //- Initial total mass fractions of gases - const scalar YGasTot0_; - - //- List of liquid names - const wordList liquidNames_; - - //- Return local id of liquid based on liquidName - label liquidLocalId(const word& liquidName) const; - - //- Return global id of liquid based on liquidName - label liquidGlobalId(const word& liquidName) const; - - //- List of IDs of liquids in global list - labelList liquidGlobalIds_; - - //- Initial mass fractions of liquids - const scalarField YLiquid0_; - - //- Initial total mass fractions of liquids - const scalar YLiquidTot0_; - - //- List of solids species - const wordList solidNames_; - - //- Return local id of solid based on solidName - label solidLocalId(const word& solidName) const; - - //- Return global id of solid based on solidName - label solidGlobalId(const word& solidName) const; - - //- List of IDs of solids in global list - labelList solidGlobalIds_; - - //- Initial mass fractions of solids - const scalarField YSolid0_; - - //- Initial total mass fractions of solids - const scalar YSolidTot0_; - - //- Initial total mass fractions of the mixture - // Index 0 = gas, 1 = liquid, 2 = solid + //- Phase component total fractions scalarField YMixture0_; + // Private member functions + + //- Construct the indices and check correct specification of + // 1 gas, 1 liquid and 1 solid + void constructIds(); + + public: //- Runtime type information @@ -126,11 +88,7 @@ public: // Constructors //- Construct from dictionary - SingleMixtureFraction - ( - const dictionary& dict, - CloudType& owner - ); + SingleMixtureFraction(const dictionary& dict, CloudType& owner); //- Destructor @@ -141,70 +99,49 @@ public: // Access - //- Return the list of composition names - const wordList compositionNames() const; + // Gas properties - //- Return the list of gas names - const wordList& gasNames() const; + //- Return the list of gas mass fractions + const scalarField& YGas0() const; - //- Return the list indices of gases in global thermo list - const labelList& gasGlobalIds() const; + //- Return the total gas mass fraction + scalar YGasTot0() const; - //- Return the list of gas mass fractions - const scalarField& YGas0() const; - //- Return the total gas mass fraction - scalar YGasTot0() const; + // Liquid properties - //- Return the list of liquid names - const wordList& liquidNames() const; + //- Return the list of liquid mass fractions + const scalarField& YLiquid0() const; - //- Return the list indices of liquid in global thermo list - const labelList& liquidGlobalIds() const; + //- Return the total liquid mass fraction + scalar YLiquidTot0() const; - //- Return the list of liquid mass fractions - const scalarField& YLiquid0() const; - //- Return the total liquid mass fraction - scalar YLiquidTot0() const; + // Solid properties - //- Return the list of solid names - const wordList& solidNames() const; + //- Return the list of solid mass fractions + const scalarField& YSolid0() const; - //- Return the list indices of solids in global thermo list - const labelList& solidGlobalIds() const; + //- Return the total solid mass fraction + scalar YSolidTot0() const; - //- Return the list of solid mass fractions - const scalarField& YSolid0() const; - //- Return the total solid mass fraction - scalar YSolidTot0() const; + // Mixture properties - //- Return the list of mixture mass fractions - const scalarField& YMixture0() const; + //- Return the list of mixture mass fractions + virtual const scalarField& YMixture0() const; - //- Return the gas constant for the gas mixture - scalar RGas(const scalarField& YGas) const; + // Indices of gas, liquid and solid phases in phase properties + // list - //- Return enthalpy for the gas mixture [energy per unit mass] - scalar HGas(const scalarField& YGas, const scalar T) const; + //- Gas id + virtual label idGas() const; - //- Return enthalpy for the solid mixture [energy per unit mass] - scalar HSolid(const scalarField& YSolid, const scalar T) const; + //- Liquid id + virtual label idLiquid() const; - //- Return specific heat caparcity for the gas mixture - scalar cpGas(const scalarField& YGas, const scalar T) const; - - //- Return specific heat caparcity for the liquid mixture - scalar cpLiquid - ( - const scalarField& YLiquid, - const scalar p, - const scalar T - ) const; - - //- Return specific heat caparcity for the solid mixture - scalar cpSolid(const scalarField& YSolid) const; + //- Solid id + virtual label idSolid() const; }; diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SinglePhaseMixture/SinglePhaseMixture.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SinglePhaseMixture/SinglePhaseMixture.C new file mode 100644 index 0000000000..bed2f1f94b --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SinglePhaseMixture/SinglePhaseMixture.C @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "SinglePhaseMixture.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::SinglePhaseMixture::constructIds() +{ + if (this->phaseProps().size() != 1) + { + FatalErrorIn + ( + "void Foam::SinglePhaseMixture::constructIds()" + ) << "Only one phase permitted" << nl << exit(FatalError); + } + + switch (this->phaseProps()[0].phase()) + { + case phaseProperties::GAS: + { + idGas_ = 0; + break; + } + case phaseProperties::LIQUID: + { + idLiquid_ = 0; + break; + } + case phaseProperties::SOLID: + { + idSolid_ = 0; + break; + } + default: + { + FatalErrorIn + ( + "void Foam::SinglePhaseMixture::constructIds()" + ) << "Unknown phase enumeration" << nl << abort(FatalError); + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::SinglePhaseMixture::SinglePhaseMixture +( + const dictionary& dict, + CloudType& owner +) +: + CompositionModel(dict, owner, typeName), + idGas_(-1), + idLiquid_(-1), + idSolid_(-1) +{ + constructIds(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::SinglePhaseMixture::~SinglePhaseMixture() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +const Foam::scalarField& +Foam::SinglePhaseMixture::YGas0() const +{ + notImplemented + ( + "const Foam::scalarField& " + "Foam::SinglePhaseMixture::YGas0() const" + ); + return this->phaseProps()[0].Y(); +} + + +template +const Foam::scalarField& +Foam::SinglePhaseMixture::YLiquid0() const +{ + notImplemented + ( + "const Foam::scalarField& " + "Foam::SinglePhaseMixture::YLiquid0() const" + ); + return this->phaseProps()[0].Y(); +} + + +template +const Foam::scalarField& +Foam::SinglePhaseMixture::YSolid0() const +{ + notImplemented + ( + "const Foam::scalarField& " + "Foam::SinglePhaseMixture::YSolid0() const" + ); + return this->phaseProps()[0].Y(); +} + + +template +const Foam::scalarField& +Foam::SinglePhaseMixture::YMixture0() const +{ + return this->phaseProps()[0].Y(); +} + + +template +Foam::label Foam::SinglePhaseMixture::idGas() const +{ + return idGas_; +} + + +template +Foam::label Foam::SinglePhaseMixture::idLiquid() const +{ + return idLiquid_; +} + + +template +Foam::label Foam::SinglePhaseMixture::idSolid() const +{ + return idSolid_; +} + + +// ************************************************************************* // + diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SinglePhaseMixture/SinglePhaseMixture.H b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SinglePhaseMixture/SinglePhaseMixture.H new file mode 100644 index 0000000000..91a727587d --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SinglePhaseMixture/SinglePhaseMixture.H @@ -0,0 +1,156 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::SinglePhaseMixture + +Description + Templated parcel single phase, multi-component class + +SourceFiles + SinglePhaseMixture.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SinglePhaseMixture_H +#define SinglePhaseMixture_H + +#include "CompositionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class SinglePhaseMixture Declaration +\*---------------------------------------------------------------------------*/ + +template +class SinglePhaseMixture +: + public CompositionModel +{ + // Private data + + // Indices of the phases - only 1 will be set + + //- Gas + label idGas_; + + //- Liquid + label idLiquid_; + + //- Solid + label idSolid_; + + + // Private member functions + + //- Construct the indices and check correct specification of + // 1 gas or 1 liquid or 1 solid + void constructIds(); + + +public: + + //- Runtime type information + TypeName("SinglePhaseMixture"); + + + // Constructors + + //- Construct from dictionary + SinglePhaseMixture(const dictionary& dict, CloudType& owner); + + + //- Destructor + virtual ~SinglePhaseMixture(); + + + // Member Functions + + // Access + + // Gas properties + + //- Return the list of gas mass fractions + const scalarField& YGas0() const; + + //- Return the total gas mass fraction + scalar YGasTot0() const; + + + // Liquid properties + + //- Return the list of liquid mass fractions + const scalarField& YLiquid0() const; + + //- Return the total liquid mass fraction + scalar YLiquidTot0() const; + + + // Solid properties + + //- Return the list of solid mass fractions + const scalarField& YSolid0() const; + + //- Return the total solid mass fraction + scalar YSolidTot0() const; + + + // Mixture properties + + //- Return the list of mixture mass fractions + virtual const scalarField& YMixture0() const; + + // Indices of gas, liquid and solid phases in phase properties + // list + + //- Gas id + virtual label idGas() const; + + //- Liquid id + virtual label idLiquid() const; + + //- Solid id + virtual label idSolid() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "SinglePhaseMixture.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.C index 33b328f212..791512789c 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.C @@ -58,8 +58,14 @@ bool Foam::NoPhaseChange::active() const template Foam::scalar Foam::NoPhaseChange::calculate ( + const scalar, const scalar, const scalarField&, + const scalarField&, + const vector, + const scalar, + const scalar, + const scalar, const scalar ) const { diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.H index 7f4359925f..07341719db 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.H @@ -26,7 +26,7 @@ Class Foam::NoPhaseChange Description - Dummy devolatilisation model for 'no phase change' + Dummy phase change model for 'no phase change' \*---------------------------------------------------------------------------*/ @@ -76,9 +76,15 @@ public: //- Update model scalar calculate ( - const scalar, - const scalarField&, - const scalar + const scalar T, + const scalar d, + const scalarField& Xc, + const scalarField& dMassMT, + const vector Ur, + const scalar Tc, + const scalar pc, + const scalar nuc, + const scalar dt ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H index 22ed27e080..b06506d828 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H @@ -67,6 +67,12 @@ protected: const dictionary coeffDict_; + // Protected member functions + + //- Sherwood number + scalar Sh() const; + + public: //- Runtime type information @@ -129,9 +135,15 @@ public: //- Update model virtual scalar calculate ( - const scalar dt, - const scalarField& YMixture, - const scalar T + const scalar T, + const scalar d, + const scalarField& Xc, + const scalarField& dMassMT, + const vector Ur, + const scalar Tc, + const scalar pc, + const scalar nuc, + const scalar dt ) const = 0; }; diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.C new file mode 100644 index 0000000000..792ae89c64 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.C @@ -0,0 +1,201 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "liquidEvaporation.H" +#include "specie.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +Foam::scalar Foam::liquidEvaporation::Sh +( + const scalar Re, + const scalar Sc +) const +{ + return 2.0 + 0.6*Foam::sqrt(Re)*pow(Sc, 0.333); +} + + +template +Foam::scalar Foam::liquidEvaporation::pSat +( + const label i, + const scalar T +) const +{ + const List >& pSat = pSat_[i]; + + label id = 0; + label nT = pSat.size(); + while ((id < nT) && (pSat[id].first() < T)) + { + id++; + } + + if (id == 0 || id == nT - 1) + { + return pSat[id].second(); + } + else + { + return + (pSat[id].first() - T) + /(pSat[id].first() - pSat[id-1].first()) + *(pSat[id].second() - pSat[id-1].second()) + + pSat[id-1].second(); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::liquidEvaporation::liquidEvaporation +( + const dictionary& dict, + CloudType& owner +) +: + PhaseChangeModel(dict, owner, typeName), + gases_(owner.gases()), + liquids_ + ( + liquidMixture::New + ( + owner.mesh().objectRegistry::lookupObject + ( + owner.carrierThermo().name().name() + ) + ) + ), + Tvap_(readScalar(coeffDict().lookup("Tvap"))), + Dm_(coeffDict().lookup("DiffusionCoeffs")), + pSat_(coeffDict().lookup("pSat")) +{ + if (liquids_.size() != Dm_.size()) + { + FatalErrorIn + ( + "Foam::liquidEvaporation::liquidEvaporation\n" + "(\n" + " const dictionary& dict,\n" + " CloudType& cloud\n" + ")\n" + ) << "Size of diffusionCoeffs list not equal to the number of liquid " + << "species" << nl << exit(FatalError); + } + + if (liquids_.size() != pSat_.size()) + { + FatalErrorIn + ( + "Foam::liquidEvaporation::liquidEvaporation\n" + "(\n" + " const dictionary& dict,\n" + " CloudType& cloud\n" + ")\n" + ) << "Size of saturation pressure lists not equal to the number of " + << "liquid species" << nl << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::liquidEvaporation::~liquidEvaporation() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::liquidEvaporation::active() const +{ + return true; +} + + +template +Foam::scalar Foam::liquidEvaporation::calculate +( + const scalar T, + const scalar d, + const scalarField& Xc, + const scalarField& dMassMT, + const vector Ur + const scalar Tc, + const scalar pc, + const scalar nuc + const scalar dt, +) const +{ + if (T < Tvap_) + { + // not reached temperature threshold + return 0.0; + } + else + { + // droplet area + scalar A = mathematicalConstant::pi*sqr(d); + + // universal gas constant + const scalar R = specie::RR.value(); + + // Reynolds number + scalar Re = mag(Ur)*d/(nuc + ROOTVSMALL); + + // calculate mass transfer of each specie + forAll(dMassMT, i) + { + // Schmidt number + scalar Sc = nuc/(Dm_[i] + ROOTVSMALL); + + // Sherwood number + scalar Sh = this->Sh(Re, Sc); + + // mass transfer coefficient [m/s] + scalar kc = Sh*Dm_[i]/(d + ROOTVSMALL); + + // vapour concentration at droplet surface [kgmol/m3] + scalar Cs = pSat(i, T)/(R*T); + + // vapour concentration in bulk gas [kgmol/m3] + scalar Cinf = Xc[i]*pc/(R*Tc); + + // molar flux of vapour [kgmol/m2/s] + scalar Ni = max(kc*(Cs - Cinf), 0.0); + + // mass transfer + dMassMT[i] -= Ni*A*liquids_.properies()[i].W()*dt; + } + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.H new file mode 100644 index 0000000000..efc97fecab --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.H @@ -0,0 +1,138 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::liquidEvaporation + +Description + Liquid evaporation model + +\*---------------------------------------------------------------------------*/ + +#ifndef liquidEvaporation_H +#define liquidEvaporation_H + +#include "PhaseChangeModel.H" +#include "liquidMixture.H" +#include "Tuple2.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class liquidEvaporation Declaration +\*---------------------------------------------------------------------------*/ + +template +class liquidEvaporation +: + public PhaseChangeModel +{ +protected: + + // Protected data + + //- Global liquid properties data + autoPtr liquids_; + + //- Vaporisation temperature [K] + // Local droplet temperature must exceed Tvap before evaporation is + // allowed + scalar Tvap_; + + //- Component diffusion coefficients - one per specie + // Note: need to be in same order as defined by liquids in thermo + // props + scalarList Dm_; + + //- Component saturation pressure vs temperature + List > > pSat_; + + + // Protected member functions + + //- Sherwood number as a function of Reynolds and Schmidt numbers + scalar Sh(const scalar Re, const scalar Sc) const; + + //- Return the saturation pressure for species i at temperature, T + scalar pSat(const label i, const scalar T) const; + + +public: + + //- Runtime type information + TypeName("liquidEvaporation"); + + + // Constructors + + //- Construct from dictionary + liquidEvaporation + ( + const dictionary& dict, + CloudType& cloud + ); + + + //- Destructor + virtual ~liquidEvaporation(); + + + // Member Functions + + //- Flag to indicate whether model activates phase change model + bool active() const; + + //- Update model + scalar calculate + ( + const scalar T, + const scalar d, + const scalarField& Xc, + const scalarField& dMassMT, + const vector Ur, + const scalar Tc, + const scalar pc, + const scalar nuc, + const scalar dt + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "liquidEvaporation.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.C b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.C index 64d33f815f..c94fe00d4a 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.C +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.C @@ -83,7 +83,7 @@ Foam::scalar Foam::HeatTransferModel::h const scalar muc ) const { - const scalar Re = rhoc*mag(Ur)*dp/(muc + SMALL); + const scalar Re = rhoc*mag(Ur)*dp/(muc + ROOTVSMALL); // const scalar Pr = muc/alphac; const scalar Pr = this->Pr();