Fixed value checks for falloff parameterizations
This commit is contained in:
parent
d69eea2b3e
commit
58e3bade9a
2 changed files with 13 additions and 15 deletions
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "cantera/kinetics/FalloffFactory.h"
|
||||
#include "cantera/base/ctexceptions.h"
|
||||
#include "cantera/base/stringUtils.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
@ -350,6 +351,10 @@ public:
|
|||
* a, b, and c of the SRI parameterization
|
||||
*/
|
||||
virtual void init(const vector_fp& c) {
|
||||
if (c[2] < 0.0) {
|
||||
throw CanteraError("SRI3::init()",
|
||||
"m_c parameter is less than zero: " + fp2str(c[2]));
|
||||
}
|
||||
m_a = c[0];
|
||||
m_b = c[1];
|
||||
m_c = c[2];
|
||||
|
|
@ -459,6 +464,14 @@ public:
|
|||
* a, b, c, d, and e of the SRI parameterization
|
||||
*/
|
||||
virtual void init(const vector_fp& c) {
|
||||
if (c[2] < 0.0) {
|
||||
throw CanteraError("SRI5::init()",
|
||||
"m_c parameter is less than zero: " + fp2str(c[2]));
|
||||
}
|
||||
if (c[3] < 0.0) {
|
||||
throw CanteraError("SRI5::init()",
|
||||
"m_d parameter is less than zero: " + fp2str(c[3]));
|
||||
}
|
||||
m_a = c[0];
|
||||
m_b = c[1];
|
||||
m_c = c[2];
|
||||
|
|
|
|||
|
|
@ -431,23 +431,8 @@ static void getFalloff(const XML_Node& f, ReactionData& rdata)
|
|||
if (type == "Troe") {
|
||||
if (np == 4) {
|
||||
rdata.falloffType = TROE4_FALLOFF;
|
||||
if (c[1] < 0.0) {
|
||||
throw CanteraError("getFalloff()", "Troe4 T3 parameter is less than zero: " + fp2str(c[1]));
|
||||
}
|
||||
if (c[2] < 0.0) {
|
||||
throw CanteraError("getFalloff()", "Troe4 T1 parameter is less than zero: " + fp2str(c[2]));
|
||||
}
|
||||
if (c[3] < 0.0) {
|
||||
throw CanteraError("getFalloff()", "Troe4 T2 parameter is less than zero: " + fp2str(c[3]));
|
||||
}
|
||||
} else if (np == 3) {
|
||||
rdata.falloffType = TROE3_FALLOFF;
|
||||
if (c[1] < 0.0) {
|
||||
throw CanteraError("getFalloff()", "Troe3 T3 parameter is less than zero: " + fp2str(c[1]));
|
||||
}
|
||||
if (c[2] < 0.0) {
|
||||
throw CanteraError("getFalloff()", "Troe3 T1 parameter is less than zero: " + fp2str(c[2]));
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("getFalloff()", "Troe parameterization is specified by number of pararameters, "
|
||||
+ int2str(np) + ", is not equal to 3 or 4");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue