Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
cell_chemistry.cpp File Reference

Finite-rate chemistry of the cells of a mesh. More...

#include "cell_chemistry.h"
#include <algorithm>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <Kokkos_Sort.hpp>
#include "chemistry_balance.h"
#include "launch_bounds.h"

Classes

struct  cell_chemistry_kernels::TeamTag< Sparse >
 
struct  cell_chemistry_kernels::LocalWork< N >
 Tag of the thread-per-cell kernel with at most N doubles of work memory per cell on the stack. More...
 
struct  cell_chemistry_kernels::ActivityTeamTag
 
struct  cell_chemistry_kernels::ActivityFunctor
 Flags the cells of a chunk that need chemistry (see CellChemistry), by threads or by teams. More...
 
struct  cell_chemistry_kernels::QueueFunctor
 Compacts the flagged cells of a chunk into a queue; the total is the queue length. More...
 
struct  cell_chemistry_kernels::AdvanceFunctor
 Advances the cells of a queue over dt, writes their partial densities, last sub-step and cost, and counts failures. The temperature seed stays as the RHS left it: halo copies of a cell get no chemistry, and their seeds must follow the owner's. More...
 
struct  cell_chemistry_kernels::WideCountFunctor
 Counts the queued cells at least as expensive as a cost (the sorted queue holds minus the costs). More...
 
struct  cell_chemistry_kernels::HeatReleaseFunctor
 Heat release rate -sum_k h_k omega_k [W/m^3] and mass production rates W_k omega_k [kg/(m^3 s)] of the cells of a chunk. More...
 

Namespaces

namespace  cell_chemistry_kernels
 

Typedefs

template<bool Sparse, bool Fast>
using cell_chemistry_kernels::TeamPolicy = Kokkos::TeamPolicy< TeamTag< Sparse >, Kokkos::LaunchBounds< WARP, Fast ? MIN_FAST_TEAMS :MIN_TEAMS > >
 
using cell_chemistry_kernels::Member = TeamPolicy< false, false >::member_type
 
template<bool Sparse>
using cell_chemistry_kernels::WideTeamPolicy = Kokkos::TeamPolicy< TeamTag< Sparse >, Kokkos::LaunchBounds< MAX_TEAM_LANES, 512/MAX_TEAM_LANES > >
 
using cell_chemistry_kernels::ActivityPolicy = Kokkos::TeamPolicy< ActivityTeamTag >
 

Functions

KOKKOS_INLINE_FUNCTION double cell_chemistry_kernels::cell_composition (const Mixture &gas, const StateView &U, const SpeciesView &rhoY, const Kokkos::View< rtype * > &T_seed, const uint32_t c, double *Y, double &T)
 Mass fractions (double) and temperature of a cell; returns its specific internal energy.
 
template<typename Space >
void cell_chemistry_kernels::launch_teams (const Space &space, const AdvanceFunctor &functor, const uint32_t league, const uint32_t threads, const uint32_t lanes, const bool sparse, const size_t fast_bytes, const Kokkos::View< uint32_t > &failures)
 Integrates queued cells [functor.offset, functor.offset + league) by teams of threads x lanes on an execution space instance; the failures go to a device scalar.
 
void cell_chemistry_kernels::sort_queue (const Kokkos::View< uint32_t * > &queue, const Kokkos::View< float * > &cost, const uint32_t n)
 Sorts queued cells [0, n) by their keys (minus the last cost: the most expensive first).
 
uint32_t cell_chemistry_kernels::read_failures (const Kokkos::View< uint32_t > &failures)
 

Variables

constexpr double cell_chemistry_kernels::WORK_MEMORY_BYTES = 1024.0 * 1024.0 * 1024.0
 
constexpr float cell_chemistry_kernels::WIDE_TEAM_COST = 16.0f
 
constexpr uint32_t cell_chemistry_kernels::WARP = 32
 
constexpr uint32_t cell_chemistry_kernels::MIN_TEAMS = 16
 
constexpr uint32_t cell_chemistry_kernels::MIN_FAST_TEAMS = 4
 
constexpr uint32_t cell_chemistry_kernels::MAX_TEAM_LANES = 512
 
constexpr uint32_t cell_chemistry_kernels::LOCAL_SMALL = 256
 
constexpr uint32_t cell_chemistry_kernels::LOCAL_LARGE = 1024
 
constexpr bool cell_chemistry_kernels::ON_GPU = !Kokkos::SpaceAccessibility<Kokkos::DefaultExecutionSpace, Kokkos::HostSpace>::accessible
 

Detailed Description

Finite-rate chemistry of the cells of a mesh.

Author
Matthew Bonanni (mbona.nosp@m.nni0.nosp@m.01@gm.nosp@m.ail..nosp@m.com)
Version
0.3
Date
2026-10-03