diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C index 063db62589..05d3bedfdc 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C @@ -275,6 +275,12 @@ Foam::tmp Foam::twoPhaseMixtureThermo::CpByCpv } +Foam::tmp Foam::twoPhaseMixtureThermo::W() const +{ + return alpha1()*thermo1_->W() + alpha2()*thermo1_->W(); +} + + Foam::tmp Foam::twoPhaseMixtureThermo::nu() const { return mu()/(alpha1()*thermo1_->rho() + alpha2()*thermo2_->rho()); diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H index aefdbdee4f..9047d6d85f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H @@ -242,6 +242,9 @@ public: const label patchi ) const; + //- Molecular weight [kg/kmol] + virtual tmp W() const; + // Fields derived from transport state variables diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C index 97867be4d3..c9f687089a 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C @@ -521,6 +521,21 @@ Foam::tmp Foam::multiphaseMixtureThermo::CpByCpv } +Foam::tmp Foam::multiphaseMixtureThermo::W() const +{ + PtrDictionary::const_iterator phasei = phases_.begin(); + + tmp tW(phasei()*phasei().thermo().W()); + + for (++phasei; phasei != phases_.end(); ++phasei) + { + tW.ref() += phasei()*phasei().thermo().W(); + } + + return tW; +} + + Foam::tmp Foam::multiphaseMixtureThermo::nu() const { return mu()/rho(); diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H index 7c8c5b6f03..15cc2ee064 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H @@ -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 W() const; + // Fields derived from transport state variables diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/Saturated/Saturated.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/Saturated/Saturated.C index de32766bc6..6e934aa36d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/Saturated/Saturated.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/Saturated/Saturated.C @@ -32,10 +32,14 @@ Foam::tmp Foam::interfaceCompositionModels::Saturated:: 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(); } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 5a5593886e..7ad4c91657 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -398,6 +398,9 @@ public: const label patchi ) const = 0; + //- Molecular weight [kg/kmol] + virtual tmp W() const = 0; + // Access to transport state variables diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index c06ffb75d7..ab5039bccb 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -720,6 +720,54 @@ Foam::tmp Foam::heThermo::THE } +template +Foam::tmp Foam::heThermo::W +( +) const +{ + const fvMesh& mesh = this->T_.mesh(); + + tmp 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 Foam::tmp Foam::heThermo::kappa() const diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H index 7967cc44cc..3764114e59 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.H +++ b/src/thermophysicalModels/basic/heThermo/heThermo.H @@ -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 W() const; + // Fields derived from transport state variables diff --git a/src/thermophysicalModels/reactionThermo/functionObjects/moleFractions/moleFractions.C b/src/thermophysicalModels/reactionThermo/functionObjects/moleFractions/moleFractions.C index e7daabe79f..b754f30c5e 100644 --- a/src/thermophysicalModels/reactionThermo/functionObjects/moleFractions/moleFractions.C +++ b/src/thermophysicalModels/reactionThermo/functionObjects/moleFractions/moleFractions.C @@ -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::calculateMoleFractions() const PtrList& 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; } } diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C index a3643c0d30..5239f1ae9a 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C @@ -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::basicSpecieMixture::W() const -{ - const PtrList& Y(basicMultiComponentMixture::Y()); - - tmp 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; -} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H index e23639498e..c92ee72385 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H @@ -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 W() const; - // Per specie thermo properties