14#ifndef CELL_CHEMISTRY_H
15#define CELL_CHEMISTRY_H
20#include <Kokkos_Core.hpp>
136 const Kokkos::View<rtype *> & chem_h,
const Kokkos::View<rtype *> & chem_cost,
uint32_t n,
137 double dt,
const Kokkos::View<rtype *> & time_scale = {},
142 const Kokkos::View<rtype *> & hrr,
const Kokkos::View<rtype **, Kokkos::LayoutRight> & production,
155 bool binned()
const {
return bin_by_cost; }
171 std::shared_ptr<ChemistryBalance> balance;
178 Kokkos::DefaultExecutionSpace narrow_space, wide_space;
179 Kokkos::View<uint32_t> team_failures[2];
180 bool bin_by_cost =
false;
181 size_t fast_bytes = 0;
185 Kokkos::View<double **, Kokkos::LayoutRight> work;
186 Kokkos::View<uint32_t **, Kokkos::LayoutRight> pivot;
187 Kokkos::View<uint32_t *> active, queue;
188 Kokkos::View<float *> cost;
189 Kokkos::View<float *> previous_cost;
Work memory and kernels that advance the cells of a state as adiabatic constant-volume reactors at fi...
Definition cell_chemistry.h:99
void init(const Mixture &gas, const chemistry::Mechanism &mechanism, const chemistry::KineticsTable<> &kinetics, const CellChemistryOptions &options, uint32_t n_cells)
Definition cell_chemistry.cpp:421
void balance_across_ranks(double threshold)
Balances the integration across ranks from now on (collective: every rank of the run,...
Definition cell_chemistry.cpp:563
Statistics advance(const StateView &U, const SpeciesView &rhoY, const Kokkos::View< rtype * > &T_seed, const Kokkos::View< rtype * > &chem_h, const Kokkos::View< rtype * > &chem_cost, uint32_t n, double dt, const Kokkos::View< rtype * > &time_scale={}, const ChemistryForcing *forcing=nullptr)
Advance cells [0, n) over dt. Partial densities change; rho, rho u, rho E and the temperature seed do...
Definition cell_chemistry.cpp:487
uint32_t lanes() const
Vector lanes per cell thread (1: one thread per cell).
Definition cell_chemistry.h:146
uint32_t sparse_entries() const
Entries of L + U of the sparse LU, 0 for the dense one.
Definition cell_chemistry.h:161
uint32_t threads() const
Threads of a cell's team.
Definition cell_chemistry.h:149
uint32_t wide_threads() const
Threads of the teams of the cells whose last call was expensive (GPUs), 0 if the same.
Definition cell_chemistry.h:152
void heat_release(const StateView &U, const SpeciesView &rhoY, const Kokkos::View< rtype * > &T_seed, const Kokkos::View< rtype * > &hrr, const Kokkos::View< rtype **, Kokkos::LayoutRight > &production, uint32_t n)
Heat release rate and mass production rates W_k omega_k of cells [0, n).
Definition cell_chemistry.cpp:623
size_t shared_bytes() const
Bytes of team scratch memory per cell holding its work memory, 0 if global memory.
Definition cell_chemistry.h:158
bool binned() const
Whether cells integrated one per thread are ordered by their last cost (GPUs).
Definition cell_chemistry.h:155
Moves the integration of queued cells from ranks with more chemistry work than the mean to ranks with...
Definition chemistry_balance.h:44
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
Device tables of a mechanism's reactions: rates of progress, production rates and their analytical de...
Thermally perfect gas mixture: the gas model of runs with a mechanism.
Adiabatic constant-volume reactor: the chemistry of one cell over a splitting step,...
Static-pattern sparse LU of the reactor's Newton matrix for large mechanisms, with the dense rank-one...
Conservative state: the flow block and the species partial densities.
Kokkos::View< rtype *[N_CONSERVATIVE]> StateView
Flow block [rho, rho u, rho E] per cell.
Definition state.h:23
Kokkos::View< rtype **, SpeciesLayout > SpeciesView
Partial densities rho Y_k per (cell, species).
Definition state.h:37
Options of CellChemistry: the reactor's tolerances, the temperature below which cells are frozen,...
Definition cell_chemistry.h:39
uint32_t lanes
Definition cell_chemistry.h:42
uint32_t threads
Definition cell_chemistry.h:43
bool forced
Definition cell_chemistry.h:46
bool bin_by_cost
Definition cell_chemistry.h:45
int shared
Definition cell_chemistry.h:44
chemistry::ReactorOptions reactor
Definition cell_chemistry.h:40
double T_frozen
Definition cell_chemistry.h:41
Definition cell_chemistry.h:108
uint64_t active
Definition cell_chemistry.h:109
uint32_t failures
Definition cell_chemistry.h:110
uint64_t sent
Definition cell_chemistry.h:111
The per-cell views a chemistry call reads and writes: the state, the temperature seed,...
Definition cell_chemistry.h:68
Kokkos::View< rtype * > T_seed
Definition cell_chemistry.h:71
Kokkos::View< rtype * > time_scale
Definition cell_chemistry.h:75
StateView U_end
Definition cell_chemistry.h:77
SpeciesView rhoY_end
Definition cell_chemistry.h:78
StateView U
Definition cell_chemistry.h:69
bool forced() const
Definition cell_chemistry.h:80
Kokkos::View< rtype * > chem_cost
Definition cell_chemistry.h:73
Kokkos::View< rtype * > chem_h
Definition cell_chemistry.h:72
SpeciesView rate
Definition cell_chemistry.h:76
SpeciesView rhoY
Definition cell_chemistry.h:70
Kokkos::View< float * > previous_cost
Definition cell_chemistry.h:74
A constant forcing of a chemistry call: the rates dU/dt of every conservative variable of each cell (...
Definition cell_chemistry.h:56
State rate
Definition cell_chemistry.h:57
State scratch
Definition cell_chemistry.h:58
Device side of the mixture gas model, captured by value in kernels.
Definition mixture.h:45
Conservative state of every cell: the flow block and the partial densities of a mixture's species....
Definition state.h:56
Reactions of a mechanism as flat device tables (compressed rows per reaction), in MemorySpace....
Definition kinetics.h:70
One ideal-gas phase of a Cantera YAML file: its elements, species and reactions.
Definition mechanism.h:145
The pattern of a reactor Jacobian in (Y_1 .. Y_Ns, T) without its rank-one part, an elimination order...
Definition sparse_lu.h:46
uint32_t nnz
Definition sparse_lu.h:51
Kokkos::View< uint32_t *, Space > cells
Definition teno_setup.cpp:682