26 #ifndef ANTIOCH_CHEMKIN_PARSER_H
27 #define ANTIOCH_CHEMKIN_PARSER_H
46 template <
typename NumericType>
47 class ChemicalMixture;
49 template <
typename NumericType,
typename CurveType>
50 class NASAThermoMixture;
52 template <
typename NumericType>
55 template <
typename NumericType>
59 template <
typename NumericType>
78 template <
typename NumericType =
double>
114 {
antioch_error_msg(
"ERROR: ChemKin Parsing only supports parsing for NASA7CurveFit!");}
118 {
antioch_error_msg(
"ERROR: ChemKin Parsing only supports parsing for NASA7CurveFit!");}
122 {
antioch_error_msg(
"ERROR: ChemKin Parsing only supports parsing for NASA7CurveFit!");}
154 bool reactants_pairs(std::vector<std::pair<std::string,int> > & reactants_pair)
const;
157 bool products_pairs(std::vector<std::pair<std::string,int> > & products_pair)
const;
166 bool is_k0(
unsigned int nrc,
const std::string & kin_model)
const;
169 unsigned int where_is_k0(
const std::string & )
const;
196 bool efficiencies(std::vector<std::pair<std::string,NumericType> > & par_values)
const;
199 bool Troe_alpha_parameter(NumericType & alpha, std::string & alpha_unit, std::string & def_unit)
const;
202 bool Troe_T1_parameter( NumericType & T1, std::string & T1_unit, std::string & def_unit)
const;
205 bool Troe_T2_parameter( NumericType & T2, std::string & T2_unit, std::string & def_unit)
const;
208 bool Troe_T3_parameter( NumericType & T3, std::string & T3_unit, std::string & def_unit)
const;
213 template <
typename CurveType>
238 void parse_orders(
const std::string & line, std::vector<std::pair<std::string, NumericType> > & reaction_orders);
241 std::pair<std::string,NumericType>
parse_molecule(
const std::string & molecule);
274 std::vector<std::pair<std::string,NumericType> >
_products;
283 std::vector<NumericType>
_A;
284 std::vector<NumericType>
_b;
285 std::vector<NumericType>
_Ea;
286 std::vector<NumericType>
_D;
296 std::map<ParsingKey,std::string>
_map;
310 template <
typename NumericType>
314 return (_chemical_process.find(
"TroeFalloff") != std::string::npos);
317 template <
typename NumericType>
324 template <
typename NumericType>
331 template <
typename NumericType>
335 return _chemical_process;
338 template <
typename NumericType>
345 template <
typename NumericType>
349 return _kinetics_model;
352 template <
typename NumericType>
360 template <
typename NumericType>
367 template <
typename NumericType>
374 template <
typename NumericType>
381 template <
typename NumericType>
388 template <
typename NumericType>
bool rate_constant_preexponential_parameter(NumericType &A, std::string &A_unit, std::string &def_unit) const
return true if pre exponentiel coefficient
bool rate_constant_lambda_parameter(std::vector< NumericType > &lambda, std::string &lambda_unit, std::string &def_unit) const
return true if lambda
bool after_coma_digits(NumericType number) const
check if the stoichiometric coef is an integer
const std::string reaction_kinetics_model(const std::vector< std::string > &) const
return reaction kinetics model
void parse_orders(const std::string &line, std::vector< std::pair< std::string, NumericType > > &reaction_orders)
Convenient method.
bool rate_constant_Tref_parameter(NumericType &Tref, std::string &Tref_unit, std::string &def_unit) const
return true if Tref
bool rate_constant_cross_section_parameter(std::vector< NumericType > &sigma, std::string &sigma_unit, std::string &def_unit) const
return true if sigma
void rescale_stoichiometry()
if stoichiometry is real, make them integer
std::vector< std::pair< std::string, NumericType > > _efficiencies
unsigned int factor_to_int(NumericType number) const
look for q when given r = p / q
std::vector< NumericType > _b
void parse_equation_coef(const std::string &line)
Convenient method.
std::string _chemical_process
std::map< ParsingKey, std::string > _map
bool rate_constant_power_parameter(NumericType &b, std::string &b_unit, std::string &def_unit) const
return true if beta coefficient
const std::string reaction_id() const
return reaction id, 0 if not provided
void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &thermo)
reads the thermo, NASA generalist, no templates for virtual
void read_thermodynamic_data_root(NASAThermoMixture< NumericType, CurveType > &thermo)
reads the thermo, NASA generalist
bool Troe_alpha_parameter(NumericType &alpha, std::string &alpha_unit, std::string &def_unit) const
return true is alpha
bool is_k0(unsigned int nrc, const std::string &kin_model) const
return true if "name" attribute is found with value "k0"
const ChemKinDefinitions _spec
std::vector< NumericType > _D
const std::string reaction_chemical_process() const
return reaction chemical process
bool rate_constant_activation_energy_parameter(NumericType &Ea, std::string &Ea_unit, std::string &def_unit) const
return true if activation energie
std::vector< NumericType > _Ea
bool products_pairs(std::vector< std::pair< std::string, int > > &products_pair) const
return pairs of products and stoichiometric coefficients
void parse_forward_orders(const std::string &line)
Convenient method.
bool next_reaction(const std::string &line)
verify if line is a new reaction
bool initialize()
Read header of file, go to interesting part.
void read_thermodynamic_data(CEAThermodynamics< NumericType > &)
reads the thermo, CEA deprecated
const std::map< std::string, NumericType > reactants_orders() const
return a map between reactants' name and found partial orders
bool Troe_T3_parameter(NumericType &T3, std::string &T3_unit, std::string &def_unit) const
return true is alpha
bool reaction()
go to next reaction
This class stores the NASA polynomial fit to the thermodynamics quantities and .
#define antioch_error_msg(errmsg)
bool reactants_pairs(std::vector< std::pair< std::string, int > > &reactants_pair) const
return pairs of reactants and stoichiometric coefficients
bool Troe_T2_parameter(NumericType &T2, std::string &T2_unit, std::string &def_unit) const
return true is alpha
This class only differs from NASA9CurveFit in the construction.
void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA9CurveFit< NumericType > > &)
reads the thermo, NASA generalist, no templates for virtual
void parse_equation(std::string &equation)
Convenient method.
std::map< ParsingKey, std::string > _default_unit
bool reaction_reversible() const
return reversible state
void read_thermodynamic_data(NASAThermoMixture< NumericType, CEACurveFit< NumericType > > &)
reads the thermo, NASA generalist, no templates for virtual
ChemKinParser()
Never use default constructor.
bool next_meaningful_line(std::string &line)
finding next line that might be a reaction
std::map< std::string, std::string > _unit_custom_ea
bool rate_constant_Berthelot_coefficient_parameter(NumericType &D, std::string &D_unit, std::string &def_unit) const
return true if D coefficient
bool verify_Kooij_in_place_of_Arrhenius() const
return true if a Kooij is called Arrhenuis
void parse_reversible_parameters(const std::string &line)
Convenient method.
const std::vector< std::string > species_list()
read SPECIES block
std::vector< std::pair< std::string, NumericType > > _reactants
std::vector< std::pair< std::string, NumericType > > _products_orders
std::string _kinetics_model
const std::string reaction_equation() const
return reaction equation
bool Troe_T1_parameter(NumericType &T1, std::string &T1_unit, std::string &def_unit) const
return true is alpha
bool Troe() const
return true if there's a Troe block
void parse_coefficients_line(const std::string &line)
Convenient method.
const std::map< std::string, NumericType > products_orders() const
return a map between products' name and found partial orders
void change_file(const std::string &filename)
std::vector< std::pair< std::string, NumericType > > _reactants_orders
The parameters are reduced parameters.
std::vector< std::pair< std::string, NumericType > > _products
bool efficiencies(std::vector< std::pair< std::string, NumericType > > &par_values) const
return true if efficiencies are found
std::map< std::string, std::string > _unit_custom_A
unsigned int where_is_k0(const std::string &) const
return index of k0 (0 or 1)
std::pair< std::string, NumericType > parse_molecule(const std::string &molecule)
Convenient method.
A parser is an instance related to a file.
std::vector< NumericType > _A
void parse_backward_orders(const std::string &line)
Convenient method.
bool is_real_number(const char &c) const
Convenient method.
void parse_a_line(const std::string &line)
Convenient method.
ChemKin format file reader.
bool rate_constant(const std::string &)
go to next rate constant