diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C index dbdc804d8b239768a3ff99bb923904ab296d6ac6..f10a1ce48b1bdbd325b7403f8da004748a76fa5d 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ const ThermoType& Foam::multiComponentMixture<ThermoType>::constructSpeciesData template<class ThermoType> void Foam::multiComponentMixture<ThermoType>::correctMassFractions() { - // It changes Yt patches to "calculated" + // Multiplication by 1.0 changes Yt patches to "calculated" volScalarField Yt("Yt", 1.0*Y_[0]); for (label n=1; n<Y_.size(); n++) @@ -57,6 +57,17 @@ void Foam::multiComponentMixture<ThermoType>::correctMassFractions() Yt += Y_[n]; } + if (mag(max(Yt).value()) < ROOTVSMALL) + { + FatalErrorIn + ( + "void Foam::multiComponentMixture<ThermoType>::" + "correctMassFractions()" + ) + << "Sum of mass fractions is zero for species " << this->species() + << exit(FatalError); + } + forAll(Y_, n) { Y_[n] /= Yt;