lagrangian: Rationalized the handling of multi-component liquids and solids
Ensures consistency between the mixture thermodynamics and composition specifications for the parcels. Simpler more efficient implementation. Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1395 as well as other consistency issues not yet reported.
This commit is contained in:
parent
a7cdf0c713
commit
6c0cc89cf5
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -41,8 +41,8 @@ Foam::COxidationDiffusionLimitedRate<CloudType>::COxidationDiffusionLimitedRate
|
|||||||
Sb_(readScalar(this->coeffDict().lookup("Sb"))),
|
Sb_(readScalar(this->coeffDict().lookup("Sb"))),
|
||||||
D_(readScalar(this->coeffDict().lookup("D"))),
|
D_(readScalar(this->coeffDict().lookup("D"))),
|
||||||
CsLocalId_(-1),
|
CsLocalId_(-1),
|
||||||
O2GlobalId_(owner.composition().globalCarrierId("O2")),
|
O2GlobalId_(owner.composition().carrierId("O2")),
|
||||||
CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
|
CO2GlobalId_(owner.composition().carrierId("CO2")),
|
||||||
WC_(0.0),
|
WC_(0.0),
|
||||||
WO2_(0.0),
|
WO2_(0.0),
|
||||||
HcCO2_(0.0)
|
HcCO2_(0.0)
|
||||||
|
@ -39,8 +39,8 @@ Foam::COxidationHurtMitchell<CloudType>::COxidationHurtMitchell
|
|||||||
Sb_(readScalar(this->coeffDict().lookup("Sb"))),
|
Sb_(readScalar(this->coeffDict().lookup("Sb"))),
|
||||||
CsLocalId_(-1),
|
CsLocalId_(-1),
|
||||||
ashLocalId_(-1),
|
ashLocalId_(-1),
|
||||||
O2GlobalId_(owner.composition().globalCarrierId("O2")),
|
O2GlobalId_(owner.composition().carrierId("O2")),
|
||||||
CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
|
CO2GlobalId_(owner.composition().carrierId("CO2")),
|
||||||
WC_(0.0),
|
WC_(0.0),
|
||||||
WO2_(0.0),
|
WO2_(0.0),
|
||||||
HcCO2_(0.0),
|
HcCO2_(0.0),
|
||||||
|
@ -47,8 +47,8 @@ Foam::COxidationIntrinsicRate<CloudType>::COxidationIntrinsicRate
|
|||||||
Ag_(readScalar(this->coeffDict().lookup("Ag"))),
|
Ag_(readScalar(this->coeffDict().lookup("Ag"))),
|
||||||
tau_(this->coeffDict().lookupOrDefault("tau", sqrt(2.0))),
|
tau_(this->coeffDict().lookupOrDefault("tau", sqrt(2.0))),
|
||||||
CsLocalId_(-1),
|
CsLocalId_(-1),
|
||||||
O2GlobalId_(owner.composition().globalCarrierId("O2")),
|
O2GlobalId_(owner.composition().carrierId("O2")),
|
||||||
CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
|
CO2GlobalId_(owner.composition().carrierId("CO2")),
|
||||||
WC_(0.0),
|
WC_(0.0),
|
||||||
WO2_(0.0),
|
WO2_(0.0),
|
||||||
HcCO2_(0.0)
|
HcCO2_(0.0)
|
||||||
|
@ -42,8 +42,8 @@ COxidationKineticDiffusionLimitedRate
|
|||||||
C2_(readScalar(this->coeffDict().lookup("C2"))),
|
C2_(readScalar(this->coeffDict().lookup("C2"))),
|
||||||
E_(readScalar(this->coeffDict().lookup("E"))),
|
E_(readScalar(this->coeffDict().lookup("E"))),
|
||||||
CsLocalId_(-1),
|
CsLocalId_(-1),
|
||||||
O2GlobalId_(owner.composition().globalCarrierId("O2")),
|
O2GlobalId_(owner.composition().carrierId("O2")),
|
||||||
CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
|
CO2GlobalId_(owner.composition().carrierId("CO2")),
|
||||||
WC_(0.0),
|
WC_(0.0),
|
||||||
WO2_(0.0),
|
WO2_(0.0),
|
||||||
HcCO2_(0.0)
|
HcCO2_(0.0)
|
||||||
|
@ -54,8 +54,8 @@ Foam::COxidationMurphyShaddix<CloudType>::COxidationMurphyShaddix
|
|||||||
n_(readScalar(this->coeffDict().lookup("n"))),
|
n_(readScalar(this->coeffDict().lookup("n"))),
|
||||||
WVol_(readScalar(this->coeffDict().lookup("WVol"))),
|
WVol_(readScalar(this->coeffDict().lookup("WVol"))),
|
||||||
CsLocalId_(-1),
|
CsLocalId_(-1),
|
||||||
O2GlobalId_(owner.composition().globalCarrierId("O2")),
|
O2GlobalId_(owner.composition().carrierId("O2")),
|
||||||
CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
|
CO2GlobalId_(owner.composition().carrierId("CO2")),
|
||||||
WC_(0.0),
|
WC_(0.0),
|
||||||
WO2_(0.0),
|
WO2_(0.0),
|
||||||
HcCO2_(0.0)
|
HcCO2_(0.0)
|
||||||
|
@ -352,19 +352,19 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
|
|||||||
// Absorb parcel into carrier phase
|
// Absorb parcel into carrier phase
|
||||||
forAll(YGas_, i)
|
forAll(YGas_, i)
|
||||||
{
|
{
|
||||||
label gid = composition.localToGlobalCarrierId(GAS, i);
|
label gid = composition.localToCarrierId(GAS, i);
|
||||||
td.cloud().rhoTrans(gid)[cellI] += dm*YMix[GAS]*YGas_[i];
|
td.cloud().rhoTrans(gid)[cellI] += dm*YMix[GAS]*YGas_[i];
|
||||||
}
|
}
|
||||||
forAll(YLiquid_, i)
|
forAll(YLiquid_, i)
|
||||||
{
|
{
|
||||||
label gid = composition.localToGlobalCarrierId(LIQ, i);
|
label gid = composition.localToCarrierId(LIQ, i);
|
||||||
td.cloud().rhoTrans(gid)[cellI] += dm*YMix[LIQ]*YLiquid_[i];
|
td.cloud().rhoTrans(gid)[cellI] += dm*YMix[LIQ]*YLiquid_[i];
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// No mapping between solid components and carrier phase
|
// No mapping between solid components and carrier phase
|
||||||
forAll(YSolid_, i)
|
forAll(YSolid_, i)
|
||||||
{
|
{
|
||||||
label gid = composition.localToGlobalCarrierId(SLD, i);
|
label gid = composition.localToCarrierId(SLD, i);
|
||||||
td.cloud().rhoTrans(gid)[cellI] += dm*YMix[SLD]*YSolid_[i];
|
td.cloud().rhoTrans(gid)[cellI] += dm*YMix[SLD]*YSolid_[i];
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -426,7 +426,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
|
|||||||
forAll(YGas_, i)
|
forAll(YGas_, i)
|
||||||
{
|
{
|
||||||
scalar dm = np0*dMassGas[i];
|
scalar dm = np0*dMassGas[i];
|
||||||
label gid = composition.localToGlobalCarrierId(GAS, i);
|
label gid = composition.localToCarrierId(GAS, i);
|
||||||
scalar hs = composition.carrier().Hs(gid, pc, T0);
|
scalar hs = composition.carrier().Hs(gid, pc, T0);
|
||||||
td.cloud().rhoTrans(gid)[cellI] += dm;
|
td.cloud().rhoTrans(gid)[cellI] += dm;
|
||||||
td.cloud().UTrans()[cellI] += dm*U0;
|
td.cloud().UTrans()[cellI] += dm*U0;
|
||||||
@ -435,7 +435,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
|
|||||||
forAll(YLiquid_, i)
|
forAll(YLiquid_, i)
|
||||||
{
|
{
|
||||||
scalar dm = np0*dMassLiquid[i];
|
scalar dm = np0*dMassLiquid[i];
|
||||||
label gid = composition.localToGlobalCarrierId(LIQ, i);
|
label gid = composition.localToCarrierId(LIQ, i);
|
||||||
scalar hs = composition.carrier().Hs(gid, pc, T0);
|
scalar hs = composition.carrier().Hs(gid, pc, T0);
|
||||||
td.cloud().rhoTrans(gid)[cellI] += dm;
|
td.cloud().rhoTrans(gid)[cellI] += dm;
|
||||||
td.cloud().UTrans()[cellI] += dm*U0;
|
td.cloud().UTrans()[cellI] += dm*U0;
|
||||||
@ -446,7 +446,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
|
|||||||
forAll(YSolid_, i)
|
forAll(YSolid_, i)
|
||||||
{
|
{
|
||||||
scalar dm = np0*dMassSolid[i];
|
scalar dm = np0*dMassSolid[i];
|
||||||
label gid = composition.localToGlobalCarrierId(SLD, i);
|
label gid = composition.localToCarrierId(SLD, i);
|
||||||
scalar hs = composition.carrier().Hs(gid, pc, T0);
|
scalar hs = composition.carrier().Hs(gid, pc, T0);
|
||||||
td.cloud().rhoTrans(gid)[cellI] += dm;
|
td.cloud().rhoTrans(gid)[cellI] += dm;
|
||||||
td.cloud().UTrans()[cellI] += dm*U0;
|
td.cloud().UTrans()[cellI] += dm*U0;
|
||||||
@ -565,7 +565,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
|
|||||||
|
|
||||||
forAll(dMassDV, i)
|
forAll(dMassDV, i)
|
||||||
{
|
{
|
||||||
const label id = composition.localToGlobalCarrierId(GAS, i);
|
const label id = composition.localToCarrierId(GAS, i);
|
||||||
const scalar Cp = composition.carrier().Cp(id, this->pc_, Ts);
|
const scalar Cp = composition.carrier().Cp(id, this->pc_, Ts);
|
||||||
const scalar W = composition.carrier().W(id);
|
const scalar W = composition.carrier().W(id);
|
||||||
const scalar Ni = dMassDV[i]/(this->areaS(d)*dt*W);
|
const scalar Ni = dMassDV[i]/(this->areaS(d)*dt*W);
|
||||||
|
@ -49,7 +49,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
|
|||||||
const scalar mass,
|
const scalar mass,
|
||||||
const label idPhase,
|
const label idPhase,
|
||||||
const scalar YPhase,
|
const scalar YPhase,
|
||||||
const scalarField& YComponents,
|
const scalarField& Y,
|
||||||
scalarField& dMassPC,
|
scalarField& dMassPC,
|
||||||
scalar& Sh,
|
scalar& Sh,
|
||||||
scalar& N,
|
scalar& N,
|
||||||
@ -58,6 +58,8 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
|
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
|
||||||
|
const CompositionModel<reactingCloudType>& composition =
|
||||||
|
td.cloud().composition();
|
||||||
PhaseChangeModel<reactingCloudType>& phaseChange = td.cloud().phaseChange();
|
PhaseChangeModel<reactingCloudType>& phaseChange = td.cloud().phaseChange();
|
||||||
|
|
||||||
if (!phaseChange.active() || (YPhase < SMALL))
|
if (!phaseChange.active() || (YPhase < SMALL))
|
||||||
@ -65,17 +67,21 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar Tvap = phaseChange.Tvap(YComponents);
|
scalarField X(composition.liquids().X(Y));
|
||||||
|
|
||||||
|
scalar Tvap = phaseChange.Tvap(X);
|
||||||
|
|
||||||
if (T < Tvap)
|
if (T < Tvap)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar TMax = phaseChange.TMax(pc_, YComponents);
|
const scalar TMax = phaseChange.TMax(pc_, X);
|
||||||
const scalar Tdash = min(T, TMax);
|
const scalar Tdash = min(T, TMax);
|
||||||
const scalar Tsdash = min(Ts, TMax);
|
const scalar Tsdash = min(Ts, TMax);
|
||||||
|
|
||||||
|
scalarField hmm(dMassPC);
|
||||||
|
|
||||||
// Calculate mass transfer due to phase change
|
// Calculate mass transfer due to phase change
|
||||||
phaseChange.calculate
|
phaseChange.calculate
|
||||||
(
|
(
|
||||||
@ -89,27 +95,23 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
|
|||||||
Tsdash,
|
Tsdash,
|
||||||
pc_,
|
pc_,
|
||||||
this->Tc_,
|
this->Tc_,
|
||||||
YComponents,
|
X,
|
||||||
dMassPC
|
dMassPC
|
||||||
);
|
);
|
||||||
|
|
||||||
// Limit phase change mass by availability of each specie
|
// Limit phase change mass by availability of each specie
|
||||||
dMassPC = min(mass*YPhase*YComponents, dMassPC);
|
dMassPC = min(mass*YPhase*Y, dMassPC);
|
||||||
|
|
||||||
const scalar dMassTot = sum(dMassPC);
|
const scalar dMassTot = sum(dMassPC);
|
||||||
|
|
||||||
// Add to cumulative phase change mass
|
// Add to cumulative phase change mass
|
||||||
phaseChange.addToPhaseChangeMass(this->nParticle_*dMassTot);
|
phaseChange.addToPhaseChangeMass(this->nParticle_*dMassTot);
|
||||||
|
|
||||||
const CompositionModel<reactingCloudType>& composition =
|
|
||||||
td.cloud().composition();
|
|
||||||
|
|
||||||
forAll(dMassPC, i)
|
forAll(dMassPC, i)
|
||||||
{
|
{
|
||||||
const label idc = composition.localToGlobalCarrierId(idPhase, i);
|
const label cid = composition.localToCarrierId(idPhase, i);
|
||||||
const label idl = composition.globalIds(idPhase)[i];
|
|
||||||
|
|
||||||
const scalar dh = phaseChange.dh(idc, idl, pc_, Tdash);
|
const scalar dh = phaseChange.dh(cid, i, pc_, Tdash);
|
||||||
Sh -= dMassPC[i]*dh/dt;
|
Sh -= dMassPC[i]*dh/dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,15 +124,14 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
|
|||||||
|
|
||||||
forAll(dMassPC, i)
|
forAll(dMassPC, i)
|
||||||
{
|
{
|
||||||
const label idc = composition.localToGlobalCarrierId(idPhase, i);
|
const label cid = composition.localToCarrierId(idPhase, i);
|
||||||
const label idl = composition.globalIds(idPhase)[i];
|
|
||||||
|
|
||||||
const scalar Cp = composition.carrier().Cp(idc, pc_, Tsdash);
|
const scalar Cp = composition.carrier().Cp(cid, pc_, Tsdash);
|
||||||
const scalar W = composition.carrier().W(idc);
|
const scalar W = composition.carrier().W(cid);
|
||||||
const scalar Ni = dMassPC[i]/(this->areaS(d)*dt*W);
|
const scalar Ni = dMassPC[i]/(this->areaS(d)*dt*W);
|
||||||
|
|
||||||
const scalar Dab =
|
const scalar Dab =
|
||||||
composition.liquids().properties()[idl].D(pc_, Tsdash, Wc);
|
composition.liquids().properties()[i].D(pc_, Tsdash, Wc);
|
||||||
|
|
||||||
// Molar flux of species coming from the particle (kmol/m^2/s)
|
// Molar flux of species coming from the particle (kmol/m^2/s)
|
||||||
N += Ni;
|
N += Ni;
|
||||||
@ -139,7 +140,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
|
|||||||
NCpW += Ni*Cp*W;
|
NCpW += Ni*Cp*W;
|
||||||
|
|
||||||
// Concentrations of emission species
|
// Concentrations of emission species
|
||||||
Cs[idc] += Ni*d/(2.0*Dab);
|
Cs[cid] += Ni*d/(2.0*Dab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,7 +527,7 @@ void Foam::ReactingParcel<ParcelType>::calc
|
|||||||
forAll(Y_, i)
|
forAll(Y_, i)
|
||||||
{
|
{
|
||||||
scalar dmi = dm*Y_[i];
|
scalar dmi = dm*Y_[i];
|
||||||
label gid = composition.localToGlobalCarrierId(0, i);
|
label gid = composition.localToCarrierId(0, i);
|
||||||
scalar hs = composition.carrier().Hs(gid, pc_, T0);
|
scalar hs = composition.carrier().Hs(gid, pc_, T0);
|
||||||
|
|
||||||
td.cloud().rhoTrans(gid)[cellI] += dmi;
|
td.cloud().rhoTrans(gid)[cellI] += dmi;
|
||||||
@ -587,7 +588,7 @@ void Foam::ReactingParcel<ParcelType>::calc
|
|||||||
forAll(dMass, i)
|
forAll(dMass, i)
|
||||||
{
|
{
|
||||||
scalar dm = np0*dMass[i];
|
scalar dm = np0*dMass[i];
|
||||||
label gid = composition.localToGlobalCarrierId(0, i);
|
label gid = composition.localToCarrierId(0, i);
|
||||||
scalar hs = composition.carrier().Hs(gid, pc_, T0);
|
scalar hs = composition.carrier().Hs(gid, pc_, T0);
|
||||||
|
|
||||||
td.cloud().rhoTrans(gid)[cellI] += dm;
|
td.cloud().rhoTrans(gid)[cellI] += dm;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -44,43 +44,62 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>
|
const Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>
|
||||||
Foam::phaseProperties::phaseTypeNames_;
|
Foam::phaseProperties::phaseTypeNames;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::phaseProperties::setGlobalIds(const wordList& globalNames)
|
void Foam::phaseProperties::reorder(const wordList& specieNames)
|
||||||
{
|
{
|
||||||
|
if (names_.size() != specieNames.size())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void phaseProperties::reorder(const wordList& specieNames)"
|
||||||
|
) << "Number of specie specifications "
|
||||||
|
<< names_.size() << nl
|
||||||
|
<< " is not equal to the number of species "
|
||||||
|
<< specieNames.size()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<word> names0(names_);
|
||||||
|
scalarField Y0(Y_);
|
||||||
|
|
||||||
|
names_ = specieNames;
|
||||||
|
|
||||||
forAll(names_, i)
|
forAll(names_, i)
|
||||||
{
|
{
|
||||||
forAll(globalNames, j)
|
bool found = false;
|
||||||
|
forAll(names0, j)
|
||||||
{
|
{
|
||||||
if (globalNames[j] == names_[i])
|
if (names0[j] == names_[i])
|
||||||
{
|
{
|
||||||
globalIds_[i] = j;
|
Y_[i] = Y0[j];
|
||||||
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (globalIds_[i] == -1)
|
|
||||||
|
if (!found)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"void Foam::phaseProperties::setGlobalIds(const wordList&)"
|
"void phaseProperties::reorder(const wordList&)"
|
||||||
) << "Could not find specie " << names_[i]
|
) << "Could not find specie " << names_[i]
|
||||||
<< " in species list" << nl
|
<< " in species properties " << names0
|
||||||
<< "Available species are: " << nl << globalNames << nl
|
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::phaseProperties::setGlobalCarrierIds
|
void Foam::phaseProperties::setCarrierIds
|
||||||
(
|
(
|
||||||
const wordList& carrierNames
|
const wordList& carrierNames
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
globalCarrierIds_ = -1;
|
carrierIds_ = -1;
|
||||||
|
|
||||||
forAll(names_, i)
|
forAll(names_, i)
|
||||||
{
|
{
|
||||||
@ -88,18 +107,16 @@ void Foam::phaseProperties::setGlobalCarrierIds
|
|||||||
{
|
{
|
||||||
if (carrierNames[j] == names_[i])
|
if (carrierNames[j] == names_[i])
|
||||||
{
|
{
|
||||||
globalCarrierIds_[i] = j;
|
carrierIds_[i] = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (globalCarrierIds_[i] == -1)
|
if (carrierIds_[i] == -1)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"void Foam::phaseProperties::setGlobalCarrierIds"
|
"void phaseProperties::setCarrierIds"
|
||||||
"("
|
"(const wordList& carrierNames)"
|
||||||
"const wordList&"
|
|
||||||
")"
|
|
||||||
) << "Could not find carrier specie " << names_[i]
|
) << "Could not find carrier specie " << names_[i]
|
||||||
<< " in species list" << nl
|
<< " in species list" << nl
|
||||||
<< "Available species are: " << nl << carrierNames << nl
|
<< "Available species are: " << nl << carrierNames << nl
|
||||||
@ -121,10 +138,11 @@ void Foam::phaseProperties::checkTotalMassFraction() const
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"void Foam::phaseProperties::checkTotalMassFraction() const"
|
"void phaseProperties::checkTotalMassFraction() const"
|
||||||
) << "Component fractions must total to unity for phase "
|
) << "Component fractions must total to unity for phase "
|
||||||
<< phaseTypeNames_[phase_] << nl
|
<< phaseTypeNames[phase_] << nl
|
||||||
<< "Components: " << nl << names_ << nl << exit(FatalError);
|
<< "Components: " << nl << names_ << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,8 +171,8 @@ Foam::word Foam::phaseProperties::phaseToStateLabel(const phaseType pt) const
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::phaseProperties::phaseToStateLabel(phaseType pt)"
|
"phaseProperties::phaseToStateLabel(phaseType pt)"
|
||||||
) << "Invalid phase: " << phaseTypeNames_[pt] << nl
|
) << "Invalid phase: " << phaseTypeNames[pt] << nl
|
||||||
<< " phase must be gas, liquid or solid" << nl
|
<< " phase must be gas, liquid or solid" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -172,8 +190,7 @@ Foam::phaseProperties::phaseProperties()
|
|||||||
stateLabel_("(unknown)"),
|
stateLabel_("(unknown)"),
|
||||||
names_(0),
|
names_(0),
|
||||||
Y_(0),
|
Y_(0),
|
||||||
globalIds_(0),
|
carrierIds_(0)
|
||||||
globalCarrierIds_(0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -183,8 +200,7 @@ Foam::phaseProperties::phaseProperties(const phaseProperties& pp)
|
|||||||
stateLabel_(pp.stateLabel_),
|
stateLabel_(pp.stateLabel_),
|
||||||
names_(pp.names_),
|
names_(pp.names_),
|
||||||
Y_(pp.Y_),
|
Y_(pp.Y_),
|
||||||
globalIds_(pp.globalIds_),
|
carrierIds_(pp.carrierIds_)
|
||||||
globalCarrierIds_(pp.globalCarrierIds_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -196,54 +212,58 @@ Foam::phaseProperties::~phaseProperties()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::phaseProperties::initialiseGlobalIds
|
void Foam::phaseProperties::reorder
|
||||||
(
|
(
|
||||||
const wordList& gasNames,
|
const wordList& gasNames,
|
||||||
const wordList& liquidNames,
|
const wordList& liquidNames,
|
||||||
const wordList& solidNames
|
const wordList& solidNames
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// determine the addressing to map between components listed in the phase
|
// Determine the addressing to map between components listed in the phase
|
||||||
// with those given in the (main) thermo properties
|
// with those given in the (main) thermo properties
|
||||||
switch (phase_)
|
switch (phase_)
|
||||||
{
|
{
|
||||||
case GAS:
|
case GAS:
|
||||||
{
|
{
|
||||||
setGlobalIds(gasNames);
|
reorder(gasNames);
|
||||||
forAll(globalCarrierIds_, i)
|
forAll(carrierIds_, i)
|
||||||
{
|
{
|
||||||
globalCarrierIds_[i] = globalIds_[i];
|
carrierIds_[i] = i;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LIQUID:
|
case LIQUID:
|
||||||
{
|
{
|
||||||
setGlobalIds(liquidNames);
|
reorder(liquidNames);
|
||||||
setGlobalCarrierIds(gasNames);
|
setCarrierIds(gasNames);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SOLID:
|
case SOLID:
|
||||||
{
|
{
|
||||||
setGlobalIds(solidNames);
|
reorder(solidNames);
|
||||||
WarningIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"phaseProperties::initialiseGlobalIds(...)"
|
"phaseProperties::reorder"
|
||||||
|
"("
|
||||||
|
"const wordList& gasNames, "
|
||||||
|
"const wordList& liquidNames, "
|
||||||
|
"const wordList& solidNames"
|
||||||
|
")"
|
||||||
) << "Assuming no mapping between solid and carrier species"
|
) << "Assuming no mapping between solid and carrier species"
|
||||||
<< endl;
|
<< endl;
|
||||||
// setGlobalCarrierIds(gasNames);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::phaseProperties::setGlobalIds"
|
"phaseProperties::reorder"
|
||||||
"("
|
"("
|
||||||
"const PtrList<volScalarField>&, "
|
"const wordList& gasNames, "
|
||||||
"const wordList&, "
|
"const wordList& liquidNames, "
|
||||||
"const wordList&"
|
"const wordList& solidNames"
|
||||||
")"
|
")"
|
||||||
) << "Invalid phase: " << phaseTypeNames_[phase_] << nl
|
) << "Invalid phase: " << phaseTypeNames[phase_] << nl
|
||||||
<< " phase must be gas, liquid or solid" << nl
|
<< " phase must be gas, liquid or solid" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -265,7 +285,7 @@ const Foam::word& Foam::phaseProperties::stateLabel() const
|
|||||||
|
|
||||||
Foam::word Foam::phaseProperties::phaseTypeName() const
|
Foam::word Foam::phaseProperties::phaseTypeName() const
|
||||||
{
|
{
|
||||||
return phaseTypeNames_[phase_];
|
return phaseTypeNames[phase_];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -281,10 +301,7 @@ const Foam::word& Foam::phaseProperties::name(const label cmptI) const
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"const Foam::word& Foam::phaseProperties::name"
|
"const word& phaseProperties::name(const label) const"
|
||||||
"("
|
|
||||||
"const label"
|
|
||||||
") const"
|
|
||||||
) << "Requested component " << cmptI << "out of range" << nl
|
) << "Requested component " << cmptI << "out of range" << nl
|
||||||
<< "Available phase components:" << nl << names_ << nl
|
<< "Available phase components:" << nl << names_ << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -306,10 +323,7 @@ Foam::scalar& Foam::phaseProperties::Y(const label cmptI)
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"const Foam::scalar& Foam::phaseProperties::Y"
|
"const scalar& phaseProperties::Y(const label) const"
|
||||||
"("
|
|
||||||
"const label"
|
|
||||||
") const"
|
|
||||||
) << "Requested component " << cmptI << "out of range" << nl
|
) << "Requested component " << cmptI << "out of range" << nl
|
||||||
<< "Available phase components:" << nl << names_ << nl
|
<< "Available phase components:" << nl << names_ << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -319,31 +333,9 @@ Foam::scalar& Foam::phaseProperties::Y(const label cmptI)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::phaseProperties::globalId(const word& cmptName) const
|
const Foam::labelList& Foam::phaseProperties::carrierIds() const
|
||||||
{
|
{
|
||||||
label id = this->id(cmptName);
|
return carrierIds_;
|
||||||
|
|
||||||
if (id < 0)
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return globalIds_[id];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::labelList& Foam::phaseProperties::globalIds() const
|
|
||||||
{
|
|
||||||
return globalIds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::labelList& Foam::phaseProperties::globalCarrierIds() const
|
|
||||||
{
|
|
||||||
return globalCarrierIds_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -362,4 +354,3 @@ Foam::label Foam::phaseProperties::id(const word& cmptName) const
|
|||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Corresponding word representations for phase type enumerations
|
//- Corresponding word representations for phase type enumerations
|
||||||
static const NamedEnum<phaseType, 4> phaseTypeNames_;
|
static const NamedEnum<phaseType, 4> phaseTypeNames;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -85,21 +85,17 @@ private:
|
|||||||
//- List of component mass fractions
|
//- List of component mass fractions
|
||||||
scalarField Y_;
|
scalarField Y_;
|
||||||
|
|
||||||
//- Global ids
|
//- Map to carrier id
|
||||||
labelList globalIds_;
|
labelList carrierIds_;
|
||||||
|
|
||||||
//- Map to carrier global id
|
|
||||||
labelList globalCarrierIds_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Set global ids
|
//- Reorder species to be consistent with the given specie name list
|
||||||
void setGlobalIds(const wordList& globalNames);
|
void reorder(const wordList& specieNames);
|
||||||
|
|
||||||
//- Set global carrier ids - attempts to map component names to global
|
//- Set carrier ids
|
||||||
// carrier species
|
void setCarrierIds(const wordList& carrierNames);
|
||||||
void setGlobalCarrierIds(const wordList& carrierNames);
|
|
||||||
|
|
||||||
//- Check the total mass fraction
|
//- Check the total mass fraction
|
||||||
void checkTotalMassFraction() const;
|
void checkTotalMassFraction() const;
|
||||||
@ -128,8 +124,9 @@ public:
|
|||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Initialise the global ids
|
//- Reorder species to be consistent with the corresponding
|
||||||
void initialiseGlobalIds
|
// phase specie name list
|
||||||
|
void reorder
|
||||||
(
|
(
|
||||||
const wordList& gasNames,
|
const wordList& gasNames,
|
||||||
const wordList& liquidNames,
|
const wordList& liquidNames,
|
||||||
@ -160,15 +157,8 @@ public:
|
|||||||
//- Return non-const access to a component mass fraction
|
//- Return non-const access to a component mass fraction
|
||||||
scalar& Y(const label cmptI);
|
scalar& Y(const label cmptI);
|
||||||
|
|
||||||
//- Return const access to the global ids
|
//- Return const access to the map to the carrier ids
|
||||||
const labelList& globalIds() const;
|
const labelList& carrierIds() const;
|
||||||
|
|
||||||
//- Return const access 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
|
|
||||||
label globalId(const word& cmptName) const;
|
|
||||||
|
|
||||||
//- Return the id of a component in the local list by name
|
//- Return the id of a component in the local list by name
|
||||||
// Returns -1 if not found
|
// Returns -1 if not found
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -34,14 +34,13 @@ Foam::phaseProperties::phaseProperties(Istream& is)
|
|||||||
stateLabel_("(unknown)"),
|
stateLabel_("(unknown)"),
|
||||||
names_(0),
|
names_(0),
|
||||||
Y_(0),
|
Y_(0),
|
||||||
globalIds_(0),
|
carrierIds_(0)
|
||||||
globalCarrierIds_(0)
|
|
||||||
{
|
{
|
||||||
is.check("Foam::phaseProperties::phaseProperties(Istream& is)");
|
is.check("Foam::phaseProperties::phaseProperties(Istream& is)");
|
||||||
|
|
||||||
dictionaryEntry phaseInfo(dictionary::null, is);
|
dictionaryEntry phaseInfo(dictionary::null, is);
|
||||||
|
|
||||||
phase_ = phaseTypeNames_[phaseInfo.keyword()];
|
phase_ = phaseTypeNames[phaseInfo.keyword()];
|
||||||
stateLabel_ = phaseToStateLabel(phase_);
|
stateLabel_ = phaseToStateLabel(phase_);
|
||||||
|
|
||||||
if (phaseInfo.size() > 0)
|
if (phaseInfo.size() > 0)
|
||||||
@ -49,8 +48,7 @@ Foam::phaseProperties::phaseProperties(Istream& is)
|
|||||||
label nComponents = phaseInfo.size();
|
label nComponents = phaseInfo.size();
|
||||||
names_.setSize(nComponents, "unknownSpecie");
|
names_.setSize(nComponents, "unknownSpecie");
|
||||||
Y_.setSize(nComponents, 0.0);
|
Y_.setSize(nComponents, 0.0);
|
||||||
globalIds_.setSize(nComponents, -1);
|
carrierIds_.setSize(nComponents, -1);
|
||||||
globalCarrierIds_.setSize(nComponents, -1);
|
|
||||||
|
|
||||||
label cmptI = 0;
|
label cmptI = 0;
|
||||||
forAllConstIter(IDLList<entry>, phaseInfo, iter)
|
forAllConstIter(IDLList<entry>, phaseInfo, iter)
|
||||||
@ -76,7 +74,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)
|
|||||||
|
|
||||||
dictionaryEntry phaseInfo(dictionary::null, is);
|
dictionaryEntry phaseInfo(dictionary::null, is);
|
||||||
|
|
||||||
pp.phase_ = pp.phaseTypeNames_[phaseInfo.keyword()];
|
pp.phase_ = pp.phaseTypeNames[phaseInfo.keyword()];
|
||||||
pp.stateLabel_ = pp.phaseToStateLabel(pp.phase_);
|
pp.stateLabel_ = pp.phaseToStateLabel(pp.phase_);
|
||||||
|
|
||||||
if (phaseInfo.size() > 0)
|
if (phaseInfo.size() > 0)
|
||||||
@ -85,8 +83,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)
|
|||||||
|
|
||||||
pp.names_.setSize(nComponents, "unknownSpecie");
|
pp.names_.setSize(nComponents, "unknownSpecie");
|
||||||
pp.Y_.setSize(nComponents, 0.0);
|
pp.Y_.setSize(nComponents, 0.0);
|
||||||
pp.globalIds_.setSize(nComponents, -1);
|
pp.carrierIds_.setSize(nComponents, -1);
|
||||||
pp.globalCarrierIds_.setSize(nComponents, -1);
|
|
||||||
|
|
||||||
label cmptI = 0;
|
label cmptI = 0;
|
||||||
forAllConstIter(IDLList<entry>, phaseInfo, iter)
|
forAllConstIter(IDLList<entry>, phaseInfo, iter)
|
||||||
@ -110,7 +107,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const phaseProperties& pp)
|
|||||||
"Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
|
"Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
|
||||||
);
|
);
|
||||||
|
|
||||||
os << pp.phaseTypeNames_[pp.phase_] << nl << token::BEGIN_BLOCK << nl
|
os << pp.phaseTypeNames[pp.phase_] << nl << token::BEGIN_BLOCK << nl
|
||||||
<< incrIndent;
|
<< incrIndent;
|
||||||
|
|
||||||
forAll(pp.names_, cmptI)
|
forAll(pp.names_, cmptI)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -49,7 +49,7 @@ Foam::phasePropertiesList::phasePropertiesList
|
|||||||
{
|
{
|
||||||
forAll(props_, i)
|
forAll(props_, i)
|
||||||
{
|
{
|
||||||
props_[i].initialiseGlobalIds(gasNames, liquidNames, solidNames);
|
props_[i].reorder(gasNames, liquidNames, solidNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
phaseTypeNames_.setSize(props_.size());
|
phaseTypeNames_.setSize(props_.size());
|
||||||
|
@ -154,7 +154,7 @@ Foam::CompositionModel<CloudType>::componentNames(const label phaseI) const
|
|||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::label Foam::CompositionModel<CloudType>::globalCarrierId
|
Foam::label Foam::CompositionModel<CloudType>::carrierId
|
||||||
(
|
(
|
||||||
const word& cmptName,
|
const word& cmptName,
|
||||||
const bool allowNotFound
|
const bool allowNotFound
|
||||||
@ -166,58 +166,21 @@ Foam::label Foam::CompositionModel<CloudType>::globalCarrierId
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::label Foam::CompositionModel<CloudType>::globalCarrierId"
|
"Foam::label Foam::CompositionModel<CloudType>::carrierId"
|
||||||
"("
|
"("
|
||||||
"const word&, "
|
"const word&, "
|
||||||
"const bool"
|
"const bool"
|
||||||
") const"
|
") const"
|
||||||
) << "Unable to determine global id for requested component "
|
) << "Unable to determine global id for requested component "
|
||||||
<< cmptName << ". Available components are " << nl
|
<< cmptName << ". Available components are " << nl
|
||||||
<< thermo_.carrier().species() << abort(FatalError);
|
<< thermo_.carrier().species()
|
||||||
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
|
||||||
Foam::label Foam::CompositionModel<CloudType>::globalId
|
|
||||||
(
|
|
||||||
const label phaseI,
|
|
||||||
const word& cmptName,
|
|
||||||
const bool allowNotFound
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
label id = phaseProps_[phaseI].globalId(cmptName);
|
|
||||||
|
|
||||||
if (id < 0 && !allowNotFound)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::label Foam::CompositionModel<CloudType>::globalId"
|
|
||||||
"("
|
|
||||||
"const label, "
|
|
||||||
"const word&, "
|
|
||||||
"const bool"
|
|
||||||
") const"
|
|
||||||
) << "Unable to determine global id for requested component "
|
|
||||||
<< cmptName << abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
|
||||||
const Foam::labelList& Foam::CompositionModel<CloudType>::globalIds
|
|
||||||
(
|
|
||||||
const label phaseI
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return phaseProps_[phaseI].globalIds();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::label Foam::CompositionModel<CloudType>::localId
|
Foam::label Foam::CompositionModel<CloudType>::localId
|
||||||
(
|
(
|
||||||
@ -247,21 +210,21 @@ Foam::label Foam::CompositionModel<CloudType>::localId
|
|||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::label Foam::CompositionModel<CloudType>::localToGlobalCarrierId
|
Foam::label Foam::CompositionModel<CloudType>::localToCarrierId
|
||||||
(
|
(
|
||||||
const label phaseI,
|
const label phaseI,
|
||||||
const label id,
|
const label id,
|
||||||
const bool allowNotFound
|
const bool allowNotFound
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
label gid = phaseProps_[phaseI].globalCarrierIds()[id];
|
label cid = phaseProps_[phaseI].carrierIds()[id];
|
||||||
|
|
||||||
if (gid < 0 && !allowNotFound)
|
if (cid < 0 && !allowNotFound)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::label "
|
"Foam::label "
|
||||||
"Foam::CompositionModel<CloudType>::localToGlobalCarrierId"
|
"Foam::CompositionModel<CloudType>::localToCarrierId"
|
||||||
"("
|
"("
|
||||||
"const label, "
|
"const label, "
|
||||||
"const label, "
|
"const label, "
|
||||||
@ -272,7 +235,7 @@ Foam::label Foam::CompositionModel<CloudType>::localToGlobalCarrierId
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return gid;
|
return cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -302,9 +265,8 @@ Foam::scalarField Foam::CompositionModel<CloudType>::X
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
WInv += Y[i]/thermo_.carrier().W(i);
|
||||||
WInv += Y[i]/thermo_.carrier().W(gid);
|
X[i] = Y[i]/thermo_.carrier().W(i);
|
||||||
X[i] = Y[i]/thermo_.carrier().W(gid);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -312,9 +274,8 @@ Foam::scalarField Foam::CompositionModel<CloudType>::X
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
WInv += Y[i]/thermo_.liquids().properties()[i].W();
|
||||||
WInv += Y[i]/thermo_.liquids().properties()[gid].W();
|
X[i] += Y[i]/thermo_.liquids().properties()[i].W();
|
||||||
X[i] += Y[i]/thermo_.liquids().properties()[gid].W();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -403,8 +364,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::H
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
HMixture += Y[i]*thermo_.carrier().Ha(i, p, T);
|
||||||
HMixture += Y[i]*thermo_.carrier().Ha(gid, p, T);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -412,8 +372,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::H
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
HMixture += Y[i]*thermo_.liquids().properties()[i].h(p, T);
|
||||||
HMixture += Y[i]*thermo_.liquids().properties()[gid].h(p, T);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -421,12 +380,11 @@ Foam::scalar Foam::CompositionModel<CloudType>::H
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
|
||||||
HMixture +=
|
HMixture +=
|
||||||
Y[i]
|
Y[i]
|
||||||
*(
|
*(
|
||||||
thermo_.solids().properties()[gid].Hf()
|
thermo_.solids().properties()[i].Hf()
|
||||||
+ thermo_.solids().properties()[gid].Cp()*T
|
+ thermo_.solids().properties()[i].Cp()*T
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -467,8 +425,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hs
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
HsMixture += Y[i]*thermo_.carrier().Hs(i, p, T);
|
||||||
HsMixture += Y[i]*thermo_.carrier().Hs(gid, p, T);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -476,12 +433,11 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hs
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
|
||||||
HsMixture +=
|
HsMixture +=
|
||||||
Y[i]
|
Y[i]
|
||||||
*(
|
*(
|
||||||
thermo_.liquids().properties()[gid].h(p, T)
|
thermo_.liquids().properties()[i].h(p, T)
|
||||||
- thermo_.liquids().properties()[gid].h(p, 298.15)
|
- thermo_.liquids().properties()[i].h(p, 298.15)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -490,8 +446,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hs
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
HsMixture += Y[i]*thermo_.solids().properties()[i].Cp()*T;
|
||||||
HsMixture += Y[i]*thermo_.solids().properties()[gid].Cp()*T;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -506,7 +461,8 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hs
|
|||||||
" const scalar, "
|
" const scalar, "
|
||||||
" const scalar"
|
" const scalar"
|
||||||
") const"
|
") const"
|
||||||
) << "Unknown phase enumeration" << abort(FatalError);
|
) << "Unknown phase enumeration"
|
||||||
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,8 +487,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hc
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
HcMixture += Y[i]*thermo_.carrier().Hc(i);
|
||||||
HcMixture += Y[i]*thermo_.carrier().Hc(gid);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -540,9 +495,8 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hc
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
|
||||||
HcMixture +=
|
HcMixture +=
|
||||||
Y[i]*thermo_.liquids().properties()[gid].h(p, 298.15);
|
Y[i]*thermo_.liquids().properties()[i].h(p, 298.15);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -550,8 +504,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hc
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
HcMixture += Y[i]*thermo_.solids().properties()[i].Hf();
|
||||||
HcMixture += Y[i]*thermo_.solids().properties()[gid].Hf();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -566,7 +519,8 @@ Foam::scalar Foam::CompositionModel<CloudType>::Hc
|
|||||||
" const scalar, "
|
" const scalar, "
|
||||||
" const scalar"
|
" const scalar"
|
||||||
") const"
|
") const"
|
||||||
) << "Unknown phase enumeration" << abort(FatalError);
|
) << "Unknown phase enumeration"
|
||||||
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,8 +545,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Cp
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
CpMixture += Y[i]*thermo_.carrier().Cp(i, p, T);
|
||||||
CpMixture += Y[i]*thermo_.carrier().Cp(gid, p, T);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -600,8 +553,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Cp
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
CpMixture += Y[i]*thermo_.liquids().properties()[i].Cp(p, T);
|
||||||
CpMixture += Y[i]*thermo_.liquids().properties()[gid].Cp(p, T);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -609,8 +561,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::Cp
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
CpMixture += Y[i]*thermo_.solids().properties()[i].Cp();
|
||||||
CpMixture += Y[i]*thermo_.solids().properties()[gid].Cp();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -625,7 +576,8 @@ Foam::scalar Foam::CompositionModel<CloudType>::Cp
|
|||||||
"const scalar, "
|
"const scalar, "
|
||||||
"const scalar"
|
"const scalar"
|
||||||
") const"
|
") const"
|
||||||
) << "Unknown phase enumeration" << abort(FatalError);
|
) << "Unknown phase enumeration"
|
||||||
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,8 +619,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::L
|
|||||||
{
|
{
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
label gid = props.globalIds()[i];
|
LMixture += Y[i]*thermo_.liquids().properties()[i].hl(p, T);
|
||||||
LMixture += Y[i]*thermo_.liquids().properties()[gid].hl(p, T);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -700,7 +651,8 @@ Foam::scalar Foam::CompositionModel<CloudType>::L
|
|||||||
"const scalar, "
|
"const scalar, "
|
||||||
"const scalar"
|
"const scalar"
|
||||||
") const"
|
") const"
|
||||||
) << "Unknown phase enumeration" << abort(FatalError);
|
) << "Unknown phase enumeration"
|
||||||
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,23 +166,12 @@ public:
|
|||||||
const wordList& componentNames(const label phaseI) const;
|
const wordList& componentNames(const label phaseI) const;
|
||||||
|
|
||||||
//- Return global id of component cmptName in carrier thermo
|
//- Return global id of component cmptName in carrier thermo
|
||||||
label globalCarrierId
|
label carrierId
|
||||||
(
|
(
|
||||||
const word& cmptName,
|
const word& cmptName,
|
||||||
const bool allowNotFound = false
|
const bool allowNotFound = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return global id of component cmptName in phase phaseI
|
|
||||||
label globalId
|
|
||||||
(
|
|
||||||
const label phaseI,
|
|
||||||
const word& cmptName,
|
|
||||||
const bool allowNotFound = false
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Return global ids of for phase phaseI
|
|
||||||
const labelList& globalIds(const label phaseI) const;
|
|
||||||
|
|
||||||
//- Return local id of component cmptName in phase phaseI
|
//- Return local id of component cmptName in phase phaseI
|
||||||
label localId
|
label localId
|
||||||
(
|
(
|
||||||
@ -191,8 +180,8 @@ public:
|
|||||||
const bool allowNotFound = false
|
const bool allowNotFound = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return global carrier id of component given local id
|
//- Return carrier id of component given local id
|
||||||
label localToGlobalCarrierId
|
label localToCarrierId
|
||||||
(
|
(
|
||||||
const label phaseI,
|
const label phaseI,
|
||||||
const label id,
|
const label id,
|
||||||
|
@ -97,7 +97,7 @@ Foam::LiquidEvaporation<CloudType>::LiquidEvaporation
|
|||||||
{
|
{
|
||||||
Info<< " " << activeLiquids_[i] << endl;
|
Info<< " " << activeLiquids_[i] << endl;
|
||||||
liqToCarrierMap_[i] =
|
liqToCarrierMap_[i] =
|
||||||
owner.composition().globalCarrierId(activeLiquids_[i]);
|
owner.composition().carrierId(activeLiquids_[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine mapping between model active liquids and global liquids
|
// Determine mapping between model active liquids and global liquids
|
||||||
@ -147,13 +147,10 @@ void Foam::LiquidEvaporation<CloudType>::calculate
|
|||||||
const scalar Ts,
|
const scalar Ts,
|
||||||
const scalar pc,
|
const scalar pc,
|
||||||
const scalar Tc,
|
const scalar Tc,
|
||||||
const scalarField& Yl,
|
const scalarField& X,
|
||||||
scalarField& dMassPC
|
scalarField& dMassPC
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// liquid volume fraction
|
|
||||||
const scalarField X(liquids_.X(Yl));
|
|
||||||
|
|
||||||
// immediately evaporate mass that has reached critical condition
|
// immediately evaporate mass that has reached critical condition
|
||||||
if ((liquids_.Tc(X) - T) < SMALL)
|
if ((liquids_.Tc(X) - T) < SMALL)
|
||||||
{
|
{
|
||||||
@ -282,11 +279,9 @@ Foam::scalar Foam::LiquidEvaporation<CloudType>::dh
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::LiquidEvaporation<CloudType>::Tvap
|
Foam::scalar Foam::LiquidEvaporation<CloudType>::Tvap
|
||||||
(
|
(
|
||||||
const scalarField& Y
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const scalarField X(liquids_.X(Y));
|
|
||||||
|
|
||||||
return liquids_.Tpt(X);
|
return liquids_.Tpt(X);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,11 +290,9 @@ template<class CloudType>
|
|||||||
Foam::scalar Foam::LiquidEvaporation<CloudType>::TMax
|
Foam::scalar Foam::LiquidEvaporation<CloudType>::TMax
|
||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalarField& Y
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const scalarField X(liquids_.X(Y));
|
|
||||||
|
|
||||||
return liquids_.pvInvert(p, X);
|
return liquids_.pvInvert(p, X);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -118,7 +118,7 @@ public:
|
|||||||
const scalar Ts,
|
const scalar Ts,
|
||||||
const scalar pc,
|
const scalar pc,
|
||||||
const scalar Tc,
|
const scalar Tc,
|
||||||
const scalarField& Yl,
|
const scalarField& X,
|
||||||
scalarField& dMassPC
|
scalarField& dMassPC
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -132,10 +132,10 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return vapourisation temperature
|
//- Return vapourisation temperature
|
||||||
virtual scalar Tvap(const scalarField& Y) const;
|
virtual scalar Tvap(const scalarField& X) const;
|
||||||
|
|
||||||
//- Return maximum/limiting temperature
|
//- Return maximum/limiting temperature
|
||||||
virtual scalar TMax(const scalar p, const scalarField& Y) const;
|
virtual scalar TMax(const scalar p, const scalarField& X) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ Foam::LiquidEvaporationBoil<CloudType>::LiquidEvaporationBoil
|
|||||||
{
|
{
|
||||||
Info<< " " << activeLiquids_[i] << endl;
|
Info<< " " << activeLiquids_[i] << endl;
|
||||||
liqToCarrierMap_[i] =
|
liqToCarrierMap_[i] =
|
||||||
owner.composition().globalCarrierId(activeLiquids_[i]);
|
owner.composition().carrierId(activeLiquids_[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine mapping between model active liquids and global liquids
|
// Determine mapping between model active liquids and global liquids
|
||||||
@ -147,13 +147,10 @@ void Foam::LiquidEvaporationBoil<CloudType>::calculate
|
|||||||
const scalar Ts,
|
const scalar Ts,
|
||||||
const scalar pc,
|
const scalar pc,
|
||||||
const scalar Tc,
|
const scalar Tc,
|
||||||
const scalarField& Yl,
|
const scalarField& X,
|
||||||
scalarField& dMassPC
|
scalarField& dMassPC
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// liquid volume fraction
|
|
||||||
const scalarField X(liquids_.X(Yl));
|
|
||||||
|
|
||||||
// immediately evaporate mass that has reached critical condition
|
// immediately evaporate mass that has reached critical condition
|
||||||
if ((liquids_.Tc(X) - T) < SMALL)
|
if ((liquids_.Tc(X) - T) < SMALL)
|
||||||
{
|
{
|
||||||
@ -378,11 +375,9 @@ Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::dh
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::Tvap
|
Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::Tvap
|
||||||
(
|
(
|
||||||
const scalarField& Y
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const scalarField X(liquids_.X(Y));
|
|
||||||
|
|
||||||
return liquids_.Tpt(X);
|
return liquids_.Tpt(X);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,11 +386,9 @@ template<class CloudType>
|
|||||||
Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::TMax
|
Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::TMax
|
||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalarField& Y
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const scalarField X(liquids_.X(Y));
|
|
||||||
|
|
||||||
return liquids_.pvInvert(p, X);
|
return liquids_.pvInvert(p, X);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -128,7 +128,7 @@ public:
|
|||||||
const scalar Ts,
|
const scalar Ts,
|
||||||
const scalar pc,
|
const scalar pc,
|
||||||
const scalar Tc,
|
const scalar Tc,
|
||||||
const scalarField& Yl,
|
const scalarField& X,
|
||||||
scalarField& dMassPC
|
scalarField& dMassPC
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -142,10 +142,10 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return vapourisation temperature
|
//- Return vapourisation temperature
|
||||||
virtual scalar Tvap(const scalarField& Y) const;
|
virtual scalar Tvap(const scalarField& X) const;
|
||||||
|
|
||||||
//- Return maximum/limiting temperature
|
//- Return maximum/limiting temperature
|
||||||
virtual scalar TMax(const scalar p, const scalarField& Y) const;
|
virtual scalar TMax(const scalar p, const scalarField& X) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -67,15 +67,18 @@ bool Foam::NoPhaseChange<CloudType>::active() const
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::NoPhaseChange<CloudType>::calculate
|
void Foam::NoPhaseChange<CloudType>::calculate
|
||||||
(
|
(
|
||||||
const scalar,
|
const scalar dt,
|
||||||
const label,
|
const label cellI,
|
||||||
const scalar,
|
const scalar Re,
|
||||||
const scalar,
|
const scalar Pr,
|
||||||
const scalar,
|
const scalar d,
|
||||||
const scalar,
|
const scalar nu,
|
||||||
const scalar,
|
const scalar T,
|
||||||
const scalar,
|
const scalar Ts,
|
||||||
scalarField&
|
const scalar pc,
|
||||||
|
const scalar Tc,
|
||||||
|
const scalarField& X,
|
||||||
|
scalarField& dMassPC
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Nothing to do...
|
// Nothing to do...
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -86,11 +86,14 @@ public:
|
|||||||
const scalar dt,
|
const scalar dt,
|
||||||
const label cellI,
|
const label cellI,
|
||||||
const scalar Re,
|
const scalar Re,
|
||||||
|
const scalar Pr,
|
||||||
const scalar d,
|
const scalar d,
|
||||||
const scalar nu,
|
const scalar nu,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalar Ts,
|
const scalar Ts,
|
||||||
const scalar pc,
|
const scalar pc,
|
||||||
|
const scalar Tc,
|
||||||
|
const scalarField& X,
|
||||||
scalarField& dMassPC
|
scalarField& dMassPC
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -127,44 +127,6 @@ Foam::PhaseChangeModel<CloudType>::enthalpyTransfer() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
|
||||||
void Foam::PhaseChangeModel<CloudType>::calculate
|
|
||||||
(
|
|
||||||
const scalar,
|
|
||||||
const label,
|
|
||||||
const scalar,
|
|
||||||
const scalar,
|
|
||||||
const scalar,
|
|
||||||
const scalar,
|
|
||||||
const scalar,
|
|
||||||
const scalar,
|
|
||||||
const scalar,
|
|
||||||
const scalar,
|
|
||||||
const scalarField&,
|
|
||||||
scalarField&
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
notImplemented
|
|
||||||
(
|
|
||||||
"void Foam::PhaseChangeModel<CloudType>::calculate"
|
|
||||||
"("
|
|
||||||
"const scalar, "
|
|
||||||
"const label, "
|
|
||||||
"const scalar, "
|
|
||||||
"const scalar, "
|
|
||||||
"const scalar, "
|
|
||||||
"const scalar, "
|
|
||||||
"const scalar, "
|
|
||||||
"const scalar, "
|
|
||||||
"const scalar, "
|
|
||||||
"const scalar, "
|
|
||||||
"const scalarField&,"
|
|
||||||
"scalarField&"
|
|
||||||
") const"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::PhaseChangeModel<CloudType>::dh
|
Foam::scalar Foam::PhaseChangeModel<CloudType>::dh
|
||||||
(
|
(
|
||||||
@ -181,8 +143,8 @@ Foam::scalar Foam::PhaseChangeModel<CloudType>::dh
|
|||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax
|
Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax
|
||||||
(
|
(
|
||||||
const scalar,
|
const scalar p,
|
||||||
const scalarField&
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return GREAT;
|
return GREAT;
|
||||||
@ -190,7 +152,7 @@ Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax
|
|||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::PhaseChangeModel<CloudType>::Tvap(const scalarField& Y) const
|
Foam::scalar Foam::PhaseChangeModel<CloudType>::Tvap(const scalarField& X) const
|
||||||
{
|
{
|
||||||
return -GREAT;
|
return -GREAT;
|
||||||
}
|
}
|
||||||
@ -224,4 +186,3 @@ void Foam::PhaseChangeModel<CloudType>::info(Ostream& os)
|
|||||||
#include "PhaseChangeModelNew.C"
|
#include "PhaseChangeModelNew.C"
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
@ -129,13 +129,7 @@ public:
|
|||||||
PhaseChangeModel(const PhaseChangeModel<CloudType>& pcm);
|
PhaseChangeModel(const PhaseChangeModel<CloudType>& pcm);
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
virtual autoPtr<PhaseChangeModel<CloudType> > clone() const
|
virtual autoPtr<PhaseChangeModel<CloudType> > clone() const = 0;
|
||||||
{
|
|
||||||
return autoPtr<PhaseChangeModel<CloudType> >
|
|
||||||
(
|
|
||||||
new PhaseChangeModel<CloudType>(*this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -171,9 +165,9 @@ public:
|
|||||||
const scalar Ts,
|
const scalar Ts,
|
||||||
const scalar pc,
|
const scalar pc,
|
||||||
const scalar Tc,
|
const scalar Tc,
|
||||||
const scalarField& Yl,
|
const scalarField& X,
|
||||||
scalarField& dMassPC
|
scalarField& dMassPC
|
||||||
) const;
|
) const = 0;
|
||||||
|
|
||||||
//- Return the enthalpy per unit mass
|
//- Return the enthalpy per unit mass
|
||||||
virtual scalar dh
|
virtual scalar dh
|
||||||
@ -185,10 +179,10 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return vapourisation temperature
|
//- Return vapourisation temperature
|
||||||
virtual scalar Tvap(const scalarField& Y) const;
|
virtual scalar Tvap(const scalarField& X) const;
|
||||||
|
|
||||||
//- Return maximum/limiting temperature
|
//- Return maximum/limiting temperature
|
||||||
virtual scalar TMax(const scalar p, const scalarField& Y) const;
|
virtual scalar TMax(const scalar p, const scalarField& X) const;
|
||||||
|
|
||||||
//- Add to phase change mass
|
//- Add to phase change mass
|
||||||
void addToPhaseChangeMass(const scalar dMass);
|
void addToPhaseChangeMass(const scalar dMass);
|
||||||
|
@ -76,8 +76,7 @@ void Foam::SprayParcel<ParcelType>::calc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get old mixture composition
|
// Get old mixture composition
|
||||||
const scalarField& Y0(this->Y());
|
scalarField X0(composition.liquids().X(this->Y()));
|
||||||
scalarField X0(composition.liquids().X(Y0));
|
|
||||||
|
|
||||||
// Check if we have critical or boiling conditions
|
// Check if we have critical or boiling conditions
|
||||||
scalar TMax = composition.liquids().Tc(X0);
|
scalar TMax = composition.liquids().Tc(X0);
|
||||||
@ -111,8 +110,7 @@ void Foam::SprayParcel<ParcelType>::calc
|
|||||||
// Update Cp, sigma, density and diameter due to change in temperature
|
// Update Cp, sigma, density and diameter due to change in temperature
|
||||||
// and/or composition
|
// and/or composition
|
||||||
scalar T1 = this->T();
|
scalar T1 = this->T();
|
||||||
const scalarField& Y1(this->Y());
|
scalarField X1(composition.liquids().X(this->Y()));
|
||||||
scalarField X1(composition.liquids().X(Y1));
|
|
||||||
|
|
||||||
this->Cp() = composition.liquids().Cp(this->pc_, T1, X1);
|
this->Cp() = composition.liquids().Cp(this->pc_, T1, X1);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------* \
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
@ -73,7 +73,8 @@ Foam::liquidMixtureProperties::liquidMixtureProperties
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::autoPtr<Foam::liquidMixtureProperties> Foam::liquidMixtureProperties::New
|
Foam::autoPtr<Foam::liquidMixtureProperties>
|
||||||
|
Foam::liquidMixtureProperties::New
|
||||||
(
|
(
|
||||||
const dictionary& thermophysicalProperties
|
const dictionary& thermophysicalProperties
|
||||||
)
|
)
|
||||||
@ -87,14 +88,14 @@ Foam::autoPtr<Foam::liquidMixtureProperties> Foam::liquidMixtureProperties::New
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::scalar Foam::liquidMixtureProperties::Tc(const scalarField& x) const
|
Foam::scalar Foam::liquidMixtureProperties::Tc(const scalarField& X) const
|
||||||
{
|
{
|
||||||
scalar vTc = 0.0;
|
scalar vTc = 0.0;
|
||||||
scalar vc = 0.0;
|
scalar vc = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
scalar x1 = x[i]*properties_[i].Vc();
|
scalar x1 = X[i]*properties_[i].Vc();
|
||||||
vc += x1;
|
vc += x1;
|
||||||
vTc += x1*properties_[i].Tc();
|
vTc += x1*properties_[i].Tc();
|
||||||
}
|
}
|
||||||
@ -103,12 +104,13 @@ Foam::scalar Foam::liquidMixtureProperties::Tc(const scalarField& x) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::liquidMixtureProperties::Tpt(const scalarField& x) const
|
Foam::scalar Foam::liquidMixtureProperties::Tpt(const scalarField& X) const
|
||||||
{
|
{
|
||||||
scalar Tpt = 0.0;
|
scalar Tpt = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
Tpt += x[i]*properties_[i].Tt();
|
Tpt += X[i]*properties_[i].Tt();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Tpt;
|
return Tpt;
|
||||||
@ -118,19 +120,19 @@ Foam::scalar Foam::liquidMixtureProperties::Tpt(const scalarField& x) const
|
|||||||
Foam::scalar Foam::liquidMixtureProperties::pvInvert
|
Foam::scalar Foam::liquidMixtureProperties::pvInvert
|
||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Set upper and lower bounds
|
// Set upper and lower bounds
|
||||||
scalar Thi = Tc(x);
|
scalar Thi = Tc(X);
|
||||||
scalar Tlo = Tpt(x);
|
scalar Tlo = Tpt(X);
|
||||||
|
|
||||||
// Check for critical and solid phase conditions
|
// Check for critical and solid phase conditions
|
||||||
if (p >= pv(p, Thi, x))
|
if (p >= pv(p, Thi, X))
|
||||||
{
|
{
|
||||||
return Thi;
|
return Thi;
|
||||||
}
|
}
|
||||||
else if (p < pv(p, Tlo, x))
|
else if (p < pv(p, Tlo, X))
|
||||||
{
|
{
|
||||||
WarningIn
|
WarningIn
|
||||||
(
|
(
|
||||||
@ -140,7 +142,7 @@ Foam::scalar Foam::liquidMixtureProperties::pvInvert
|
|||||||
" const scalarField&"
|
" const scalarField&"
|
||||||
") const"
|
") const"
|
||||||
) << "Pressure below triple point pressure: "
|
) << "Pressure below triple point pressure: "
|
||||||
<< "p = " << p << " < Pt = " << pv(p, Tlo, x) << nl << endl;
|
<< "p = " << p << " < Pt = " << pv(p, Tlo, X) << nl << endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +151,7 @@ Foam::scalar Foam::liquidMixtureProperties::pvInvert
|
|||||||
|
|
||||||
while ((Thi - Tlo) > 1.0e-4)
|
while ((Thi - Tlo) > 1.0e-4)
|
||||||
{
|
{
|
||||||
if ((pv(p, T, x) - p) <= 0.0)
|
if ((pv(p, T, X) - p) <= 0.0)
|
||||||
{
|
{
|
||||||
Tlo = T;
|
Tlo = T;
|
||||||
}
|
}
|
||||||
@ -165,38 +167,41 @@ Foam::scalar Foam::liquidMixtureProperties::pvInvert
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::liquidMixtureProperties::Tpc(const scalarField& x) const
|
Foam::scalar Foam::liquidMixtureProperties::Tpc(const scalarField& X) const
|
||||||
{
|
{
|
||||||
scalar Tpc = 0.0;
|
scalar Tpc = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
Tpc += x[i]*properties_[i].Tc();
|
Tpc += X[i]*properties_[i].Tc();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Tpc;
|
return Tpc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::liquidMixtureProperties::Ppc(const scalarField& x) const
|
Foam::scalar Foam::liquidMixtureProperties::Ppc(const scalarField& X) const
|
||||||
{
|
{
|
||||||
scalar Vc = 0.0;
|
scalar Vc = 0.0;
|
||||||
scalar Zc = 0.0;
|
scalar Zc = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
Vc += x[i]*properties_[i].Vc();
|
Vc += X[i]*properties_[i].Vc();
|
||||||
Zc += x[i]*properties_[i].Zc();
|
Zc += X[i]*properties_[i].Zc();
|
||||||
}
|
}
|
||||||
|
|
||||||
return RR*Zc*Tpc(x)/Vc;
|
return RR*Zc*Tpc(X)/Vc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::liquidMixtureProperties::omega(const scalarField& x) const
|
Foam::scalar Foam::liquidMixtureProperties::omega(const scalarField& X) const
|
||||||
{
|
{
|
||||||
scalar omega = 0.0;
|
scalar omega = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
omega += x[i]*properties_[i].omega();
|
omega += X[i]*properties_[i].omega();
|
||||||
}
|
}
|
||||||
|
|
||||||
return omega;
|
return omega;
|
||||||
@ -208,28 +213,30 @@ Foam::scalarField Foam::liquidMixtureProperties::Xs
|
|||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar Tg,
|
const scalar Tg,
|
||||||
const scalar Tl,
|
const scalar Tl,
|
||||||
const scalarField& xg,
|
const scalarField& Xg,
|
||||||
const scalarField& xl
|
const scalarField& Xl
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
scalarField xs(xl.size(), 0.0);
|
scalarField Xs(Xl.size());
|
||||||
|
|
||||||
// Raoult's Law
|
// Raoult's Law
|
||||||
forAll(xs, i)
|
forAll(Xs, i)
|
||||||
{
|
{
|
||||||
scalar Ti = min(TrMax*properties_[i].Tc(), Tl);
|
scalar Ti = min(TrMax*properties_[i].Tc(), Tl);
|
||||||
xs[i] = properties_[i].pv(p, Ti)*xl[i]/p;
|
Xs[i] = properties_[i].pv(p, Ti)*Xl[i]/p;
|
||||||
}
|
}
|
||||||
return xs;
|
|
||||||
|
return Xs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::liquidMixtureProperties::W(const scalarField& x) const
|
Foam::scalar Foam::liquidMixtureProperties::W(const scalarField& X) const
|
||||||
{
|
{
|
||||||
scalar W = 0.0;
|
scalar W = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
W += x[i]*properties_[i].W();
|
W += X[i]*properties_[i].W();
|
||||||
}
|
}
|
||||||
|
|
||||||
return W;
|
return W;
|
||||||
@ -238,13 +245,17 @@ Foam::scalar Foam::liquidMixtureProperties::W(const scalarField& x) const
|
|||||||
|
|
||||||
Foam::scalarField Foam::liquidMixtureProperties::Y(const scalarField& X) const
|
Foam::scalarField Foam::liquidMixtureProperties::Y(const scalarField& X) const
|
||||||
{
|
{
|
||||||
scalarField Y(X/W(X));
|
scalarField Y(X.size());
|
||||||
|
scalar sumY = 0.0;
|
||||||
|
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
Y[i] *= properties_[i].W();
|
Y[i] = X[i]*properties_[i].W();
|
||||||
|
sumY += Y[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Y /= sumY;
|
||||||
|
|
||||||
return Y;
|
return Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,15 +263,17 @@ Foam::scalarField Foam::liquidMixtureProperties::Y(const scalarField& X) const
|
|||||||
Foam::scalarField Foam::liquidMixtureProperties::X(const scalarField& Y) const
|
Foam::scalarField Foam::liquidMixtureProperties::X(const scalarField& Y) const
|
||||||
{
|
{
|
||||||
scalarField X(Y.size());
|
scalarField X(Y.size());
|
||||||
scalar Winv = 0.0;
|
scalar sumX = 0.0;
|
||||||
|
|
||||||
forAll(X, i)
|
forAll(X, i)
|
||||||
{
|
{
|
||||||
Winv += Y[i]/properties_[i].W();
|
|
||||||
X[i] = Y[i]/properties_[i].W();
|
X[i] = Y[i]/properties_[i].W();
|
||||||
|
sumX += X[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp<scalarField> tfld = X/Winv;
|
X /= sumX;
|
||||||
return tfld();
|
|
||||||
|
return X;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -268,22 +281,29 @@ Foam::scalar Foam::liquidMixtureProperties::rho
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
scalar sumY = 0.0;
|
||||||
scalar v = 0.0;
|
scalar v = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
if (x[i] > SMALL)
|
if (X[i] > SMALL)
|
||||||
{
|
{
|
||||||
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
||||||
scalar rho = SMALL + properties_[i].rho(p, Ti);
|
scalar rho = properties_[i].rho(p, Ti);
|
||||||
v += x[i]*properties_[i].W()/rho;
|
|
||||||
|
if (rho > SMALL)
|
||||||
|
{
|
||||||
|
scalar Yi = X[i]*properties_[i].W();
|
||||||
|
sumY += Yi;
|
||||||
|
v += Yi/rho;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return W(x)/v;
|
return sumY/v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -291,21 +311,25 @@ Foam::scalar Foam::liquidMixtureProperties::pv
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
scalar sumY = 0.0;
|
||||||
scalar pv = 0.0;
|
scalar pv = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
if (x[i] > SMALL)
|
if (X[i] > SMALL)
|
||||||
{
|
{
|
||||||
|
scalar Yi = X[i]*properties_[i].W();
|
||||||
|
sumY += Yi;
|
||||||
|
|
||||||
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
||||||
pv += x[i]*properties_[i].pv(p, Ti)*properties_[i].W();
|
pv += Yi*properties_[i].pv(p, Ti);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pv/W(x);
|
return pv/sumY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -313,21 +337,25 @@ Foam::scalar Foam::liquidMixtureProperties::hl
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
scalar sumY = 0.0;
|
||||||
scalar hl = 0.0;
|
scalar hl = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
if (x[i] > SMALL)
|
if (X[i] > SMALL)
|
||||||
{
|
{
|
||||||
|
scalar Yi = X[i]*properties_[i].W();
|
||||||
|
sumY += Yi;
|
||||||
|
|
||||||
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
||||||
hl += x[i]*properties_[i].hl(p, Ti)*properties_[i].W();
|
hl += Yi*properties_[i].hl(p, Ti);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hl/W(x);
|
return hl/sumY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -335,21 +363,25 @@ Foam::scalar Foam::liquidMixtureProperties::Cp
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
scalar sumY = 0.0;
|
||||||
scalar Cp = 0.0;
|
scalar Cp = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
if (x[i] > SMALL)
|
if (X[i] > SMALL)
|
||||||
{
|
{
|
||||||
|
scalar Yi = X[i]*properties_[i].W();
|
||||||
|
sumY += Yi;
|
||||||
|
|
||||||
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
||||||
Cp += x[i]*properties_[i].Cp(p, Ti)*properties_[i].W();
|
Cp += Yi*properties_[i].Cp(p, Ti);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Cp/W(x);
|
return Cp/sumY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -357,29 +389,32 @@ Foam::scalar Foam::liquidMixtureProperties::sigma
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// sigma is based on surface mole fractions
|
// sigma is based on surface mole fractions
|
||||||
// which is estimated from Raoult's Law
|
// which are estimated from Raoult's Law
|
||||||
scalar sigma = 0.0;
|
scalar sigma = 0.0;
|
||||||
scalarField Xs(x.size(), 0.0);
|
scalarField Xs(X.size());
|
||||||
scalar XsSum = 0.0;
|
scalar XsSum = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
||||||
scalar Pvs = properties_[i].pv(p, Ti);
|
scalar Pvs = properties_[i].pv(p, Ti);
|
||||||
scalar xs = x[i]*Pvs/p;
|
|
||||||
XsSum += xs;
|
Xs[i] = X[i]*Pvs/p;
|
||||||
Xs[i] = xs;
|
XsSum += Xs[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Xs /= XsSum;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
if (Xs[i] > SMALL)
|
if (Xs[i] > SMALL)
|
||||||
{
|
{
|
||||||
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
||||||
sigma += (Xs[i]/XsSum)*properties_[i].sigma(p, Ti);
|
sigma += Xs[i]*properties_[i].sigma(p, Ti);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,17 +426,17 @@ Foam::scalar Foam::liquidMixtureProperties::mu
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
scalar mu = 0.0;
|
scalar mu = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
if (x[i] > SMALL)
|
if (X[i] > SMALL)
|
||||||
{
|
{
|
||||||
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
||||||
mu += x[i]*log(properties_[i].mu(p, Ti));
|
mu += X[i]*log(properties_[i].mu(p, Ti));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,11 +448,11 @@ Foam::scalar Foam::liquidMixtureProperties::K
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// calculate superficial volume fractions phii
|
// Calculate superficial volume fractions phii
|
||||||
scalarField phii(x.size(), 0.0);
|
scalarField phii(X.size());
|
||||||
scalar pSum = 0.0;
|
scalar pSum = 0.0;
|
||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
@ -425,14 +460,11 @@ Foam::scalar Foam::liquidMixtureProperties::K
|
|||||||
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
||||||
|
|
||||||
scalar Vi = properties_[i].W()/properties_[i].rho(p, Ti);
|
scalar Vi = properties_[i].W()/properties_[i].rho(p, Ti);
|
||||||
phii[i] = x[i]*Vi;
|
phii[i] = X[i]*Vi;
|
||||||
pSum += phii[i];
|
pSum += phii[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(phii, i)
|
phii /= pSum;
|
||||||
{
|
|
||||||
phii[i] /= pSum;
|
|
||||||
}
|
|
||||||
|
|
||||||
scalar K = 0.0;
|
scalar K = 0.0;
|
||||||
|
|
||||||
@ -462,7 +494,7 @@ Foam::scalar Foam::liquidMixtureProperties::D
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Blanc's law
|
// Blanc's law
|
||||||
@ -470,10 +502,10 @@ Foam::scalar Foam::liquidMixtureProperties::D
|
|||||||
|
|
||||||
forAll(properties_, i)
|
forAll(properties_, i)
|
||||||
{
|
{
|
||||||
if (x[i] > SMALL)
|
if (X[i] > SMALL)
|
||||||
{
|
{
|
||||||
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
scalar Ti = min(TrMax*properties_[i].Tc(), T);
|
||||||
Dinv += x[i]/properties_[i].D(p, Ti);
|
Dinv += X[i]/properties_[i].D(p, Ti);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,6 @@ class liquidMixtureProperties
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
@ -139,23 +138,23 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Calculate the critical temperature of mixture
|
//- Calculate the critical temperature of mixture
|
||||||
scalar Tc(const scalarField& x) const;
|
scalar Tc(const scalarField& X) const;
|
||||||
|
|
||||||
//- Invert the vapour pressure relationship to retrieve the boiling
|
//- Invert the vapour pressure relationship to retrieve the boiling
|
||||||
// temperature of the mixture as a function of pressure
|
// temperature of the mixture as a function of pressure
|
||||||
scalar pvInvert(const scalar p, const scalarField& x) const;
|
scalar pvInvert(const scalar p, const scalarField& X) const;
|
||||||
|
|
||||||
//- Return pseudocritical temperature according to Kay's rule
|
//- Return pseudocritical temperature according to Kay's rule
|
||||||
scalar Tpc(const scalarField& x) const;
|
scalar Tpc(const scalarField& X) const;
|
||||||
|
|
||||||
//- Return pseudocritical pressure (modified Prausnitz and Gunn)
|
//- Return pseudocritical pressure (modified Prausnitz and Gunn)
|
||||||
scalar Ppc(const scalarField& x) const;
|
scalar Ppc(const scalarField& X) const;
|
||||||
|
|
||||||
//- Return pseudo triple point temperature (mole averaged formulation)
|
//- Return pseudo triple point temperature (mole averaged formulation)
|
||||||
scalar Tpt(const scalarField& x) const;
|
scalar Tpt(const scalarField& X) const;
|
||||||
|
|
||||||
//- Return mixture accentric factor
|
//- Return mixture accentric factor
|
||||||
scalar omega(const scalarField& x) const;
|
scalar omega(const scalarField& X) const;
|
||||||
|
|
||||||
//- Return the surface molar fractions
|
//- Return the surface molar fractions
|
||||||
scalarField Xs
|
scalarField Xs
|
||||||
@ -163,19 +162,18 @@ public:
|
|||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar Tg,
|
const scalar Tg,
|
||||||
const scalar Tl,
|
const scalar Tl,
|
||||||
const scalarField& xg,
|
const scalarField& Xg,
|
||||||
const scalarField& xl
|
const scalarField& Xl
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Calculate the mean molecular weight [kg/kmol]
|
//- Calculate the mean molecular weight [kg/kmol]
|
||||||
// from mole fractions
|
// from mole fractions
|
||||||
scalar W(const scalarField& X) const;
|
scalar W(const scalarField& X) const;
|
||||||
|
|
||||||
//- Returns the mass fractions, given mole fractions
|
//- Returns the mass fractions corresponding to the given mole fractions
|
||||||
scalarField Y(const scalarField& X) const;
|
scalarField Y(const scalarField& X) const;
|
||||||
|
|
||||||
//- Returns the mole fractions, given mass fractions
|
//- Returns the mole fractions corresponding to the given mass fractions
|
||||||
scalarField X(const scalarField& Y) const;
|
scalarField X(const scalarField& Y) const;
|
||||||
|
|
||||||
//- Calculate the mixture density [kg/m^3]
|
//- Calculate the mixture density [kg/m^3]
|
||||||
@ -183,7 +181,7 @@ public:
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Calculate the mixture vapour pressure [Pa]
|
//- Calculate the mixture vapour pressure [Pa]
|
||||||
@ -191,7 +189,7 @@ public:
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Calculate the mixture latent heat [J/kg]
|
//- Calculate the mixture latent heat [J/kg]
|
||||||
@ -199,7 +197,7 @@ public:
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Calculate the mixture heat capacity [J/(kg K)]
|
//- Calculate the mixture heat capacity [J/(kg K)]
|
||||||
@ -207,7 +205,7 @@ public:
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Estimate mixture surface tension [N/m]
|
//- Estimate mixture surface tension [N/m]
|
||||||
@ -215,7 +213,7 @@ public:
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Calculate the mixture viscosity [Pa s]
|
//- Calculate the mixture viscosity [Pa s]
|
||||||
@ -223,7 +221,7 @@ public:
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Estimate thermal conductivity [W/(m K)]
|
//- Estimate thermal conductivity [W/(m K)]
|
||||||
@ -232,7 +230,7 @@ public:
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Vapour diffussivity [m2/s]
|
//- Vapour diffussivity [m2/s]
|
||||||
@ -240,7 +238,7 @@ public:
|
|||||||
(
|
(
|
||||||
const scalar p,
|
const scalar p,
|
||||||
const scalar T,
|
const scalar T,
|
||||||
const scalarField& x
|
const scalarField& X
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user