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.
This commit is contained in:
Will Bainbridge
2017-12-01 14:21:28 +00:00
parent 97cbfccb15
commit a830b9b3c1
11 changed files with 101 additions and 46 deletions

View File

@ -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());

View File

@ -242,6 +242,9 @@ public:
const label patchi
) const;
//- Molecular weight [kg/kmol]
virtual tmp<volScalarField> W() const;
// Fields derived from transport state variables

View File

@ -521,6 +521,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();

View File

@ -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
@ -373,6 +373,9 @@ public:
const label patchi
) const;
//- Molecular weight [kg/kmol]
virtual tmp<volScalarField> W() const;
// Fields derived from transport state variables

View File

@ -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();
}

View File

@ -398,6 +398,9 @@ public:
const label patchi
) const = 0;
//- Molecular weight [kg/kmol]
virtual tmp<volScalarField> W() const = 0;
// Access to transport state variables

View File

@ -720,6 +720,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

View File

@ -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 |
-------------------------------------------------------------------------------
License
@ -253,6 +253,9 @@ public:
const label patchi
) const;
//- Molecular weight [kg/kmol]
virtual tmp<volScalarField> W() const;
// Fields derived from transport state variables

View File

@ -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;
}
}

View File

@ -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("zero", dimless, 0)
)
);
volScalarField& rW = trW.ref();
forAll(Y, i)
{
rW += Y[i]/W(i);
}
rW = 1.0/rW;
return trW;
}
// ************************************************************************* //

View File

@ -85,9 +85,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