This model creates 8 cells at each corner of a cube, and one in the middle. The cell in the middle secretes a substance. The cells are modeled to move according to the extracellular gradient; in this case to the middle.
%jsroot on
gROOT->LoadMacro("${BDMSYS}/etc/rootlogon.C");
INFO: Created simulation object 'simulation' with UniqueName='simulation'.
#include "biodynamo.h"
List the extracellular substances
enum Substances { kKalium };
Initialize biodynamo
Simulation simulation("diffusion");
Define the substances that cells may secrete
ModelInitializer::DefineSubstance(kKalium, "Kalium", 0.4, 0, 25);
Create 8 cells in a 2x2x2 grid setup
auto construct = [&](const Double3& position) {
Cell* cell = new Cell(position);
cell->SetDiameter(30);
cell->SetMass(1.0);
cell->AddBehavior(new Chemotaxis("Kalium", 0.5));
return cell;
};
ModelInitializer::Grid3D(2, 100, construct);
The cell responsible for secretion
auto* secreting_cell = new Cell({50, 50, 50});
secreting_cell->AddBehavior(new Secretion("Kalium", 4));
simulation.GetResourceManager()->AddAgent(secreting_cell);
Run simulation for n timesteps
simulation.GetScheduler()->Simulate(300);
std::cout << "Simulation completed successfully!\n";
Simulation completed successfully!
Let's visualize the output!
VisualizeInNotebook();