Commit 57019e88 authored by andy's avatar andy
Browse files

ENH: Added checking for mass fractions summing to zero

parent 94da7c46
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment