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

#include <ascii_parser.h>

Classes

class  Cache
 

Public Member Functions

 CEAThermodynamics (const ChemicalMixture< CoeffType > &chem_mixture, const std::string &filename=DefaultFilename::thermo_data())
 
virtual ~CEAThermodynamics ()
 Destructor. More...
 
void add_curve_fit (const std::string &species_name, const std::vector< CoeffType > &coeffs)
 
void add_curve_fit (const std::string &species_name, const std::vector< CoeffType > &coeffs, const std::vector< CoeffType > &)
 
bool check () const
 Checks that curve fits have been specified for all species in the mixture. More...
 
template<typename StateType >
StateType cp (const Cache< StateType > &cache, unsigned int species) const
 We currently need different specializations for scalar vs vector inputs here. More...
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
StateType >::type 
cp (const Cache< StateType > &cache, const VectorStateType &mass_fractions) const
 
template<typename StateType >
StateType cv (const Cache< StateType > &cache, unsigned int species) const
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
StateType >::type 
cv (const Cache< StateType > &cache, const VectorStateType &mass_fractions) const
 
template<typename StateType >
StateType h (const Cache< StateType > &cache, unsigned int species) const
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
void >::type 
h (const Cache< StateType > &cache, VectorStateType &h) const
 
template<typename StateType >
StateType h_RT_minus_s_R (const Cache< StateType > &cache, unsigned int species) const
 We currently need different specializations for scalar vs vector inputs here. More...
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
void >::type 
h_RT_minus_s_R (const Cache< StateType > &cache, VectorStateType &h_RT_minus_s_R) const
 
template<typename StateType >
StateType dh_RT_minus_s_R_dT (const Cache< StateType > &cache, unsigned int species) const
 We currently need different specializations for scalar vs vector inputs here. More...
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
void >::type 
dh_RT_minus_s_R_dT (const Cache< StateType > &cache, VectorStateType &dh_RT_minus_s_R_dT) const
 
template<typename StateType >
StateType cp_over_R (const Cache< StateType > &cache, unsigned int species) const
 
template<typename StateType >
StateType h_over_RT (const Cache< StateType > &cache, unsigned int species) const
 
template<typename StateType >
StateType s_over_R (const Cache< StateType > &cache, unsigned int species) const
 
const ChemicalMixture
< CoeffType > & 
chemical_mixture () const
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
StateType >::type 
cp (const Cache< StateType > &cache, const VectorStateType &mass_fractions) const
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
void >::type 
h (const Cache< StateType > &cache, VectorStateType &h) const
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
void >::type 
h_RT_minus_s_R (const Cache< StateType > &cache, VectorStateType &h_RT_minus_s_R) const
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
void >::type 
dh_RT_minus_s_R_dT (const Cache< StateType > &cache, VectorStateType &dh_RT_minus_s_R_dT) const
 
template<typename StateType , typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
StateType >::type 
cv (const Cache< StateType > &cache, const VectorStateType &mass_fractions) const
 

Protected Attributes

const ChemicalMixture
< CoeffType > & 
_chem_mixture
 
std::vector< CEACurveFit
< CoeffType > * > 
_species_curve_fits
 
std::vector< CoeffType > _cp_at_200p1
 

Private Member Functions

 CEAThermodynamics ()
 Default constructor. More...
 

Detailed Description

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

Definition at line 75 of file ascii_parser.h.

Constructor & Destructor Documentation

template<typename CoeffType >
Antioch::CEAThermodynamics< CoeffType >::CEAThermodynamics ( const ChemicalMixture< CoeffType > &  chem_mixture,
const std::string &  filename = DefaultFilename::thermo_data() 
)
inline

deprecated

Definition at line 186 of file cea_thermo.h.

References Antioch::CEAThermodynamics< CoeffType >::_cp_at_200p1, Antioch::CEAThermodynamics< CoeffType >::_species_curve_fits, antioch_deprecated, Antioch::CEAThermodynamics< CoeffType >::cp(), and Antioch::read_cea_mixture_data_ascii().

187  : _chem_mixture(chem_mixture),
188  _species_curve_fits(chem_mixture.n_species(), NULL)
189  {
190 
191  // should not use this object
193 
194  // Read in CEA coefficients. Note this assumes chem_mixture is fully constructed.
196  read_cea_mixture_data_ascii(*this, filename);
197 
198  // Cache cp values at small temperatures
199  _cp_at_200p1.reserve( _species_curve_fits.size() );
200  for( unsigned int s = 0; s < _species_curve_fits.size(); s++ )
201  {
202  _cp_at_200p1.push_back(CoeffType(0));
203  _cp_at_200p1[s] = this->cp( Cache<CoeffType>(200.1), s );
204  }
205 
206  return;
207  }
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
const ChemicalMixture< CoeffType > & _chem_mixture
Definition: cea_thermo.h:168
#define antioch_deprecated()
std::vector< CoeffType > _cp_at_200p1
Definition: cea_thermo.h:172
void read_cea_mixture_data_ascii(CEAThermoMixture< NumericType > &thermo, const std::string &filename)
StateType cp(const Cache< StateType > &cache, unsigned int species) const
We currently need different specializations for scalar vs vector inputs here.
Definition: cea_thermo.h:264
template<typename CoeffType >
Antioch::CEAThermodynamics< CoeffType >::~CEAThermodynamics ( )
inlinevirtual

Destructor.

virtual so this can be subclassed by the user.

Definition at line 212 of file cea_thermo.h.

213  {
214  // Clean up all the CEACurveFits we created
215  for( typename std::vector<CEACurveFit<CoeffType>* >::iterator it = _species_curve_fits.begin();
216  it < _species_curve_fits.end(); ++it )
217  {
218  delete (*it);
219  }
220 
221  return;
222  }
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
template<typename CoeffType = double>
Antioch::CEAThermodynamics< CoeffType >::CEAThermodynamics ( )
private

Default constructor.

Private to force to user to supply a ChemicalMixture object.

Member Function Documentation

template<typename CoeffType >
void Antioch::CEAThermodynamics< CoeffType >::add_curve_fit ( const std::string &  species_name,
const std::vector< CoeffType > &  coeffs 
)
inline

Definition at line 227 of file cea_thermo.h.

References antioch_assert, and antioch_assert_less_equal.

Referenced by Antioch::CEAThermodynamics< CoeffType >::add_curve_fit(), Antioch::read_cea_thermo_data_ascii(), and Antioch::ASCIIParser< NumericType >::read_thermodynamic_data().

229  {
230  antioch_assert( _chem_mixture.species_name_map().find(species_name) !=
231  _chem_mixture.species_name_map().end() );
232 
233  unsigned int s = _chem_mixture.species_name_map().find(species_name)->second;
234 
237 
238  _species_curve_fits[s] = new CEACurveFit<CoeffType>(coeffs);
239  return;
240  }
#define antioch_assert(asserted)
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
const ChemicalMixture< CoeffType > & _chem_mixture
Definition: cea_thermo.h:168
#define antioch_assert_less_equal(expr1, expr2)
template<typename CoeffType = double>
void Antioch::CEAThermodynamics< CoeffType >::add_curve_fit ( const std::string &  species_name,
const std::vector< CoeffType > &  coeffs,
const std::vector< CoeffType > &   
)
inline

Definition at line 95 of file cea_thermo.h.

References Antioch::CEAThermodynamics< CoeffType >::add_curve_fit().

96  {this->add_curve_fit(species_name,coeffs);}
void add_curve_fit(const std::string &species_name, const std::vector< CoeffType > &coeffs)
Definition: cea_thermo.h:227
template<typename CoeffType >
bool Antioch::CEAThermodynamics< CoeffType >::check ( ) const
inline

Checks that curve fits have been specified for all species in the mixture.

Definition at line 245 of file cea_thermo.h.

Referenced by Antioch::read_cea_thermo_data_ascii().

246  {
247  bool valid = true;
248 
249  for( typename std::vector<CEACurveFit<CoeffType>* >::const_iterator it = _species_curve_fits.begin();
250  it != _species_curve_fits.end(); ++ it )
251  {
252  if( !(*it) )
253  valid = false;
254  }
255 
256  return valid;
257  }
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
template<typename CoeffType >
const ChemicalMixture< CoeffType > & Antioch::CEAThermodynamics< CoeffType >::chemical_mixture ( ) const
inline

Definition at line 572 of file cea_thermo.h.

Referenced by Antioch::read_cea_thermo_data_ascii(), and Antioch::ASCIIParser< NumericType >::read_thermodynamic_data().

573  {
574  return _chem_mixture;
575  }
const ChemicalMixture< CoeffType > & _chem_mixture
Definition: cea_thermo.h:168
template<typename CoeffType >
template<typename StateType >
StateType Antioch::CEAThermodynamics< CoeffType >::cp ( const Cache< StateType > &  cache,
unsigned int  species 
) const
inline

We currently need different specializations for scalar vs vector inputs here.

Definition at line 264 of file cea_thermo.h.

References Antioch::constant_clone(), Antioch::if_else(), and Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T.

Referenced by Antioch::CEAThermodynamics< CoeffType >::CEAThermodynamics(), and test_cp().

265  {
266  typedef typename Antioch::value_type<StateType>::type ScalarType;
267 
268  // T < 200.1 ? cp_at_200p1 : R * cp_over_R
269  return
271  (cache.T < ScalarType(200.1),
273  (cache.T,_cp_at_200p1[species]),
274  StateType
275  (this->_chem_mixture.R(species) *
276  this->cp_over_R(cache, species)));
277  }
const ChemicalMixture< CoeffType > & _chem_mixture
Definition: cea_thermo.h:168
StateType cp_over_R(const Cache< StateType > &cache, unsigned int species) const
Definition: cea_thermo.h:335
_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
std::vector< CoeffType > _cp_at_200p1
Definition: cea_thermo.h:172
template<typename CoeffType = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, StateType >::type Antioch::CEAThermodynamics< CoeffType >::cp ( const Cache< StateType > &  cache,
const VectorStateType &  mass_fractions 
) const
template<typename CoeffType = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, StateType >::type Antioch::CEAThermodynamics< CoeffType >::cp ( const Cache< StateType > &  cache,
const VectorStateType &  mass_fractions 
) const
inline

Definition at line 286 of file cea_thermo.h.

References antioch_assert_equal_to, antioch_assert_greater, and cp().

288  {
289  antioch_assert_equal_to( mass_fractions.size(), _species_curve_fits.size() );
290  antioch_assert_greater( mass_fractions.size(), 0 );
291 
292  StateType cp = mass_fractions[0]*this->cp(cache,0);
293 
294  for( unsigned int s = 1; s < _species_curve_fits.size(); s++ )
295  {
296  cp += mass_fractions[s]*this->cp(cache,s);
297  }
298 
299  return cp;
300  }
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
#define antioch_assert_equal_to(expr1, expr2)
#define antioch_assert_greater(expr1, expr2)
StateType cp(const Cache< StateType > &cache, unsigned int species) const
We currently need different specializations for scalar vs vector inputs here.
Definition: cea_thermo.h:264
template<typename CoeffType >
template<typename StateType >
StateType Antioch::CEAThermodynamics< CoeffType >::cp_over_R ( const Cache< StateType > &  cache,
unsigned int  species 
) const
inline

Definition at line 335 of file cea_thermo.h.

References antioch_assert_less, Antioch::if_else(), Antioch::max(), Antioch::min(), Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T2, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T3, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T4, and Antioch::zero_clone().

336  {
337  antioch_assert_less( species, _species_curve_fits.size() );
338  // FIXME - we need assert_less to be vectorizable
339  // antioch_assert_less( _species_curve_fits[species]->interval(cache.T),
340  // _species_curve_fits[species]->n_intervals() );
341 
342  typedef typename
344  const UIntType interval = this->_species_curve_fits[species]->interval(cache.T);
345 
346  const unsigned int begin_interval = Antioch::min(interval);
347  const unsigned int end_interval = Antioch::max(interval)+1;
348 
349  // FIXME - this needs expression templates to be faster...
350 
351  StateType returnval = Antioch::zero_clone(cache.T);
352 
353  /* cp/R = a0*T^-2 + a1*T^-1 + a2 + a3*T + a4*T^2 + a5*T^3 + a6*T^4 */
354  for (unsigned int i=begin_interval; i != end_interval; ++i)
355  {
356  const CoeffType * const a =
357  this->_species_curve_fits[species]->coefficients(i);
358  returnval = Antioch::if_else
359  (interval == i,
360  StateType(a[0]/cache.T2 + a[1]/cache.T + a[2] + a[3]*cache.T +
361  a[4]*cache.T2 + a[5]*cache.T3 + a[6]*cache.T4),
362  returnval);
363  }
364 
365  return returnval;
366  }
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
Definition: eigen_utils.h:88
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
#define antioch_assert_less(expr1, expr2)
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::CEAThermodynamics< CoeffType >::cv ( const Cache< StateType > &  cache,
unsigned int  species 
) const
inline

Definition at line 553 of file cea_thermo.h.

References cp().

554  {
555  return this->cp(cache,species) - _chem_mixture.R(species);
556  }
const ChemicalMixture< CoeffType > & _chem_mixture
Definition: cea_thermo.h:168
StateType cp(const Cache< StateType > &cache, unsigned int species) const
We currently need different specializations for scalar vs vector inputs here.
Definition: cea_thermo.h:264
template<typename CoeffType = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, StateType >::type Antioch::CEAThermodynamics< CoeffType >::cv ( const Cache< StateType > &  cache,
const VectorStateType &  mass_fractions 
) const
template<typename CoeffType = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, StateType >::type Antioch::CEAThermodynamics< CoeffType >::cv ( const Cache< StateType > &  cache,
const VectorStateType &  mass_fractions 
) const
inline

Definition at line 564 of file cea_thermo.h.

References cp().

566  {
567  return this->cp(cache,mass_fractions) - _chem_mixture.R(mass_fractions);
568  }
const ChemicalMixture< CoeffType > & _chem_mixture
Definition: cea_thermo.h:168
StateType cp(const Cache< StateType > &cache, unsigned int species) const
We currently need different specializations for scalar vs vector inputs here.
Definition: cea_thermo.h:264
template<typename CoeffType >
template<typename StateType >
StateType Antioch::CEAThermodynamics< CoeffType >::dh_RT_minus_s_R_dT ( const Cache< StateType > &  cache,
unsigned int  species 
) const
inline

We currently need different specializations for scalar vs vector inputs here.

Definition at line 487 of file cea_thermo.h.

References antioch_assert_less, Antioch::if_else(), Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::lnT, Antioch::max(), Antioch::min(), Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T2, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T3, and Antioch::zero_clone().

Referenced by tester(), and vectester().

488  {
489  antioch_assert_less( species, _species_curve_fits.size() );
490  // FIXME - we need assert_less to be vectorizable
491  // antioch_assert_less( _species_curve_fits[species]->interval(cache.T),
492  // _species_curve_fits[species]->n_intervals() );
493 
494  typedef typename
496  const UIntType interval = this->_species_curve_fits[species]->interval(cache.T);
497 
498  const unsigned int begin_interval = Antioch::min(interval);
499  const unsigned int end_interval = Antioch::max(interval)+1;
500 
501  // FIXME - this needs expression templates to be faster...
502 
503  StateType returnval = Antioch::zero_clone(cache.T);
504 
505  typedef typename
507 
508  /* 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,
509  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] */
510  for (unsigned int i=begin_interval; i != end_interval; ++i)
511  {
512  const CoeffType * const a =
513  this->_species_curve_fits[species]->coefficients(i);
514  returnval = Antioch::if_else
515  (interval == i,
516  StateType(a[0]/cache.T3 - a[7]/cache.T2 -
517  a[1]*cache.lnT/cache.T2 - a[2]/cache.T -
518  a[3]/raw_type(2) - a[4]*cache.T/raw_type(3) -
519  a[5]*cache.T2/raw_type(4) -
520  a[6]*cache.T3/raw_type(5)),
521  returnval);
522  }
523 
524  return returnval;
525  }
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
Definition: eigen_utils.h:88
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
#define antioch_assert_less(expr1, expr2)
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 = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, void >::type Antioch::CEAThermodynamics< CoeffType >::dh_RT_minus_s_R_dT ( const Cache< StateType > &  cache,
VectorStateType &  dh_RT_minus_s_R_dT 
) const
template<typename CoeffType = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, void >::type Antioch::CEAThermodynamics< CoeffType >::dh_RT_minus_s_R_dT ( const Cache< StateType > &  cache,
VectorStateType &  dh_RT_minus_s_R_dT 
) const
inline

Definition at line 534 of file cea_thermo.h.

References antioch_assert_equal_to.

536  {
538 
539  for( unsigned int s = 0; s < _species_curve_fits.size(); s++ )
540  {
541  dh_RT_minus_s_R_dT[s] = this->dh_RT_minus_s_R_dT(cache,s);
542  }
543 
544  return;
545  }
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
#define antioch_assert_equal_to(expr1, expr2)
StateType dh_RT_minus_s_R_dT(const Cache< StateType > &cache, unsigned int species) const
We currently need different specializations for scalar vs vector inputs here.
Definition: cea_thermo.h:487
template<typename CoeffType >
template<typename StateType >
StateType Antioch::CEAThermodynamics< CoeffType >::h ( const Cache< StateType > &  cache,
unsigned int  species 
) const
inline

Definition at line 306 of file cea_thermo.h.

References Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T.

307  {
308  return this->_chem_mixture.R(species)*cache.T*this->h_over_RT(cache,species);
309  }
const ChemicalMixture< CoeffType > & _chem_mixture
Definition: cea_thermo.h:168
StateType h_over_RT(const Cache< StateType > &cache, unsigned int species) const
Definition: cea_thermo.h:372
template<typename CoeffType = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, void >::type Antioch::CEAThermodynamics< CoeffType >::h ( const Cache< StateType > &  cache,
VectorStateType &  h 
) const
template<typename CoeffType = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, void >::type Antioch::CEAThermodynamics< CoeffType >::h ( const Cache< StateType > &  cache,
VectorStateType &  h 
) const
inline

Definition at line 318 of file cea_thermo.h.

References antioch_assert_equal_to, and Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T.

319  {
321 
322  for( unsigned int s = 0; s < _species_curve_fits.size(); s++ )
323  {
324  h[s] = this->_chem_mixture.R(s)*cache.T*this->h_over_RT(cache,s);
325  }
326 
327  return;
328  }
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
#define antioch_assert_equal_to(expr1, expr2)
const ChemicalMixture< CoeffType > & _chem_mixture
Definition: cea_thermo.h:168
StateType h(const Cache< StateType > &cache, unsigned int species) const
Definition: cea_thermo.h:306
StateType h_over_RT(const Cache< StateType > &cache, unsigned int species) const
Definition: cea_thermo.h:372
template<typename CoeffType >
template<typename StateType >
StateType Antioch::CEAThermodynamics< CoeffType >::h_over_RT ( const Cache< StateType > &  cache,
unsigned int  species 
) const
inline

Definition at line 372 of file cea_thermo.h.

References antioch_assert_less, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::lnT, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T2, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T3, and Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T4.

373  {
374  antioch_assert_less( species, _species_curve_fits.size() );
375  antioch_assert_less( _species_curve_fits[species]->interval(cache.T),
376  _species_curve_fits[species]->n_intervals() );
377 
378  const unsigned int interval = this->_species_curve_fits[species]->interval(cache.T);
379 
380  const CoeffType *a = this->_species_curve_fits[species]->coefficients(interval);
381 
382  typedef typename
384 
385  /* 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 */
386  return -a[0]/cache.T2 + a[1]*cache.lnT/cache.T + a[2] +
387  a[3]*cache.T/raw_type(2) + a[4]*cache.T2/raw_type(3) +
388  a[5]*cache.T3/raw_type(4) + a[6]*cache.T4/raw_type(5) +
389  a[7]/cache.T;
390  }
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
#define antioch_assert_less(expr1, expr2)
template<typename CoeffType >
template<typename StateType >
StateType Antioch::CEAThermodynamics< CoeffType >::h_RT_minus_s_R ( const Cache< StateType > &  cache,
unsigned int  species 
) const
inline

We currently need different specializations for scalar vs vector inputs here.

Definition at line 420 of file cea_thermo.h.

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

Referenced by tester(), tester_N2N(), and vectester().

421  {
422  antioch_assert_less( species, _species_curve_fits.size() );
423  // FIXME - we need assert_less to be vectorizable
424 // antioch_assert_less( _species_curve_fits[species]->interval(cache.T),
425 // _species_curve_fits[species]->n_intervals() );
426 
427  typedef typename
429  const UIntType interval = this->_species_curve_fits[species]->interval(cache.T);
430  const unsigned int begin_interval = Antioch::min(interval);
431  const unsigned int end_interval = Antioch::max(interval)+1;
432 
433  // FIXME - this needs expression templates to be faster...
434 
435  StateType returnval = Antioch::zero_clone(cache.T);
436 
437  typedef typename
439 
440  /* 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,
441  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] */
442  for (unsigned int i=begin_interval; i != end_interval; ++i)
443  {
444  const CoeffType * const a =
445  this->_species_curve_fits[species]->coefficients(i);
446  returnval = Antioch::if_else
447  (interval == i,
448  StateType(-a[0]/cache.T2/raw_type(2) +
449  (a[1] + a[7])/cache.T +
450  a[1]*cache.lnT/cache.T - a[2]*cache.lnT +
451  (a[2] - a[8]) - a[3]*cache.T/raw_type(2) -
452  a[4]*cache.T2/raw_type(6) -
453  a[5]*cache.T3/raw_type(12) -
454  a[6]*cache.T4/raw_type(20)),
455  returnval);
456  }
457 
458  return returnval;
459  }
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
Definition: eigen_utils.h:88
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
#define antioch_assert_less(expr1, expr2)
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 = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, void >::type Antioch::CEAThermodynamics< CoeffType >::h_RT_minus_s_R ( const Cache< StateType > &  cache,
VectorStateType &  h_RT_minus_s_R 
) const
template<typename CoeffType = double>
template<typename StateType , typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, void >::type Antioch::CEAThermodynamics< CoeffType >::h_RT_minus_s_R ( const Cache< StateType > &  cache,
VectorStateType &  h_RT_minus_s_R 
) const
inline

Definition at line 468 of file cea_thermo.h.

References antioch_assert_equal_to.

470  {
472 
473  for( unsigned int s = 0; s < _species_curve_fits.size(); s++ )
474  {
475  h_RT_minus_s_R[s] = this->h_RT_minus_s_R(cache,s);
476  }
477 
478  return;
479  }
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
#define antioch_assert_equal_to(expr1, expr2)
StateType h_RT_minus_s_R(const Cache< StateType > &cache, unsigned int species) const
We currently need different specializations for scalar vs vector inputs here.
Definition: cea_thermo.h:420
template<typename CoeffType >
template<typename StateType >
StateType Antioch::CEAThermodynamics< CoeffType >::s_over_R ( const Cache< StateType > &  cache,
unsigned int  species 
) const
inline

Definition at line 396 of file cea_thermo.h.

References antioch_assert_less, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::lnT, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T2, Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T3, and Antioch::CEAThermodynamics< CoeffType >::Cache< StateType >::T4.

397  {
398  antioch_assert_less( species, _species_curve_fits.size() );
399  antioch_assert_less( _species_curve_fits[species]->interval(cache.T),
400  _species_curve_fits[species]->n_intervals() );
401 
402  const unsigned int interval = this->_species_curve_fits[species]->interval(cache.T);
403 
404  const CoeffType *a = this->_species_curve_fits[species]->coefficients(interval);
405 
406  typedef typename
408 
409  /* 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 */
410  return -a[0]/cache.T2/raw_type(2) - a[1]/cache.T +
411  a[2]*cache.lnT + a[3]*cache.T + a[4]*cache.T2/raw_type(2) +
412  a[5]*cache.T3/raw_type(3) + a[6]*cache.T4/raw_type(4) + a[8];
413  }
std::vector< CEACurveFit< CoeffType > * > _species_curve_fits
Definition: cea_thermo.h:170
#define antioch_assert_less(expr1, expr2)

Member Data Documentation

template<typename CoeffType = double>
const ChemicalMixture<CoeffType>& Antioch::CEAThermodynamics< CoeffType >::_chem_mixture
protected

Definition at line 168 of file cea_thermo.h.

template<typename CoeffType = double>
std::vector<CoeffType> Antioch::CEAThermodynamics< CoeffType >::_cp_at_200p1
protected
template<typename CoeffType = double>
std::vector<CEACurveFit<CoeffType>* > Antioch::CEAThermodynamics< CoeffType >::_species_curve_fits
protected

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