To learn how to use ODEs, see this tutorial. Here's is a brief overview of the steps discussed there:
// Define ODEs with basic resource dynamics
this.grid[i][j].alive = 0
ODE setup
// Define ODEs with basic resource dynamics
let resource_dynamics = function (u, k) {
return function (x, y) {
let external = y[0] // The first variable (y[0]) is the external resource concentration, which is taken up with rate u
let internal = y[1] // The second variable (y[1]) is the internal resource concentration, which is used by the cells to divide
return [-u * external, u * external - k * internal]
}
}
// Configuration object with initial states, parameters, and diffusion rates
let ode_config = {
ode_name: "resources",
init_states: [1, 0], // Initial values of external and internal resources
parameters: [0.0, 0.0], // u and k are set to 0.0 by default, as we will make it dependent on cell presence!
diffusion_rates: [0.2, 0.0] // resources diffuse through exteral environment, but internal resources stay inside cells
}
let external = y[0] // The first variable (y[0]) is the external resource concentration, which is taken up with rate u
let internal = y[1] // The second variable (y[1]) is the internal resource concentration, which is used by the cells to divide
return [-u * external, u * external - k * internal]
}let internal = y[1] // The second variable (y[1]) is the internal resource concentration, which is used by the cells to divide
return [-u * external, u * external - k * internal]
init_states: [1, 0], // Initial values of external and internal resources
parameters: [0.0, 0.0], // u and k are set to 0.0 by default, as we will make it dependent on cell presence!
diffusion_rates: [0.2, 0.0] // resources diffuse through exteral environment, but internal resources stay inside cells