BUG: basicSpecieMixture: Removed duplicated molecular weight mixing
Mixture molecular weight is now evaluated in heThermo like everything else, relying on the low level specie mixing rules. Units have also been corrected. SpecieMixture: Pure virtual definition for W to prevent Clang warning
This commit is contained in:
parent
d9afa508e1
commit
f180ab7249
@ -275,6 +275,12 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::CpByCpv
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::W() const
|
||||
{
|
||||
return alpha1()*thermo1_->W() + alpha2()*thermo1_->W();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::nu() const
|
||||
{
|
||||
return mu()/(alpha1()*thermo1_->rho() + alpha2()*thermo2_->rho());
|
||||
|
@ -242,6 +242,9 @@ public:
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Molecular weight [kg/kmol]
|
||||
virtual tmp<volScalarField> W() const;
|
||||
|
||||
|
||||
// Fields derived from transport state variables
|
||||
|
||||
|
@ -519,6 +519,21 @@ Foam::tmp<Foam::scalarField> Foam::multiphaseMixtureThermo::CpByCpv
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::multiphaseMixtureThermo::W() const
|
||||
{
|
||||
PtrDictionary<phaseModel>::const_iterator phasei = phases_.begin();
|
||||
|
||||
tmp<volScalarField> tW(phasei()*phasei().thermo().W());
|
||||
|
||||
for (++phasei; phasei != phases_.end(); ++phasei)
|
||||
{
|
||||
tW.ref() += phasei()*phasei().thermo().W();
|
||||
}
|
||||
|
||||
return tW;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::multiphaseMixtureThermo::nu() const
|
||||
{
|
||||
return mu()/rho();
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -362,6 +362,9 @@ public:
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Molecular weight [kg/kmol]
|
||||
virtual tmp<volScalarField> W() const;
|
||||
|
||||
|
||||
// Fields derived from transport state variables
|
||||
|
||||
|
@ -32,10 +32,14 @@ Foam::tmp<Foam::volScalarField>
|
||||
Foam::interfaceCompositionModels::Saturated<Thermo, OtherThermo>::
|
||||
wRatioByP() const
|
||||
{
|
||||
return
|
||||
const dimensionedScalar Wi
|
||||
(
|
||||
"W",
|
||||
dimMass/dimMoles,
|
||||
this->thermo_.composition().W(saturatedIndex_)
|
||||
/this->thermo_.composition().W()
|
||||
/this->thermo_.p();
|
||||
);
|
||||
|
||||
return Wi/this->thermo_.W()/this->thermo_.p();
|
||||
}
|
||||
|
||||
|
||||
|
@ -402,6 +402,9 @@ public:
|
||||
const label patchi
|
||||
) const = 0;
|
||||
|
||||
//- Molecular weight [kg/kmol]
|
||||
virtual tmp<volScalarField> W() const = 0;
|
||||
|
||||
|
||||
// Access to transport state variables
|
||||
|
||||
|
@ -731,6 +731,54 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::THE
|
||||
}
|
||||
|
||||
|
||||
template<class BasicThermo, class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::W
|
||||
(
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = this->T_.mesh();
|
||||
|
||||
tmp<volScalarField> tW
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"W",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh,
|
||||
dimMass/dimMoles
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& W = tW.ref();
|
||||
scalarField& WCells = W.primitiveFieldRef();
|
||||
|
||||
forAll(WCells, celli)
|
||||
{
|
||||
WCells[celli] = this->cellMixture(celli).W();
|
||||
}
|
||||
|
||||
volScalarField::Boundary& WBf = W.boundaryFieldRef();
|
||||
|
||||
forAll(WBf, patchi)
|
||||
{
|
||||
scalarField& Wp = WBf[patchi];
|
||||
forAll(Wp, facei)
|
||||
{
|
||||
Wp[facei] = this->patchFaceMixture(patchi, facei).W();
|
||||
}
|
||||
}
|
||||
|
||||
return tW;
|
||||
}
|
||||
|
||||
|
||||
template<class BasicThermo, class MixtureType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::heThermo<BasicThermo, MixtureType>::kappa() const
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -258,6 +258,9 @@ public:
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Molecular weight [kg/kmol]
|
||||
virtual tmp<volScalarField> W() const;
|
||||
|
||||
|
||||
// Fields derived from transport state variables
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,11 +36,18 @@ void Foam::moleFractions<ThermoType>::calculateMoleFractions()
|
||||
|
||||
const PtrList<volScalarField>& Y = thermo.composition().Y();
|
||||
|
||||
const volScalarField W(thermo.composition().W());
|
||||
const volScalarField W(thermo.W());
|
||||
|
||||
forAll(Y, i)
|
||||
{
|
||||
X_[i] = W*Y[i]/thermo.composition().W(i);
|
||||
const dimensionedScalar Wi
|
||||
(
|
||||
"W",
|
||||
dimMass/dimMoles,
|
||||
thermo.composition().W(i)
|
||||
);
|
||||
|
||||
X_[i] = W*Y[i]/Wi;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,6 +213,9 @@ public:
|
||||
//- Heat capacity at constant volume [J/kg/K]
|
||||
virtual tmp<volScalarField> Cv() const = 0;
|
||||
|
||||
//- Molecular weight of the given specie [kg/kmol]
|
||||
virtual tmp<volScalarField> W() const = 0;
|
||||
|
||||
//- Thermal diffusivity for temperature
|
||||
// of mixture for patch [J/m/s/K]
|
||||
virtual tmp<scalarField> kappa
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,38 +47,4 @@ Foam::basicSpecieMixture::basicSpecieMixture
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::basicSpecieMixture::W() const
|
||||
{
|
||||
const PtrList<volScalarField>& Y(basicMultiComponentMixture::Y());
|
||||
|
||||
tmp<volScalarField> trW
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("W", Y[0].group()),
|
||||
Y[0].time().timeName(),
|
||||
Y[0].mesh()
|
||||
),
|
||||
Y[0].mesh(),
|
||||
dimensionedScalar(dimless, Zero)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& rW = trW.ref();
|
||||
|
||||
forAll(Y, i)
|
||||
{
|
||||
rW += Y[i]/W(i);
|
||||
}
|
||||
|
||||
rW = 1.0/rW;
|
||||
|
||||
return trW;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -88,9 +88,6 @@ public:
|
||||
//- Molecular weight of the given specie [kg/kmol]
|
||||
virtual scalar W(const label speciei) const = 0;
|
||||
|
||||
//- Molecular weight of the mixture [kg/kmol]
|
||||
tmp<volScalarField> W() const;
|
||||
|
||||
|
||||
// Per specie thermo properties
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user