I've changed the example to produce some console output from the micromodel, and apparently the micro part only runs once (because afterwards the starting time is higher than the intended finish time). Is that intentional?
Here's the code with print operators:
while instance.reuse_instance():
# F_INIT
t_max = instance.get_setting('t_max', 'float')
dt = instance.get_setting('dt', 'float')
k = instance.get_setting('k', 'float')
msg = instance.receive('initial_state')
U = np.array(msg.data)
t_cur = msg.timestamp
print("Start time "+str(t_cur)+"; dt = "+str(dt))
print("t_max = "+str(t_max))
while t_cur + dt < t_max:
# O_I
# S
U += k * U * dt
t_cur += dt
# O_F
print("Finish time: "+str(t_cur))
print("Time elapsed in the micromodel: "+ str(t_cur - msg.timestamp))
print()
instance.send('final_state', Message(t_cur, None, U.tolist()))
And here's the output:
(muscle3_venv) asvitenkov@node-10n:~/muscle3_source/muscle3-0.2.0/docs/source/examples/python$ python3 ./reaction_diffusion.py
Start time 0.0; dt = 2.469136e-08
t_max = 2.469136e-06
Finish time: 2.469135999999996e-06
Time elapsed in the micromodel: 2.469135999999996e-06
Start time 2.469136e-06; dt = 2.469136e-08
t_max = 2.469136e-06
Finish time: 2.469136e-06
Time elapsed in the micromodel: 0.0
Start time 4.938272e-06; dt = 2.469136e-08
t_max = 2.469136e-06
Finish time: 4.938272e-06
Time elapsed in the micromodel: 0.0
Start time 7.407408e-06; dt = 2.469136e-08
t_max = 2.469136e-06
Finish time: 7.407408e-06
Time elapsed in the micromodel: 0.0
...
I've changed the example to produce some console output from the micromodel, and apparently the micro part only runs once (because afterwards the starting time is higher than the intended finish time). Is that intentional?
Here's the code with print operators:
And here's the output: