[Kinetics] Add methods for inspecting Falloff objects

This commit is contained in:
Ray Speth 2015-04-22 18:09:40 -04:00
parent 9d4a3e0f75
commit d2418c0c2a
2 changed files with 54 additions and 1 deletions

View file

@ -1,7 +1,7 @@
#ifndef CT_FALLOFF_H
#define CT_FALLOFF_H
#include "cantera/base/ct_defs.h"
#include "cantera/kinetics/reaction_defs.h"
namespace Cantera
{
@ -69,6 +69,21 @@ public:
virtual size_t workSize() {
return 0;
}
//! Return an integer representing the type of the Falloff parameterization.
virtual int getType() const {
return SIMPLE_FALLOFF;
}
//! Returns the number of parameters used by this parameterization. The
//! values of these parameters can be obtained from getParameters().
virtual size_t nParameters() const {
return 0;
}
//! Get the values of the parameters for this object. *params* must be an
//! array of at least nParameters() elements.
virtual void getParameters(double* params) const {}
};
@ -127,6 +142,17 @@ public:
return 1;
}
virtual int getType() const {
return TROE_FALLOFF;
}
virtual size_t nParameters() const {
return 4;
}
//! Sets params to contain, in order, \f[ (A, T_3, T_1, T_2) \f]
virtual void getParameters(double* params) const;
protected:
//! parameter a in the 4-parameter Troe falloff function. Dimensionless
doublereal m_a;
@ -190,6 +216,17 @@ public:
return 2;
}
virtual int getType() const {
return SRI_FALLOFF;
}
virtual size_t nParameters() const {
return 5;
}
//! Sets params to contain, in order, \f[ (a, b, c, d, e) \f]
virtual void getParameters(double* params) const;
protected:
//! parameter a in the 5-parameter SRI falloff function. Dimensionless.
doublereal m_a;

View file

@ -48,6 +48,13 @@ double Troe::F(double pr, const double* work) const
return pow(10.0, lgf);
}
void Troe::getParameters(double* params) const {
params[0] = m_a;
params[1] = 1.0/m_rt3;
params[2] = 1.0/m_rt1;
params[3] = m_t2;
}
void SRI::init(const vector_fp& c)
{
if (c[2] < 0.0) {
@ -87,4 +94,13 @@ double SRI::F(double pr, const double* work) const
return pow(*work, xx) * work[1];
}
void SRI::getParameters(double* params) const
{
params[0] = m_a;
params[1] = m_b;
params[2] = m_c;
params[3] = m_d;
params[4] = m_e;
}
}