Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
chemistry::KineticsTable< MemorySpace > Struct Template Reference

Reactions of a mechanism as flat device tables (compressed rows per reaction), in MemorySpace. All quantities SI with kmol, in double precision in every build. Concentrations C_k = rho Y_k / W_k. More...

#include <kinetics.h>

Public Types

template<typename T >
using View1 = Kokkos::View< T *, MemorySpace >
 

Public Member Functions

KOKKOS_INLINE_FUNCTION void plog_level (const uint32_t l, const double log_T, const double inv_T, double &k, double &dlnk_dT) const
 Sum of the PLOG rates at pressure level l and its d ln k / dT.
 
KOKKOS_INLINE_FUNCTION void pressure_rate (const uint32_t i, const double log_T, const double inv_T, const double ln_p, double &k, double &dlnk_dT, double &dlnk_dlnp) const
 Rate constant of a PLOG or Chebyshev reaction at T and ln p, with d ln k / dT at fixed p and d ln k / d ln p.
 
KOKKOS_INLINE_FUNCTION double third_body (const uint32_t i, const double *C, const double C_total) const
 Third-body concentration of reaction i.
 
KOKKOS_INLINE_FUNCTION void falloff_function (const uint32_t i, const double T, const double Pr, double &F, double &dlnF_dlnPr, double &dlnF_dT) const
 Falloff blending F(Pr, T) and its logarithmic derivatives d ln F / d ln Pr and d ln F / dT at fixed Pr.
 
KOKKOS_INLINE_FUNCTION uint32_t derivatives_size () const
 Doubles of ReactionDerivatives storage.
 
template<typename Lanes >
KOKKOS_INLINE_FUNCTION void rates_of_progress (const Lanes &lanes, const double T, const double *C, const double C_total, const double *g_RT, const double *h_RT, double *q, const ReactionDerivatives *d) const
 Rates of progress q_i [kmol/(m^3 s)] of every reaction (one per lane) and, with derivatives, what the Jacobian needs.
 
KOKKOS_INLINE_FUNCTION void rates_of_progress (const double T, const double *C, const double *g_RT, double *q) const
 Rates of progress of one thread, without derivatives.
 
template<typename Lanes >
KOKKOS_INLINE_FUNCTION void production_rates (const Lanes &lanes, const double *q, double *omega, double *partial=nullptr) const
 Net production rates omega_k = sum_i nu_ki q_i [kmol/(m^3 s)], one species per lane, summed by reaction index (or the same sums of any per-reaction quantity, e.g. dq_dT).
 
KOKKOS_INLINE_FUNCTION void production_rates (const double *q, double *omega) const
 
template<typename Lanes >
KOKKOS_INLINE_FUNCTION void production_jacobian_entries (const Lanes &lanes, const ReactionDerivatives &d, double *values, double *all_columns) const
 The structural entries of the Jacobian of the production rates (d omega_k / d C_j at fixed T, without the part shared by all columns), values[e] for entry e = (entry_row(e), entry_column(e)), one entry per lane; and that shared part of each row in all_columns.
 
template<typename Lanes >
KOKKOS_INLINE_FUNCTION void production_jacobian (const Lanes &lanes, const ReactionDerivatives &d, double *J, const uint32_t stride, double *all_columns=nullptr) const
 Jacobian of the production rates with respect to the concentrations at fixed T, one row per lane: J[dense_index(stride, k, j)] = d omega_k / d C_j for j < n_species (by rows, or by columns for lanes with Lanes::column_major).
 

Static Public Member Functions

static KOKKOS_INLINE_FUNCTION double plain_power (const double C, const double order)
 C^order: repeated products for integer orders, pow of max(C, 0) otherwise.
 
static KOKKOS_INLINE_FUNCTION double power (const double C, const double order, const double C_reg=C_REG)
 Mass-action factor C^order, regularized below C_reg for 0 < order < 1.
 
static KOKKOS_INLINE_FUNCTION double power_derivative (const double C, const double order, const double C_reg=C_REG)
 d power(C, order) / dC.
 
static KOKKOS_INLINE_FUNCTION double arrhenius (const double A, const double b, const double Ea_R, const double log_T, const double inv_T)
 

Public Attributes

uint32_t n_species = 0
 
uint32_t n_reactions = 0
 
View1< uint8_t > type
 
View1< uint8_t > falloff
 
View1< uint8_t > reversible
 
Kokkos::View< double *[3], Kokkos::LayoutRight, MemorySpace > rate
 
Kokkos::View< double *[3], Kokkos::LayoutRight, MemorySpace > low
 
Kokkos::View< double *[5], Kokkos::LayoutRight, MemorySpace > falloff_params
 
View1< uint32_t > forward_offset
 
View1< uint32_t > forward_species
 
View1< double > forward_order
 
View1< uint32_t > reverse_offset
 
View1< uint32_t > reverse_species
 
View1< double > reverse_order
 
View1< uint32_t > net_offset
 
View1< uint32_t > net_species
 
View1< double > net_nu
 
View1< uint32_t > species_offset
 
View1< uint32_t > species_reaction
 
View1< double > species_nu
 
View1< uint32_t > chunk_offset
 
View1< uint32_t > chunk_end
 
View1< uint32_t > entry_row
 
View1< uint32_t > entry_column
 
View1< uint32_t > entry_offset
 
View1< uint32_t > term_source
 
View1< double > term_coefficient
 
View1< double > delta_nu
 
View1< uint32_t > efficiency_offset
 
View1< uint32_t > efficiency_species
 
View1< double > efficiency_extra
 
View1< double > default_efficiency
 
View1< uint32_t > plog_offset
 
View1< double > plog_ln_p
 
View1< uint32_t > plog_rate_offset
 
Kokkos::View< double *[3], Kokkos::LayoutRight, MemorySpace > plog_rate
 
View1< uint32_t > chebyshev_offset
 
View1< uint32_t > chebyshev_n_p
 
View1< double > chebyshev
 
Kokkos::View< double *[4], Kokkos::LayoutRight, MemorySpace > chebyshev_range
 
double C_reg = C_REG
 

Static Public Attributes

static constexpr double C_REG = 1e-12
 Concentration [kmol/m^3] below which orders 0 < n < 1 follow C_reg^n x ((2 - n) + (n - 1) x), x = C / C_reg (linear in C for x < 0): C^1 at C_reg, with a bounded slope at C = 0 where n C^(n - 1) diverges.
 
static constexpr uint32_t MAX_KEPT = 4
 Factors C^order of a reaction's products that the derivatives reuse.
 

Detailed Description

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
struct chemistry::KineticsTable< MemorySpace >

Reactions of a mechanism as flat device tables (compressed rows per reaction), in MemorySpace. All quantities SI with kmol, in double precision in every build. Concentrations C_k = rho Y_k / W_k.

Rates follow Cantera: k = A T^b exp(-Ea / RT); three-body reactions multiply both directions by [M] = sum_k eff_k C_k; falloff reactions use k = k_inf Pr / (1 + Pr) F with Pr = k_0 [M] / k_inf and F = 1 (Lindemann), Troe or SRI; PLOG reactions interpolate ln k linearly in ln p between the bracketing pressures (constant outside them), summing the rates given at one pressure; Chebyshev reactions take log10 k as a series in reduced 1/T and log10 p, with p = C_total R T; reversible reactions take k_r = k_f / K_c with K_c = exp(-sum_k nu_k g_k / RT) (p_atm / RT)^(sum_k nu_k).

Member Typedef Documentation

◆ View1

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
template<typename T >
using chemistry::KineticsTable< MemorySpace >::View1 = Kokkos::View<T *, MemorySpace>

Member Function Documentation

◆ arrhenius()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
static KOKKOS_INLINE_FUNCTION double chemistry::KineticsTable< MemorySpace >::arrhenius ( const double  A,
const double  b,
const double  Ea_R,
const double  log_T,
const double  inv_T 
)
inlinestatic

◆ derivatives_size()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
KOKKOS_INLINE_FUNCTION uint32_t chemistry::KineticsTable< MemorySpace >::derivatives_size ( ) const
inline

Doubles of ReactionDerivatives storage.

◆ falloff_function()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
KOKKOS_INLINE_FUNCTION void chemistry::KineticsTable< MemorySpace >::falloff_function ( const uint32_t  i,
const double  T,
const double  Pr,
double &  F,
double &  dlnF_dlnPr,
double &  dlnF_dT 
) const
inline

Falloff blending F(Pr, T) and its logarithmic derivatives d ln F / d ln Pr and d ln F / dT at fixed Pr.

◆ plain_power()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
static KOKKOS_INLINE_FUNCTION double chemistry::KineticsTable< MemorySpace >::plain_power ( const double  C,
const double  order 
)
inlinestatic

C^order: repeated products for integer orders, pow of max(C, 0) otherwise.

◆ plog_level()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
KOKKOS_INLINE_FUNCTION void chemistry::KineticsTable< MemorySpace >::plog_level ( const uint32_t  l,
const double  log_T,
const double  inv_T,
double &  k,
double &  dlnk_dT 
) const
inline

Sum of the PLOG rates at pressure level l and its d ln k / dT.

◆ power()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
static KOKKOS_INLINE_FUNCTION double chemistry::KineticsTable< MemorySpace >::power ( const double  C,
const double  order,
const double  C_reg = C_REG 
)
inlinestatic

Mass-action factor C^order, regularized below C_reg for 0 < order < 1.

◆ power_derivative()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
static KOKKOS_INLINE_FUNCTION double chemistry::KineticsTable< MemorySpace >::power_derivative ( const double  C,
const double  order,
const double  C_reg = C_REG 
)
inlinestatic

d power(C, order) / dC.

◆ pressure_rate()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
KOKKOS_INLINE_FUNCTION void chemistry::KineticsTable< MemorySpace >::pressure_rate ( const uint32_t  i,
const double  log_T,
const double  inv_T,
const double  ln_p,
double &  k,
double &  dlnk_dT,
double &  dlnk_dlnp 
) const
inline

Rate constant of a PLOG or Chebyshev reaction at T and ln p, with d ln k / dT at fixed p and d ln k / d ln p.

◆ production_jacobian()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
template<typename Lanes >
KOKKOS_INLINE_FUNCTION void chemistry::KineticsTable< MemorySpace >::production_jacobian ( const Lanes &  lanes,
const ReactionDerivatives &  d,
double *  J,
const uint32_t  stride,
double *  all_columns = nullptr 
) const
inline

Jacobian of the production rates with respect to the concentrations at fixed T, one row per lane: J[dense_index(stride, k, j)] = d omega_k / d C_j for j < n_species (by rows, or by columns for lanes with Lanes::column_major).

Parameters
dDerivatives from rates_of_progress at the same state.
all_columnsIf not null, the part of row k that is the same in every column (third bodies at their default efficiency, PLOG and Chebyshev pressures) goes to all_columns[k] instead of J.

◆ production_jacobian_entries()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
template<typename Lanes >
KOKKOS_INLINE_FUNCTION void chemistry::KineticsTable< MemorySpace >::production_jacobian_entries ( const Lanes &  lanes,
const ReactionDerivatives &  d,
double *  values,
double *  all_columns 
) const
inline

The structural entries of the Jacobian of the production rates (d omega_k / d C_j at fixed T, without the part shared by all columns), values[e] for entry e = (entry_row(e), entry_column(e)), one entry per lane; and that shared part of each row in all_columns.

◆ production_rates() [1/2]

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
KOKKOS_INLINE_FUNCTION void chemistry::KineticsTable< MemorySpace >::production_rates ( const double *  q,
double *  omega 
) const
inline

◆ production_rates() [2/2]

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
template<typename Lanes >
KOKKOS_INLINE_FUNCTION void chemistry::KineticsTable< MemorySpace >::production_rates ( const Lanes &  lanes,
const double *  q,
double *  omega,
double *  partial = nullptr 
) const
inline

Net production rates omega_k = sum_i nu_ki q_i [kmol/(m^3 s)], one species per lane, summed by reaction index (or the same sums of any per-reaction quantity, e.g. dq_dT).

◆ rates_of_progress() [1/2]

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
KOKKOS_INLINE_FUNCTION void chemistry::KineticsTable< MemorySpace >::rates_of_progress ( const double  T,
const double *  C,
const double *  g_RT,
double *  q 
) const
inline

Rates of progress of one thread, without derivatives.

◆ rates_of_progress() [2/2]

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
template<typename Lanes >
KOKKOS_INLINE_FUNCTION void chemistry::KineticsTable< MemorySpace >::rates_of_progress ( const Lanes &  lanes,
const double  T,
const double *  C,
const double  C_total,
const double *  g_RT,
const double *  h_RT,
double *  q,
const ReactionDerivatives *  d 
) const
inline

Rates of progress q_i [kmol/(m^3 s)] of every reaction (one per lane) and, with derivatives, what the Jacobian needs.

Parameters
CConcentrations (n_species), C_total their sum.
g_RT,h_RTSpecies g / RT and h / RT at T (h_RT only with derivatives).
qRates of progress (n_reactions).
dNull, or the derivatives (laid out by ReactionDerivatives::at).

◆ third_body()

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
KOKKOS_INLINE_FUNCTION double chemistry::KineticsTable< MemorySpace >::third_body ( const uint32_t  i,
const double *  C,
const double  C_total 
) const
inline

Third-body concentration of reaction i.

Member Data Documentation

◆ C_REG

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
constexpr double chemistry::KineticsTable< MemorySpace >::C_REG = 1e-12
staticconstexpr

Concentration [kmol/m^3] below which orders 0 < n < 1 follow C_reg^n x ((2 - n) + (n - 1) x), x = C / C_reg (linear in C for x < 0): C^1 at C_reg, with a bounded slope at C = 0 where n C^(n - 1) diverges.

◆ C_reg

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
double chemistry::KineticsTable< MemorySpace >::C_reg = C_REG

◆ chebyshev

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::chebyshev

◆ chebyshev_n_p

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::chebyshev_n_p

◆ chebyshev_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::chebyshev_offset

◆ chebyshev_range

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
Kokkos::View<double *[4], Kokkos::LayoutRight, MemorySpace> chemistry::KineticsTable< MemorySpace >::chebyshev_range

◆ chunk_end

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::chunk_end

◆ chunk_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::chunk_offset

◆ default_efficiency

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::default_efficiency

◆ delta_nu

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::delta_nu

◆ efficiency_extra

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::efficiency_extra

◆ efficiency_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::efficiency_offset

◆ efficiency_species

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::efficiency_species

◆ entry_column

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::entry_column

◆ entry_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::entry_offset

◆ entry_row

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::entry_row

◆ falloff

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint8_t> chemistry::KineticsTable< MemorySpace >::falloff

◆ falloff_params

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
Kokkos::View<double *[5], Kokkos::LayoutRight, MemorySpace> chemistry::KineticsTable< MemorySpace >::falloff_params

◆ forward_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::forward_offset

◆ forward_order

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::forward_order

◆ forward_species

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::forward_species

◆ low

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
Kokkos::View<double *[3], Kokkos::LayoutRight, MemorySpace> chemistry::KineticsTable< MemorySpace >::low

◆ MAX_KEPT

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
constexpr uint32_t chemistry::KineticsTable< MemorySpace >::MAX_KEPT = 4
staticconstexpr

Factors C^order of a reaction's products that the derivatives reuse.

◆ n_reactions

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
uint32_t chemistry::KineticsTable< MemorySpace >::n_reactions = 0

◆ n_species

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
uint32_t chemistry::KineticsTable< MemorySpace >::n_species = 0

◆ net_nu

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::net_nu

◆ net_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::net_offset

◆ net_species

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::net_species

◆ plog_ln_p

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::plog_ln_p

◆ plog_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::plog_offset

◆ plog_rate

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
Kokkos::View<double *[3], Kokkos::LayoutRight, MemorySpace> chemistry::KineticsTable< MemorySpace >::plog_rate

◆ plog_rate_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::plog_rate_offset

◆ rate

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
Kokkos::View<double *[3], Kokkos::LayoutRight, MemorySpace> chemistry::KineticsTable< MemorySpace >::rate

◆ reverse_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::reverse_offset

◆ reverse_order

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::reverse_order

◆ reverse_species

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::reverse_species

◆ reversible

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint8_t> chemistry::KineticsTable< MemorySpace >::reversible

◆ species_nu

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::species_nu

◆ species_offset

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::species_offset

◆ species_reaction

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::species_reaction

◆ term_coefficient

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<double> chemistry::KineticsTable< MemorySpace >::term_coefficient

◆ term_source

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint32_t> chemistry::KineticsTable< MemorySpace >::term_source

◆ type

template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
View1<uint8_t> chemistry::KineticsTable< MemorySpace >::type

The documentation for this struct was generated from the following file: