lagrangian: phaseProperties: Support species that don't exist in the carrier

A cloud may now contain species that do not exist within the carrier
thermodynamics. Correspondence between lagrangian and carrier components
is only required when there is phase change.
This commit is contained in:
Will Bainbridge
2021-05-12 16:01:59 +01:00
parent d53b521abf
commit 0be43e7bb6
3 changed files with 22 additions and 22 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -117,14 +117,6 @@ void Foam::phaseProperties::setCarrierIds
break;
}
}
if (carrierIds_[i] == -1)
{
FatalErrorInFunction
<< "Could not find carrier specie " << names_[i]
<< " in species list" << nl
<< "Available species are: " << nl << carrierNames << nl
<< exit(FatalError);
}
}
}
@ -233,8 +225,8 @@ void Foam::phaseProperties::reorder
// Set the list of solid species to correspond to the complete list
// defined in the thermodynamics package.
reorder(solidNames);
// Assume there is no correspondence between the solid species and
// the species in the carrier phase (no sublimation).
// Set the ids of the corresponding species in the carrier phase
setCarrierIds(gasNames);
break;
}
default:
@ -306,9 +298,17 @@ Foam::scalar& Foam::phaseProperties::Y(const label speciei)
}
const Foam::labelList& Foam::phaseProperties::carrierIds() const
Foam::label Foam::phaseProperties::carrierId(const label speciei) const
{
return carrierIds_;
if (carrierIds_[speciei] == -1)
{
FatalErrorInFunction
<< "Could not find specie " << names_[speciei]
<< " in carrier " << nl
<< exit(FatalError);
}
return carrierIds_[speciei];
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -162,8 +162,8 @@ public:
//- Return non-const access to a specie mass fraction
scalar& Y(const label speciei);
//- Return const access to the map to the carrier ids
const labelList& carrierIds() const;
//- Return the carrier id for a given specie
label carrierId(const label speciei) const;
//- Return the id of a specie in the local list by name
// Returns -1 if not found

View File

@ -237,7 +237,7 @@ Foam::label Foam::CompositionModel<CloudType>::localToCarrierId
const bool allowNotFound
) const
{
label cid = phaseProps_[phasei].carrierIds()[id];
label cid = phaseProps_[phasei].carrierId(id);
if (cid < 0 && !allowNotFound)
{
@ -277,7 +277,7 @@ Foam::scalarField Foam::CompositionModel<CloudType>::X
{
forAll(Y, i)
{
label cid = props.carrierIds()[i];
label cid = props.carrierId(i);
X[i] = Y[i]/carrierMixture_->Wi(cid);
WInv += X[i];
}
@ -323,7 +323,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::H
{
forAll(Y, i)
{
label cid = props.carrierIds()[i];
label cid = props.carrierId(i);
HMixture += Y[i]*carrierMixture_->Ha(cid, p, T);
}
break;
@ -372,7 +372,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hs
{
forAll(Y, i)
{
label cid = props.carrierIds()[i];
label cid = props.carrierId(i);
HsMixture += Y[i]*carrierMixture_->Hs(cid, p, T);
}
break;
@ -423,7 +423,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hc
{
forAll(Y, i)
{
label cid = props.carrierIds()[i];
label cid = props.carrierId(i);
HcMixture += Y[i]*carrierMixture_->Hf(cid);
}
break;
@ -473,7 +473,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Cp
{
forAll(Y, i)
{
label cid = props.carrierIds()[i];
label cid = props.carrierId(i);
CpMixture += Y[i]*carrierMixture_->Cp(cid, p, T);
}
break;