Is it possible to start/stop advance a simulation? #2461
-
|
I've looked through the documentation a bit, and haven't found any examples of simulations that start/stop in a loop. Is this paradigm supported? For example, would this slightly modified example work to chop the simulation in 100 pieces: import arbor as A
# Get a communication context (with 4 threads, no GPU)
context = A.context(threads=4, gpu_id=None)
# Initialise a recipe of user-defined type my_recipe with 100 cells.
n_cells = 100
recipe = my_recipe(n_cells)
# Get a description of the partition of the model over the cores.
decomp = A.partition_load_balance(recipe, context)
# Instantiate the simulation.
sim = A.simulation(recipe, decomp, context)
# Run the simulation for 2000 ms with a time step of 0.025 ms
tSim = 2000 * U.ms
dt = 0.025 * U.ms
for i in range(100):
sim.run(tSim / 100 * i, dt)
print("Time to do something super important in Python before continuing") |
Beta Was this translation helpful? Give feedback.
Answered by
thorstenhater
May 9, 2025
Replies: 1 comment
-
|
Hi @filimarc, absolutely, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
filimarc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @filimarc,
absolutely,
sim.run(tfinal=T)will advance the simulation object's state until timeTregardless of its internal time.So, your example will run
[0, 0*tSim/100),[0*tSim/100, 1*tSim/100),[1*tSim/100, 2*tSim/100), ...