19#include <Kokkos_Core.hpp>
60 const double rho =
static_cast<double>(U[0]);
64 W[1 +
i] = U[1 +
i] / U[0];
65 u2 +=
static_cast<double>(U[1 +
i]) *
static_cast<double>(U[1 +
i]);
67 const double e =
static_cast<double>(U[
E]) / rho - 0.5 *
u2 / (rho * rho);
73 gamma =
static_cast<rtype>((cv + R) / cv);
106 std::vector<double>
mass_fractions(
const toml::value & table,
const std::string & where)
const;
118 std::vector<double>
mole_fractions(
const std::vector<double> & Y)
const;
121 double gas_constant(
const std::vector<double> & Y)
const;
124 double energy(
double T,
const std::vector<double> & Y)
const;
127 void surrogates(
double T,
const std::vector<double> & Y,
double & gamma,
double & e0)
const;
143 std::string transport_name;
Host side of the mixture gas model: the mechanism, a host copy of the thermodynamics for setup,...
Definition mixture.h:83
std::vector< double > mole_fractions(const std::vector< double > &Y) const
Mole fractions from mass fractions.
Definition mixture.cpp:127
bool viscous() const
Definition mixture.h:95
void conservatives(double p, double T, const rtype *u, const std::vector< double > &Y, rtype *U, rtype *rhoY) const
Conservatives and partial densities at pressure p, temperature T, velocity u and mass fractions Y.
Definition mixture.cpp:156
void surrogates(double T, const std::vector< double > &Y, double &gamma, double &e0) const
Frozen gamma and energy offset e0 = e - cv T at T.
Definition mixture.cpp:148
std::vector< double > mass_fractions(const toml::value &table, const std::string &where) const
Mass fractions from a table of the input holding X (mole fractions) or Y, by species name; normalized...
Definition mixture.cpp:78
uint32_t n_species() const
Definition mixture.h:96
std::vector< double > mass_fractions_from_mole(const std::vector< double > &X) const
Mass fractions from mole fractions.
Definition mixture.cpp:116
static bool composition_varies(const toml::value &table)
Whether the X or Y of a table varies in space: some value is an expression (a string) or a balance sp...
Definition mixture.cpp:105
double energy(double T, const std::vector< double > &Y) const
Internal energy per unit mass at T [J/kg].
Definition mixture.cpp:142
const Mixture & device() const
Definition mixture.h:94
std::vector< std::string > species_names() const
Definition mixture.h:97
static MixtureModel from_input(const toml::value &input)
From the [physics] table: mechanism and optional phase; for type = "navier_stokes" the transport mode...
Definition mixture.cpp:18
double gas_constant(const std::vector< double > &Y) const
Gas constant of a composition [J/(kg K)].
Definition mixture.cpp:138
const chemistry::Mechanism & mechanism() const
Definition mixture.h:93
logging::Items summary() const
Display lines for the run log.
Definition mixture.cpp:167
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
float rtype
Definition common_typedef.h:39
#define N_DIM
Definition common_typedef.h:28
#define FOR_I_DIM
Definition common_typedef.h:32
Console output: rank-0 info lines, aligned sections and tables, warnings and errors on stderr,...
Gas-phase mechanisms read from Cantera YAML files.
chemistry::ReactorOptions reactor_options(const toml::value &input)
Chemistry integrator options from the optional [chemistry] table: rtol, atol (on mass fractions),...
Definition mixture.cpp:178
std::vector< std::pair< std::string, std::string > > Items
Key-value lines of a setup section, in display order.
Definition log.h:27
Adiabatic constant-volume reactor: the chemistry of one cell over a splitting step,...
Conservative state: the flow block and the species partial densities.
The partial densities of one cell, in any layout.
Definition state.h:40
Device side of the mixture gas model, captured by value in kernels.
Definition mixture.h:45
uint32_t n_species
Definition mixture.h:48
bool viscous
Definition mixture.h:49
chemistry::ThermoTable thermo
Definition mixture.h:46
KOKKOS_INLINE_FUNCTION void cell_state(const rtype *U, const CellSpecies &rhoY, const rtype T_guess, rtype *W, rtype &gamma, rtype &e0, rtype &T) const
State of a cell from its conservatives U and contiguous partial densities rhoY: W = [rho,...
Definition mixture.h:57
chemistry::TransportTable transport
Definition mixture.h:47
Mass fractions of a cell from its partial densities.
Definition mixture.h:31
CellSpecies rhoY
Definition mixture.h:32
KOKKOS_INLINE_FUNCTION double operator()(const uint32_t k) const
Definition mixture.h:34
double inv_rho
Definition mixture.h:33
One ideal-gas phase of a Cantera YAML file: its elements, species and reactions.
Definition mechanism.h:145
std::vector< std::string > species_names() const
Definition mechanism.cpp:622
Species thermodynamics of a mechanism on the device, in double precision in every build: per species ...
Definition thermo.h:43
KOKKOS_INLINE_FUNCTION double gas_constant(const F_Y &y) const
Mixture gas constant R_u sum_k Y_k / W_k [J/(kg K)].
Definition thermo.h:117
KOKKOS_INLINE_FUNCTION double cp_mass(const double T, const F_Y &y) const
Mixture cp [J/(kg K)].
Definition thermo.h:125
KOKKOS_INLINE_FUNCTION double T_from_e(const double e, const F_Y &y, const double T_guess) const
Temperature at which the mixture has internal energy e: Newton from T_guess (300 K if outside the bra...
Definition thermo.h:161
Transport properties of a mechanism's mixtures on the device, in double precision in every build: Wil...
Definition transport.h:87
SlotArray< double, Space > X
Definition teno_setup.cpp:478
Device tables of species thermodynamics and thermally perfect mixture properties.
Species transport fits and mixture-averaged transport properties on the device.