26 #include "grins_config.h"
28 #ifdef GRINS_HAVE_CANTERA
37 #include "libmesh/getpot.h"
50 _cantera_gas.reset(
new Cantera::IdealGasMix( cantera_chem_file, mixture ) );
52 catch(Cantera::CanteraError)
54 Cantera::showErrors(std::cerr);
62 catch(Cantera::CanteraError)
64 Cantera::showErrors(std::cerr);
80 if( input.have_variable(
"Physics/Chemistry/mixture") )
83 "GasMixture/Cantera/gas_mixture" );
85 mixture = input(
"Physics/Chemistry/mixture",
"DIE!" );
87 else if( input.have_variable(
"Materials/"+material+
"/GasMixture/Cantera/gas_mixture") )
89 mixture = input(
"Materials/"+material+
"/GasMixture/Cantera/gas_mixture",
"DIE!");
93 libmesh_error_msg(
"ERROR: Could not find valid input for Cantera gas_mixture!");
101 libmesh_assert_equal_to( mass_fractions.size(),
_cantera_gas->nSpecies() );
104 for(
unsigned int s = 0; s < mass_fractions.size(); s++ )
106 M += mass_fractions[s]/(this->
M(s));
114 libmesh_assert_equal_to( mass_fractions.size(),
_cantera_gas->nSpecies() );
116 libMesh::Real
R = 0.0;
117 for(
unsigned int s = 0; s < mass_fractions.size(); s++ )
119 R += mass_fractions[s]*this->
R(s);
126 std::vector<libMesh::Real>& mole_fractions )
const
128 libmesh_assert_equal_to( mass_fractions.size(),
_cantera_gas->nSpecies() );
130 libmesh_assert_equal_to( mole_fractions.size(), mass_fractions.size() );
132 for(
unsigned int s = 0; s < mass_fractions.size(); s++ )
134 mole_fractions[s] = this->
X(s, M_mix, mass_fractions[s]);
142 #endif // GRINS_HAVE_CANTERA
libMesh::UniquePtr< Cantera::Transport > _cantera_transport
libMesh::Real R(unsigned int species) const
libMesh::Real X(unsigned int species, libMesh::Real M, libMesh::Real mass_fraction) const
libMesh::UniquePtr< Cantera::IdealGasMix > _cantera_gas
libMesh::Real M_mix(const std::vector< libMesh::Real > &mass_fractions) const
libMesh::Real R_mix(const std::vector< libMesh::Real > &mass_fractions) const
ParameterUser base class. Utility methods for subclasses.
static void dep_input_warning(const std::string &old_option, const std::string &property)
Helper function for parsing/maintaing backward compatibility.
static std::string parse_chemical_kinetics_datafile_name(const GetPot &input, const std::string &material)
libMesh::Real M(unsigned int species) const
std::string parse_mixture(const GetPot &input, const std::string &material)