Separate agents and diffusion time scales

Hi everyone, a question loosely related to this one: can I separate the diffusion time scale from that of the agents’ behaviours? From my understanding, the diffusion grids are updated at every time step according to the variable dt_ = 1. To make the diffusion process more accurate/stable, it could be necessary to scale down the diffusion constant and the degradation rate, and in that case a time step instead of representing e.g. 1 hour would be equivalent to 1 second or 0.1 second. However, this shouldn’t influence the agents’ behaviours (i.e. I want the agents to keep on dividing once per hour). What’s the best way to tell the agents to wait e.g. 3599 time steps until the next Run() of the divide behaviour?

Thank you

Hi @nicogno,

Diffusion is an Operation in BioDynaMo, and as such, you can set it’s frequency (which is 1 for all Operations by default). See:

So for diffusion that would look something like:

auto* scheduler = Simulation::GetActive()->GetScheduler();
auto* diffusion_op = scheduler->GetOps("diffusion")[0];
diffusion_op->frequency_ = 3599;

A list of all the default operations can be found in the file.


1 Like

Hi Nicolo,

I just stumbled across this post and saw that you said the diffusion updates with dt_=1.0. If you’re running on the latest master, we just pushed an update such that the diffusion uses the same time step as the simulation (as specified in the parameters). By default, this is 0.01. So depending on if you use the simulation time step somewhere in your ABM or not, you can modify either your diffusion coefficient or the simulation time step to obtain the same results as before. Anyway, Ahmad’s answer remains valid.

Best, Tobi

1 Like

Hi Tobias,

definitely helpful!

Thank you,