antioch-0.4.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
Antioch::CEACurveFit< CoeffType > Class Template Reference

This class only differs from NASA9CurveFit in the construction. More...

#include <ascii_parser.h>

Inheritance diagram for Antioch::CEACurveFit< CoeffType >:
Antioch::NASA9CurveFit< CoeffType > Antioch::NASACurveFitBase< CoeffType >

Public Member Functions

 CEACurveFit (const std::vector< CoeffType > &coeffs)
 
 CEACurveFit (const std::vector< CoeffType > &coeffs, const std::vector< CoeffType > &temps)
 
 ~CEACurveFit ()
 
template<typename StateType >
const StateType cp_over_R (const TempCache< StateType > &cache) const
 
template<typename StateType >
StateType h_over_RT (const TempCache< StateType > &cache) const
 
template<typename StateType >
StateType s_over_R (const TempCache< StateType > &cache) const
 
template<typename StateType >
StateType h_RT_minus_s_R (const TempCache< StateType > &cache) const
 
template<typename StateType >
StateType dh_RT_minus_s_R_dT (const TempCache< StateType > &cache) const
 
unsigned int n_intervals () const
 The number of intervals for this NASA9 curve fit. More...
 
template<typename StateType >
Antioch::rebind< StateType,
unsigned int >::type 
interval (const StateType &T) const
 The interval the input temperature lies in. More...
 
template<typename StateType >
Antioch::rebind< StateType,
unsigned int >::type 
interval (const StateType &T) const
 
const CoeffType * coefficients (const unsigned int interval) const
 The ordering/packing of the coefficients will depend on the subclass. More...
 

Protected Member Functions

void init_nasa9_temps (const std::vector< CoeffType > &coeffs, unsigned n_coeffs)
 
void check_coeff_size () const
 
void check_temp_coeff_size_consistency () const
 

Protected Attributes

unsigned int _n_coeffs
 The number of coefficients in each interval. More...
 
std::vector< CoeffType > _coefficients
 The coefficient data. More...
 
std::vector< CoeffType > _temp
 The temperatures. More...
 

Private Member Functions

void remap_coeffs (const std::vector< CoeffType > &coeffs)
 

Detailed Description

template<typename CoeffType = double>
class Antioch::CEACurveFit< CoeffType >

This class only differs from NASA9CurveFit in the construction.

Here, we assume that there are 10 coefficients, with the 7th being zero. This is exactly the format output from NASA's CEA program and, hence, this class was build to enable this compatiblity. Internally, the coefficients are remapped to 9 coefficients and is then functionally identical to NASA9CurveFit.

Definition at line 72 of file ascii_parser.h.

Constructor & Destructor Documentation

template<typename CoeffType >
Antioch::CEACurveFit< CoeffType >::CEACurveFit ( const std::vector< CoeffType > &  coeffs)
inline

Definition at line 61 of file cea_curve_fit.h.

References Antioch::NASACurveFitBase< CoeffType >::_coefficients, Antioch::NASACurveFitBase< CoeffType >::_n_coeffs, antioch_error_msg, Antioch::NASACurveFitBase< CoeffType >::check_coeff_size(), Antioch::NASACurveFitBase< CoeffType >::check_temp_coeff_size_consistency(), Antioch::NASA9CurveFit< CoeffType >::init_nasa9_temps(), and Antioch::CEACurveFit< CoeffType >::remap_coeffs().

62  :NASA9CurveFit<CoeffType>()
63  {
64 
65  if( this->_coefficients.size()%10 != 0 )
66  antioch_error_msg("ERROR: Expected CEA style of input for coefficients! Must be a multiple of 10!");
67 
68  this->_n_coeffs = 9;
69 
70  // If no temp is provided, we assume the standard CEA form.
71  this->init_nasa9_temps( coeffs, 10 );
72 
73  this->remap_coeffs(coeffs);
74 
75  this->check_coeff_size();
77  }
void remap_coeffs(const std::vector< CoeffType > &coeffs)
void check_temp_coeff_size_consistency() const
void init_nasa9_temps(const std::vector< CoeffType > &coeffs, unsigned n_coeffs)
#define antioch_error_msg(errmsg)
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType >
Antioch::CEACurveFit< CoeffType >::CEACurveFit ( const std::vector< CoeffType > &  coeffs,
const std::vector< CoeffType > &  temps 
)
inline

Definition at line 81 of file cea_curve_fit.h.

References Antioch::NASACurveFitBase< CoeffType >::_coefficients, Antioch::NASACurveFitBase< CoeffType >::_n_coeffs, Antioch::NASACurveFitBase< CoeffType >::_temp, antioch_error_msg, Antioch::NASACurveFitBase< CoeffType >::check_coeff_size(), Antioch::NASACurveFitBase< CoeffType >::check_temp_coeff_size_consistency(), and Antioch::CEACurveFit< CoeffType >::remap_coeffs().

83  :NASA9CurveFit<CoeffType>()
84  {
85  if( this->_coefficients.size()%10 != 0 )
86  antioch_error_msg("ERROR: Expected CEA style of input for coefficients! Must be a multiple of 10!");
87 
88  this->_n_coeffs = 9;
89 
90  this->_temp = temp;
91 
92  this->remap_coeffs(coeffs);
93 
94  this->check_coeff_size();
96  }
void remap_coeffs(const std::vector< CoeffType > &coeffs)
void check_temp_coeff_size_consistency() const
std::vector< CoeffType > _temp
The temperatures.
#define antioch_error_msg(errmsg)
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType = double>
Antioch::CEACurveFit< CoeffType >::~CEACurveFit ( )
inline

Definition at line 51 of file cea_curve_fit.h.

51 {}

Member Function Documentation

template<typename CoeffType >
void Antioch::NASACurveFitBase< CoeffType >::check_coeff_size ( ) const
inlineprotectedinherited

Definition at line 143 of file nasa_curve_fit_base.h.

References antioch_error_msg.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit(), Antioch::NASA7CurveFit< CoeffType >::NASA7CurveFit(), and Antioch::NASA9CurveFit< CoeffType >::NASA9CurveFit().

144  {
145  if( this->_coefficients.size()%this->_n_coeffs != 0 )
146  {
147  std::stringstream ncs;
148  ncs << this->_n_coeffs;
149 
150  std::stringstream css;
151  css << this->_coefficients.size()%this->_n_coeffs;
152 
153  std::string msg = "ERROR: coeffs size must be a multiple of "+ncs.str()+"\n";
154  msg += " Found "+css.str()+"\n";
155  antioch_error_msg(msg);
156  }
157  }
#define antioch_error_msg(errmsg)
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType >
void Antioch::NASACurveFitBase< CoeffType >::check_temp_coeff_size_consistency ( ) const
inlineprotectedinherited

Definition at line 161 of file nasa_curve_fit_base.h.

References antioch_error_msg.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit(), Antioch::NASA7CurveFit< CoeffType >::NASA7CurveFit(), and Antioch::NASA9CurveFit< CoeffType >::NASA9CurveFit().

162  {
163  if( this->_temp.size() != this->_coefficients.size()/this->_n_coeffs + 1 )
164  {
165  std::stringstream tss;
166  tss << this->_temp.size();
167 
168  std::stringstream css;
169  css << this->_coefficients.size();
170 
171  std::stringstream cssd;
172  cssd << this->_n_coeffs*(this->_temp.size()-1);
173 
174  std::string msg = "ERROR: Inconsistency in temp and coeff size.\n";
175  msg += " Found temp size of "+tss.str()+"\n";
176  msg += " Found coeff size of "+css.str()+"\n";
177  msg += " Expected coeff size of "+cssd.str()+"\n";
178  antioch_error_msg(msg);
179  }
180  }
std::vector< CoeffType > _temp
The temperatures.
#define antioch_error_msg(errmsg)
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType >
const CoeffType * Antioch::NASACurveFitBase< CoeffType >::coefficients ( const unsigned int  interval) const
inlineinherited

The ordering/packing of the coefficients will depend on the subclass.

Returns
a pointer to the coefficients in the interval specified.

Definition at line 133 of file nasa_curve_fit_base.h.

References antioch_assert_less, and antioch_assert_less_equal.

Referenced by AntiochTesting::NASA7XMLParsingTest< long double >::check_curve_fits(), and AntiochTesting::NASA9XMLParsingTest< long double >::test_supplied_species().

134  {
137 
139  }
#define antioch_assert_less(expr1, expr2)
#define antioch_assert_less_equal(expr1, expr2)
Antioch::rebind< StateType, unsigned int >::type interval(const StateType &T) const
The interval the input temperature lies in.
unsigned int n_intervals() const
The number of intervals for this NASA9 curve fit.
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType >
template<typename StateType >
const StateType Antioch::NASA9CurveFit< CoeffType >::cp_over_R ( const TempCache< StateType > &  cache) const
inlineinherited
Returns
the value $\frac{Cp}{\mathrm{R}}$

\[ \frac{Cp}{\mathrm{R}} = \frac{a_0}{T^2} + \frac{a_1}{T} + a_2 + a_3 T + a_4 T^2 + a_5 T^3 + a_6 T^4 \]

Definition at line 199 of file nasa9_curve_fit.h.

References Antioch::if_else(), Antioch::max(), Antioch::min(), Antioch::TempCache< StateType >::T, Antioch::TempCache< StateType >::T2, Antioch::TempCache< StateType >::T3, Antioch::TempCache< StateType >::T4, and Antioch::zero_clone().

Referenced by AntiochTesting::NASA9CurveFitTest< long double >::test_cp().

200  {
201  typedef typename
203  const UIntType interval = this->interval(cache.T);
204  const unsigned int begin_interval = Antioch::min(interval);
205  const unsigned int end_interval = Antioch::max(interval)+1;
206 
207  // FIXME - this needs expression templates to be faster...
208 
209  StateType returnval = Antioch::zero_clone(cache.T);
210 
211  for (unsigned int i=begin_interval; i != end_interval; ++i)
212  {
213  const CoeffType * const a =
214  this->coefficients(i);
215  returnval = Antioch::if_else
216  (interval == i,
217  StateType(a[0]/cache.T2 + a[1]/cache.T + a[2] + a[3]*cache.T +
218  a[4]*cache.T2 + a[5]*cache.T3 + a[6]*cache.T4),
219  returnval);
220  }
221 
222  return returnval;
223 
224  }
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
Definition: eigen_utils.h:88
const CoeffType * coefficients(const unsigned int interval) const
The ordering/packing of the coefficients will depend on the subclass.
Antioch::rebind< StateType, unsigned int >::type interval(const StateType &T) const
The interval the input temperature lies in.
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type min(const T &in)
Definition: eigen_utils.h:98
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type if_else(const Condition &condition, const T1 &if_true, const T2 &if_false)
Definition: eigen_utils.h:250
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<typename CoeffType >
template<typename StateType >
StateType Antioch::NASA9CurveFit< CoeffType >::dh_RT_minus_s_R_dT ( const TempCache< StateType > &  cache) const
inlineinherited
Returns
the value $\frac{\partial\left(\frac{g}{\mathrm{R}T}\right)}{\partial T} = \frac{\partial\left(\frac{h}{\mathrm{R}T} - \frac{s}{R}\right)}{\partial T}$

\[ \frac{g}{\mathrm{R}T} = \frac{a_0}{T^3} + \frac{a_1 + a_8}{T^2} + a_1 \ln(T) + a_1 - \frac{a2}{T} - \frac{a_3}{2} - \frac{a_4}{3} T - \frac{a_5}{4} T^2 - \frac{a_6}{5} T^3 \]

Definition at line 317 of file nasa9_curve_fit.h.

References Antioch::if_else(), Antioch::TempCache< StateType >::lnT, Antioch::max(), Antioch::min(), Antioch::TempCache< StateType >::T, Antioch::TempCache< StateType >::T2, Antioch::TempCache< StateType >::T3, and Antioch::zero_clone().

318  {
319  typedef typename
321  const UIntType interval = this->interval(cache.T);
322  const unsigned int begin_interval = Antioch::min(interval);
323  const unsigned int end_interval = Antioch::max(interval)+1;
324 
325  // FIXME - this needs expression templates to be faster...
326 
327  StateType returnval = Antioch::zero_clone(cache.T);
328 
329  /* h/RT = -a[0]/T2 + a[1]*lnT/T + a[2] + a[3]*T/2. + a[4]*T2/3. + a[5]*T3/4. + a[6]*T4/5. + a[7]/T,
330  s/R = -a[0]/T2/2. - a[1]/T + a[2]*lnT + a[3]*T + a[4]*T2/2. + a[5]*T3/3. + a[6]*T4/4. + a[8] */
331  for (unsigned int i=begin_interval; i != end_interval; ++i)
332  {
333  const CoeffType * const a =
334  this->coefficients(i);
335  returnval = Antioch::if_else
336  (interval == i,
337  StateType(a[0]/cache.T3 - a[7]/cache.T2 -
338  a[1]*cache.lnT/cache.T2 - a[2]/cache.T -
339  a[3]/2. - a[4]*cache.T/3. - a[5]*cache.T2/4. -
340  a[6]*cache.T3/5.),
341  returnval);
342  }
343 
344  return returnval;
345 
346  }
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
Definition: eigen_utils.h:88
const CoeffType * coefficients(const unsigned int interval) const
The ordering/packing of the coefficients will depend on the subclass.
Antioch::rebind< StateType, unsigned int >::type interval(const StateType &T) const
The interval the input temperature lies in.
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type min(const T &in)
Definition: eigen_utils.h:98
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type if_else(const Condition &condition, const T1 &if_true, const T2 &if_false)
Definition: eigen_utils.h:250
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<typename CoeffType >
template<typename StateType >
StateType Antioch::NASA9CurveFit< CoeffType >::h_over_RT ( const TempCache< StateType > &  cache) const
inlineinherited
Returns
the value $\frac{h}{\mathrm{R}T}$

\[ \frac{h}{\mathrm{R}T} = -\frac{a_0}{T^2} + \frac{a_1}{T} \ln(T) + a2 + \frac{a_3}{2} T + \frac{a_4}{3} T^2 + \frac{a_5}{4} T^3 + \frac{a_6}{5} T^4 + \frac{a_8}{T} \]

Definition at line 229 of file nasa9_curve_fit.h.

References Antioch::if_else(), Antioch::TempCache< StateType >::lnT, Antioch::max(), Antioch::min(), Antioch::TempCache< StateType >::T, Antioch::TempCache< StateType >::T2, Antioch::TempCache< StateType >::T3, Antioch::TempCache< StateType >::T4, and Antioch::zero_clone().

Referenced by AntiochTesting::NASA9CurveFitTest< long double >::test_h().

230  {
231  typedef typename
233  const UIntType interval = this->interval(cache.T);
234  const unsigned int begin_interval = Antioch::min(interval);
235  const unsigned int end_interval = Antioch::max(interval)+1;
236 
237  StateType returnval = Antioch::zero_clone(cache.T);
238 
239  for (unsigned int i=begin_interval; i != end_interval; ++i)
240  {
241  const CoeffType *a = this->coefficients(interval);
242 
243  /* h/RT = -a0*T^-2 + a1*T^-1*lnT + a2 + a3*T/2 + a4*T^2/3 + a5*T^3/4 + a6*T^4/5 + a7/T */
244  returnval = Antioch::if_else
245  ( interval == i,
246  StateType( -a[0]/cache.T2 + a[1]*cache.lnT/cache.T + a[2] +
247  a[3]*cache.T/2.0L + a[4]*cache.T2/3.0L + a[5]*cache.T3/4.0L +
248  a[6]*cache.T4/5.0L + a[7]/cache.T),
249  returnval);
250  }
251  return returnval;
252  }
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
Definition: eigen_utils.h:88
const CoeffType * coefficients(const unsigned int interval) const
The ordering/packing of the coefficients will depend on the subclass.
Antioch::rebind< StateType, unsigned int >::type interval(const StateType &T) const
The interval the input temperature lies in.
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type min(const T &in)
Definition: eigen_utils.h:98
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type if_else(const Condition &condition, const T1 &if_true, const T2 &if_false)
Definition: eigen_utils.h:250
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<typename CoeffType >
template<typename StateType >
StateType Antioch::NASA9CurveFit< CoeffType >::h_RT_minus_s_R ( const TempCache< StateType > &  cache) const
inlineinherited
Returns
the value $\frac{g}{\mathrm{R}T} = \frac{h}{\mathrm{R}T} - \frac{s}{R}$

\[ \frac{g}{\mathrm{R}T} = -\frac{a_0}{2T^2} - \frac{a_1 + a_8}{T} + \frac{a_1}{T} \ln(T) - a2 \ln(T) + (a_2 - a_9) - \frac{a_3}{2} T - \frac{a_4}{6} T^2 - \frac{a_5}{12} T^3 - \frac{a_6}{20} T^4 \]

Definition at line 286 of file nasa9_curve_fit.h.

References Antioch::if_else(), Antioch::TempCache< StateType >::lnT, Antioch::max(), Antioch::min(), Antioch::TempCache< StateType >::T, Antioch::TempCache< StateType >::T2, Antioch::TempCache< StateType >::T3, Antioch::TempCache< StateType >::T4, and Antioch::zero_clone().

287  {
288  typedef typename
290  const UIntType interval = this->interval(cache.T);
291  const unsigned int begin_interval = Antioch::min(interval);
292  const unsigned int end_interval = Antioch::max(interval)+1;
293 
294  StateType returnval = Antioch::zero_clone(cache.T);
295 
296  for (unsigned int i=begin_interval; i != end_interval; ++i)
297  {
298  const CoeffType *a = this->coefficients(interval);
299 
300  /* h/RT = -a[0]/T2 + a[1]*lnT/T + a[2] + a[3]*T/2. + a[4]*T2/3. + a[5]*T3/4. + a[6]*T4/5. + a[7]/T,
301  s/R = -a[0]/T2/2. - a[1]/T + a[2]*lnT + a[3]*T + a[4]*T2/2. + a[5]*T3/3. + a[6]*T4/4. + a[8] */
302  returnval = Antioch::if_else
303  ( interval == i,
304  StateType(-a[0]/cache.T2/2.0 + (a[1] + a[7])/cache.T +
305  a[1]*cache.lnT/cache.T - a[2]*cache.lnT +
306  (a[2] - a[8]) - a[3]*cache.T/2.0 -
307  a[4]*cache.T2/6.0 - a[5]*cache.T3/12.0 -
308  a[6]*cache.T4/20.0),
309  returnval);
310  }
311  return returnval;
312  }
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
Definition: eigen_utils.h:88
const CoeffType * coefficients(const unsigned int interval) const
The ordering/packing of the coefficients will depend on the subclass.
Antioch::rebind< StateType, unsigned int >::type interval(const StateType &T) const
The interval the input temperature lies in.
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type min(const T &in)
Definition: eigen_utils.h:98
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type if_else(const Condition &condition, const T1 &if_true, const T2 &if_false)
Definition: eigen_utils.h:250
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<typename CoeffType >
void Antioch::NASA9CurveFit< CoeffType >::init_nasa9_temps ( const std::vector< CoeffType > &  coeffs,
unsigned  n_coeffs 
)
inlineprotectedinherited

Definition at line 182 of file nasa9_curve_fit.h.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit(), and Antioch::NASA9CurveFit< CoeffType >::NASA9CurveFit().

184  {
185  // All default NASA9 curve fits should have this
186  this->_temp.resize(3);
187  this->_temp[0] = 200.L;
188  this->_temp[1] = 1000.L;
189  this->_temp[2] = 6000.L;
190 
191  // But some also have this last interval. We infer this from the size of the coeffs.
192  if( coeffs.size()/n_coeffs == 3 )
193  this->_temp.push_back(20000.L);
194  }
std::vector< CoeffType > _temp
The temperatures.
template<typename CoeffType = double>
template<typename StateType >
Antioch::rebind<StateType, unsigned int>::type Antioch::NASACurveFitBase< CoeffType >::interval ( const StateType &  T) const
inherited

The interval the input temperature lies in.

Returns
which curve fit interval the input temperature lies in.
template<typename CoeffType = double>
template<typename StateType >
Antioch::rebind<StateType, unsigned int>::type Antioch::NASACurveFitBase< CoeffType >::interval ( const StateType &  T) const
inlineinherited

Definition at line 113 of file nasa_curve_fit_base.h.

References Antioch::constant_clone(), Antioch::if_else(), and Antioch::zero_clone().

114  {
115  typedef typename
117  UIntType interval;
118  Antioch::zero_clone(interval, T);
119 
120  for(unsigned int i = 1; i < _temp.size(); ++i)
121  {
122  interval = Antioch::if_else
123  (T > _temp[i-1] && T < _temp[i],
124  Antioch::constant_clone(interval, i-1),
125  interval );
126  }
127 
128  return interval;
129  }
std::vector< CoeffType > _temp
The temperatures.
Antioch::rebind< StateType, unsigned int >::type interval(const StateType &T) const
The interval the input temperature lies in.
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > constant_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex, const Scalar &value)
Definition: eigen_utils.h:181
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type if_else(const Condition &condition, const T1 &if_true, const T2 &if_false)
Definition: eigen_utils.h:250
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<typename CoeffType >
unsigned int Antioch::NASACurveFitBase< CoeffType >::n_intervals ( ) const
inlineinherited

The number of intervals for this NASA9 curve fit.

Definition at line 106 of file nasa_curve_fit_base.h.

Referenced by AntiochTesting::NASA7XMLParsingTest< long double >::check_curve_fits(), and AntiochTesting::NASA9XMLParsingTest< long double >::test_supplied_species().

107  { return _coefficients.size() / _n_coeffs; }
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType >
void Antioch::CEACurveFit< CoeffType >::remap_coeffs ( const std::vector< CoeffType > &  coeffs)
inlineprivate

Definition at line 100 of file cea_curve_fit.h.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit().

101  {
102  this->_coefficients.resize(this->_n_coeffs*(this->_temp.size()-1),0.0);
103 
104  for( unsigned int t = 0; t < this->_temp.size()-1; t++ )
105  {
106  for( unsigned int c = 0; c < 7; c++ )
107  {
108  unsigned int i = 10*t + c;
109  unsigned int j = 9*t + c;
110  this->_coefficients[j] = coeffs[i];
111  }
112 
113  for( unsigned int c = 7; c < 9; c++ )
114  {
115  unsigned int i = 10*t + c;
116  unsigned int j = 9*t + c;
117  this->_coefficients[j] = coeffs[i+1];
118  }
119  }
120  }
std::vector< CoeffType > _temp
The temperatures.
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType >
template<typename StateType >
StateType Antioch::NASA9CurveFit< CoeffType >::s_over_R ( const TempCache< StateType > &  cache) const
inlineinherited
Returns
the value $\frac{s}{\mathrm{R}}$

\[ \frac{s}{\mathrm{R}} = -\frac{a_0}{2T^2} - \frac{a_1}{T} + a_2 \ln(T) + a_3 T + \frac{a_4}{2} T^2 + \frac{a_5}{3} T^3 + \frac{a_6}{4} T^4 + a_9 \]

Definition at line 257 of file nasa9_curve_fit.h.

References Antioch::if_else(), Antioch::TempCache< StateType >::lnT, Antioch::max(), Antioch::min(), Antioch::TempCache< StateType >::T, Antioch::TempCache< StateType >::T2, Antioch::TempCache< StateType >::T3, Antioch::TempCache< StateType >::T4, and Antioch::zero_clone().

Referenced by AntiochTesting::NASA9CurveFitTest< long double >::test_s().

258  {
259  typedef typename
261  const UIntType interval = this->interval(cache.T);
262  const unsigned int begin_interval = Antioch::min(interval);
263  const unsigned int end_interval = Antioch::max(interval)+1;
264 
265  StateType returnval = Antioch::zero_clone(cache.T);
266 
267  for (unsigned int i=begin_interval; i != end_interval; ++i)
268  {
269  const CoeffType *a = this->coefficients(interval);
270 
271  /* s/R = -a0*T^-2/2 - a1*T^-1 + a2*lnT + a3*T + a4*T^2/2 + a5*T^3/3 + a6*T^4/4 + a8 */
272  returnval = Antioch::if_else
273  ( interval == i,
274  StateType( -a[0]/cache.T2/2.0 - a[1]/cache.T + a[2]*cache.lnT
275  + a[3]*cache.T + a[4]*cache.T2/2.0 + a[5]*cache.T3/3.0
276  + a[6]*cache.T4/4.0 + a[8]),
277  returnval);
278  }
279  return returnval;
280  }
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
Definition: eigen_utils.h:88
const CoeffType * coefficients(const unsigned int interval) const
The ordering/packing of the coefficients will depend on the subclass.
Antioch::rebind< StateType, unsigned int >::type interval(const StateType &T) const
The interval the input temperature lies in.
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type min(const T &in)
Definition: eigen_utils.h:98
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type if_else(const Condition &condition, const T1 &if_true, const T2 &if_false)
Definition: eigen_utils.h:250
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145

Member Data Documentation

template<typename CoeffType = double>
std::vector<CoeffType> Antioch::NASACurveFitBase< CoeffType >::_coefficients
protectedinherited

The coefficient data.

The coeffcients are packed in linear ordering. That is, a0-a9 for the first interval, a0-a9 for the second interval, and so on.

Definition at line 85 of file nasa_curve_fit_base.h.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit().

template<typename CoeffType = double>
unsigned int Antioch::NASACurveFitBase< CoeffType >::_n_coeffs
protectedinherited
template<typename CoeffType = double>
std::vector<CoeffType> Antioch::NASACurveFitBase< CoeffType >::_temp
protectedinherited

The temperatures.

The temperature defining the intervals

Definition at line 91 of file nasa_curve_fit_base.h.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit(), and Antioch::NASA7CurveFit< CoeffType >::NASA7CurveFit().


The documentation for this class was generated from the following files:

Generated on Thu Jul 7 2016 11:09:48 for antioch-0.4.0 by  doxygen 1.8.8