Commit 3efc299d authored by Andrew Heather's avatar Andrew Heather
Browse files

multiple updates

parent bbb9e523
......@@ -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;
}
}
......
......@@ -104,7 +104,8 @@ inline Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel
),
YGas_(YGas0),
YLiquid_(YLiquid0),
YSolid_(YSolid0)
YSolid_(YSolid0),
canCombust_(false)
{}
......
......@@ -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_;
......
......@@ -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;
......
......@@ -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_;
}
......
......@@ -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
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment