chemkinReader: Add tolerance to element balance check

Patch provided by Daniel Jasinski
Resolved bug-report http://www.openfoam.org/mantisbt/view.php?id=1843
This commit is contained in:
Henry Weller
2015-09-02 15:32:16 +01:00
parent 7405f7552e
commit 8733ce815e
2 changed files with 12 additions and 6 deletions

View File

@ -753,10 +753,11 @@ void Foam::chemkinReader::addReaction
forAll(nAtoms, i) forAll(nAtoms, i)
{ {
if (mag(nAtoms[i]) > SMALL) if (mag(nAtoms[i]) > imbalanceTol_)
{ {
FatalErrorIn("chemkinReader::addReaction") FatalErrorIn("chemkinReader::addReaction")
<< "Elemental imbalance in " << elementNames_[i] << "Elemental imbalance of " << mag(nAtoms[i])
<< " in " << elementNames_[i]
<< " in reaction" << nl << " in reaction" << nl
<< reactions_.last() << nl << reactions_.last() << nl
<< " on line " << lineNo_-1 << " on line " << lineNo_-1
@ -839,7 +840,8 @@ Foam::chemkinReader::chemkinReader
specieNames_(10), specieNames_(10),
speciesTable_(species), speciesTable_(species),
reactions_(speciesTable_, speciesThermo_), reactions_(speciesTable_, speciesThermo_),
newFormat_(newFormat) newFormat_(newFormat),
imbalanceTol_(ROOTSMALL)
{ {
read(CHEMKINFileName, thermoFileName); read(CHEMKINFileName, thermoFileName);
} }
@ -855,7 +857,8 @@ Foam::chemkinReader::chemkinReader
specieNames_(10), specieNames_(10),
speciesTable_(species), speciesTable_(species),
reactions_(speciesTable_, speciesThermo_), reactions_(speciesTable_, speciesThermo_),
newFormat_(thermoDict.lookupOrDefault("newFormat", false)) newFormat_(thermoDict.lookupOrDefault("newFormat", false)),
imbalanceTol_(thermoDict.lookupOrDefault("imbalanceTolerance", ROOTSMALL))
{ {
if (newFormat_) if (newFormat_)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -77,7 +77,7 @@ public:
gas gas
}; };
//- Species element //- species element
struct specieElement struct specieElement
{ {
word elementName; word elementName;
@ -211,6 +211,9 @@ private:
//- Flag to indicate that file is in new format //- Flag to indicate that file is in new format
Switch newFormat_; Switch newFormat_;
//- Tolerance for element imbalance in a reaction
scalar imbalanceTol_;
// Private Member Functions // Private Member Functions