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>
49 MODEL_CONSTANT std::size_t
n_c = 1;
52 static constexpr std::string_view
name =
"monod";
83 KOKKOS_INLINE_FUNCTION
static void
85 [[maybe_unused]] std::size_t idx,
96 const auto l0 = local_dist.draw(
99 return std::make_tuple(l0, mu);
109 constexpr auto dl =
l_max_m / 2.;
115 = dl / Kokkos::numbers::ln2;
118 KOKKOS_INLINE_FUNCTION
static double
119 mass([[maybe_unused]] std::size_t idx,
131 const std::size_t position_index,
136 const auto s = GET_CLAMPED_CONCENTRATION_CAST(
FloatType, 0);
154 GET_CONTRIBS(0) = phi_s;
164 mu_p += d_t * inv_tau * (mu -
mu_p);
169 KOKKOS_INLINE_FUNCTION
static void
171 [[maybe_unused]] std::size_t idx,
172 [[maybe_unused]] std::size_t idx2,
187 const FloatType new_current_length = current_l / 2.F;
194 GET_PROPERTY_FROM(idx2, buffer_arr,
particle_var::l) = new_current_length;
199 = cell_lenghtening_value;
202 static std::vector<std::string_view>
205 return {
"length",
"mu",
"mu_eff" };
208 static std::vector<std::size_t>
216 static std::vector<std::string_view>
KOKKOS_INLINE_FUNCTION auto sample_random_variables(const pool_type &pool, auto &&functor)
Definition prng.hpp:48
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 *[Nc], ComputeSpace::array_layout, ComputeSpace, Kokkos::MemoryTraits< Kokkos::MemoryTraitsFlags::Restrict > > ParticlesContribs
Definition alias.hpp:66
Kokkos::View< F *[Nd], ComputeSpace::array_layout, ComputeSpace, Kokkos::MemoryTraits< Kokkos::MemoryTraitsFlags::Restrict > > ParticlesModel
Definition alias.hpp:52
Models definition.
Definition acetate.hpp:18
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:70
static std::vector< std::string_view > species()
Definition monod.hpp:217
MODEL_CONSTANT auto initial_length_dist
Definition monod.hpp:80
static constexpr std::string_view name
Definition monod.hpp:52
MC::ParticlesContribs< Self::n_c, Self::FloatType > SelfContribs
Definition monod.hpp:58
MODEL_CONSTANT FloatType d_m
Cell diameter (m)
Definition monod.hpp:74
static KOKKOS_INLINE_FUNCTION MC::Status update(const MC::pool_type &random_pool, FloatType d_t, std::size_t idx, const SelfParticle &arr, const SelfContribs &arr_contribs, const std::size_t position_index, const MC::LocalConcentration &c)
Definition monod.hpp:126
static constexpr std::size_t n_var
Definition monod.hpp:51
static KOKKOS_INLINE_FUNCTION double mass(std::size_t idx, const SelfParticle &arr)
Definition monod.hpp:119
float FloatType
Definition monod.hpp:55
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:84
MODEL_CONSTANT FloatType l_min_m
Minimum cell length (m), half of maximum length.
Definition monod.hpp:72
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:75
std::nullopt_t Config
Definition monod.hpp:59
MODEL_CONSTANT FloatType l_max_m
Maximum cell length (m)
Definition monod.hpp:71
MODEL_CONSTANT std::size_t n_c
Definition monod.hpp:49
Monod Self
Definition monod.hpp:54
static std::vector< std::string_view > names()
Definition monod.hpp:203
MC::ParticlesModel< Self::n_var, Self::FloatType > SelfParticle
Definition monod.hpp:57
MODEL_CONSTANT FloatType k_s
Monod constant for substrate concentration (m)
Definition monod.hpp:73
MODEL_CONSTANT FloatType mu_max
Maximum specific growth rate (1/s), converted from per hour.
Definition monod.hpp:69
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:170
MODEL_CONSTANT FloatType y_s_x
Model constants used in biomass growth and cell elongation.
Definition monod.hpp:68
std::true_type uniform_weight
Definition monod.hpp:53