1#ifndef __MODEL_MONOD_HPP__
2#define __MODEL_MONOD_HPP__
4#include "mc/macros.hpp"
5#include "models/utils.hpp"
6#include <Kokkos_MathematicalConstants.hpp>
8#include <mc/prng/prng_extension.hpp>
9#include <mc/traits.hpp>
51 static constexpr std::string_view
name =
"monod";
80 KOKKOS_INLINE_FUNCTION
static void
82 [[maybe_unused]] std::size_t idx,
93 const auto l0 = local_dist.draw(
96 return std::make_tuple(l0, mu);
106 constexpr auto dl =
l_max_m / 2.;
112 = dl / Kokkos::numbers::ln2;
115 KOKKOS_INLINE_FUNCTION
static double
116 mass([[maybe_unused]] std::size_t idx,
125 [[maybe_unused]] std::size_t idx,
127 const std::size_t position_index,
131 Kokkos::max(0., GET_CONCENTRATION(0)));
162 KOKKOS_INLINE_FUNCTION
static void
164 [[maybe_unused]] std::size_t idx,
165 [[maybe_unused]] std::size_t idx2,
180 const FloatType new_current_length = current_l / 2.F;
187 GET_PROPERTY_FROM(idx2, buffer_arr,
particle_var::l) = new_current_length;
192 = cell_lenghtening_value;
199 return { .begin = begin, .end = begin + 1 };
202 static std::vector<std::string_view>
205 return {
"length",
"mu",
"mu_eff" };
208 static std::vector<std::size_t>
KOKKOS_INLINE_FUNCTION auto sample_random_variables(const pool_type &pool, auto &&functor)
Definition prng.hpp:45
Status
Definition alias.hpp:125
gen_pool_type< Kokkos::DefaultExecutionSpace > pool_type
Definition alias.hpp:100
KernelConcentrationType LocalConcentration
Definition alias.hpp:170
Kokkos::View< F *[Nd], ComputeSpace::array_layout, ComputeSpace, Kokkos::MemoryTraits< Kokkos::MemoryTraitsFlags::Restrict > > ParticlesModel
Definition alias.hpp:52
Models definition.
Definition config_loader.hpp:9
KOKKOS_INLINE_FUNCTION MC::Status check_div(const T l, const T lc)
Definition utils.hpp:64
KOKKOS_INLINE_FUNCTION consteval F c_linear_density(F rho, F d)
Definition utils.hpp:94
Represents a TruncatedNormal (Gaussian) probability distribution.
Definition prng_extension.hpp:354
Simplified Monod model for glucose consumption and biomass growth.
Definition monod.hpp:27
MODEL_CONSTANT FloatType tau_meta
Metabolic time constant (s), inverse of max growth rate.
Definition monod.hpp:67
MODEL_CONSTANT auto initial_length_dist
Definition monod.hpp:77
static constexpr std::string_view name
Definition monod.hpp:51
static MC::ContribIndexBounds get_bounds()
Definition monod.hpp:196
MODEL_CONSTANT FloatType d_m
Cell diameter (m)
Definition monod.hpp:71
static constexpr std::size_t n_var
Definition monod.hpp:50
static KOKKOS_INLINE_FUNCTION double mass(std::size_t idx, const SelfParticle &arr)
Definition monod.hpp:116
float FloatType
Definition monod.hpp:54
static std::vector< std::size_t > get_number()
Definition monod.hpp:209
static KOKKOS_INLINE_FUNCTION void init(const MC::pool_type &random_pool, std::size_t idx, const SelfParticle &arr)
Definition monod.hpp:81
MODEL_CONSTANT FloatType l_min_m
Minimum cell length (m), half of maximum length.
Definition monod.hpp:69
particle_var
Enumeration for the Monod model variables.
Definition monod.hpp:38
@ mu_p
Maximum specific growth rate (potential growth rate)
Definition monod.hpp:41
@ mue
Effective growth rate (used for export purposes only)
Definition monod.hpp:42
@ l
Length of the cell.
Definition monod.hpp:39
@ phi_s_c
Instantaneous glucose consumption rate.
Definition monod.hpp:45
@ l_max
Maximum cell length (assumed constant for all cells)
Definition monod.hpp:40
@ __COUNT__
Helper for determining the size of the variable list.
Definition monod.hpp:46
@ _init_only_cell_lenghtening
Definition monod.hpp:43
MODEL_CONSTANT FloatType lin_density
Linear density of the biomass (kg/m), calculated from cell diameter.
Definition monod.hpp:72
std::nullopt_t Config
Definition monod.hpp:56
MODEL_CONSTANT FloatType l_max_m
Maximum cell length (m)
Definition monod.hpp:68
static KOKKOS_INLINE_FUNCTION MC::Status update(const MC::pool_type &random_pool, FloatType d_t, std::size_t idx, const SelfParticle &arr, const std::size_t position_index, const MC::LocalConcentration &c)
Definition monod.hpp:123
Monod Self
Definition monod.hpp:53
static std::vector< std::string_view > names()
Definition monod.hpp:203
MC::ParticlesModel< Self::n_var, Self::FloatType > SelfParticle
Definition monod.hpp:55
MODEL_CONSTANT FloatType k_s
Monod constant for substrate concentration (m)
Definition monod.hpp:70
MODEL_CONSTANT FloatType mu_max
Maximum specific growth rate (1/s), converted from per hour.
Definition monod.hpp:66
static KOKKOS_INLINE_FUNCTION void division(const MC::pool_type &random_pool, std::size_t idx, std::size_t idx2, const SelfParticle &arr, const SelfParticle &buffer_arr)
Definition monod.hpp:163
MODEL_CONSTANT FloatType y_s_x
Model constants used in biomass growth and cell elongation.
Definition monod.hpp:65
std::true_type uniform_weight
Definition monod.hpp:52