From 3d4f910bc3b35266299291a35e3967dfa0082712 Mon Sep 17 00:00:00 2001 From: andy <a.heather@opencfd.co.uk> Date: Fri, 10 Jul 2009 11:58:51 +0100 Subject: [PATCH] moving correctMassFractions() to multiComponentMixture --- .../basicMultiComponentMixture.C | 21 ++--------------- .../basicMultiComponentMixture.H | 6 ----- .../multiComponentMixture.C | 23 ++++++++++++++++++- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C index 1016a33a97b..984c06bdf2c 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C @@ -26,24 +26,6 @@ License #include "basicMultiComponentMixture.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::basicMultiComponentMixture::correctMassFractions() -{ - volScalarField Yt = Y_[0]; - - for(label n=1; n<Y_.size(); n++) - { - Yt += Y_[n]; - } - - forAll (Y_, n) - { - Y_[n] /= Yt; - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::basicMultiComponentMixture::basicMultiComponentMixture @@ -120,7 +102,8 @@ Foam::basicMultiComponentMixture::basicMultiComponentMixture } } - correctMassFractions(); + // Do not enforce constraint of sum of mass fractions to equal 1 here + // - not applicable to all models } diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H index a21485889a6..4a83754c0ff 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H @@ -63,12 +63,6 @@ protected: PtrList<volScalarField> Y_; - // Protected member functions - - //- Correct the mass fractions to sum to 1 - void correctMassFractions(); - - public: // Constructors diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C index 521959a2e9c..62458df4642 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C @@ -47,6 +47,23 @@ const ThermoType& Foam::multiComponentMixture<ThermoType>::constructSpeciesData } +template<class ThermoType> +void Foam::multiComponentMixture<ThermoType>::correctMassFractions() +{ + volScalarField Yt = Y_[0]; + + for (label n=1; n<Y_.size(); n++) + { + Yt += Y_[n]; + } + + forAll (Y_, n) + { + Y_[n] /= Yt; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class ThermoType> @@ -70,6 +87,8 @@ Foam::multiComponentMixture<ThermoType>::multiComponentMixture new ThermoType(*specieThermoData[species_[i]]) ); } + + correctMassFractions(); } @@ -83,7 +102,9 @@ Foam::multiComponentMixture<ThermoType>::multiComponentMixture basicMultiComponentMixture(thermoDict, thermoDict.lookup("species"), mesh), speciesData_(species_.size()), mixture_("mixture", constructSpeciesData(thermoDict)) -{} +{ + correctMassFractions(); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -- GitLab