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,
130 =
static_cast<FloatType>(Kokkos::max(0., c(0)));
161 KOKKOS_INLINE_FUNCTION
static void
163 [[maybe_unused]] std::size_t idx,
164 [[maybe_unused]] std::size_t idx2,
179 const FloatType new_current_length = current_l / 2.F;
186 GET_PROPERTY_FROM(idx2, buffer_arr,
particle_var::l) = new_current_length;
191 = cell_lenghtening_value;
198 return { .begin = begin, .end = begin + 1 };
201 static std::vector<std::string_view>
204 return {
"length",
"mu",
"mu_eff" };
207 static std::vector<std::size_t>
Kokkos::Subview< KernelConcentrationType, int, decltype(Kokkos::ALL)> LocalConcentration
Definition alias.hpp:105
KOKKOS_INLINE_FUNCTION auto sample_random_variables(const pool_type &pool, auto &&functor)
Definition prng.hpp:45
Status
Definition alias.hpp:58
gen_pool_type< Kokkos::DefaultExecutionSpace > pool_type
Definition alias.hpp:39
Kokkos::View< F *[Nd], Kokkos::LayoutRight > ParticlesModel
Definition alias.hpp:19
Models definition.
Definition config_loader.hpp:9
KOKKOS_INLINE_FUNCTION MC::Status check_div(const T l, const T lc)
Definition utils.hpp:19
KOKKOS_INLINE_FUNCTION consteval F c_linear_density(F rho, F d)
Definition utils.hpp:49
Represents a TruncatedNormal (Gaussian) probability distribution.
Definition prng_extension.hpp:362
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
static KOKKOS_INLINE_FUNCTION MC::Status update(const MC::pool_type &random_pool, FloatType d_t, std::size_t idx, const SelfParticle &arr, const MC::LocalConcentration &c)
Definition monod.hpp:123
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:195
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:208
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
Monod Self
Definition monod.hpp:53
static std::vector< std::string_view > names()
Definition monod.hpp:202
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:162
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