antioch-0.4.0
Namespaces | Classes | Typedefs | Enumerations | Functions
Antioch Namespace Reference

The parameters are reduced parameters. More...

Namespaces

 AntiochPrivate
 
 Constants
 
 KineticsModel
 
 ReactionType
 
 UnitBaseConstant
 
 UnitBaseStorage
 

Classes

class  ArrheniusRate
 Arrhenius rate equation. More...
 
singleton  ASCIIParser
 
class  BerthelotHercourtEssenRate
 Berthelot Hercourt-Essen rate equation. More...
 
class  BerthelotRate
 Berthelot rate equation. More...
 
class  BinaryDiffusionBase
 Base class for binary diffusion models. More...
 
class  BlottnerViscosity
 
class  CEACurveFit
 This class only differs from NASA9CurveFit in the construction. More...
 
class  CEAEvaluator
 
class  CEAThermodynamics
 
class  CEAThermoMixture
 
singleton  ChemicalMixture
 Class storing chemical mixture properties. More...
 
class  ChemicalSpecies
 Class to encapsulate data for each chemical species. More...
 
class  ChemKinDefinitions
 
singleton  ChemKinParser
 ChemKin format file reader. More...
 
struct  ConductivityTraits
 
struct  ConductivityTraits< EuckenThermalConductivity< ThermoEvaluator > >
 
struct  ConductivityTraits< KineticsTheoryThermalConductivity< ThermoEvaluator, CoeffType > >
 
class  ConstantLewisDiffusivity
 Compute species diffusivity based on constant Lewis number. More...
 
class  ConstantRate
 Constant rate equation. More...
 
struct  constructor_or_reference
 
struct  constructor_or_reference< T, T >
 
class  Converter
 Class to deal with the conversion between units. More...
 
class  DefaultInstallFilename
 Default filenames in the install tree. More...
 
class  DefaultSourceFilename
 Default filenames in the source tree. More...
 
struct  DiffusionTraits
 Characteristics of various diffusion models. More...
 
struct  DiffusionTraits< ConstantLewisDiffusivity< CoeffType > >
 
class  DuplicateReaction
 A single reaction mechanism. More...
 
struct  eigen_library_tag
 
class  ElementaryReaction
 A single reaction mechanism. More...
 
struct  enable_if_c
 
struct  enable_if_c< false, T >
 
class  EuckenThermalConductivity
 Species conductivity based on Eucken relation. More...
 
class  FailedNewtonTTvInversion
 A class representing failed Newton convergence in T/Tv inversion. More...
 
class  FalloffReaction
 Base class for falloff processes. More...
 
class  FalloffThreeBodyReaction
 Base class for falloff processes coupled with efficiencies. More...
 
class  FileError
 A class representing a failed attempt by the library to open a file (or construct an fstream, etc), to be thrown by "antioch_file_error(filename);" For ease of debugging, "filename" should include any (absolute or relative or implicit) pathname that was part of the failed open. More...
 
struct  has_size
 
struct  has_size< std::valarray< T > >
 
struct  has_size< std::vector< T > >
 
struct  has_size< T, typename Antioch::enable_if_c< is_eigen< T >::value, void >::type >
 
struct  has_size< T, typename Antioch::enable_if_c< is_metaphysicl< T >::value, void >::type >
 
struct  has_size< vex::vector< T > >
 
class  HercourtEssenRate
 Hercourt-Essen rate equation. More...
 
class  IdealGasMicroThermo
 
struct  if_else_type
 
struct  if_else_type< false, T1, T2 >
 
class  InSI
 Seven integers to characterize the power vector. More...
 
struct  is_eigen
 
struct  is_eigen< _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >
 
struct  is_metaphysicl
 
struct  is_metaphysicl< MetaPhysicL::NumberArray< size, T > >
 
struct  is_valarray
 
struct  is_valarray< std::valarray< T > >
 
class  KineticsConditions
 This class contains the conditions of the chemistry. More...
 
class  KineticsEvaluator
 Class to handle computing mass source terms for a given ReactionSet. More...
 
class  KineticsTheoryThermalConductivity
 Conductivity based on kinetic theory of mixtures approximations. More...
 
class  KineticsType
 base class for kinetics models More...
 
class  KooijRate
 Kooij rate equation. More...
 
class  LennardJonesPotential
 
class  LindemannFalloff
 Simplest falloff model ( $F = 1$) More...
 
class  LogicError
 A class to represent the internal "this should never happen" errors, to be thrown by "antioch_error();". More...
 
struct  metaphysicl_library_tag
 
class  MixtureAveragedTransportEvaluator
 Compute transport properties using ``mixture averaged" model. More...
 
class  MixtureAveragedTransportMixture
 Mixture object for MixtureAveragedTransport model. More...
 
class  MixtureConductivity
 Container class for species thermal conductivities. More...
 
class  MixtureDiffusion
 Container class for species binary diffusion models. More...
 
class  MixtureTransportBase
 Base class for MixtureViscosity, MixtureConductivity, etc. More...
 
class  MixtureViscosity
 Container class for species viscosities. More...
 
class  NASA7CurveFit
 
class  NASA9CurveFit
 This class stores the NASA polynomial fit to the thermodynamics quantities $\frac{C_p}{\mathrm{R}}$ $\frac{h}{\mathrm{R}T}$ and $\frac{s}{\mathrm{R}T}$. More...
 
singleton  NASACurveFit
 
class  NASACurveFitBase
 
singleton  NASAEvaluator
 
class  NASAThermoMixture
 
class  NotImplemented
 A class to stub for features that should be in Antioch, but haven't been written yet, to be thrown by "antioch_not_implemented();". More...
 
struct  numeric_library_tag
 
class  ParserBase
 A parser is an instance related to a file. More...
 
class  ParsingError
 A class representing error while parsing. More...
 
class  ParticleFlux
 Stores the incoming flux of particles. More...
 
class  PhotochemicalRate
 Photochemical rate. More...
 
struct  raw_value_type
 
struct  raw_value_type< _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >
 
struct  raw_value_type< const T >
 
struct  raw_value_type< std::valarray< T > >
 
struct  raw_value_type< std::vector< T > >
 
struct  raw_value_type< T, typename Antioch::enable_if_c< is_metaphysicl< T >::value, void >::type >
 
struct  raw_value_type< vex::vector< T > >
 
class  Reaction
 A single reaction mechanism. More...
 
singleton  ReactionSet
 This class encapsulates all the reaction mechanisms considered in a chemical nonequilibrium simulation. More...
 
struct  rebind
 
struct  rebind< _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >, NewScalar >
 
struct  rebind< MetaPhysicL::NumberArray< size, T >, NewScalar >
 
struct  rebind< std::valarray< T >, NewScalar >
 
struct  rebind< std::vector< T >, NewScalar >
 
struct  rebind< vex::vector< T >, NewScalar >
 
struct  return_auto
 
struct  return_auto< std::vector< T > >
 
struct  return_auto< T, typename Antioch::enable_if_c< is_eigen< T >::value, void >::type >
 
struct  return_auto< T, typename Antioch::enable_if_c< is_metaphysicl< T >::value, void >::type >
 
struct  return_auto< T, typename Antioch::enable_if_c< is_valarray< T >::value, void >::type >
 
struct  return_auto< vex::vector< T > >
 
class  RotationalRelaxation
 
class  SigmaBinConverter
 
class  SIPrefixes
 Prefixes in unit. More...
 
struct  size_type
 
struct  size_type< std::valarray< T > >
 
struct  size_type< std::vector< T > >
 
struct  size_type< T, typename Antioch::enable_if_c< is_eigen< T >::value, void >::type >
 
struct  size_type< T, typename Antioch::enable_if_c< is_metaphysicl< T >::value, void >::type >
 
struct  size_type< vex::vector< T > >
 
class  SpeciesConductivityBase
 Base class for species conducitivity models. More...
 
class  SpeciesDiffusionBase
 Base class for species diffusion models. More...
 
class  SpeciesViscosityBase
 Base class for species viscosity models. More...
 
struct  state_type
 
struct  state_type< T, typename enable_if_c< is_eigen< T >::value, void >::type >
 
struct  state_type< T, typename enable_if_c< is_metaphysicl< T >::value, void >::type >
 
struct  state_type< T, typename enable_if_c< is_valarray< T >::value, void >::type >
 
class  StatMechThermodynamics
 
class  StockmayerPotential
 
class  SutherlandViscosity
 
struct  tag_type
 
struct  tag_type< T, typename std::enable_if< is_eigen< T >::value >::type >
 
struct  tag_type< T, typename std::enable_if< vex::is_vector_expression< T >::value >::type >
 
class  TempCache
 
class  ThreeBodyReaction
 A single reaction mechanism. More...
 
class  TransportMixture
 Class storing chemical mixture properties. More...
 
class  TransportSpecies
 Class to encapsulate data relevant for transport for each chemical species. More...
 
class  TroeFalloff
 The Troe falloff model is defined by:

\[ \log_{10}\left(F\right) = \frac{\log_{10}\left(F_{\text{cent}}\right)} {1 + \left[ \frac{\log_{10}\left(P_r\right) + c} {n - d \cdot \left[\log_{10}\left(P_r\right) + c\right]} \right]^2} \]

with

\[ \begin{split} P_r & = [\mathrm{M}] \frac{k_0}{k_\infty} \\ n & = 0.75 - 1.27 \log_{10}\left(F_{\text{cent}}\right) \\ c & = - 0.40 - 0.67 \log_{10}\left(F_{\text{cent}}\right) \\ d & = 0.14 \\ F_{\text{cent}} & = (1 - \alpha) \cdot \exp\left(-\frac{T}{T^{***}}\right) + \alpha \cdot \exp\left(-\frac{T}{T^*}\right) + \exp\left(-\frac{T^{**}}{T}\right) \end{split} \]

The derivatives are therefore:

\[ \begin{split} \frac{\partial F_{\text{cent}}}{\partial T} & = \frac{\alpha - 1}{T^{***}} \cdot \exp\left(-\frac{T}{T^{***}}\right) - \frac{\alpha}{T^{*}} \cdot \exp\left(-\frac{T}{T^*}\right) + \frac{T^{**}}{T^{2}} \exp\left(-\frac{T^{**}}{T}\right) \\ \frac{\partial \log_{10}\left(F_\text{cent}\right)}{\partial T} & = \frac{1}{\ln(10) F_\text{cent}}\frac{\partial F_\text{cent}}{\partial T} \\ \frac{\partial n}{\partial T} & = - 1.27 \frac{\partial \log_{10}\left(F_\text{cent}\right)}{\partial T} \\ \frac{\partial c}{\partial T} & = - 0.67 \frac{\partial \log_{10}\left(F_\text{cent}\right)}{\partial T} \\\\ \frac{\partial P_r}{\partial T} & = P_r \left(\frac{\partial k_0}{\partial T} \frac{1}{k_0} - \frac{\partial k_\infty}{\partial T} \frac{1}{k_\infty} \right)\\ \frac{\partial \log_{10}(P_r)}{\partial T} & = \frac{1}{\ln(10) P_r} \frac{\partial P_r}{\partial T} \\\\ \frac{\partial \log_{10}(F)}{\partial T} & = \frac{\partial \log_{10}\left(F_\text{cent}\right)}{\partial T} \frac{1}{1 + \left[\frac{\log_{10}\left(P_r\right) + c} {n - d\left(\log_{10}\left(P_r\right) + c\right)}\right]^2} - \log_{10}\left(F_\text{cent}\right) 2\left[\frac{\log_{10}\left(P_r\right) + c}{n - d \left[\log_{10}\left(P_r\right) + c\right]}\right]^2 \left[\frac{\frac{\partial \log_{10}\left(P_r\right)}{\partial T} + \frac{\partial c}{\partial T}} {\log_{10}\left(P_r\right) + c} - \frac{\frac{\partial n}{\partial T} - d \left[\frac{\partial \log_{10}\left(P_r\right)}{\partial T} + \frac{\partial c}{\partial T}\right]} {n - d \left[\log_{10}\left(P_r\right) + c\right]} \right] \frac{1}{\left[1 + \left[\frac{\log_{10}\left(P_r\right) + c} {n - d\left(\log_{10}\left(P_r\right) + c\right)} \right]^2 \right]^2} \\ & = \log_{10}\left(F\right) \left[\frac{\partial \log_{10}\left(F_\text{cent}\right)}{\partial T} \frac{1}{F_\text{cent}} - 2\left[\frac{\log_{10}\left(P_r\right) + c}{n - d \left[\log_{10}\left(P_r\right) + c\right]}\right]^2 \left[\frac{\frac{\partial \log_{10}\left(P_r\right)}{\partial T} + \frac{\partial c}{\partial T}} {\log_{10}\left(P_r\right) + c} - \frac{\frac{\partial n}{\partial T} - d \left[\frac{\partial \log_{10}\left(P_r\right)}{\partial T} + \frac{\partial c}{\partial T}\right]} {n - d \left[\log_{10}\left(P_r\right) + c\right]} \right] \frac{1}{1 + \left[\frac{\log_{10}\left(P_r\right) + c} {n - d\left(\log_{10}\left(P_r\right) + c\right)} \right]^2} \right] \\ \frac{\partial F}{\partial T} & = \ln(10) F \frac{\partial \log_{10}\left(F\right)}{\partial T} \\\\\\\\ \frac{\partial P_r}{\partial c_i} & = \frac{k_0}{k_\infty} \\ \frac{\partial \log_{10}(P_r)}{\partial c_i} & = \frac{1}{\ln(10) P_r} \frac{\partial P_r}{\partial c_i} = \frac{1}{\ln(10) [\mathrm{M}]}\\\\ \frac{\partial \log_{10}\left(F\right)}{\partial c_i} & = -\frac{\log_{10}^2\left(F\right)}{\log_{10}\left(F_\text{cent}\right)} \frac{\partial \log_{10}\left(P_r\right)}{\partial c_i} \left(1 - \frac{1}{n - d\left[\log_{10}\left(P_r\right) + c\right]}\right) \left(\log_{10}\left(P_r\right) + c\right) \\ \frac{\partial F}{\partial c_i} & = \ln(10) F \frac{\partial \log_{10}\left(F\right)}{\partial c_i} \end{split} \]

. More...

 
class  UnitBase
 wrapper for unit storage More...
 
class  UnitError
 A class representing error in units. More...
 
class  Units
 An advanced unit class. More...
 
struct  valarray_library_tag
 
struct  value_type
 
struct  value_type< _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >
 
struct  value_type< const T >
 
struct  value_type< std::valarray< T > >
 
struct  value_type< std::vector< T > >
 
struct  value_type< T, typename Antioch::enable_if_c< is_metaphysicl< T >::value, void >::type >
 
struct  value_type< vex::vector< T > >
 
class  VantHoffRate
 Van't Hoff rate equation. More...
 
struct  vector_library_tag
 
struct  vexcl_library_tag
 
class  WilkeEvaluator
 Deprecated. Use MixtureAveragedTransportEvaluator instead. More...
 
class  WilkeMixture
 
class  XMLParser
 Nothing is stored, this parser is based on the tinyxml2 implementation. More...
 

Typedefs

typedef unsigned int Species
 
typedef DefaultSourceFilename DefaultFilename
 

Enumerations

enum  ParsingType { ASCII = 0, XML, CHEMKIN }
 
enum  ParsingKey {
  SPECIES_SET = 0, SPECIES_DATA, SPECIES, THERMO,
  PHASE_BLOCK, TMIN, TMAX, NASADATA,
  NASA7, NASA9, REACTION_DATA, REACTION,
  REVERSIBLE, ID, EQUATION, CHEMICAL_PROCESS,
  KINETICS_MODEL, REACTANTS, PRODUCTS, FORWARD_ORDER,
  BACKWARD_ORDER, PREEXP, POWER, ACTIVATION_ENERGY,
  BERTHELOT_COEFFICIENT, TREF, HV_LAMBDA, HV_CROSS_SECTION,
  UNIT, EFFICIENCY, FALLOFF_LOW, FALLOFF_LOW_NAME,
  TROE_FALLOFF, TROE_F_ALPHA, TROE_F_TS, TROE_F_TSS,
  TROE_F_TSSS
}
 
enum  ParsingUnit { MOL_WEIGHT = 0, MASS_ENTHALPY }
 

Functions

template<typename CoeffType , typename VectorCoeffType >
KineticsType< CoeffType,
VectorCoeffType > * 
build_rate (const VectorCoeffType &data, const KineticsModel::KineticsModel &kin)
 cross-road to kinetics model More...
 
template<typename CoeffType , typename VectorCoeffType , typename VectorType >
void reset_rate (KineticsType< CoeffType, VectorCoeffType > &kin, const VectorType &coefs)
 
template<typename CoeffType , typename VectorCoeffType >
void reset_parameter_of_rate (KineticsType< CoeffType, VectorCoeffType > &rate, KineticsModel::Parameters parameter, const CoeffType new_value, const std::string &unit="SI")
 The rate constant models derived from the Arrhenius model have an activation energy which is stored and used, for efficiency reasons, in the reduced $\frac{E_a}{\mathrm{R}}$ form in K. More...
 
template<typename CoeffType , typename VectorCoeffType >
void reset_parameter_of_rate (KineticsType< CoeffType, VectorCoeffType > &rate, KineticsModel::Parameters parameter, const CoeffType new_value, int l, const std::string &unit="SI")
 
template<typename CoeffType >
Reaction< CoeffType > * build_reaction (const unsigned int n_species, const std::string &equation, const bool &reversible, const ReactionType::ReactionType &type, const KineticsModel::KineticsModel &kin)
 
template<class NumericType >
void read_blottner_data_ascii (MixtureViscosity< BlottnerViscosity< NumericType >, NumericType > &mu, const std::string &filename)
 
template<class NumericType >
void read_blottner_data_ascii_default (MixtureViscosity< BlottnerViscosity< NumericType >, NumericType > &mu)
 
template<class NumericType >
void read_cea_mixture_data_ascii (CEAThermoMixture< NumericType > &thermo, const std::string &filename)
 
template<class NumericType >
void read_cea_mixture_data_ascii_default (CEAThermoMixture< NumericType > &thermo)
 
template<class NumericType >
void read_cea_mixture_data_ascii (CEAThermodynamics< NumericType > &thermo, const std::string &filename)
 
template<class NumericType >
void read_cea_mixture_data (CEAThermoMixture< NumericType > &thermo, const std::string &filename, ParsingType type, bool verbose=true)
 
template<class NumericType >
void read_cea_thermo_data_ascii (CEAThermodynamics< NumericType > &thermo, const std::string &filename)
 
template<class NumericType >
void build_constant_lewis_diffusivity (MixtureDiffusion< ConstantLewisDiffusivity< NumericType >, NumericType > &D, const NumericType Le)
 
template<class NumericType >
void build_constant_lewis_diffusivity (MixtureDiffusion< ConstantLewisDiffusivity< NumericType >, NumericType > &D, const std::vector< NumericType > &Le)
 
template<class MicroThermo , class NumericType >
void build_eucken_thermal_conductivity (MixtureConductivity< EuckenThermalConductivity< MicroThermo >, NumericType > &k, const MicroThermo &thermo)
 
template<class MicroThermo , class NumericType >
void build_kinetics_theory_thermal_conductivity (MixtureConductivity< KineticsTheoryThermalConductivity< MicroThermo, NumericType >, NumericType > &k, const MicroThermo &thermo)
 
template<class NumericType >
void read_nasa_mixture_data_ascii (NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &thermo, const std::string &filename)
 
template<class NumericType , typename CurveType >
void read_nasa_mixture_data (NASAThermoMixture< NumericType, CurveType > &thermo, const std::string &filename=DefaultSourceFilename::thermo_data(), ParsingType=ASCII, bool verbose=true)
 
template<class NumericType >
void read_reaction_set_data_xml (const std::string &filename, const bool verbose, ReactionSet< NumericType > &reaction_set)
 
template<class NumericType >
void read_reaction_set_data_chemkin (const std::string &filename, const bool verbose, ReactionSet< NumericType > &reaction_set)
 
template<typename NumericType >
void read_reaction_set_data (const std::string &filename, const bool verbose, ReactionSet< NumericType > &reaction_set, ParsingType type=ASCII)
 
template<typename NumericType >
void verify_unit_of_parameter (Units< NumericType > &default_unit, const std::string &provided_unit, const std::vector< std::string > &accepted_unit, const std::string &equation, const std::string &parameter_name)
 
template<typename NumericType >
void read_chemical_species_composition (ParserBase< NumericType > *parser, ChemicalMixture< NumericType > &mixture)
 
template<class NumericType >
void read_species_data (ParserBase< NumericType > *parser, ChemicalMixture< NumericType > &chem_mixture)
 
template<class NumericType >
void read_species_vibrational_data (ParserBase< NumericType > *parser, ChemicalMixture< NumericType > &chem_mixture)
 
template<class NumericType >
void read_species_electronic_data (ParserBase< NumericType > *parser, ChemicalMixture< NumericType > &chem_mixture)
 
template<class NumericType >
void read_sutherland_data_ascii (MixtureViscosity< SutherlandViscosity< NumericType >, NumericType > &mu, const std::string &filename)
 
template<class NumericType >
void read_sutherland_data_ascii_default (MixtureViscosity< SutherlandViscosity< NumericType >, NumericType > &mu)
 
template<typename NumericType >
void read_transport_species_data_ascii (TransportMixture< NumericType > &transport, const std::string &filename)
 
template<typename NumericType >
void read_transport_species_data (ParserBase< NumericType > *parser, TransportMixture< NumericType > &transport)
 
 ANTIOCH_NUMERIC_TYPE_CLASS_INSTANTIATE (ASCIIParser)
 
 ANTIOCH_ASCII_PARSER_INSTANTIATE ()
 
 ANTIOCH_BLOTTNER_PARSING_INSTANTIATE ()
 
 ANTIOCH_CEA_MIXTURE_DATA_ASCII_PARSING_INSTANTIATE ()
 
template void read_cea_mixture_data< float > (CEAThermoMixture< float > &, const std::string &, ParsingType, bool)
 
template void read_cea_mixture_data< double > (CEAThermoMixture< double > &, const std::string &, ParsingType, bool)
 
template void read_cea_mixture_data< long double > (CEAThermoMixture< long double > &, const std::string &, ParsingType, bool)
 
 ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE (NASA7CurveFit)
 
 ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE (NASA9CurveFit)
 
 ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE (CEACurveFit)
 
template void read_nasa_mixture_data_ascii< float > (NASAThermoMixture< float, NASA7CurveFit< float > > &, const std::string &)
 
template void read_nasa_mixture_data_ascii< double > (NASAThermoMixture< double, NASA7CurveFit< double > > &, const std::string &)
 
template void read_nasa_mixture_data_ascii< long double > (NASAThermoMixture< long double, NASA7CurveFit< long double > > &, const std::string &)
 
 ANTIOCH_READ_REACTION_SET_DATA_INSTANTIATE ()
 
 ANTIOCH_SPECIES_PARSING_INSTANTIATE ()
 
 ANTIOCH_SUTHERLAND_PARSING_INSTANTIATE ()
 
template void read_transport_species_data< float > (ParserBase< float > *, TransportMixture< float > &)
 
template void read_transport_species_data< double > (ParserBase< double > *, TransportMixture< double > &)
 
template void read_transport_species_data< long double > (ParserBase< long double > *, TransportMixture< long double > &)
 
template void read_transport_species_data_ascii< float > (TransportMixture< float > &, const std::string &)
 
template void read_transport_species_data_ascii< double > (TransportMixture< double > &, const std::string &)
 
template void read_transport_species_data_ascii< long double > (TransportMixture< long double > &, const std::string &)
 
 ANTIOCH_NUMERIC_TYPE_CLASS_INSTANTIATE (XMLParser)
 
 ANTIOCH_XML_PARSER_INSTANTIATE ()
 
template<typename StateType >
const ANTIOCH_AUTO(StateType)
EuckenThermalConductivity
< ThermoEvaluator > return 
trans (s, mu_s)
 
template<typename StateType >
const ANTIOCH_AUTO (StateType) KineticsTheoryThermalConductivity< ThermoEvaluator
 
template<typename T >
Antioch::enable_if_c< is_eigen
< T >::value, typename
value_type< T >::type >::type 
max (const T &in)
 
template<typename T >
Antioch::enable_if_c< is_eigen
< T >::value, typename
value_type< T >::type >::type 
min (const T &in)
 
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
_Matrix< _Scalar, _Rows, _Cols,
_Options, _MaxRows, _MaxCols > 
zero_clone (const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
 
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols, typename Scalar2 >
void zero_clone (_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &output, const _Matrix< Scalar2, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
 
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols, typename Scalar >
_Matrix< _Scalar, _Rows, _Cols,
_Options, _MaxRows, _MaxCols > 
constant_clone (const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex, const Scalar &value)
 
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols, typename Scalar >
void constant_fill (_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &output, const Scalar &value)
 
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
void set_zero (_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &a)
 
template<typename Condition , typename T1 , typename T2 >
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)
 
template<typename VectorT , template< typename, int, int, int, int, int > class _Matrix, typename _UIntT , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
enable_if_c< is_eigen
< typename value_type< VectorT >
::type >::value, typename
value_type< VectorT >::type >
::type 
eval_index (const VectorT &vec, const _Matrix< _UIntT, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &index)
 
template<typename T >
bool conjunction_root (const T &vec, eigen_library_tag)
 
template<typename T >
bool disjunction_root (const T &vec, eigen_library_tag)
 
void skip_comment_lines (std::istream &in, const char comment_start)
 Skip comment lines in the header of an ASCII text file prefixed with the comment character 'comment_start'. More...
 
template<typename T >
Antioch::enable_if_c
< is_metaphysicl< T >::value,
typename value_type< T >::type >
::type 
max (const T &in)
 
template<typename T >
Antioch::enable_if_c
< is_metaphysicl< T >::value,
typename value_type< T >::type >
::type 
min (const T &in)
 
template<typename Tbool , typename Ttrue , typename Tfalse >
Antioch::enable_if_c
< is_metaphysicl< Tbool >
::value &&is_metaphysicl
< Ttrue >::value
&&is_metaphysicl< Tfalse >
::value, typename state_type
< Ttrue >::type >::type 
if_else (const Tbool &condition, const Ttrue &if_true, const Tfalse &if_false)
 
template<typename VectorT , typename UIntType >
Antioch::enable_if_c
< is_metaphysicl< typename
Antioch::value_type< VectorT >
::type >::value
&&is_metaphysicl< UIntType >
::value, typename
Antioch::value_type< VectorT >
::type >::type 
eval_index (const VectorT &vec, const UIntType &indexes)
 
 ANTIOCH_PLAIN_SCALAR (float)
 
 ANTIOCH_PLAIN_SCALAR (double)
 
 ANTIOCH_PLAIN_SCALAR (long double)
 
 ANTIOCH_PLAIN_SCALAR (short)
 
 ANTIOCH_PLAIN_SCALAR (int)
 
 ANTIOCH_PLAIN_SCALAR (unsigned short)
 
template<typename T >
void set_zero (T &output)
 
template<typename T >
zero_clone (const T &)
 
template<typename T , typename T2 >
void zero_clone (T &output, const T2 &)
 
template<typename T >
void init_clone (T &output, const T &example)
 
template<typename Vector , typename Scalar >
void init_constant (Vector &output, const Scalar &example)
 
template<typename T , typename Scalar >
constant_clone (const T &, const Scalar &value)
 
template<typename T , typename Scalar >
void constant_fill (T &output, const Scalar &value)
 
template<typename T , typename VectorScalar >
custom_clone (const T &, const VectorScalar &values, unsigned int indexes)
 
template<typename T , typename VectorScalar >
custom_clone (const T &, const VectorScalar &values, const typename Antioch::rebind< T, unsigned int >::type &indexes)
 
template<typename VectorT >
value_type< VectorT >::type eval_index (const VectorT &vec, unsigned int index)
 
bool conjunction (const bool &vec)
 
template<typename T >
bool conjunction (const T &vec)
 
template<typename T >
bool conjunction_root (const T &vec, numeric_library_tag)
 
bool disjunction (const bool &vec)
 
template<typename T >
bool disjunction (const T &vec)
 
template<typename T >
bool disjunction_root (const T &vec, numeric_library_tag)
 
template<typename T1 , typename T2 >
void zero_clone (T1 &output, const T2 &example)
 
template<typename T >
if_else (bool condition, T if_true, T if_false)
 
void split_string (const std::string &input, const std::string &delimiter, std::vector< std::string > &results)
 All characters in delimiter will be treated as a delimiter. More...
 
void remove_newline_from_strings (std::vector< std::string > &strings)
 Strips newline characters from strings in the input vector, strings. More...
 
template<typename T >
string_to_T (const std::string &input)
 
template<typename Type >
std::pair< std::string, Type > split_string_on_colon (const std::string &token)
 
int SplitString (const std::string &input, const std::string &delimiter, std::vector< std::string > &results, bool includeEmpties=true)
 Taken from FIN-S for XML parsing. More...
 
int ascii_getline (std::istream &buf, std::string &line)
 adapted getline, never believe ascii file for the formatting of end-of-line. More...
 
KineticsModel::Parameters string_to_kin_enum (const std::string &str)
 
ReactionType::Parameters string_to_chem_enum (const std::string &str)
 
template<typename T >
max (const std::valarray< T > &in)
 
template<typename T >
min (const std::valarray< T > &in)
 
template<typename T >
std::valarray< T > zero_clone (const std::valarray< T > &example)
 
template<typename T1 , typename T2 >
void zero_clone (std::valarray< T1 > &output, const std::valarray< T2 > &example)
 
template<typename T , typename Scalar >
std::valarray< T > constant_clone (const std::valarray< T > &example, const Scalar &value)
 
template<typename T >
void init_clone (std::valarray< T > &output, const std::valarray< T > &example)
 
template<typename T >
std::valarray< T > if_else (const std::valarray< bool > &condition, const std::valarray< T > &if_true, const std::valarray< T > &if_false)
 
template<typename VectorT >
Antioch::enable_if_c
< Antioch::is_valarray
< typename value_type< VectorT >
::type >::value, typename
value_type< VectorT >::type >
::type 
eval_index (const VectorT &vec, const std::valarray< unsigned int > &index)
 
template<typename T >
std::vector< T > zero_clone (const std::vector< T > &example)
 
template<typename T1 , typename T2 >
void zero_clone (std::vector< T1 > &output, const std::vector< T2 > &example)
 
template<typename T , typename Scalar >
std::vector< T > zero_clone (const std::vector< T > &example, const Scalar &value)
 
template<typename T >
void set_zero (std::vector< T > &a)
 
template<typename T , typename VectorScalar >
std::vector< T > custom_clone (const std::vector< T > &, const VectorScalar &vecsrc, std::vector< unsigned int > &indexes)
 
template<typename T , typename Scalar >
std::vector< T > constant_clone (const std::vector< T > &example, const Scalar &value)
 
template<typename T , typename VectorScalar >
std::vector< T > custom_clone (const std::vector< T > &vec, const VectorScalar &vecsrc, const std::vector< unsigned int > &indexes)
 
template<typename T >
max (const vex::vector< T > &in)
 
template<typename T >
min (const vex::vector< T > &in)
 
template<typename T >
vex::vector< T > zero_clone (const vex::vector< T > &example)
 
template<typename T1 , typename T2 >
void zero_clone (vex::vector< T1 > &output, const vex::vector< T2 > &example)
 
template<typename T , typename Scalar >
vex::vector< T > constant_clone (const vex::vector< T > &example, const Scalar &value)
 
template<typename T >
void init_clone (vex::vector< T > &output, const vex::vector< T > &example)
 
template<typename BoolInput , typename IfValue , typename ElseValue >
boost::proto::result_of::make_expr
< boost::proto::tag::if_else_,
boost::proto::deduce_domain,
const vex::vector_expression
< BoolInput > &, const IfValue
&, const ElseValue & >::type
const 
if_else (const vex::vector_expression< BoolInput > &condition, const IfValue &if_true, const ElseValue &if_false)
 
template<typename T >
bool disjunction_root (const T &vec_input, vexcl_library_tag)
 
template<typename T >
bool conjunction_root (const T &vec_input, vexcl_library_tag)
 
template<typename VectorT , typename IntT >
enable_if_c
< vex::is_vector_expression
< typename value_type< VectorT >
::type >::value
&&vex::is_vector_expression
< IntT >::value, typename
value_type< VectorT >::type >
::type 
eval_index (const VectorT &vec, const IntT &index)
 
int get_antioch_version ()
 

Detailed Description

The parameters are reduced parameters.

Everything here is deprecated, it is for backward compatibility, using the deprecated name/object CEAThermo...<NumericType>.

The complete Van't Hoff equation is (all the others are deductible from it) $k(T) = A * \left(\frac{T}{\mathrm{T_0}}\right)^\beta \exp\left(-\frac{E_a}{\mathrm{R}T} + D T\right)$ with $\mathrm{T_0}$ being a reference temperature and $\mathrm{R}$ the ideal gas constant. The reduced parameters are:

\[ \begin{array}{ccc}\toprule \text{Parameter} & \text{reduced parameter} \\\midrule A & A \mathrm{T_0}^\beta \\ \beta & \beta \\ E_a & \frac{E_a}{\mathrm{R}}\\ D & D\\\bottomrule \end{array} \]

This library is intended for performances, thus the reference temperature is taken equal to one in order to skip the division step ( $\frac{T}{\mathrm{T_0}}$). This is not an option, this is an obligation: the kinetics equations are coded without the division step.

We required to provide:

for both descriptions (Mixture, dynamics).

Typedef Documentation

Definition at line 106 of file default_filename.h.

typedef unsigned int Antioch::Species

Definition at line 49 of file chemical_mixture.h.

Enumeration Type Documentation

Enumerator
SPECIES_SET 
SPECIES_DATA 
SPECIES 
THERMO 
PHASE_BLOCK 
TMIN 
TMAX 
NASADATA 
NASA7 
NASA9 
REACTION_DATA 
REACTION 
REVERSIBLE 
ID 
EQUATION 
CHEMICAL_PROCESS 
KINETICS_MODEL 
REACTANTS 
PRODUCTS 
FORWARD_ORDER 
BACKWARD_ORDER 
PREEXP 
POWER 
ACTIVATION_ENERGY 
BERTHELOT_COEFFICIENT 
TREF 
HV_LAMBDA 
HV_CROSS_SECTION 
UNIT 
EFFICIENCY 
FALLOFF_LOW 
FALLOFF_LOW_NAME 
TROE_FALLOFF 
TROE_F_ALPHA 
TROE_F_TS 
TROE_F_TSS 
TROE_F_TSSS 

Definition at line 36 of file parsing_enum.h.

36  {SPECIES_SET = 0,
38  SPECIES,
39  THERMO,
41 //
42  TMIN,
43  TMAX,
44  NASADATA,
45  NASA7,
46  NASA9,
47 //
49  REACTION,
50  REVERSIBLE,
51  ID,
52  EQUATION,
55  REACTANTS,
56  PRODUCTS,
59  PREEXP,
60  POWER,
63  TREF,
64  HV_LAMBDA,
66  UNIT,
67  EFFICIENCY,
72  TROE_F_TS,
73  TROE_F_TSS,
75  };
Enumerator
ASCII 
XML 
CHEMKIN 

Definition at line 32 of file parsing_enum.h.

Enumerator
MOL_WEIGHT 
MASS_ENTHALPY 

Definition at line 77 of file parsing_enum.h.

Function Documentation

Antioch::ANTIOCH_ASCII_PARSER_INSTANTIATE ( )
template<typename StateType >
const Antioch::ANTIOCH_AUTO ( StateType  )
inline
Antioch::ANTIOCH_BLOTTNER_PARSING_INSTANTIATE ( )
Antioch::ANTIOCH_CEA_MIXTURE_DATA_ASCII_PARSING_INSTANTIATE ( )
Antioch::ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE ( NASA7CurveFit  )
Antioch::ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE ( NASA9CurveFit  )
Antioch::ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE ( CEACurveFit  )
Antioch::ANTIOCH_NUMERIC_TYPE_CLASS_INSTANTIATE ( ASCIIParser  )
Antioch::ANTIOCH_NUMERIC_TYPE_CLASS_INSTANTIATE ( XMLParser  )
Antioch::ANTIOCH_PLAIN_SCALAR ( float  )
Antioch::ANTIOCH_PLAIN_SCALAR ( double  )
Antioch::ANTIOCH_PLAIN_SCALAR ( long  double)
Antioch::ANTIOCH_PLAIN_SCALAR ( short  )
Antioch::ANTIOCH_PLAIN_SCALAR ( int  )
Antioch::ANTIOCH_PLAIN_SCALAR ( unsigned  short)
Antioch::ANTIOCH_READ_REACTION_SET_DATA_INSTANTIATE ( )
Antioch::ANTIOCH_SPECIES_PARSING_INSTANTIATE ( )
Antioch::ANTIOCH_SUTHERLAND_PARSING_INSTANTIATE ( )
Antioch::ANTIOCH_XML_PARSER_INSTANTIATE ( )
int Antioch::ascii_getline ( std::istream &  buf,
std::string &  line 
)
inline

adapted getline, never believe ascii file for the formatting of end-of-line.

end-of-line triggered by
or

  • Windows
  • Unix/Linux
  • Mac

Definition at line 169 of file string_utils.h.

Referenced by Antioch::ChemKinParser< NumericType >::initialize(), Antioch::ChemKinParser< NumericType >::next_meaningful_line(), Antioch::ChemKinParser< NumericType >::read_thermodynamic_data_root(), and Antioch::ChemKinParser< NumericType >::species_list().

170  {
171  char c('a');
172  line.clear();
173  while(!buf.eof())
174  {
175  c = buf.get();
176  if(c == '\n' || c == '\r')break;
177  line += c;
178  }
179  char n = buf.peek();
180 
181  /* never trust ascii files, they may come from
182  Windows, suppodedly \n\r, but let's not
183  underestimate Windows's viciousness
184  */
185  if((c == '\n' && n == '\r') ||
186  (n == '\n' && c == '\r'))c = buf.get();
187 
188  return buf.good();
189  }
template<class NumericType >
void Antioch::build_constant_lewis_diffusivity ( MixtureDiffusion< ConstantLewisDiffusivity< NumericType >, NumericType > &  D,
const NumericType  Le 
)

Definition at line 46 of file constant_lewis_diffusivity_building.h.

References Antioch::KineticsModel::D.

47  {
48  std::vector<NumericType> coeffs(1, Le);
49  for(unsigned int s = 0; s < D.mixture().n_species(); s++)
50  {
51  D.add_species_diffusion(s,coeffs);
52  }
53  }
template<class NumericType >
void Antioch::build_constant_lewis_diffusivity ( MixtureDiffusion< ConstantLewisDiffusivity< NumericType >, NumericType > &  D,
const std::vector< NumericType > &  Le 
)

Definition at line 56 of file constant_lewis_diffusivity_building.h.

References Antioch::KineticsModel::D.

57  {
58  for(unsigned int s = 0; s < D.mixture().n_species(); s++)
59  {
60  std::vector<NumericType> coeffs(1, Le[s]);
61  D.add_species_diffusion(s,coeffs);
62  }
63  }
template<class MicroThermo , class NumericType >
void Antioch::build_eucken_thermal_conductivity ( MixtureConductivity< EuckenThermalConductivity< MicroThermo >, NumericType > &  k,
const MicroThermo &  thermo 
)

Definition at line 42 of file eucken_thermal_conductivity_building.h.

44  {
45  for(unsigned int s = 0; s < k.mixture().n_species(); s++)
46  {
47  // Eucken doesn't have any coefficients to cache so we provide a dummy vector
48  std::vector<NumericType> dummy;
49  k.add(s,dummy,thermo);
50  }
51  }
template<class MicroThermo , class NumericType >
void Antioch::build_kinetics_theory_thermal_conductivity ( MixtureConductivity< KineticsTheoryThermalConductivity< MicroThermo, NumericType >, NumericType > &  k,
const MicroThermo &  thermo 
)

Definition at line 48 of file kinetics_theory_thermal_conductivity_building.h.

50  {
51  for(unsigned int s = 0; s < k.mixture().n_species(); s++)
52  {
53  std::vector<NumericType> coeffs(2);
54  coeffs[0] = k.mixture().transport_species()[s]->rotational_relaxation();
55  coeffs[1] = k.mixture().transport_species()[s]->LJ_depth();
56  k.add(s,coeffs,thermo);
57  }
58  }
template<typename CoeffType , typename VectorCoeffType >
KineticsType< CoeffType, VectorCoeffType > * Antioch::build_rate ( const VectorCoeffType &  data,
const KineticsModel::KineticsModel &  kin 
)
inline

cross-road to kinetics model

We take here the parameters as:

Definition at line 89 of file kinetics_parsing.h.

References antioch_assert_equal_to, antioch_error, Antioch::KineticsModel::ARRHENIUS, Antioch::KineticsModel::BERTHELOT, Antioch::KineticsModel::BHE, Antioch::KineticsModel::CONSTANT, Antioch::KineticsModel::HERCOURT_ESSEN, Antioch::KineticsModel::KOOIJ, Antioch::KineticsModel::PHOTOCHEM, std::pow(), and Antioch::KineticsModel::VANTHOFF.

91  {
92  using std::pow;
93 
94  KineticsType<CoeffType,VectorCoeffType>* rate = NULL;
95 
96  switch(kin)
97  {
99  {
100  antioch_assert_equal_to(1,data.size());
101  rate = new ConstantRate<CoeffType>(data[0]);//Cf
102  }
103  break;
104 
106  {
107  antioch_assert_equal_to(3,data.size());
108  rate = new HercourtEssenRate<CoeffType>(data[0],data[1],data[2]);//Cf,eta,Tref
109  }
110  break;
111 
113  {
114  antioch_assert_equal_to(2,data.size());
115  rate = new BerthelotRate<CoeffType>(data[0],data[1]);// Cf, D
116  }
117  break;
118 
120  {
121  antioch_assert_equal_to(3,data.size());
122  rate = new ArrheniusRate<CoeffType>(data[0],data[1],data[2]);//Cf,Ea,scale
123  }
124  break;
125 
126  case(KineticsModel::BHE):
127  {
128  antioch_assert_equal_to(4,data.size());
129  rate = new BerthelotHercourtEssenRate<CoeffType>(data[0],data[1],data[2],data[3]);//Cf,eta,D,Tref
130  }
131  break;
132 
133  case(KineticsModel::KOOIJ):
134  {
135  antioch_assert_equal_to(5,data.size());
136  rate = new KooijRate<CoeffType>(data[0],data[1],data[2],data[3],data[4]);//Cf,eta,Ea,Tref,scale
137  }
138  break;
139 
141  {
142  antioch_assert_equal_to(6,data.size());
143  rate = new VantHoffRate<CoeffType>(data[0],data[1],data[2],data[3],data[4],data[5]);//Cf,eta,Ea,D,Tref,scale
144  }
145  break;
146 
148  {
149  antioch_assert_equal_to(0,data.size()%2); //two vectors in one: lambda then cross-section
150  VectorCoeffType cs;
151  VectorCoeffType lambda;
152  for(unsigned int i = 0; i < data.size()/2; i++)
153  {
154  lambda.push_back(data[i]);
155  cs.push_back(data[i + data.size()/2]);
156  }
157  rate = new PhotochemicalRate<CoeffType,VectorCoeffType>(cs,lambda);//cs,lambda
158  }
159  break;
160 
161  default:
162  {
163  antioch_error();
164  }
165 
166  } // switch(kin)
167 
168  return rate;
169  }
#define antioch_assert_equal_to(expr1, expr2)
#define antioch_error()
Scalar BHE(const Scalar &T, const Scalar &Cf, const Scalar &eta, const Scalar &D, const Scalar &Tf=1.)
Definition: parsing_xml.C:55
Antioch::enable_if_c< Antioch::is_valarray< T >::value, typename Antioch::state_type< T >::type >::type pow(const T &in, const T2 &n)
template<typename CoeffType >
Reaction< CoeffType > * Antioch::build_reaction ( const unsigned int  n_species,
const std::string &  equation,
const bool &  reversible,
const ReactionType::ReactionType &  type,
const KineticsModel::KineticsModel &  kin 
)
inline

Definition at line 53 of file reaction_parsing.h.

References antioch_error, Antioch::ReactionType::DUPLICATE, Antioch::ReactionType::ELEMENTARY, Antioch::ReactionType::LINDEMANN_FALLOFF, Antioch::ReactionType::LINDEMANN_FALLOFF_THREE_BODY, Antioch::ReactionType::THREE_BODY, Antioch::ReactionType::TROE_FALLOFF, and Antioch::ReactionType::TROE_FALLOFF_THREE_BODY.

58  {
59  Reaction<CoeffType>* reaction = NULL;
60 
61  switch(type)
62  {
64  {
65  reaction = new ElementaryReaction<CoeffType>(n_species,equation,reversible,kin);
66  }
67  break;
68 
70  {
71  reaction = new DuplicateReaction<CoeffType>(n_species,equation,reversible,kin);
72  }
73  break;
74 
76  {
77  reaction = new ThreeBodyReaction<CoeffType>(n_species,equation,reversible,kin);
78  }
79  break;
80 
82  {
83  reaction = new FalloffReaction<CoeffType,LindemannFalloff<CoeffType> >(n_species,equation,reversible,type,kin);
84  }
86  {
87  reaction = new FalloffReaction<CoeffType,TroeFalloff<CoeffType> >(n_species,equation,reversible,type,kin);
88  }
89  break;
90 
92  {
93  reaction = new FalloffThreeBodyReaction<CoeffType,LindemannFalloff<CoeffType> >(n_species,equation,reversible,type,kin);
94  }
96  {
97  reaction = new FalloffThreeBodyReaction<CoeffType,TroeFalloff<CoeffType> >(n_species,equation,reversible,type,kin);
98  }
99  break;
100 
101  default:
102  {
103  antioch_error();
104  }
105 
106  } // switch(type)
107 
108  // Dummy
109  return reaction;
110  }
#define antioch_error()
bool Antioch::conjunction ( const bool &  vec)
inline

Definition at line 161 of file metaprogramming.h.

Referenced by Antioch::SigmaBinConverter< VectorCoeffType >::y_on_custom_grid().

162 {
163  return vec;
164 }
template<typename T >
bool Antioch::conjunction ( const T &  vec)
inline

Definition at line 168 of file metaprogramming.h.

References conjunction_root().

169 {
170  typedef typename tag_type<T>::type tag;
171  return conjunction_root(vec,tag());
172 }
bool conjunction_root(const T &vec, numeric_library_tag)
template<typename T >
bool Antioch::conjunction_root ( const T &  vec,
numeric_library_tag   
)
inline

Definition at line 176 of file metaprogramming.h.

177 {
178  for(unsigned int i = 0; i < vec.size(); i++)
179  {
180  if(!vec[i])return false;
181  }
182  return true;
183 }
template<typename T >
bool Antioch::conjunction_root ( const T &  vec_input,
vexcl_library_tag   
)
inline

Definition at line 227 of file vexcl_utils.h.

References antioch_error.

228 {
229 #ifdef ANTIOCH_HAVE_VEXCL
230  vex::detail::get_expression_properties prop;
231  vex::detail::extract_terminals()(boost::proto::as_child(vec_input),prop);
232 
233  vex::all_of all_of(prop.queue);
234  return all_of(vec_input); // at least one false
235 #else
236  antioch_error();
237  return false;
238 #endif
239 }
#define antioch_error()
template<typename T >
bool Antioch::conjunction_root ( const T &  vec,
eigen_library_tag   
)
inline

Definition at line 278 of file eigen_utils.h.

Referenced by conjunction().

279 {
280  return vec.all();
281 }
template<typename T , typename Scalar >
std::vector<T> Antioch::constant_clone ( const std::vector< T > &  example,
const Scalar &  value 
)
inline
template<typename T , typename Scalar >
T Antioch::constant_clone ( const T &  ,
const Scalar &  value 
)
inline

Definition at line 128 of file metaprogramming.h.

128 { return value; }
template<typename T , typename Scalar >
vex::vector< T > Antioch::constant_clone ( const vex::vector< T > &  example,
const Scalar &  value 
)
inline

Definition at line 176 of file vexcl_utils.h.

177 {
178  vex::vector<T> returnval(example.queue_list(), example.size());
179  returnval = value;
180  return returnval;
181 }
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols, typename Scalar >
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > Antioch::constant_clone ( const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &  ex,
const Scalar &  value 
)
inline
template<typename T , typename Scalar >
std::valarray< T > Antioch::constant_clone ( const std::valarray< T > &  example,
const Scalar &  value 
)
inline

Definition at line 187 of file valarray_utils.h.

188 {
189  if (example.size())
190  return std::valarray<T>(value,example.size());
191  else
192  return std::valarray<T>();
193 }
template<typename T , typename Scalar >
void Antioch::constant_fill ( T &  output,
const Scalar &  value 
)
inline

Definition at line 132 of file metaprogramming.h.

132 { output = value; }
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols, typename Scalar >
void Antioch::constant_fill ( _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &  output,
const Scalar &  value 
)
inline

Definition at line 204 of file eigen_utils.h.

Referenced by Antioch::ConstantRate< CoeffType >::rate_and_derivative().

207 {
208  output.fill(value);
209 }
template<typename T , typename VectorScalar >
std::vector<T> Antioch::custom_clone ( const std::vector< T > &  vec,
const VectorScalar &  vecsrc,
const std::vector< unsigned int > &  indexes 
)
inline
template<typename T , typename VectorScalar >
T Antioch::custom_clone ( const T &  ,
const VectorScalar &  values,
unsigned int  indexes 
)
inline

Definition at line 136 of file metaprogramming.h.

Referenced by Antioch::SigmaBinConverter< VectorCoeffType >::custom_bin_value().

136 {return values[indexes];}
template<typename T , typename VectorScalar >
T Antioch::custom_clone ( const T &  ,
const VectorScalar &  values,
const typename Antioch::rebind< T, unsigned int >::type &  indexes 
)
inline

Definition at line 140 of file metaprogramming.h.

141 {
142  T returnval(indexes.size()); //bof bof - metaphysicl has size within type, this suppose that size_type<indexes>::type can be changed in value_type<T>::type
143 
144  for(unsigned int i = 0; i < indexes.size(); i++)
145  {
146  returnval[i] = values[indexes[i]];
147  }
148  return returnval;
149 }
template<typename T , typename VectorScalar >
std::vector<T> Antioch::custom_clone ( const std::vector< T > &  ,
const VectorScalar &  vecsrc,
std::vector< unsigned int > &  indexes 
)
inline

Definition at line 175 of file vector_utils.h.

176 {
177  std::vector<T> returnval;
178  returnval.resize(indexes.size());
179  for (std::size_t i=0; i != indexes.size(); ++i)
180  returnval[i] = vecsrc[indexes[i]];
181  return returnval;
182 }
bool Antioch::disjunction ( const bool &  vec)
inline

Definition at line 186 of file metaprogramming.h.

Referenced by Antioch::SigmaBinConverter< VectorCoeffType >::custom_bin_value().

187 {
188  return vec;
189 }
template<typename T >
bool Antioch::disjunction ( const T &  vec)
inline

Definition at line 193 of file metaprogramming.h.

References disjunction_root().

194 {
195  typedef typename tag_type<T>::type tag;
196  return disjunction_root(vec,tag());
197 }
bool disjunction_root(const T &vec, numeric_library_tag)
template<typename T >
bool Antioch::disjunction_root ( const T &  vec,
numeric_library_tag   
)
inline

Definition at line 201 of file metaprogramming.h.

202 {
203  for(unsigned int i = 0; i < vec.size(); i++)
204  {
205  if(vec[i])return true;
206  }
207  return false;
208 }
template<typename T >
bool Antioch::disjunction_root ( const T &  vec_input,
vexcl_library_tag   
)
inline

Definition at line 211 of file vexcl_utils.h.

References antioch_error.

212 {
213 #ifdef ANTIOCH_HAVE_VEXCL
214  vex::detail::get_expression_properties prop;
215  vex::detail::extract_terminals()(boost::proto::as_child(vec_input),prop);
216 
217  vex::any_of any_of(prop.queue);
218  return any_of(vec_input); // at least one true
219 #else
220  antioch_error();
221  return false;
222 #endif
223 }
#define antioch_error()
template<typename T >
bool Antioch::disjunction_root ( const T &  vec,
eigen_library_tag   
)
inline

Definition at line 285 of file eigen_utils.h.

Referenced by disjunction().

286 {
287  return vec.any();
288 }
template<typename VectorT , typename UIntType >
Antioch::enable_if_c< is_metaphysicl< typename Antioch::value_type< VectorT >::type >::value &&is_metaphysicl< UIntType >::value, typename Antioch::value_type< VectorT >::type >::type Antioch::eval_index ( const VectorT &  vec,
const UIntType &  indexes 
)
inline

Definition at line 154 of file metaphysicl_utils.h.

155 {
156  typename Antioch::value_type<VectorT>::type returnval;
157 
158  for(typename Antioch::size_type<typename Antioch::value_type<VectorT>::type>::type i = 0;
159  i < indexes.size(); i++)
160  returnval[i] = vec[indexes[i]][i];
161 
162  return returnval;
163 }
template<typename VectorT >
value_type< VectorT >::type Antioch::eval_index ( const VectorT &  vec,
unsigned int  index 
)
inline

Definition at line 155 of file metaprogramming.h.

156 {
157  return vec[index];
158 }
template<typename VectorT , typename IntT >
enable_if_c< vex::is_vector_expression< typename value_type< VectorT >::type >::value &&vex::is_vector_expression< IntT >::value, typename value_type< VectorT >::type >::type Antioch::eval_index ( const VectorT &  vec,
const IntT &  index 
)
inline

Definition at line 248 of file vexcl_utils.h.

References zero_clone().

249 {
250  typename value_type<VectorT>::type returnval = zero_clone(vec[0]);
251 
252  // FIXME - this will be painfully slow
253  for (unsigned int i=0; i != index.size(); ++i)
254  returnval[i] = vec[index[i]][i];
255 
256  return returnval;
257 }
void zero_clone(vex::vector< T1 > &output, const vex::vector< T2 > &example)
Definition: vexcl_utils.h:167
template<typename VectorT >
Antioch::enable_if_c< Antioch::is_valarray< typename value_type< VectorT >::type >::value, typename value_type< VectorT >::type >::type Antioch::eval_index ( const VectorT &  vec,
const std::valarray< unsigned int > &  index 
)
inline

Definition at line 249 of file valarray_utils.h.

250 {
251  typename value_type<VectorT>::type returnval;
252  std::size_t sz = index.size();
253  returnval.resize(sz);
254  for (std::size_t i=0; i != sz; ++i)
255  returnval[i] = vec[index[i]][i];
256  return returnval;
257 }
template<typename VectorT , template< typename, int, int, int, int, int > class _Matrix, typename _UIntT , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
enable_if_c< is_eigen< typename value_type< VectorT >::type >::value, typename value_type< VectorT >::type >::type Antioch::eval_index ( const VectorT &  vec,
const _Matrix< _UIntT, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &  index 
)
inline

Definition at line 268 of file eigen_utils.h.

Referenced by Antioch::SigmaBinConverter< VectorCoeffType >::y_on_custom_grid().

269 {
270  typename value_type<VectorT>::type returnval = vec[0];
271  for (unsigned int i=0; i != index.size(); ++i)
272  returnval[i] = vec[index[i]][i];
273  return returnval;
274 }
int Antioch::get_antioch_version ( )

Definition at line 31 of file antioch_version.C.

32  {
33  /* Note: return format follows the versioning convention xx.yy.zz where
34 
35  xx = major version number
36  yy = minor version number
37  zz = micro version number
38 
39  For example:
40  v. 0.23 -> 002300 = 2300
41  v 0.23.1 -> 002301 = 2301
42  v. 10.23.2 -> 102302 */
43 
44  int major_version = 0;
45  int minor_version = 0;
46  int micro_version = 0;
47 
48 #ifdef ANTIOCH_MAJOR_VERSION
49  major_version = ANTIOCH_MAJOR_VERSION;
50 #endif
51 
52 #ifdef ANTIOCH_MINOR_VERSION
53  minor_version = ANTIOCH_MINOR_VERSION;
54 #endif
55 
56 #ifdef ANTIOCH_MICRO_VERSION
57  micro_version = ANTIOCH_MICRO_VERSION;
58 #endif
59 
60  return major_version*10000 + minor_version*100 + micro_version;
61  }
template<typename Tbool , typename Ttrue , typename Tfalse >
Antioch::enable_if_c< is_metaphysicl< Tbool >::value &&is_metaphysicl< Ttrue >::value &&is_metaphysicl< Tfalse >::value, typename state_type< Ttrue >::type >::type Antioch::if_else ( const Tbool &  condition,
const Ttrue &  if_true,
const Tfalse &  if_false 
)
inline

Definition at line 133 of file metaphysicl_utils.h.

References antioch_assert_equal_to.

136 {
137  typename state_type<Ttrue>::type returnval;
138  antioch_assert_equal_to(condition.size(), if_true.size());
139  antioch_assert_equal_to(condition.size(), if_false.size());
140 
141  for (std::size_t i=0; i != condition.size(); ++i)
142  returnval[i] = condition[i] ? if_true[i] : if_false[i];
143 
144  return returnval;
145 }
#define antioch_assert_equal_to(expr1, expr2)
template<typename BoolInput , typename IfValue , typename ElseValue >
boost::proto::result_of::make_expr< boost::proto::tag::if_else_, boost::proto::deduce_domain, const vex::vector_expression< BoolInput > &, const IfValue &, const ElseValue & >::type const Antioch::if_else ( const vex::vector_expression< BoolInput > &  condition,
const IfValue &  if_true,
const ElseValue &  if_false 
)
inline

Definition at line 202 of file vexcl_utils.h.

205 {
206  return boost::proto::if_else(condition, if_true, if_false);
207 }
boost::proto::result_of::make_expr< boost::proto::tag::if_else_, boost::proto::deduce_domain, const vex::vector_expression< BoolInput > &, const IfValue &, const ElseValue & >::type const if_else(const vex::vector_expression< BoolInput > &condition, const IfValue &if_true, const ElseValue &if_false)
Definition: vexcl_utils.h:202
template<typename T >
T Antioch::if_else ( bool  condition,
if_true,
if_false 
)
inline
template<typename T >
std::valarray< T > Antioch::if_else ( const std::valarray< bool > &  condition,
const std::valarray< T > &  if_true,
const std::valarray< T > &  if_false 
)
inline

Definition at line 226 of file valarray_utils.h.

References antioch_assert_equal_to.

229 {
230  antioch_assert_equal_to(condition.size(), if_true.size());
231  antioch_assert_equal_to(condition.size(), if_false.size());
232 
233  const std::size_t size = condition.size();
234  std::valarray<T> returnval(size);
235 
236  for (std::size_t i=0; i != size; ++i)
237  returnval[i] = condition[i] ? if_true[i] : if_false[i];
238 
239  return returnval;
240 }
#define antioch_assert_equal_to(expr1, expr2)
template<typename Condition , typename T1 , typename T2 >
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type Antioch::if_else ( const Condition &  condition,
const T1 &  if_true,
const T2 &  if_false 
)
inline
template<typename T >
void Antioch::init_clone ( T &  output,
const T &  example 
)
inline

Definition at line 115 of file metaprogramming.h.

Referenced by init_clone(), init_constant(), Antioch::SIPrefixes< T >::operator=(), and Antioch::Units< T >::set_SI_converter().

115 { output = example; }
template<typename T >
void Antioch::init_clone ( vex::vector< T > &  output,
const vex::vector< T > &  example 
)
inline

Definition at line 186 of file vexcl_utils.h.

187 {
188  output.resize(example.queue_list(), example.size());
189  output = example;
190 }
template<typename T >
void Antioch::init_clone ( std::valarray< T > &  output,
const std::valarray< T > &  example 
)
inline

Definition at line 200 of file valarray_utils.h.

References init_clone().

201 {
202  const std::size_t sz = example.size();
203  output.resize(sz);
204  for (std::size_t i=0; i != sz; ++i)
205  init_clone(output[i], example[i]);
206 }
void init_clone(std::valarray< T > &output, const std::valarray< T > &example)
template<typename Vector , typename Scalar >
void Antioch::init_constant ( Vector &  output,
const Scalar &  example 
)
inline
template<typename T >
Antioch::enable_if_c< is_metaphysicl< T >::value, typename value_type< T >::type >::type Antioch::max ( const T &  in)
inline

Definition at line 67 of file metaphysicl_utils.h.

References std::max(), and max().

68 {
69  using std::max;
70 
71  typename value_type<T>::type maxval = in[0];
72  const std::size_t size = in.size();
73  for (std::size_t i = 1; i < size; ++i)
74  maxval = max(maxval, in[i]);
75 
76  return maxval;
77 }
max(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &a, const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &b) ANTIOCH_AUTOFUNC(_Matrix< _Scalar ANTIOCH_COMMA _Rows ANTIOCH_COMMA _Cols ANTIOCH_COMMA _Options ANTIOCH_COMMA _MaxRows ANTIOCH_COMMA _MaxCols >
Antioch::enable_if_c< is_metaphysicl< T >::value, typename value_type< T >::type >::type max(const T &in)
template<typename T >
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type Antioch::max ( const T &  in)
inline
template<typename T >
T Antioch::max ( const vex::vector< T > &  in)
inline

Definition at line 109 of file vexcl_utils.h.

110 {
111  vex::Reductor<T, vex::MAX> vex_max(in.queue_list());
112  return vex_max(in);
113 }
template<typename T >
T Antioch::max ( const std::valarray< T > &  in)
inline

Definition at line 119 of file valarray_utils.h.

120 {
121  return in.max();
122 }
template<typename T >
Antioch::enable_if_c< is_metaphysicl< T >::value, typename value_type< T >::type >::type Antioch::min ( const T &  in)
inline

Definition at line 84 of file metaphysicl_utils.h.

References std::min(), and min().

85 {
86  using std::min;
87 
88  typename value_type<T>::type minval = in[0];
89  const std::size_t size = in.size();
90  for (std::size_t i = 1; i < size; ++i)
91  minval = min(minval, in[i]);
92 
93  return minval;
94 }
typename _Scalar int _Rows int _Cols int _Options int _MaxRows int _MaxCols inline min(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &a, const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &b) ANTIOCH_AUTOFUNC(_Matrix< _Scalar ANTIOCH_COMMA _Rows ANTIOCH_COMMA _Cols ANTIOCH_COMMA _Options ANTIOCH_COMMA _MaxRows ANTIOCH_COMMA _MaxCols >
Antioch::enable_if_c< is_metaphysicl< T >::value, typename value_type< T >::type >::type min(const T &in)
template<typename T >
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type Antioch::min ( const T &  in)
inline
template<typename T >
T Antioch::min ( const vex::vector< T > &  in)
inline

Definition at line 118 of file vexcl_utils.h.

119 {
120  vex::Reductor<T, vex::MIN> vex_min(in.queue_list());
121  return vex_min(in);
122 }
template<typename T >
T Antioch::min ( const std::valarray< T > &  in)
inline

Definition at line 127 of file valarray_utils.h.

128 {
129  return in.min();
130 }
template<class NumericType >
void Antioch::read_blottner_data_ascii ( MixtureViscosity< BlottnerViscosity< NumericType >, NumericType > &  mu,
const std::string &  filename 
)

Definition at line 41 of file blottner_parsing.C.

References antioch_error, Antioch::ChemicalMixture< CoeffType >::chemical_mixture(), skip_comment_lines(), and Antioch::ChemicalMixture< CoeffType >::species_name_map().

Referenced by read_blottner_data_ascii_default(), and tester().

43  {
44  std::ifstream in(filename.c_str());
45  if(!in.is_open())
46  {
47  std::cerr << "ERROR: unable to load file " << filename << std::endl;
48  antioch_error();
49  }
50 
51  // skip the header
52  skip_comment_lines(in, '#');
53 
54  std::string name;
55  NumericType a, b, c;
56 
57  while (in.good())
58  {
59  in >> name; // Species Name
60  in >> a; //
61  in >> b; //
62  in >> c; //
63 
64  // If we are still good, we have a valid set of transport
65  // data for this species. Otherwise, we read past end-of-file
66  // in the section above
67  if (in.good())
68  {
69  const ChemicalMixture<NumericType>& chem_mixture = mu.chemical_mixture();
70 
71  // Check if this is a species we want.
72  if( chem_mixture.species_name_map().find(name) !=
73  chem_mixture.species_name_map().end() )
74  {
75  // Pack up coefficients
76  std::vector<NumericType> coeffs(3);
77  coeffs[0] = a;
78  coeffs[1] = b;
79  coeffs[2] = c;
80  mu.add(name, coeffs);
81  }
82  }
83 
84  }
85  in.close();
86  return;
87  }
#define antioch_error()
void skip_comment_lines(std::istream &in, const char comment_start)
Skip comment lines in the header of an ASCII text file prefixed with the comment character 'comment_s...
Definition: input_utils.h:46
template<class NumericType >
void Antioch::read_blottner_data_ascii_default ( MixtureViscosity< BlottnerViscosity< NumericType >, NumericType > &  mu)

Definition at line 90 of file blottner_parsing.C.

References Antioch::DefaultSourceFilename::blottner_data(), and read_blottner_data_ascii().

91  {
92  read_blottner_data_ascii(mu, DefaultFilename::blottner_data());
93  }
void read_blottner_data_ascii(MixtureViscosity< BlottnerViscosity< NumericType >, NumericType > &mu, const std::string &filename)
template<class NumericType >
void Antioch::read_cea_mixture_data ( CEAThermoMixture< NumericType > &  thermo,
const std::string &  filename,
ParsingType  type,
bool  verbose = true 
)

Definition at line 41 of file cea_mixture_parsing.C.

References antioch_error, antioch_parsing_error, ASCII, Antioch::NASAThermoMixture< CoeffType, CEACurveFit< CoeffType > >::check(), CHEMKIN, Antioch::ParserBase< NumericType >::read_thermodynamic_data(), and XML.

Referenced by read_cea_mixture_data_ascii(), read_cea_mixture_data_ascii_default(), and tester().

42  {
43 
44  ParserBase<NumericType> * parser(NULL);
45  switch(type)
46  {
47  case ASCII:
48  parser = new ASCIIParser<NumericType>(filename,verbose);
49  break;
50  case CHEMKIN:
51  parser = new ChemKinParser<NumericType>(filename,verbose);
52  break;
53  case XML:
54  parser = new XMLParser<NumericType>(filename,verbose);
55  break;
56  default:
57  antioch_parsing_error("unknown type");
58  }
59 
60  parser->read_thermodynamic_data(thermo);
61  // Make sure we actually populated everything
62  if( !thermo.check() )
63  {
64  std::cerr << "Error: CEA table not fully populated" << std::endl;
65  antioch_error();
66  }
67  }
#define antioch_error()
#define antioch_parsing_error(description)
template void Antioch::read_cea_mixture_data< double > ( CEAThermoMixture< double > &  ,
const std::string &  ,
ParsingType  ,
bool   
)
template void Antioch::read_cea_mixture_data< float > ( CEAThermoMixture< float > &  ,
const std::string &  ,
ParsingType  ,
bool   
)
template void Antioch::read_cea_mixture_data< long double > ( CEAThermoMixture< long double > &  ,
const std::string &  ,
ParsingType  ,
bool   
)
template<class NumericType >
void Antioch::read_cea_mixture_data_ascii ( CEAThermoMixture< NumericType > &  thermo,
const std::string &  filename 
)

Definition at line 45 of file cea_mixture_ascii_parsing.C.

References antioch_deprecated, ASCII, and read_cea_mixture_data().

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

46  {
48  read_cea_mixture_data( thermo, filename, ASCII, true );
49  }
void read_cea_mixture_data(CEAThermoMixture< NumericType > &thermo, const std::string &filename, ParsingType type, bool verbose=true)
#define antioch_deprecated()
template<class NumericType >
void Antioch::read_cea_mixture_data_ascii ( CEAThermodynamics< NumericType > &  thermo,
const std::string &  filename 
)

Definition at line 52 of file cea_mixture_ascii_parsing.C.

References antioch_deprecated, and Antioch::ASCIIParser< NumericType >::read_thermodynamic_data().

53  {
55  ASCIIParser<NumericType> parser(filename);
56  parser.read_thermodynamic_data(thermo);
57  }
#define antioch_deprecated()
template<class NumericType >
void Antioch::read_cea_mixture_data_ascii_default ( CEAThermoMixture< NumericType > &  thermo)

Definition at line 38 of file cea_mixture_ascii_parsing.C.

References antioch_deprecated, ASCII, read_cea_mixture_data(), and Antioch::DefaultSourceFilename::thermo_data().

39  {
41  read_cea_mixture_data(thermo, DefaultFilename::thermo_data(), ASCII, true);
42  }
void read_cea_mixture_data(CEAThermoMixture< NumericType > &thermo, const std::string &filename, ParsingType type, bool verbose=true)
#define antioch_deprecated()
template<class NumericType >
void Antioch::read_cea_thermo_data_ascii ( CEAThermodynamics< NumericType > &  thermo,
const std::string &  filename 
)
inline

Definition at line 40 of file cea_thermo_ascii_parsing.C.

References Antioch::CEAThermodynamics< CoeffType >::add_curve_fit(), antioch_error, Antioch::CEAThermodynamics< CoeffType >::check(), Antioch::CEAThermodynamics< CoeffType >::chemical_mixture(), skip_comment_lines(), and Antioch::ChemicalMixture< CoeffType >::species_name_map().

41  {
42  std::ifstream in(filename.c_str());
43  if(!in.is_open())
44  {
45  std::cerr << "ERROR: unable to load file " << filename << std::endl;
46  antioch_error();
47  }
48 
49  skip_comment_lines(in, '#');
50 
51  std::string name;
52  unsigned int n_int;
53  std::vector<NumericType> coeffs;
54  NumericType h_form, val;
55 
56  const ChemicalMixture<NumericType>& chem_mixture = thermo.chemical_mixture();
57 
58  while (in.good())
59  {
60  in >> name; // Species Name
61  in >> n_int; // Number of T intervals: [200-1000], [1000-6000], ([6000-20000])
62  in >> h_form; // Formation Enthalpy @ 298.15 K
63 
64  coeffs.clear();
65  for (unsigned int interval=0; interval<n_int; interval++)
66  {
67  for (unsigned int n=0; n<10; n++)
68  {
69  in >> val, coeffs.push_back(val);
70  }
71  }
72 
73  // If we are still good, we have a valid set of thermodynamic
74  // data for this species. Otherwise, we read past end-of-file
75  // in the section above
76  if (in.good())
77  {
78  // Check if this is a species we want.
79  if( chem_mixture.species_name_map().find(name) !=
80  chem_mixture.species_name_map().end() )
81  {
82  thermo.add_curve_fit(name, coeffs);
83  }
84  }
85  } // end while
86 
87  in.close();
88 
89  // Make sure we actually populated everything
90  if( !thermo.check() )
91  {
92  std::cerr << "Error: CEA table not fully populated" << std::endl;
93  antioch_error();
94  }
95  }
#define antioch_error()
void skip_comment_lines(std::istream &in, const char comment_start)
Skip comment lines in the header of an ASCII text file prefixed with the comment character 'comment_s...
Definition: input_utils.h:46
template<typename NumericType >
void Antioch::read_chemical_species_composition ( ParserBase< NumericType > *  parser,
ChemicalMixture< NumericType > &  mixture 
)

Definition at line 40 of file species_parsing.C.

References Antioch::ChemicalMixture< CoeffType >::initialize_species(), and Antioch::ParserBase< NumericType >::species_list().

42  {
43  std::vector<std::string> species = parser->species_list();
44 
45  mixture.initialize_species(species);
46  }
template<class NumericType , typename CurveType >
void Antioch::read_nasa_mixture_data ( NASAThermoMixture< NumericType, CurveType > &  thermo,
const std::string &  filename = DefaultSourceFilename::thermo_data(),
ParsingType  type = ASCII,
bool  verbose = true 
)

Definition at line 42 of file nasa_mixture_parsing.C.

References antioch_error, antioch_parsing_error, ASCII, Antioch::NASAThermoMixture< CoeffType, NASAFit >::check(), CHEMKIN, Antioch::ParserBase< NumericType >::read_thermodynamic_data(), and XML.

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

43  {
44 
45  ParserBase<NumericType> * parser(NULL);
46  switch(type)
47  {
48  case ASCII:
49  parser = new ASCIIParser<NumericType>(filename,verbose);
50  break;
51  case CHEMKIN:
52  parser = new ChemKinParser<NumericType>(filename,verbose);
53  break;
54  case XML:
55  parser = new XMLParser<NumericType>(filename,verbose);
56  break;
57  default:
58  antioch_parsing_error("unknown type");
59  }
60 
61  parser->read_thermodynamic_data(thermo);
62 
63  // Make sure we actually populated everything
64  if( !thermo.check() )
65  {
66  std::cerr << "Error: NASA table not fully populated" << std::endl;
67  antioch_error();
68  }
69 
70  return;
71  }
#define antioch_error()
#define antioch_parsing_error(description)
template<class NumericType >
void Antioch::read_nasa_mixture_data_ascii ( NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &  thermo,
const std::string &  filename 
)

Definition at line 74 of file nasa_mixture_parsing.C.

References antioch_deprecated, CHEMKIN, and read_nasa_mixture_data().

75  {
77  read_nasa_mixture_data( thermo, filename, CHEMKIN, true);
78  }
void read_nasa_mixture_data(NASAThermoMixture< NumericType, CurveType > &thermo, const std::string &filename=DefaultSourceFilename::thermo_data(), ParsingType=ASCII, bool verbose=true)
#define antioch_deprecated()
template void Antioch::read_nasa_mixture_data_ascii< double > ( NASAThermoMixture< double, NASA7CurveFit< double > > &  ,
const std::string &   
)
template void Antioch::read_nasa_mixture_data_ascii< float > ( NASAThermoMixture< float, NASA7CurveFit< float > > &  ,
const std::string &   
)
template void Antioch::read_nasa_mixture_data_ascii< long double > ( NASAThermoMixture< long double, NASA7CurveFit< long double > > &  ,
const std::string &   
)
template<typename NumericType >
void Antioch::read_reaction_set_data ( const std::string &  filename,
const bool  verbose,
ReactionSet< NumericType > &  reaction_set,
ParsingType  type = ASCII 
)

Definition at line 77 of file read_reaction_set_data.C.

References Antioch::Reaction< CoeffType, VectorCoeffType >::add_forward_rate(), Antioch::Reaction< CoeffType, VectorCoeffType >::add_product(), Antioch::Reaction< CoeffType, VectorCoeffType >::add_reactant(), Antioch::ReactionSet< CoeffType >::add_reaction(), antioch_assert, antioch_assert_equal_to, antioch_do_once, antioch_error, antioch_not_implemented, antioch_parameter_required, antioch_parsing_error, Antioch::KineticsModel::ARRHENIUS, ASCII, Antioch::KineticsModel::BERTHELOT, Antioch::KineticsModel::BHE, Antioch::ReactionSet< CoeffType >::chemical_mixture(), CHEMKIN, Antioch::Units< T >::clear(), Antioch::KineticsModel::CONSTANT, Antioch::ReactionType::DUPLICATE, Antioch::ParserBase< NumericType >::efficiencies(), Antioch::ReactionType::ELEMENTARY, Antioch::Reaction< CoeffType >::equation(), Antioch::Reaction< CoeffType, VectorCoeffType >::equation(), Antioch::Units< T >::factor_to_some_unit(), Antioch::Units< T >::get_SI_factor(), Antioch::Units< T >::get_symbol(), Antioch::KineticsModel::HERCOURT_ESSEN, Antioch::ParserBase< NumericType >::initialize(), Antioch::Units< T >::is_homogeneous(), Antioch::ParserBase< NumericType >::is_k0(), Antioch::Units< T >::is_united(), Antioch::KineticsModel::KOOIJ, Antioch::ReactionType::LINDEMANN_FALLOFF, Antioch::ReactionType::LINDEMANN_FALLOFF_THREE_BODY, Antioch::Reaction< CoeffType, VectorCoeffType >::n_rate_constants(), Antioch::ChemicalMixture< CoeffType >::n_species(), Antioch::KineticsModel::PHOTOCHEM, Antioch::ParserBase< NumericType >::products_orders(), Antioch::ParserBase< NumericType >::products_pairs(), Antioch::ParserBase< NumericType >::rate_constant(), Antioch::ParserBase< NumericType >::rate_constant_activation_energy_parameter(), Antioch::ParserBase< NumericType >::rate_constant_Berthelot_coefficient_parameter(), Antioch::ParserBase< NumericType >::rate_constant_cross_section_parameter(), Antioch::ParserBase< NumericType >::rate_constant_lambda_parameter(), Antioch::ParserBase< NumericType >::rate_constant_power_parameter(), Antioch::ParserBase< NumericType >::rate_constant_preexponential_parameter(), Antioch::ParserBase< NumericType >::rate_constant_Tref_parameter(), Antioch::ParserBase< NumericType >::reactants_orders(), Antioch::ParserBase< NumericType >::reactants_pairs(), Antioch::ParserBase< NumericType >::reaction(), Antioch::ParserBase< NumericType >::reaction_chemical_process(), Antioch::ParserBase< NumericType >::reaction_equation(), Antioch::ParserBase< NumericType >::reaction_id(), Antioch::ParserBase< NumericType >::reaction_kinetics_model(), Antioch::ParserBase< NumericType >::reaction_reversible(), Antioch::Reaction< CoeffType, VectorCoeffType >::set_efficiency(), Antioch::Reaction< CoeffType, VectorCoeffType >::set_id(), Antioch::Units< T >::set_unit(), Antioch::ChemicalMixture< CoeffType >::species_name_map(), Antioch::Units< T >::substract(), Antioch::Reaction< CoeffType, VectorCoeffType >::swap_forward_rates(), Antioch::ReactionType::THREE_BODY, Antioch::ParserBase< NumericType >::Troe(), Antioch::ParserBase< NumericType >::Troe_alpha_parameter(), Antioch::ReactionType::TROE_FALLOFF, Antioch::ReactionType::TROE_FALLOFF_THREE_BODY, Antioch::ParserBase< NumericType >::Troe_T1_parameter(), Antioch::ParserBase< NumericType >::Troe_T2_parameter(), Antioch::ParserBase< NumericType >::Troe_T3_parameter(), Antioch::Reaction< CoeffType, VectorCoeffType >::type(), Antioch::KineticsModel::VANTHOFF, Antioch::ParserBase< NumericType >::verify_Kooij_in_place_of_Arrhenius(), verify_unit_of_parameter(), Antioch::ParserBase< NumericType >::where_is_k0(), and XML.

81  {
82  ParserBase<NumericType> * parser(NULL);
83  switch(type)
84  {
85  case ASCII:
86  parser = new ASCIIParser<NumericType>(filename,verbose);
87  break;
88  case CHEMKIN:
89  parser = new ChemKinParser<NumericType>(filename,verbose);
90  break;
91  case XML:
92  parser = new XMLParser<NumericType>(filename,verbose);
93  break;
94  default:
95  antioch_parsing_error("unknown type");
96  }
97 
98  //error or no reaction data
99  if(!parser->initialize())return;
100 
101  const ChemicalMixture<NumericType>& chem_mixture = reaction_set.chemical_mixture();
102  unsigned int n_species = chem_mixture.n_species();
103  // Sanity Check on species
104  /*
105  tinyxml2::XMLElement* species = element->FirstChildElement("phase");
106  species = species->FirstChildElement("speciesArray");
107 
108  std::vector<std::string> species_names;
109 
110  std::cout << species->GetText() << std::endl;
111 
112  SplitString(std::string(species->GetText()),
113  " ",
114  species_names,
115  false);
116 
117 
118  if( n_species != species_names.size() )
119  {
120  std::cerr << "Error: Mismatch in n_species and the number of species specified in" << std::endl
121  << " the kinetics XML file " << filename << std::endl
122  << " Found species: " << species->GetText() << std::endl;
123  antioch_error();
124  }
125  */
126 
127  std::map<std::string,KineticsModel::KineticsModel> kin_keyword;
128  kin_keyword["Constant"] = KineticsModel::CONSTANT;
129  kin_keyword["HercourtEssen"] = KineticsModel::HERCOURT_ESSEN;
130  kin_keyword["Berthelot"] = KineticsModel::BERTHELOT;
131  kin_keyword["Arrhenius"] = KineticsModel::ARRHENIUS;
132  kin_keyword["BerthelotHercourtEssen"] = KineticsModel::BHE;
133  kin_keyword["Kooij"] = KineticsModel::KOOIJ;
134  kin_keyword["ModifiedArrhenius"] = KineticsModel::KOOIJ; //for Arrhenius fans
135  kin_keyword["VantHoff"] = KineticsModel::VANTHOFF;
136  kin_keyword["photochemistry"] = KineticsModel::PHOTOCHEM;
137 
138  std::map<KineticsModel::KineticsModel,unsigned int> kinetics_model_map;
139  kinetics_model_map[KineticsModel::CONSTANT] = 0;
140  kinetics_model_map[KineticsModel::HERCOURT_ESSEN] = 1;
141  kinetics_model_map[KineticsModel::BERTHELOT] = 2;
142  kinetics_model_map[KineticsModel::ARRHENIUS] = 3;
143  kinetics_model_map[KineticsModel::BHE] = 4;
144  kinetics_model_map[KineticsModel::KOOIJ] = 5;
145  kinetics_model_map[KineticsModel::VANTHOFF] = 7;
146  kinetics_model_map[KineticsModel::PHOTOCHEM] = 8;
147 
148  std::vector<std::string> models;
149  models.push_back("Constant");
150  models.push_back("HercourtEssen");
151  models.push_back("Berthelot");
152  models.push_back("Arrhenius");
153  models.push_back("BerthelotHercourtEssen");
154  models.push_back("Kooij");
155  models.push_back("ModifiedArrhenius");
156  models.push_back("VantHoff");
157  models.push_back("photochemistry");
158 
159  std::map<std::string,ReactionType::ReactionType> proc_keyword;
160  proc_keyword["Elementary"] = ReactionType::ELEMENTARY;
161  proc_keyword["Duplicate"] = ReactionType::DUPLICATE;
162  proc_keyword["ThreeBody"] = ReactionType::THREE_BODY;
163  proc_keyword["threeBody"] = ReactionType::THREE_BODY; // Cantera/backward compatiblity
164  proc_keyword["LindemannFalloff"] = ReactionType::LINDEMANN_FALLOFF;
165  proc_keyword["TroeFalloff"] = ReactionType::TROE_FALLOFF;
166  proc_keyword["LindemannFalloffThreeBody"] = ReactionType::LINDEMANN_FALLOFF_THREE_BODY;
167  proc_keyword["TroeFalloffThreeBody"] = ReactionType::TROE_FALLOFF_THREE_BODY;
168 
169  while (parser->reaction())
170  {
171  if (verbose) std::cout << "Reaction \"" << parser->reaction_id() << "\":\n"
172  << " eqn: " << parser->reaction_equation()
173  << std::endl;
174 
177 
178  if (!parser->reaction_chemical_process().empty())
179  {
180  if (verbose) std::cout << " type: " << parser->reaction_chemical_process() << std::endl;
181  if(!proc_keyword.count(parser->reaction_chemical_process()))
182  {
183  std::cerr << "Implemented chemical processes are:\n"
184  << " Elementary (default)\n"
185  << " Duplicate\n"
186  << " ThreeBody\n"
187  << " LindemannFalloff\n"
188  << " TroeFalloff\n"
189  << " LindemannFalloffThreeBody\n"
190  << " TroeFalloffThreeBody\n"
191  << "See Antioch documentation for more details."
192  << std::endl;
194  }
195  typeReaction = proc_keyword[parser->reaction_chemical_process()];
196  }
197 
198  bool reversible(parser->reaction_reversible());
199  if (verbose) std::cout << "reversible: " << reversible << std::endl;
200 
201  kineticsModel = kin_keyword[parser->reaction_kinetics_model(models)];
202  const std::string reading_kinetics_model = parser->reaction_kinetics_model(models);
203 
204  // usually Kooij is called Arrhenius, check here
205  if(kineticsModel == KineticsModel::ARRHENIUS)
206  {
207  if(parser->verify_Kooij_in_place_of_Arrhenius())
208  {
209  kineticsModel = KineticsModel::KOOIJ;
211  std::cout << "In reaction(s) including " << parser->reaction_id() << "\n"
212  << "An equation of the form \"A * (T/Tref)^beta * exp(-Ea/(R*T))\" is a Kooij equation,\n"
213  << "I guess a modified Arrhenius could be a name too. Whatever, the correct label is\n"
214  << "\"Kooij\", or, << à la limite >> \"ModifiedArrhenius\". Please use those terms instead,\n"
215  << "thanks and a good day to you, user." << std::endl;
216  ); // antioch_do_once
217  }
218  }
219 
220  // construct a Reaction object
221  Reaction<NumericType>* my_rxn = build_reaction<NumericType>(n_species, parser->reaction_equation(),
222  reversible,typeReaction,kineticsModel);
223  my_rxn->set_id(parser->reaction_id());
224 
225  // We will add the reaction, unless we do not have a
226  // reactant or product
227  bool relevant_reaction = true;
228  NumericType order_reaction(0);
229  std::vector<std::pair<std::string,int> > molecules_pairs;
230 
231  if(parser->reactants_pairs(molecules_pairs))
232  {
233 
234  std::map<std::string,NumericType> orders = parser->reactants_orders();
235  if (verbose)
236  {
237  std::cout << "\n reactants: ";
238  for(unsigned int ir = 0; ir < molecules_pairs.size(); ir++)
239  {
240  NumericType order = (orders.count(molecules_pairs[ir].first))?orders.at(molecules_pairs[ir].first):static_cast<NumericType>(molecules_pairs[ir].second);
241  std::cout << molecules_pairs[ir].first << ":" << molecules_pairs[ir].second << "," << order << ", ";
242  }
243  }
244 
245  for( unsigned int p=0; p < molecules_pairs.size(); p++ )
246  {
247  if(molecules_pairs[p].first == "e-") molecules_pairs[p].first = "e";
248 
249  if(verbose) std::cout << "\n " << molecules_pairs[p].first << " " << molecules_pairs[p].second;
250 
251  if( !chem_mixture.species_name_map().count( molecules_pairs[p].first ) )
252  {
253  relevant_reaction = false;
254  if (verbose) std::cout << "\n -> skipping this reaction (no reactant " << molecules_pairs[p].first << ")";
255  }
256  else
257  {
258  NumericType order = (orders.count(molecules_pairs[p].first))?orders.at(molecules_pairs[p].first):static_cast<NumericType>(molecules_pairs[p].second);
259  my_rxn->add_reactant( molecules_pairs[p].first,
260  chem_mixture.species_name_map().find( molecules_pairs[p].first )->second,
261  molecules_pairs[p].second, order );
262  order_reaction += order;
263  }
264  }
265  }
266 
267  molecules_pairs.clear();
268  if(parser->products_pairs(molecules_pairs))
269  {
270 
271  std::map<std::string,NumericType> orders = parser->products_orders();
272  if(verbose) std::cout << "\n products: ";
273  for(unsigned int ir = 0; ir < molecules_pairs.size(); ir++)
274  {
275  NumericType order = (orders.count(molecules_pairs[ir].first))?orders.at(molecules_pairs[ir].first):static_cast<NumericType>(molecules_pairs[ir].second);
276  std::cout << molecules_pairs[ir].first << ":" << molecules_pairs[ir].second << "," << order << ", ";
277  }
278 
279  for (unsigned int p=0; p < molecules_pairs.size(); p++)
280  {
281  if(molecules_pairs[p].first == "e-") molecules_pairs[p].first = "e";
282 
283  if(verbose) std::cout << "\n " << molecules_pairs[p].first << " " << molecules_pairs[p].second;
284 
285  if( !chem_mixture.species_name_map().count( molecules_pairs[p].first ) )
286  {
287  relevant_reaction = false;
288  if (verbose) std::cout << "\n -> skipping this reaction (no product " << molecules_pairs[p].first << ")";
289  }
290  else
291  {
292  NumericType order = (orders.count(molecules_pairs[p].first))?orders.at(molecules_pairs[p].first):static_cast<NumericType>(molecules_pairs[p].second);
293  my_rxn->add_product( molecules_pairs[p].first,
294  chem_mixture.species_name_map().find( molecules_pairs[p].first )->second,
295  molecules_pairs[p].second, order );
296  }
297  }
298  if(verbose) std::cout << std::endl;
299  }
300 
301  if(!relevant_reaction)
302  {
303  if(verbose) std::cout << "skipped reaction\n\n";
304  delete my_rxn;
305  continue;
306  }
307 
308  while(parser->rate_constant(reading_kinetics_model)) //for duplicate and falloff models, several kinetics rate to load, no mixing allowed
309  {
310 
311  /* Any data is formatted by the parser method.
312  * For any data required, parser sends back:
313  * - true/false if data is found
314  * - value of data
315  * - unit of data if found, empty string else
316  * - default unit of data
317  *
318  * The parser defines the defaults, note the special case
319  * of the pre-exponential parameters:
320  * its unit is [quantity-1]^(order - 1)/s, thus the parser
321  * defines only the [quantity-1] unit (SI unit is m^3/mol)
322  * as default.
323  */
324 
325  std::vector<NumericType> data; // for rate constant
326 
327  Units<NumericType> def_unit;
328  int pow_unit(order_reaction - 1);
329  bool is_falloff(false);
330  bool is_k0(false);
331  //threebody always
332  if(my_rxn->type() == ReactionType::THREE_BODY)pow_unit++;
333  //falloff for k0
334  if(my_rxn->type() == ReactionType::LINDEMANN_FALLOFF ||
335  my_rxn->type() == ReactionType::TROE_FALLOFF ||
336  my_rxn->type() == ReactionType::LINDEMANN_FALLOFF_THREE_BODY ||
337  my_rxn->type() == ReactionType::TROE_FALLOFF_THREE_BODY)
338  {
339  is_falloff = verbose;
340  //k0 is either determined by an explicit name, or is the first of unnamed rate constants
341  if(parser->is_k0(my_rxn->n_rate_constants(),reading_kinetics_model))
342  {
343  pow_unit++;
344  is_k0 = verbose;
345  }
346  }
347 
348  NumericType par_value(-1.);
349  std::vector<NumericType> par_values;
350  std::string par_unit;
351  std::string default_unit;
352  std::vector<std::string> accepted_unit;
353 
354  // verbose as we read along
355  if(verbose)std::cout << " rate: " << models[kinetics_model_map[kineticsModel]] << " model\n";
356  if(is_falloff){
357  (is_k0)?std::cout << " Low pressure limit rate constant\n":std::cout << " High pressure limit rate constant\n";
358  }
359 
360  // pre-exponential
361  if(parser->rate_constant_preexponential_parameter(par_value, par_unit, default_unit))
362  {
363  // using Units object to build accepted_unit
364  accepted_unit.clear();
365  def_unit.set_unit("m3/mol");
366  //to the m-1 power
367  if(pow_unit != 0)
368  {
369  def_unit *= pow_unit;
370  }else
371  {
372  def_unit.clear();
373  }
374  def_unit.substract("s"); // per second
375  accepted_unit.push_back(def_unit.get_symbol());
376 
377  def_unit.set_unit(default_unit);
378  //to the m-1 power
379  if(pow_unit != 0)
380  {
381  def_unit *= pow_unit;
382  }else
383  {
384  def_unit.clear();
385  }
386  def_unit.substract("s"); // per second
387  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_rxn->equation(), "A");
388  if(verbose)
389  {
390  std::cout << " A: " << par_value
391  << " " << def_unit.get_symbol() << std::endl;
392  }
393  data.push_back(par_value * def_unit.get_SI_factor());
394  }
395 
396  // beta
397  if(parser->rate_constant_power_parameter(par_value,par_unit,default_unit))
398  {
399  accepted_unit.clear();
400  accepted_unit.push_back("");
401  def_unit.set_unit(default_unit);
402  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_rxn->equation(), "beta");
403  if(par_value == 0.)//if ARRHENIUS parameterized as KOOIJ, bad test, need to rethink it
404  {
405  std::cerr << "In reaction " << parser->reaction_id() << "\n"
406  << "An equation of the form \"A * exp(-Ea/(R*T))\" is an Arrhenius equation,\n"
407  << "and most certainly not a Kooij one\n"
408  << "it has been corrected, but please, change that in your file.\n"
409  << "Thanks and a good day to you, user." << std::endl;
410  kineticsModel = KineticsModel::ARRHENIUS;
411  }else
412  {
413  data.push_back(par_value * def_unit.get_SI_factor());
414  }
415  if(verbose)
416  {
417  std::cout << " b: " << par_value << std::endl;
418  }
419  }
420 
421  // activation energy
422  if(parser->rate_constant_activation_energy_parameter(par_value,par_unit,default_unit))
423  {
424  accepted_unit.clear();
425  accepted_unit.push_back("J/mol");
426  accepted_unit.push_back("K");
427  def_unit.set_unit(default_unit);
428  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_rxn->equation(), "Ea");
429  data.push_back(par_value * def_unit.get_SI_factor());
430  if(verbose)
431  {
432  std::cout << " E: " << par_value
433  << " " << def_unit.get_symbol() << std::endl;
434  }
435  }
436 
437 
438  // Berthelot coefficient (D)
439  if(parser->rate_constant_Berthelot_coefficient_parameter(par_value,par_unit,default_unit))
440  {
441  accepted_unit.clear();
442  accepted_unit.push_back("K");
443  def_unit.set_unit(default_unit);
444  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_rxn->equation(), "D");
445  data.push_back(par_value * def_unit.get_SI_factor());
446  if(verbose)
447  {
448  std::cout << " D: " << par_value
449  << " " << def_unit.get_symbol() << std::endl;
450  }
451  }
452 
453  // Tref, not for everyone
454  if(kineticsModel == KineticsModel::HERCOURT_ESSEN ||
455  kineticsModel == KineticsModel::BHE ||
456  kineticsModel == KineticsModel::KOOIJ ||
457  kineticsModel == KineticsModel::VANTHOFF)
458  {
459  par_value = 1.;
460  if(parser->rate_constant_Tref_parameter(par_value,par_unit,default_unit))
461  {
462  accepted_unit.clear();
463  accepted_unit.push_back("K");
464  def_unit.set_unit(default_unit);
465  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_rxn->equation(), "Tref");
466  }else
467  {
468  antioch_parameter_required("Tref","1 K");
469  }
470  data.push_back(par_value);
471  }
472 
473  // scale E -> E/R
474  if(kineticsModel == KineticsModel::ARRHENIUS ||
475  kineticsModel == KineticsModel::KOOIJ ||
476  kineticsModel == KineticsModel::VANTHOFF)
477  {
478  parser->rate_constant_activation_energy_parameter(par_value,par_unit,default_unit);
479  (par_unit.empty())?def_unit.set_unit(default_unit):def_unit.set_unit(par_unit);
480  // now finding R unit: [Ea] / [K]
481  def_unit.substract("K");
482 
483  par_value = (def_unit.is_united())?
484  Antioch::Constants::R_universal<NumericType>() // Ea already tranformed in SI
485  :1.L; // no unit, so Ea already in K
486  data.push_back(par_value);
487  }
488 
489  //photochemistry
490  // lambda is either a length (def nm) or cm-1
491  // cross-section has several possibilities if given
492  // * cm2 per bin:
493  // - length (typically nm) or cm-1
494  // * cm2 no bin given:
495  // - if given, lambda unit
496  // - if not, nm
497 
498  // starting with lambda (for bin unit in cross-section)
499  // lambda is not in SI (m is really to violent), it will be nm
500  if(parser->rate_constant_lambda_parameter(par_values,par_unit,default_unit))
501  {
503  accepted_unit.clear();
504  accepted_unit.push_back("nm");
505  accepted_unit.push_back("cm-1");
506  def_unit.set_unit(default_unit);
507  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_rxn->equation(), "lambda");
508 
509  data.clear();
510 
511  if(def_unit.is_homogeneous("nm"))// it's a length
512  {
513  for(unsigned int il = 0; il < par_values.size(); il++)
514  {
515  data.push_back(par_values[il] * def_unit.factor_to_some_unit("nm"));
516  }
517  }else // it's the inverse of a length
518  {
519  for(unsigned int il = 0; il < par_values.size(); il++)
520  {
521  data.push_back(1.L/(par_values[il] * def_unit.factor_to_some_unit("nm-1")));
522  }
523  }
524 
525  //now the cross-section
526 
527  NumericType bin_coefficient = (def_unit.is_homogeneous("nm"))?def_unit.factor_to_some_unit("nm"):
528  def_unit.factor_to_some_unit("nm-1");
529  if(!parser->rate_constant_cross_section_parameter(par_values,par_unit,default_unit))
530  {
531  std::cerr << "Where is the cross-section? In what universe have you photochemistry with a wavelength grid and no cross-section on it?" << std::endl;
532  antioch_error();
533  }
534  //test length
535  if(par_values.size() != data.size())
536  {
537  std::cerr << "Your cross-section vector and your lambda vector don't have the same size!\n"
538  << "What am I supposed to do with that?"
539  << std::endl;
540  antioch_error();
541  }
542 
543  /* here we will use two def unit:
544  * cs_unit, cm2 by default
545  * bin_unit, nm by default.
546  *
547  * strict rigorous unit is
548  * - (cs_unit - bin_unit): cm2/nm
549  * correct unit is
550  * - cs_unit: cm2
551  *
552  * so we need to test against those two possibilities.
553  * Now the funny part is that we test homogeneity, not
554  * equality, for generality purposes, so in case of strict
555  * rigorous unit, we need to decompose the read_unit into
556  * cross_section and bin units, so we can make the appropriate change.
557  *
558  * !TODO make the decomposition instead of strict equality
559  */
560 
561  accepted_unit.clear();
562  accepted_unit.push_back("cm2"); // only cross-section
563  accepted_unit.push_back("cm2/nm"); // per bin, bin is length-like
564  accepted_unit.push_back("cm2/nm-1"); // per bin, bin is inverse length-like
565  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_rxn->equation(), "cross-section");
566 
567 
568  if(def_unit.is_homogeneous("cm2")) // gotta use the bin unit, real unit is [cs]/[provided bin unit]
569  {
570  for(unsigned int ics = 0; ics < par_values.size(); ics++)
571  {
572  data.push_back(par_values[ics] * def_unit.get_SI_factor() / bin_coefficient); //cs in SI, bin in nm or nm-1
573  }
574  }else // bin unit is provided
575  {
576  std::string target_unit = (def_unit.is_homogeneous("cm2/nm"))?"m2/nm":"m2/nm-1";
577  for(unsigned int ics = 0; ics < par_values.size(); ics++)
578  {
579  data.push_back(par_values[ics] * def_unit.factor_to_some_unit(target_unit));
580  }
581  }
582 
583  } //end photochemistry
584 
585  if(data.empty()) //replace the old "if no A parameters" as A is not required anymore
586  {
587  std::cerr << "Somehow, I have a bad feeling about a chemical reaction without any data parameters...\n"
588  << "This is too sad, I give up...\n"
589  << "Please, check the reaction " << my_rxn->equation() << " before coming back to me." << std::endl;
590  antioch_error(); //HEY!!!
591  }
592 
593  KineticsType<NumericType>* rate = build_rate<NumericType>(data,kineticsModel);
594 
595  my_rxn->add_forward_rate(rate);
596 
597  } //end of duplicate/falloff kinetics description loop
598 
599  // for falloff, we need a way to know which rate constant is the low pressure limit
600  // and which is the high pressure limit
601  // usually by calling the low pressure limite "k0". If nothing given, by default
602  // the first rate constant encountered is the low limit,
603  // so we need to change something only if the second rate constant has a "name" attribute
604  // of value "k0"
605  if(my_rxn->type() == ReactionType::LINDEMANN_FALLOFF ||
606  my_rxn->type() == ReactionType::TROE_FALLOFF ||
607  my_rxn->type() == ReactionType::LINDEMANN_FALLOFF_THREE_BODY ||
608  my_rxn->type() == ReactionType::TROE_FALLOFF_THREE_BODY)
609  {
610  antioch_assert_equal_to(my_rxn->n_rate_constants(),2);
611  if(parser->where_is_k0(reading_kinetics_model) == 1) // second given is k0
612  {
613  my_rxn->swap_forward_rates(0,1);
614  }
615  }
616 
617 
618  std::vector<std::pair<std::string,NumericType> > efficiencies;
619  //efficiencies are only for three body reactions
620  if(parser->efficiencies(efficiencies))
621  {
622  antioch_assert(ReactionType::THREE_BODY == my_rxn->type() ||
623  ReactionType::LINDEMANN_FALLOFF_THREE_BODY == my_rxn->type() ||
624  ReactionType::TROE_FALLOFF_THREE_BODY == my_rxn->type());
625 
626  for(unsigned int p = 0; p < efficiencies.size(); p++)
627  {
628  if(verbose)std::cout << "\n" << efficiencies[p].first << " " << efficiencies[p].second;
629 
630  if(efficiencies[p].first == "e-") efficiencies[p].first = "e";
631 
632  // it is possible that the efficiency is specified for a species we are not
633  // modeling - so only add the efficiency if it is included in our list
634  if( chem_mixture.species_name_map().count( efficiencies[p].first ) )
635  {
636  my_rxn->set_efficiency( efficiencies[p].first,
637  chem_mixture.species_name_map().find( efficiencies[p].first )->second,
638  efficiencies[p].second );
639  }
640  }
641  if(verbose)std::cout << std::endl;
642  }
643 
644  //F parameters only for Troe falloff
645  if(parser->Troe())
646  {
647  antioch_assert(ReactionType::TROE_FALLOFF == my_rxn->type() ||
648  ReactionType::TROE_FALLOFF_THREE_BODY == my_rxn->type());
649 
650  FalloffReaction<NumericType,TroeFalloff<NumericType> > *my_fall_rxn =
651  static_cast<FalloffReaction<NumericType,TroeFalloff<NumericType> > *> (my_rxn);
652 
653  Units<NumericType> def_unit;
654  NumericType par_value(-1.);
655  std::string par_unit;
656  std::string default_unit;
657  std::vector<std::string> accepted_unit;
658 
659  // alpha
660  if(!parser->Troe_alpha_parameter(par_value,par_unit,default_unit))
661  {
662  std::cerr << "alpha parameter of Troe falloff missing!" << std::endl;
663  antioch_error();
664  }
665  accepted_unit.clear();
666  accepted_unit.push_back("");
667  def_unit.set_unit(default_unit);
668  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_fall_rxn->equation(), "alpha");
669  my_fall_rxn->F().set_alpha(par_value * def_unit.get_SI_factor());
670 
671  // T***
672  if(!parser->Troe_T3_parameter(par_value,par_unit,default_unit))
673  {
674  std::cerr << "T*** parameter of Troe falloff missing!" << std::endl;
675  antioch_error();
676  }
677  accepted_unit.clear();
678  accepted_unit.push_back("K");
679  def_unit.set_unit(default_unit);
680  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_fall_rxn->equation(), "T***");
681  my_fall_rxn->F().set_T3(par_value * def_unit.get_SI_factor());
682 
683  // T*
684  if(!parser->Troe_T1_parameter(par_value,par_unit,default_unit))
685  {
686  std::cerr << "T* parameter of Troe falloff missing!" << std::endl;
687  antioch_error();
688  }
689  // accepted unit is the same
690  def_unit.set_unit(default_unit);
691  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_fall_rxn->equation(), "T*");
692  my_fall_rxn->F().set_T1(par_value * def_unit.get_SI_factor());
693 
694  // T** is optional
695  if(parser->Troe_T2_parameter(par_value,par_unit,default_unit))
696  {
697  def_unit.set_unit(default_unit);
698  verify_unit_of_parameter(def_unit, par_unit, accepted_unit, my_fall_rxn->equation(), "T**");
699  my_fall_rxn->F().set_T2(par_value * def_unit.get_SI_factor());
700  }
701  }
702 
703  reaction_set.add_reaction(my_rxn);
704 
705  if(verbose) std::cout << "\n\n";
706  }
707 
708  if(parser)
709  delete parser;
710  }
#define antioch_assert(asserted)
#define antioch_not_implemented()
#define antioch_assert_equal_to(expr1, expr2)
#define antioch_parameter_required(parameter, defaultpar)
#define antioch_error()
Scalar BHE(const Scalar &T, const Scalar &Cf, const Scalar &eta, const Scalar &D, const Scalar &Tf=1.)
Definition: parsing_xml.C:55
#define antioch_parsing_error(description)
#define antioch_do_once(do_this)
void verify_unit_of_parameter(Units< NumericType > &default_unit, const std::string &provided_unit, const std::vector< std::string > &accepted_unit, const std::string &equation, const std::string &parameter_name)
template<class NumericType >
void Antioch::read_reaction_set_data_chemkin ( const std::string &  filename,
const bool  verbose,
ReactionSet< NumericType > &  reaction_set 
)
inline

Definition at line 149 of file read_reaction_set_data.h.

References CHEMKIN.

152  {
153  read_reaction_set_data<NumericType>(filename,verbose,reaction_set,CHEMKIN);
154  }
template<class NumericType >
void Antioch::read_reaction_set_data_xml ( const std::string &  filename,
const bool  verbose,
ReactionSet< NumericType > &  reaction_set 
)
inline

Definition at line 140 of file read_reaction_set_data.h.

References XML.

143  {
144  read_reaction_set_data<NumericType >(filename,verbose,reaction_set,XML);
145  }
template<class NumericType >
void Antioch::read_species_data ( ParserBase< NumericType > *  parser,
ChemicalMixture< NumericType > &  chem_mixture 
)

Definition at line 49 of file species_parsing.C.

References antioch_error, Antioch::ChemicalMixture< CoeffType >::chemical_species(), Antioch::ParserBase< NumericType >::file(), Antioch::ParserBase< NumericType >::read_chemical_species(), Antioch::ChemicalMixture< CoeffType >::species_inverse_name_map(), and Antioch::ChemicalMixture< CoeffType >::species_list().

51  {
52  parser->read_chemical_species(chem_mixture);
53 
54  // sanity check, we require these informations
55  bool fail(false);
56  for(unsigned int s = 0; s < chem_mixture.chemical_species().size(); s++)
57  {
58  if(!chem_mixture.chemical_species()[s])
59  {
60  fail = true;
61  break;
62  }
63  }
64  if(fail)
65  {
66  std::cerr << "Molecule(s) is(are) missing. Please update the information."
67  << " Currently using file " << parser->file() << ".\n"
68  << "Missing molecule(s) is(are):" << std::endl;
69  for(unsigned int i = 0; i < chem_mixture.species_list().size(); i++)
70  {
71  if(!chem_mixture.chemical_species()[i])
72  {
73  std::cerr << chem_mixture.species_inverse_name_map().at(i) << std::endl;
74  }
75  }
76  antioch_error();
77  }
78  }
#define antioch_error()
template<class NumericType >
void Antioch::read_species_electronic_data ( ParserBase< NumericType > *  parser,
ChemicalMixture< NumericType > &  chem_mixture 
)

Definition at line 103 of file species_parsing.C.

References Antioch::ChemicalMixture< CoeffType >::chemical_species(), Antioch::ParserBase< NumericType >::file(), and Antioch::ParserBase< NumericType >::read_electronic_data().

106  {
107  parser->read_electronic_data(chem_mixture);
108 
109  // sanity check, we check these informations
110  std::vector<std::string> missing;
111  for(unsigned int s = 0; s < chem_mixture.chemical_species().size(); s++)
112  {
113  if(chem_mixture.chemical_species()[s]->theta_e().empty())missing.push_back(chem_mixture.chemical_species()[s]->species());
114  }
115  if(!missing.empty())
116  {
117  std::cerr << "WARNING:\nElectronic levels are missing. Please update the information."
118  << " Currently using file " << parser->file() << ".\n"
119  << "Missing molecule(s) is(are):" << std::endl;
120  for(unsigned int m = 0; m < missing.size(); m++)std::cerr << missing[m] << std::endl;
121  }
122  }
template<class NumericType >
void Antioch::read_species_vibrational_data ( ParserBase< NumericType > *  parser,
ChemicalMixture< NumericType > &  chem_mixture 
)

Definition at line 81 of file species_parsing.C.

References Antioch::ChemicalMixture< CoeffType >::chemical_species(), Antioch::ParserBase< NumericType >::file(), and Antioch::ParserBase< NumericType >::read_vibrational_data().

83  {
84  parser->read_vibrational_data(chem_mixture);
85 
86  // sanity check, we check these informations
87  std::vector<std::string> missing;
88  for(unsigned int s = 0; s < chem_mixture.chemical_species().size(); s++)
89  {
90  if(chem_mixture.chemical_species()[s]->theta_v().empty())missing.push_back(chem_mixture.chemical_species()[s]->species());
91  }
92  if(!missing.empty())
93  {
94  std::cout << "WARNING:\nVibrational levels are missing. Please update the information."
95  << " Currently using file " << parser->file() << ".\n"
96  << "Missing molecule(s) is(are):" << std::endl;
97  for(unsigned int m = 0; m < missing.size(); m++)std::cerr << missing[m] << std::endl;
98  }
99  }
template<class NumericType >
void Antioch::read_sutherland_data_ascii ( MixtureViscosity< SutherlandViscosity< NumericType >, NumericType > &  mu,
const std::string &  filename 
)

Definition at line 42 of file sutherland_parsing.C.

References antioch_error, Antioch::ChemicalMixture< CoeffType >::chemical_mixture(), skip_comment_lines(), and Antioch::ChemicalMixture< CoeffType >::species_name_map().

Referenced by read_sutherland_data_ascii_default().

44  {
45  std::ifstream in(filename.c_str());
46  if(!in.is_open())
47  {
48  std::cerr << "ERROR: unable to load file " << filename << std::endl;
49  antioch_error();
50  }
51 
52  // skip the header
53  skip_comment_lines(in, '#');
54 
55  std::string name;
56  NumericType a, b;
57 
58  while (in.good())
59  {
60  in >> name; // Species Name
61  in >> a; //
62  in >> b; //
63 
64  // If we are still good, we have a valid set of transport
65  // data for this species. Otherwise, we read past end-of-file
66  // in the section above
67  if (in.good())
68  {
69  const ChemicalMixture<NumericType>& chem_mixture = mu.chemical_mixture();
70 
71  // Check if this is a species we want.
72  if( chem_mixture.species_name_map().find(name) !=
73  chem_mixture.species_name_map().end() )
74  {
75  // Pack up coefficients
76  std::vector<NumericType> coeffs(2);
77  coeffs[0] = a;
78  coeffs[1] = b;
79  mu.add(name, coeffs);
80  }
81  }
82  }
83  in.close();
84  }
#define antioch_error()
void skip_comment_lines(std::istream &in, const char comment_start)
Skip comment lines in the header of an ASCII text file prefixed with the comment character 'comment_s...
Definition: input_utils.h:46
template<class NumericType >
void Antioch::read_sutherland_data_ascii_default ( MixtureViscosity< SutherlandViscosity< NumericType >, NumericType > &  mu)

Definition at line 87 of file sutherland_parsing.C.

References read_sutherland_data_ascii(), and Antioch::DefaultSourceFilename::sutherland_data().

88  {
89  read_sutherland_data_ascii(mu, DefaultFilename::sutherland_data());
90  }
void read_sutherland_data_ascii(MixtureViscosity< SutherlandViscosity< NumericType >, NumericType > &mu, const std::string &filename)
template<typename NumericType >
void Antioch::read_transport_species_data ( ParserBase< NumericType > *  parser,
TransportMixture< NumericType > &  transport 
)

Definition at line 37 of file transport_species_parsing.C.

References Antioch::ParserBase< NumericType >::file(), Antioch::TransportMixture< CoeffType >::n_species(), Antioch::ParserBase< NumericType >::read_transport_data(), Antioch::TransportMixture< CoeffType >::species_inverse_name_map(), and Antioch::TransportMixture< CoeffType >::transport_species().

Referenced by read_transport_species_data_ascii(), and Antioch::TransportMixture< CoeffType >::TransportMixture().

38  {
39  parser->read_transport_data(transport);
40 
41  // sanity check, we may require these informations
42  bool fail(false);
43  for(unsigned int s = 0; s < transport.n_species(); s++)
44  {
45  if(!transport.transport_species()[s])
46  {
47  fail = true;
48  break;
49  }
50  }
51  if(fail)
52  {
53  std::cerr << "Molecule(s) is(are) missing in transport description. Please update the information."
54  << " Currently using file " << parser->file() << ".\n"
55  << "You might have some problem later if you need these description. "
56  << "Missing molecule(s) is(are):" << std::endl;
57  for(unsigned int i = 0; i < transport.n_species(); i++)
58  {
59  if(!transport.transport_species()[i])
60  {
61  std::cerr << transport.species_inverse_name_map().at(i) << std::endl;
62  }
63  }
64  }
65  }
template void Antioch::read_transport_species_data< double > ( ParserBase< double > *  ,
TransportMixture< double > &   
)
template void Antioch::read_transport_species_data< float > ( ParserBase< float > *  ,
TransportMixture< float > &   
)
template void Antioch::read_transport_species_data< long double > ( ParserBase< long double > *  ,
TransportMixture< long double > &   
)
template<typename NumericType >
void Antioch::read_transport_species_data_ascii ( TransportMixture< NumericType > &  transport,
const std::string &  filename 
)

Definition at line 68 of file transport_species_parsing.C.

References antioch_deprecated, and read_transport_species_data().

69  {
71 
72  ASCIIParser<NumericType> parser(filename,true);
73 
74  read_transport_species_data( &parser, transport);
75  }
void read_transport_species_data(ParserBase< NumericType > *parser, TransportMixture< NumericType > &transport)
#define antioch_deprecated()
template void Antioch::read_transport_species_data_ascii< double > ( TransportMixture< double > &  ,
const std::string &   
)
template void Antioch::read_transport_species_data_ascii< float > ( TransportMixture< float > &  ,
const std::string &   
)
template void Antioch::read_transport_species_data_ascii< long double > ( TransportMixture< long double > &  ,
const std::string &   
)
void Antioch::remove_newline_from_strings ( std::vector< std::string > &  strings)

Strips newline characters from strings in the input vector, strings.

Note that if an element of the vector is only the newline character, that element will be removed from the vector.

Definition at line 56 of file string_utils.C.

Referenced by Antioch::XMLParser< NumericType >::read_thermodynamic_data_root(), Antioch::XMLParser< NumericType >::species_list(), and AntiochTesting::StringUtilitiesTest::test_strip_newlines().

57  {
58  std::string newline_str = "\n";
59 
60  // First, detect any elements that are purely newlines, cache their iterator position,
61  // and them remove them.
62  std::vector<std::vector<std::string>::iterator> its_to_be_removed;
63 
64  for( std::vector<std::string>::iterator it = strings.begin(); it != strings.end(); ++it )
65  if( (*it) == newline_str )
66  its_to_be_removed.push_back(it);
67 
68  for( std::vector<std::vector<std::string>::iterator>::iterator it = its_to_be_removed.begin();
69  it != its_to_be_removed.end(); ++it )
70  strings.erase( *it );
71 
72  // Now, strip any newline characters in the remaining elements
73  for( std::vector<std::string>::iterator it = strings.begin(); it != strings.end(); ++it )
74  {
75  std::string& elem = *it;
76 
77  // Compiler will not accept newline_str as the third argument to std::remove
78  elem.erase( std::remove(elem.begin(), elem.end(), '\n'), elem.end() );
79  }
80  }
template<typename CoeffType , typename VectorCoeffType >
void Antioch::reset_parameter_of_rate ( KineticsType< CoeffType, VectorCoeffType > &  rate,
KineticsModel::Parameters  parameter,
const CoeffType  new_value,
const std::string &  unit = "SI" 
)

The rate constant models derived from the Arrhenius model have an activation energy which is stored and used, for efficiency reasons, in the reduced $\frac{E_a}{\mathrm{R}}$ form in K.

This calls for a subtle management of the get/set function. This is done by a unit management, by default an activation energy is an energy by quantity, so the default is to consider the SI unit for an energy, (J/mol). Therefore if the provided value is in Kelvin, it should be explicitely provided.

Definition at line 235 of file kinetics_parsing.h.

References antioch_error, Antioch::KineticsModel::ARRHENIUS, Antioch::KineticsModel::BERTHELOT, Antioch::KineticsModel::BHE, Antioch::KineticsModel::CONSTANT, Antioch::KineticsModel::E, Antioch::KineticsModel::HERCOURT_ESSEN, Antioch::KineticsModel::KOOIJ, Antioch::KineticsType< CoeffType, VectorCoeffType >::type(), and Antioch::KineticsModel::VANTHOFF.

Referenced by Antioch::Reaction< CoeffType, VectorCoeffType >::set_parameter_of_rate(), and tester().

238  {
239 
240 // this is crude at the moment, no test
241 // this will be replaced by a unit manager
242 // at some point, to be able to have an explicit
243 // custom internal unit system with appropriate testing
244  CoeffType new_coef = (unit == "SI")?new_value:
245  new_value * Units<typename value_type<CoeffType>::type>(unit).get_SI_factor();
246 
247 // Ea management, we want K, two possibilities now
248 // 1 - Ea is already in K
249 // 2 - Ea is in J.mol-1
250  if(parameter == KineticsModel::Parameters::E)
251  {
252  if(unit != "K")
253  {
254  new_coef = new_coef / Constants::R_universal<typename value_type<CoeffType>::type>();
255  }
256  }
257 
258 
259  switch(rate.type())
260  {
262  {
263  static_cast<ConstantRate<CoeffType>*>(&rate)->set_parameter(parameter,new_coef);
264  }
265  break;
266 
268  {
269  static_cast< HercourtEssenRate<CoeffType>*>(&rate)->set_parameter(parameter,new_coef);
270  }
271  break;
272 
274  {
275  static_cast< BerthelotRate<CoeffType>*>(&rate)->set_parameter(parameter,new_coef);
276  }
277  break;
278 
280  {
281  static_cast< ArrheniusRate<CoeffType>*>(&rate)->set_parameter(parameter,new_coef);
282  }
283  break;
284 
285  case(KineticsModel::BHE):
286  {
287  static_cast< BerthelotHercourtEssenRate<CoeffType>*>(&rate)->set_parameter(parameter,new_coef);
288  }
289  break;
290 
291  case(KineticsModel::KOOIJ):
292  {
293  static_cast< KooijRate<CoeffType>*>(&rate)->set_parameter(parameter,new_coef);
294  }
295  break;
296 
298  {
299  static_cast< VantHoffRate<CoeffType>*>(&rate)->set_parameter(parameter,new_coef);
300  }
301  break;
302 
303  default:
304  {
305  antioch_error();
306  }
307 
308  } // switch(kin.type())
309  }
#define antioch_error()
Scalar BHE(const Scalar &T, const Scalar &Cf, const Scalar &eta, const Scalar &D, const Scalar &Tf=1.)
Definition: parsing_xml.C:55
template<typename CoeffType , typename VectorCoeffType >
void Antioch::reset_parameter_of_rate ( KineticsType< CoeffType, VectorCoeffType > &  rate,
KineticsModel::Parameters  parameter,
const CoeffType  new_value,
int  l,
const std::string &  unit = "SI" 
)

Definition at line 312 of file kinetics_parsing.h.

References antioch_error, Antioch::KineticsModel::PHOTOCHEM, and Antioch::KineticsType< CoeffType, VectorCoeffType >::type().

315  {
316 
317 // this is crude at the moment, no test
318 // this will be replaced by a unit manager
319 // at some point, to be able to have an explicit
320 // custom internal unit system with appropriate testing
321  CoeffType new_coef = (unit == "SI")?new_value:
322  new_value * Units<typename value_type<CoeffType>::type>(unit).get_SI_factor();
323 
324  switch(rate.type())
325  {
327  {
328  static_cast<PhotochemicalRate<CoeffType,VectorCoeffType>*>(&rate)->set_parameter(parameter,l,new_coef);
329  }
330  break;
331 
332  default:
333  {
334  antioch_error();
335  }
336 
337  } // switch(kin.type())
338  }
#define antioch_error()
template<typename CoeffType , typename VectorCoeffType , typename VectorType >
void Antioch::reset_rate ( KineticsType< CoeffType, VectorCoeffType > &  kin,
const VectorType &  coefs 
)

Definition at line 172 of file kinetics_parsing.h.

References antioch_error, Antioch::KineticsModel::ARRHENIUS, Antioch::KineticsModel::BERTHELOT, Antioch::KineticsModel::BHE, Antioch::KineticsModel::CONSTANT, Antioch::KineticsModel::HERCOURT_ESSEN, Antioch::KineticsModel::KOOIJ, Antioch::KineticsModel::PHOTOCHEM, Antioch::KineticsType< CoeffType, VectorCoeffType >::type(), and Antioch::KineticsModel::VANTHOFF.

Referenced by tester().

173  {
174 
175  switch(kin.type())
176  {
178  {
179  static_cast<ConstantRate<CoeffType>*>(&kin)->reset_coefs(coefs);
180  }
181  break;
182 
184  {
185  static_cast< HercourtEssenRate<CoeffType>*>(&kin)->reset_coefs(coefs);
186  }
187  break;
188 
190  {
191  static_cast< BerthelotRate<CoeffType>*>(&kin)->reset_coefs(coefs);
192  }
193  break;
194 
196  {
197  static_cast< ArrheniusRate<CoeffType>*>(&kin)->reset_coefs(coefs);
198  }
199  break;
200 
201  case(KineticsModel::BHE):
202  {
203  static_cast< BerthelotHercourtEssenRate<CoeffType>*>(&kin)->reset_coefs(coefs);
204  }
205  break;
206 
207  case(KineticsModel::KOOIJ):
208  {
209  static_cast< KooijRate<CoeffType>*>(&kin)->reset_coefs(coefs);
210  }
211  break;
212 
214  {
215  static_cast< VantHoffRate<CoeffType>*>(&kin)->reset_coefs(coefs);
216  }
217  break;
218 
220  {
221  static_cast<PhotochemicalRate<CoeffType,VectorCoeffType>*>(&kin)->reset_coefs(coefs);
222  }
223  break;
224 
225  default:
226  {
227  antioch_error();
228  }
229 
230  } // switch(kin.type())
231  }
#define antioch_error()
Scalar BHE(const Scalar &T, const Scalar &Cf, const Scalar &eta, const Scalar &D, const Scalar &Tf=1.)
Definition: parsing_xml.C:55
template<typename T >
void Antioch::set_zero ( T &  output)
inline

Definition at line 103 of file metaprogramming.h.

103 { output = 0; }
template<typename T >
void Antioch::set_zero ( std::vector< T > &  a)
inline

Definition at line 167 of file vector_utils.h.

References zero_clone().

168 {
169  if (a.size())
170  std::fill(a.begin(), a.end(), zero_clone(a[0]));
171 }
std::vector< T > zero_clone(const std::vector< T > &example, const Scalar &value)
Definition: vector_utils.h:156
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
void Antioch::set_zero ( _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &  a)
inline
void Antioch::skip_comment_lines ( std::istream &  in,
const char  comment_start 
)
inline

Skip comment lines in the header of an ASCII text file prefixed with the comment character 'comment_start'.

This is put in Antioch namespace so we can reuse in a few classes where we are reading in text tables. Originally taken from FIN-S.

Definition at line 46 of file input_utils.h.

Referenced by read_blottner_data_ascii(), read_cea_thermo_data_ascii(), read_sutherland_data_ascii(), and Antioch::ParserBase< NumericType >::skip_comments().

47  {
48  char c, line[256];
49 
50  in.get(c);
51  while(std::isblank(c))in.get(c);
52 
53  in.putback(c);
54 
55  while (in.get(c), c==comment_start)
56  in.getline (line, 255);
57 
58  // put back first character of
59  // first non-comment line
60  in.putback (c);
61  }
void Antioch::split_string ( const std::string &  input,
const std::string &  delimiter,
std::vector< std::string > &  results 
)

All characters in delimiter will be treated as a delimiter.

Definition at line 34 of file string_utils.C.

Referenced by Antioch::XMLParser< NumericType >::efficiencies(), Antioch::XMLParser< NumericType >::get_parameter(), Antioch::XMLParser< NumericType >::molecules_pairs(), Antioch::XMLParser< NumericType >::read_thermodynamic_data_root(), Antioch::XMLParser< NumericType >::species_list(), and AntiochTesting::StringUtilitiesTest::test_split_string().

37  {
38  // Skip delimiters at beginning.
39  std::string::size_type first_pos = input.find_first_not_of(delimiter, 0);
40 
41  std::string::size_type pos = input.find_first_of(delimiter, first_pos);
42 
43  while (std::string::npos != pos || std::string::npos != first_pos)
44  {
45  // Found a token, add it to the vector.
46  results.push_back(input.substr(first_pos, pos - first_pos));
47 
48  // Skip delimiters. Note the "not_of"
49  first_pos = input.find_first_not_of(delimiter, pos);
50 
51  // Find next delimiter
52  pos = input.find_first_of(delimiter, first_pos);
53  }
54  }
template<typename Type >
std::pair<std::string, Type> Antioch::split_string_on_colon ( const std::string &  token)
inline

Definition at line 69 of file string_utils.h.

References antioch_assert.

70  {
71  std::pair<std::string, Type> ret = std::make_pair(std::string(), 0);
72  std::string::size_type colon_position = token.find(":");
73  antioch_assert (colon_position != std::string::npos);
74  ret.first = token.substr(0, colon_position);
75  ret.second = string_to_T<Type>(token.substr(colon_position + 1));
76  return ret;
77  }
#define antioch_assert(asserted)
int Antioch::SplitString ( const std::string &  input,
const std::string &  delimiter,
std::vector< std::string > &  results,
bool  includeEmpties = true 
)
inline

Taken from FIN-S for XML parsing.

Definition at line 83 of file string_utils.h.

References std::int.

Referenced by Antioch::ChemKinParser< NumericType >::initialize(), Antioch::ChemKinParser< NumericType >::next_reaction(), Antioch::ChemKinParser< NumericType >::parse_coefficients_line(), Antioch::ChemKinParser< NumericType >::parse_equation(), Antioch::ChemKinParser< NumericType >::parse_equation_coef(), Antioch::ChemKinParser< NumericType >::parse_orders(), Antioch::ChemKinParser< NumericType >::parse_reversible_parameters(), Antioch::ChemKinParser< NumericType >::read_thermodynamic_data_root(), and Antioch::ChemKinParser< NumericType >::species_list().

87  {
88  using std::vector;
89  using std::string;
90 
91  int iPos = 0;
92  int newPos = -1;
93  int sizeS2 = (int)delimiter.size();
94  int isize = (int)input.size();
95 
96  if(
97  ( isize == 0 )
98  ||
99  ( sizeS2 == 0 )
100  )
101  {
102  return 0;
103  }
104 
105  vector<int> positions;
106 
107  newPos = input.find (delimiter, 0);
108 
109  if( newPos < 0 )
110  {
111  return 0;
112  }
113 
114  int numFound = 0;
115 
116  while( newPos >= iPos )
117  {
118  numFound++;
119  positions.push_back(newPos);
120  iPos = newPos;
121  newPos = input.find (delimiter, iPos+sizeS2);
122  }
123 
124  if( numFound == 0 )
125  {
126  return 0;
127  }
128 
129  for( int i=0; i <= static_cast<int>(positions.size()); ++i )
130  {
131  string s("");
132  if( i == 0 )
133  {
134  s = input.substr( i, positions[i] );
135  }
136  else
137  {
138  int offset = positions[i-1] + sizeS2;
139  if( offset < isize )
140  {
141  if( i == static_cast<int>(positions.size()) )
142  {
143  s = input.substr(offset);
144  }
145  else if( i > 0 )
146  {
147  s = input.substr( positions[i-1] + sizeS2,
148  positions[i] - positions[i-1] - sizeS2 );
149  }
150  }
151  }
152  if( includeEmpties || ( s.size() > 0 ) )
153  {
154  results.push_back(s);
155  }
156  }
157  return numFound;
158  }
a int
Definition: eigen_utils.h:67
ReactionType::Parameters Antioch::string_to_chem_enum ( const std::string &  str)
inline
KineticsModel::Parameters Antioch::string_to_kin_enum ( const std::string &  str)
inline

Definition at line 192 of file string_utils.h.

References Antioch::KineticsModel::A, Antioch::KineticsModel::B, Antioch::KineticsModel::D, Antioch::KineticsModel::E, Antioch::KineticsModel::HIGH_PRESSURE, Antioch::KineticsModel::LAMBDA, Antioch::KineticsModel::LOW_PRESSURE, Antioch::KineticsModel::NOT_FOUND, Antioch::KineticsModel::R_SCALE, Antioch::KineticsModel::SIGMA, and Antioch::KineticsModel::T_REF.

Referenced by Antioch::ReactionSet< CoeffType >::find_kinetics_model_parameter(), Antioch::ReactionSet< CoeffType >::get_parameter_of_reaction(), and Antioch::ReactionSet< CoeffType >::set_parameter_of_reaction().

193  {
194 // kinetics
195  if(str == "A")
196  {
198  }else if(str == "E")
199  {
201  }else if(str == "B")
202  {
204  }else if(str == "D")
205  {
207  }else if(str == "Tref")
208  {
210  }else if(str == "Rscale")
211  {
213  }else if(str == "sigma")
214  {
216  }else if(str == "lambda")
217  {
219  }else if(str == "0")
220  {
222  }else if(str == "inf")
223  {
225  }else
226  {
228  }
229  }
template<typename T >
T Antioch::string_to_T ( const std::string &  input)
inline

Definition at line 57 of file string_utils.h.

References antioch_error.

58  {
59  std::istringstream converter(input);
60  T returnval;
61  converter >> returnval;
62  if (converter.fail())
63  antioch_error();
64  return returnval;
65  }
#define antioch_error()
template<typename StateType >
const ANTIOCH_AUTO (StateType) EuckenThermalConductivity<ThermoEvaluator> return Antioch::trans ( ,
mu_s   
)
template<typename NumericType >
void Antioch::verify_unit_of_parameter ( Units< NumericType > &  default_unit,
const std::string &  provided_unit,
const std::vector< std::string > &  accepted_unit,
const std::string &  equation,
const std::string &  parameter_name 
)

Definition at line 44 of file read_reaction_set_data.C.

References antioch_unit_error, antioch_unit_required, Antioch::Units< T >::get_symbol(), Antioch::Units< T >::is_homogeneous(), Antioch::Units< T >::is_united(), and Antioch::Units< T >::set_unit().

Referenced by read_reaction_set_data().

49  {
50  if(provided_unit.empty() && default_unit.is_united()) //no unit provided and there is one
51  {
52  antioch_unit_required(parameter_name,default_unit.get_symbol());
53  }else // test
54  {
55  bool found(false);
56  for(unsigned int i = 0; i < accepted_unit.size(); i++)
57  {
58  if(Units<NumericType>(accepted_unit[i]).is_homogeneous(provided_unit))
59  {
60  found = true;
61  break;
62  }
63  }
64  if(!found)
65  {
66  std::string errorstring("Error in reaction " + equation);
67  errorstring += "\n" + parameter_name + " parameter's unit should be homogeneous to \"" + accepted_unit[0] + "\"";
68  for(unsigned int i = 1; i < accepted_unit.size(); i++)errorstring += ", or \"" + accepted_unit[i] + "\"";
69  errorstring += " and you provided \"" + provided_unit + "\"";
70  antioch_unit_error(errorstring);
71  }
72  default_unit.set_unit(provided_unit);
73  }
74  }
#define antioch_unit_required(parameter, defaultunit)
#define antioch_unit_error(description)
template<typename T >
T Antioch::zero_clone ( const T &  )
inline

Definition at line 107 of file metaprogramming.h.

107 { return 0; }
template<typename T , typename T2 >
void Antioch::zero_clone ( T &  output,
const T2 &   
)
inline

Definition at line 111 of file metaprogramming.h.

111 { output = 0; }
template<typename T >
std::vector< T > Antioch::zero_clone ( const std::vector< T > &  example)
inline

Definition at line 134 of file vector_utils.h.

References zero_clone().

135 {
136  if (example.size())
137  return std::vector<T>(example.size(),zero_clone(example[0]));
138 
139  return std::vector<T>();
140 }
std::vector< T > zero_clone(const std::vector< T > &example, const Scalar &value)
Definition: vector_utils.h:156
template<typename T1 , typename T2 >
void Antioch::zero_clone ( std::vector< T1 > &  output,
const std::vector< T2 > &  example 
)
inline

Definition at line 145 of file vector_utils.h.

References zero_clone().

146 {
147  const std::size_t sz = example.size();
148  output.resize(sz);
149  for (std::size_t i=0; i != sz; ++i)
150  Antioch::zero_clone(output[i], example[i]);
151 }
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > Antioch::zero_clone ( const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &  ex)
inline

Definition at line 145 of file eigen_utils.h.

References zero_clone().

Referenced by Antioch::FalloffReaction< CoeffType, FalloffType >::compute_forward_rate_coefficient(), Antioch::FalloffThreeBodyReaction< CoeffType, FalloffType >::compute_forward_rate_coefficient(), Antioch::Reaction< CoeffType, VectorCoeffType >::compute_forward_rate_coefficient(), Antioch::DuplicateReaction< CoeffType >::compute_forward_rate_coefficient_and_derivatives(), Antioch::FalloffReaction< CoeffType, FalloffType >::compute_forward_rate_coefficient_and_derivatives(), Antioch::FalloffThreeBodyReaction< CoeffType, FalloffType >::compute_forward_rate_coefficient_and_derivatives(), Antioch::Reaction< CoeffType, VectorCoeffType >::compute_rate_of_progress(), Antioch::Reaction< CoeffType, VectorCoeffType >::compute_rate_of_progress_and_derivatives(), Antioch::NASA7CurveFit< CoeffType >::cp_over_R(), Antioch::NASA9CurveFit< CoeffType >::cp_over_R(), Antioch::CEAThermodynamics< CoeffType >::cp_over_R(), Antioch::SigmaBinConverter< VectorCoeffType >::custom_bin_value(), Antioch::StatMechThermodynamics< CoeffType >::cv_el(), Antioch::StatMechThermodynamics< CoeffType >::cv_vib_over_R(), Antioch::KineticsType< CoeffType, VectorCoeffType >::derivative(), Antioch::NASA7CurveFit< CoeffType >::dh_RT_minus_s_R_dT(), Antioch::NASA9CurveFit< CoeffType >::dh_RT_minus_s_R_dT(), Antioch::CEAThermodynamics< CoeffType >::dh_RT_minus_s_R_dT(), Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::diffusion_mixing_rule(), Antioch::AntiochPrivate::GSLSplinerPolicy< true >::dinterpolation(), Antioch::StatMechThermodynamics< CoeffType >::e_el(), Antioch::TroeFalloff< CoeffType >::F_and_derivatives(), Antioch::NASA7CurveFit< CoeffType >::h_over_RT(), Antioch::NASA9CurveFit< CoeffType >::h_over_RT(), Antioch::NASA7CurveFit< CoeffType >::h_RT_minus_s_R(), Antioch::NASA9CurveFit< CoeffType >::h_RT_minus_s_R(), Antioch::CEAThermodynamics< CoeffType >::h_RT_minus_s_R(), Antioch::AntiochPrivate::GSLSplinerPolicy< true >::interpolation(), Antioch::NASACurveFitBase< CoeffType >::interval(), Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::k(), Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::mu(), Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::mu_and_k(), Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::mu_and_k_and_D(), Antioch::KineticsType< CoeffType, VectorCoeffType >::operator()(), Antioch::NASA7CurveFit< CoeffType >::s_over_R(), Antioch::NASA9CurveFit< CoeffType >::s_over_R(), set_zero(), tester(), vectester(), Antioch::SigmaBinConverter< VectorCoeffType >::y_on_custom_grid(), and zero_clone().

146 {
147  // We can't just use setZero here with arbitrary _Scalar types
148  if (ex.size())
149  return
150  _Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
151  (ex.rows(), ex.cols()).setConstant(zero_clone(ex[0]));
152 
153  return
154  _Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
155  (ex.rows(), ex.cols());
156 }
void zero_clone(_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &output, const _Matrix< Scalar2, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:165
template<typename T , typename Scalar >
std::vector<T> Antioch::zero_clone ( const std::vector< T > &  example,
const Scalar &  value 
)
inline

Definition at line 156 of file vector_utils.h.

157 {
158  if (example.size())
159  return std::vector<T>(example.size(),value);
160 
161  return std::vector<T>();
162 }
template<typename T >
vex::vector< T > Antioch::zero_clone ( const vex::vector< T > &  example)
inline

Definition at line 157 of file vexcl_utils.h.

158 {
159  vex::vector<T> returnval(example.queue_list(), example.size());
160  returnval.clear();
161  return returnval;
162 }
template<typename T >
std::valarray< T > Antioch::zero_clone ( const std::valarray< T > &  example)
inline

Definition at line 165 of file valarray_utils.h.

References zero_clone().

166 {
167  if (example.size())
168  return std::valarray<T>(zero_clone(example[0]),example.size());
169  else
170  return std::valarray<T>();
171 }
void zero_clone(std::valarray< T1 > &output, const std::valarray< T2 > &example)
template<template< typename, int, int, int, int, int > class _Matrix, typename _Scalar , int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols, typename Scalar2 >
void Antioch::zero_clone ( _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &  output,
const _Matrix< Scalar2, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &  ex 
)
inline

Definition at line 165 of file eigen_utils.h.

Referenced by set_zero(), and zero_clone().

167 {
168  // We can't just use setZero here with arbitrary _Scalar types
169  output.resize(ex.rows(), ex.cols());
170  output.setConstant(zero_clone(ex[0]));
171 }
void zero_clone(_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &output, const _Matrix< Scalar2, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:165
template<typename T1 , typename T2 >
void Antioch::zero_clone ( T1 &  output,
const T2 &  example 
)
inline
template<typename T1 , typename T2 >
void Antioch::zero_clone ( vex::vector< T1 > &  output,
const vex::vector< T2 > &  example 
)
inline

Definition at line 167 of file vexcl_utils.h.

Referenced by eval_index().

168 {
169  output.resize(example.queue_list(), example.size());
170  output = 0;
171 }
template<typename T1 , typename T2 >
void Antioch::zero_clone ( std::valarray< T1 > &  output,
const std::valarray< T2 > &  example 
)
inline

Definition at line 176 of file valarray_utils.h.

References zero_clone().

177 {
178  const std::size_t sz = example.size();
179  output.resize(sz);
180  for (std::size_t i=0; i != sz; ++i)
181  Antioch::zero_clone(output[i], example[i]);
182 }
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145

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