diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 4d4eae98fb8dadda1548d555ee43b0a064900a65..3ad7743863f2aa85693df91bd7c4fa833c0224cb 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -341,19 +341,19 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc // Transfer mass lost from particle to carrier mass source forAll(YGas_, i) { - label id = td.cloud().composition().localToGlobalGasId(GAS, i); + label id = td.cloud().composition().localToGlobalCarrierId(GAS, i); td.cloud().rhoTrans(id)[cellI] += np0*dMassGas[i]; } forAll(YLiquid_, i) { - label id = td.cloud().composition().localToGlobalGasId(LIQ, i); + label id = td.cloud().composition().localToGlobalCarrierId(LIQ, i); td.cloud().rhoTrans(id)[cellI] += np0*dMassLiquid[i]; } /* // No mapping between solid components and carrier phase forAll(YSolid_, i) { - label id = td.cloud().composition().localToGlobalGasId(SLD, i); + label id = td.cloud().composition().localToGlobalCarrierId(SLD, i); td.cloud().rhoTrans(id)[cellI] += np0*dMassSolid[i]; } */ @@ -385,12 +385,14 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc // Absorb parcel into carrier phase forAll(YGas_, i) { - label id = td.cloud().composition().localToGlobalGasId(GAS, i); + label id = + td.cloud().composition().localToGlobalCarrierId(GAS, i); td.cloud().rhoTrans(id)[cellI] += np0*mass1*YMix[GAS]*YGas_[i]; } forAll(YLiquid_, i) { - label id = td.cloud().composition().localToGlobalGasId(LIQ, i); + label id = + td.cloud().composition().localToGlobalCarrierId(LIQ, i); td.cloud().rhoTrans(id)[cellI] += np0*mass1*YMix[LIQ]*YLiquid_[i]; } @@ -398,13 +400,14 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc // No mapping between solid components and carrier phase forAll(YSolid_, i) { - label id = td.cloud().composition().localToGlobalGasId(SLD, i); + label id = + td.cloud().composition().localToGlobalCarrierId(SLD, i); td.cloud().rhoTrans(id)[cellI] += np0*mass1*YMix[SLD]*YSolid_[i]; } */ - td.cloud().hsTrans()[cellI] += np0*mass1*H1; td.cloud().UTrans()[cellI] += np0*mass1*U1; + td.cloud().hsTrans()[cellI] += np0*mass1*H1; } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H index 9709da663d185283e29b92a9ebfa6d79e3c475f0..ef40cdc9948bfbe2e8082923f3f497424cdca541 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H @@ -104,7 +104,8 @@ inline Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel ), YGas_(YGas0), YLiquid_(YLiquid0), - YSolid_(YSolid0) + YSolid_(YSolid0), + canCombust_(false) {} diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C index b37f7c715e27ea0272a038bef14676f10384e9cd..bbf58e49a04cfd0ccf3891ea318cf5824b6d2557 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C @@ -40,7 +40,8 @@ Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel ReactingParcel<ParcelType>(cloud, is, readFields), YGas_(0), YLiquid_(0), - YSolid_(0) + YSolid_(0), + canCombust_(false) { if (readFields) { @@ -58,14 +59,7 @@ Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel YLiquid_.setSize(nLiquid); YSolid_.setSize(nSolid); - if (is.format() == IOstream::ASCII) - { - is >> YGas_ >> YLiquid_ >> YSolid_; - } - else - { - is >> YGas_ >> YLiquid_ >> YSolid_; - } + is >> YGas_ >> YLiquid_ >> YSolid_; // scale the mass fractions const scalarField& YMix = this->Y_; diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 3ea161f28f48b02eaa9452b69c59bfe243490eb3..39658fcf2f8eccfd5b615f40405e515325aaef2f 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -187,7 +187,7 @@ void Foam::ReactingParcel<ParcelType>::calc // Transfer mass lost from particle to carrier mass source forAll(dMassPC, i) { - label id = td.cloud().composition().localToGlobalGasId(0, i); + label id = td.cloud().composition().localToGlobalCarrierId(0, i); td.cloud().rhoTrans(id)[cellI] += np0*dMassPC[i]; } @@ -210,7 +210,8 @@ void Foam::ReactingParcel<ParcelType>::calc // Absorb parcel into carrier phase forAll(Y_, i) { - label id = td.cloud().composition().localToGlobalGasId(0, i); + label id = + td.cloud().composition().localToGlobalCarrierId(0, i); td.cloud().rhoTrans(id)[cellI] += np0*mass1*Y_[i]; } td.cloud().UTrans()[cellI] += np0*mass1*U1; diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C index 1da916150845d91850dd915f704cdaf20edaed87..eb451ba36f07fe864ae3f33cac1c15b0c0858d85 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C @@ -63,22 +63,22 @@ void Foam::phaseProperties::setGlobalIds } if (globalIds_[i] == -1) { - wordList globalGasNames(YGas.size()); + wordList globalCarrierNames(YGas.size()); forAll (YGas, k) { - globalGasNames[k] = YGas[k].name(); + globalCarrierNames[k] = YGas[k].name(); } FatalErrorIn ( - "void phaseProperties::setGlobalGasIds" + "void phaseProperties::setGlobalIds" "(" "const PtrList<volScalarField>&" ")" - ) << "Could not find gas species " << names_[i] + ) << "Could not find carrier species " << names_[i] << " in species list" << nl - << "Available species are: " << nl << globalGasNames << nl + << "Available species are: " << nl << globalCarrierNames << nl << exit(FatalError); } } @@ -111,11 +111,13 @@ void Foam::phaseProperties::setGlobalIds(const wordList& globalNames) } -void Foam::phaseProperties::setGlobalGasIds +void Foam::phaseProperties::setGlobalCarrierIds ( const PtrList<volScalarField>& YGas ) { + globalCarrierIds_ = -1; + forAll(names_, i) { forAll (YGas, j) @@ -124,11 +126,11 @@ void Foam::phaseProperties::setGlobalGasIds if (specieName == names_[i]) { - globalGasIds_[i] = j; + globalCarrierIds_[i] = j; break; } } - if (globalGasIds_[i] == -1) + if (globalCarrierIds_[i] == -1) { wordList gasNames(YGas.size()); forAll(YGas, gasI) @@ -138,7 +140,7 @@ void Foam::phaseProperties::setGlobalGasIds FatalErrorIn ( - "void Foam::phaseProperties::setGlobalGasIds" + "void Foam::phaseProperties::setGlobalCarrierIds" "(" "const PtrList<volScalarField>&" ")" @@ -215,7 +217,7 @@ Foam::phaseProperties::phaseProperties() names_(0), Y_(0), globalIds_(0), - globalGasIds_(0) + globalCarrierIds_(0) {} @@ -226,7 +228,7 @@ Foam::phaseProperties::phaseProperties(const phaseProperties& pp) names_(pp.names_), Y_(pp.Y_), globalIds_(pp.globalIds_), - globalGasIds_(pp.globalGasIds_) + globalCarrierIds_(pp.globalCarrierIds_) {} @@ -252,16 +254,16 @@ void Foam::phaseProperties::initialiseGlobalIds case GAS: { setGlobalIds(YGas); - forAll(globalGasIds_, i) + forAll(globalCarrierIds_, i) { - globalGasIds_[i] = globalIds_[i]; + globalCarrierIds_[i] = globalIds_[i]; } break; } case LIQUID: { setGlobalIds(liquidNames); - setGlobalGasIds(YGas); + setGlobalCarrierIds(YGas); break; } case SOLID: @@ -272,7 +274,7 @@ void Foam::phaseProperties::initialiseGlobalIds "phaseProperties::initialiseGlobalIds(...)" ) << "Assuming no mapping between solid and carrier species" << endl; -// setGlobalGasIds(YGas); +// setGlobalCarrierIds(YGas); break; } default: @@ -383,9 +385,9 @@ const Foam::labelList& Foam::phaseProperties::globalIds() const } -const Foam::labelList& Foam::phaseProperties::globalGasIds() const +const Foam::labelList& Foam::phaseProperties::globalCarrierIds() const { - return globalGasIds_; + return globalCarrierIds_; } diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H index be45bc51ca1b70702e72198687a8c179bbab6545..c87f51b7a05dd255b41c05bbed89ce4a4732472b 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H @@ -88,21 +88,21 @@ private: //- Global ids labelList globalIds_; - //- Map to gas global id - labelList globalGasIds_; + //- Map to carrier global id + labelList globalCarrierIds_; // Private member functions - //- Set global ids - specialisation for carrier gas phases + //- Set global ids - specialisation for carrier phases void setGlobalIds(const PtrList<volScalarField>& YGas); //- Set global ids - liquid and solid phases void setGlobalIds(const wordList& globalNames); - //- Set global gas ids - attempts to map component names to global + //- Set global carrier ids - attempts to map component names to global // carrier species - void setGlobalGasIds(const PtrList<volScalarField>& YGas); + void setGlobalCarrierIds(const PtrList<volScalarField>& YGas); //- Check the total mass fraction void checkTotalMassFraction() const; @@ -166,8 +166,8 @@ public: //- Return const acccess to the global ids const labelList& globalIds() const; - //- Return const acccess to the map to the gas global ids - const labelList& globalGasIds() const; + //- Return const acccess to the map to the carrier global ids + const labelList& globalCarrierIds() const; //- Return the global id of a component in the local list by name // Returns -1 if not found diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C index 18da442052b96e62bd34eaa342a95fe86318adea..2fbb79039b7366ffc5a47a28eb7ba288fc481354 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C @@ -36,7 +36,7 @@ Foam::phaseProperties::phaseProperties(Istream& is) names_(0), Y_(0), globalIds_(0), - globalGasIds_(0) + globalCarrierIds_(0) { is.check("Foam::phaseProperties::phaseProperties(Istream& is)"); @@ -51,7 +51,7 @@ Foam::phaseProperties::phaseProperties(Istream& is) names_.setSize(nComponents, "unknownSpecie"); Y_.setSize(nComponents, 0.0); globalIds_.setSize(nComponents, -1); - globalGasIds_.setSize(nComponents, -1); + globalCarrierIds_.setSize(nComponents, -1); label cmptI = 0; forAllConstIter(IDLList<entry>, phaseInfo, iter) @@ -87,7 +87,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp) pp.names_.setSize(nComponents, "unknownSpecie"); pp.Y_.setSize(nComponents, 0.0); pp.globalIds_.setSize(nComponents, -1); - pp.globalGasIds_.setSize(nComponents, -1); + pp.globalCarrierIds_.setSize(nComponents, -1); label cmptI = 0; forAllConstIter(IDLList<entry>, phaseInfo, iter) diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C index 1bbdc5221f9d8026aba434fbec0337d4ce9fffc2..4336b72baa3b282e33914f0533e0b9f3fb4f2ab0 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C @@ -178,6 +178,34 @@ Foam::CompositionModel<CloudType>::componentNames(const label phaseI) const } +template<class CloudType> +Foam::label Foam::CompositionModel<CloudType>::globalCarrierId +( + const word& cmptName +) const +{ + forAll(carrierThermo_.composition().Y(), i) + { + word carrierSpecieName = carrierThermo_.composition().Y()[i].name(); + if (cmptName == carrierSpecieName) + { + return i; + } + } + + FatalErrorIn + ( + "Foam::label Foam::CompositionModel<CloudType>::globalCarrierId" + "(" + "const word&" + ") const" + ) << "Unable to determine global id for requested component " + << cmptName << nl << abort(FatalError); + + return -1; +} + + template<class CloudType> Foam::label Foam::CompositionModel<CloudType>::globalId ( @@ -241,24 +269,25 @@ Foam::label Foam::CompositionModel<CloudType>::localId template<class CloudType> -Foam::label Foam::CompositionModel<CloudType>::localToGlobalGasId +Foam::label Foam::CompositionModel<CloudType>::localToGlobalCarrierId ( const label phaseI, const label id ) const { - label gid = phaseProps_[phaseI].globalGasIds()[id]; + label gid = phaseProps_[phaseI].globalCarrierIds()[id]; if (gid < 0) { FatalErrorIn ( - "Foam::label Foam::CompositionModel<CloudType>::localToGlobalGasId" + "Foam::label " + "Foam::CompositionModel<CloudType>::localToGlobalCarrierId" "(" "const label, " "const label" ") const" - ) << "Unable to determine global gas id for phase " + ) << "Unable to determine global carrier id for phase " << phaseI << " with local id " << id << nl << abort(FatalError); } diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H index e45f7d96d0148f2976c80ebaa27bde64edb47b42..8fb8762cf02c970feb4db9dceb8ca9e6b8050af9 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H @@ -179,6 +179,9 @@ public: //- Return the list of component names for phaseI const wordList& componentNames(const label phaseI) const; + //- Return global id of component cmptName in carrier thermo + label globalCarrierId(const word& cmptName) const; + //- Return global id of component cmptName in phase phaseI label globalId(const label phaseI, const word& cmptName) const; @@ -188,8 +191,8 @@ public: //- Return local id of component cmptName in phase phaseI label localId(const label phaseI, const word& cmptName) const; - //- Return global gas id of component given local id - label localToGlobalGasId + //- Return global carrier id of component given local id + label localToGlobalCarrierId ( const label phaseI, const label id