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 b84ce6a7fa..3c139dc8f1 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 afaf713ef2..7e4717698a 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C @@ -519,6 +519,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 b14d67e1f6..084b878084 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 @@ -362,6 +362,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 13b72b5304..9025bcf2c4 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -402,6 +402,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 cb10d720e9..83273d4566 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -731,6 +731,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 ad44afc40b..acd60a4397 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 | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License @@ -258,6 +258,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 5cfcde4a33..4339e23243 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/SpecieMixture/SpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H index bc387a6dd9..f4a20ca9e6 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H @@ -213,6 +213,9 @@ public: //- Heat capacity at constant volume [J/kg/K] virtual tmp Cv() const = 0; + //- Molecular weight of the given specie [kg/kmol] + virtual tmp W() const = 0; + //- Thermal diffusivity for temperature // of mixture for patch [J/m/s/K] virtual tmp kappa diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C index 7772c6a1da..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(dimless, Zero) - ) - ); - - 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 0ce2bdedc8..f1d1856d00 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H @@ -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 W() const; - // Per specie thermo properties