mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added checking for mass fractions summing to zero
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user