This is the second example about diffusion. In this one, we will show that diffusion, coupled with degradation and non-uniform synthesis, can result in concentration gradients.
The code for this example is mostly identical to that of the previous example, therefore we will only explain the parts that differ from the previous example.
In [1]:
%matplotlib notebook
In [2]:
import multicell
import numpy as np
In [3]:
sim = multicell.simulation_builder.generate_cell_grid_sim(20, 1, 1, 1e-3)
In [4]:
sim.register_cell_variable("a")
In [5]:
A = np.array([20] * 10 + [0] * 10)
sim.set_constants({"D_a": 100., "mu_a": 1., "A": A})
In [6]:
def da_dt(simulation, a, c_a, D_a, mu_a, A, adjacency_matrix, **kwargs):
return simulation.diffusion(D_a, c_a, adjacency_matrix) - mu_a * a + mu_a * A
sim.set_ODE("a", da_dt)
The equation is designed so that the system has a steady state, and the total amount of a
in the system at that steady state is independent of the value of mu_a
, the turnover rate. We can therefore safely change the value of mu_a
to modify the turnover without affecting the scale of the concentration values, which is useful for visualization purposes.
In [7]:
sim.initialize_cell_variables()
a0 = A # Same as in the previous example
sim.set_cell_variable("a", a0)
In [8]:
sim.set_duration(4)
sim.set_time_steps(10, "log2")
In [9]:
sim.register_renderer(multicell.rendering.MatplotlibRenderer, "c_a", {"max_cmap": 20, "view": (90, -90), "axes": False})
In [10]:
sim.renderer.display("c_a")
In [11]:
sim.simulate()
In this example, concentrations are no longer uniform at the steady state, as a result of the turnover of species a
.
The competition between diffusion and turnover leads to the formation of concentration gradients around the source of the species. The steepness of the gradient depends on diffusion and turnover rates, relative to each other. The faster the diffusion and the slower the turnover, the smoother the gradient.
Changing the values of D_a
and mu_a
will affect the steady state. Increasing values of mu_a
will increase the turnover rate, while increasing the value of D_a
will increase the diffusion rate.