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