diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C index 063db62589a4455fb54d9c93d59ccffffcd5c696..05d3bedfdce8e668e7d4b2794d9c6e1fc9f8855a 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C @@ -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()); diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H index b84ce6a7fac4a0434ae7f4789df6dec1c3e38aa7..3c139dc8f103aeda650f20fba34fce2b3b775363 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<volScalarField> 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 afaf713ef23e0ac336cf32666d613672439b0f11..7e4717698ad0eec2b8b61f7dcf0fcc06c31b64da 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C @@ -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(); diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H index b14d67e1f626f3d83c8d034750d2f982af41f4b8..084b8780845673ec39a27207e5e1533bfafd0529 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<volScalarField> 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 de32766bc6dd72e2c6e74dd25036c60e6ed13d20..6e934aa36dd629f0d4d181ff43d4accafa8707b0 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::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(); } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 13b72b530451ca0e11b95fb8ce33e659fde4c18d..9025bcf2c437e14fd6b02725521028b6fb86d13d 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<volScalarField> 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 cb10d720e989206c254391b9d09e7116e85fe892..83273d456686d0eccd98223dbc8dc6a1af4fcdad 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -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 diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H index ad44afc40becbf93bb24dd3ecbd3249f8f7adbe2..acd60a4397e3694d260120b34a43630700828e2e 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<volScalarField> 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 5cfcde4a339085e086a7e6e3a48bfcecb9eeda7c..4339e232435cf6ae0170f251c4eeaaf856356ee8 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<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; } } diff --git a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H index bc387a6dd9b7869601d32a6dcfaee213dc241245..f4a20ca9e651a1e367cc1ba4fa19487a13fb38f6 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<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 diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C index 7772c6a1da6fce8f2a6dfba9ec0c5c36bd7b8228..5239f1ae9a2ce5e1ff670b98535ed5ff2f95566e 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::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; -} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H index 0ce2bdedc8d8f6392583aafde4b4ce638a744353..f1d1856d001068b8a0b9788dd72f630b9ed48d02 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<volScalarField> W() const; - // Per specie thermo properties