<jupyter_start><jupyter_text>In this example, we will use Multicell to simulate the self-reorganization of a geometrical Turing pattern, based on equations developed by <NAME>, as the cells of the underlying tissue grow and divide. Preparation<jupyter_code>%matplotlib notebook<jupyter_output><empty_output><jupyter_text>Imports<jupyter_code>import multicell
import numpy as np<jupyter_output><empty_output><jupyter_text>Problem definition Simulation and tissue structure<jupyter_code>sim = multicell.simulation_builder.generate_cell_grid_sim(20, 20, 1, 1e-3)<jupyter_output><empty_output><jupyter_text>Biological species<jupyter_code>sim.register_cell_variable("a")
sim.register_cell_variable("h")<jupyter_output><empty_output><jupyter_text>Computed variables<jupyter_code>def c_a2(c_a, **kwargs):
    return c_a ** 2

sim.register_computed_variable("c_a2", c_a2)<jupyter_output><empty_output><jupyter_text>Constants<jupyter_code>sim.set_constants({"mu_a": 1e-1, "mu_h": 2e-1, "rho_a": 1., "rho_h": 1., "q": 1., "H": 0.35, "A": 0., "D_h": 5., "D_a": 0.025})<jupyter_output><empty_output><jupyter_text>Differential equations<jupyter_code>def da_dt(simulation, a, c_a, c_a2, c_h, D_a, mu_a, rho_a, A, q, adjacency_matrix, **kwargs):
    return simulation.diffusion(D_a, c_a, adjacency_matrix) + rho_a * c_a2 / c_h / (1 + q**2 * c_a2) - mu_a * a + A

def dh_dt(simulation, h, c_a2, c_h, D_h, mu_h, rho_h, H, adjacency_matrix, **kwargs):
    return simulation.diffusion(D_h, c_h, adjacency_matrix) + rho_h * c_a2 - mu_h * h + H

sim.set_ODE("a", da_dt)
sim.set_ODE("h", dh_dt)
sim.initialize_cell_variables()

a0 = np.full(sim.n_cells, 0.789)
h0 = np.full(sim.n_cells, 4.863)

sim.set_cell_variable("a", a0)
sim.set_cell_variable("h", h0)<jupyter_output><empty_output><jupyter_text>DurationThe duration of the simulation is set to a large value to let the system stabilize after each growth and division step.<jupyter_code>sim.set_duration(1e8)<jupyter_output><empty_output><jupyter_text>Tissue growth<jupyter_code>sim.enable_growth(n_steps=11)
sim.register_growth_method(multicell.growth.linear_growth, {"coefficient": [1.1, 1.05, 1.]})<jupyter_output><empty_output><jupyter_text>Cell divisions<jupyter_code>sim.enable_division()
sim.register_division_method(multicell.division.symmetrical_division)
sim.register_division_trigger(multicell.division.volume_trigger, {"volume_threshold": 2.})<jupyter_output><empty_output><jupyter_text>Rendering<jupyter_code>sim.register_renderer(multicell.rendering.MatplotlibRenderer, "c_a", {"max_cmap": 1.3, "view_size": 60, "view": (90, -90), "axes": False})<jupyter_output><empty_output><jupyter_text>Visualization of the initial state<jupyter_code>sim.renderer.display("c_a")<jupyter_output><empty_output><jupyter_text>Simulation<jupyter_code>sim.simulate()<jupyter_output>Growth step #0
Growth of the tissue: 0.591077804565 seconds
Cell divisions: 0.606067895889 seconds
{'fraction_non_alphanumeric': 0.13204951856946354, 'fraction_numerical': 0.03163686382393398, 'mean_word_length': 8.996563573883162, 'pattern_counts': {'":': 15, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '417217', 'license': 'MIT', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1138, 'n_words': 194, 'path': 'examples/07 - Gierer-Meinhardt with growth and divisions.ipynb', 'repo_name': 'pauloernestom/multicell', 'size': '2922'}