-
Notifications
You must be signed in to change notification settings - Fork 28
How do I reset the solver upon a step input
The ODE solver employed in D2D uses automatic step size control. Although this typically allows for efficient numerical simulation of the initial value problem, this can be problematic when the inputs are discontinuous. In such cases, the simulation may skip over aforementioned events. Rather than limiting the maximum step size manually, it is better specify such events. This signals the solver to only integrate up to the point of the event and then re-initialize the integrator to perform the remainder of the simulation.
In D2D, there are two ways to deal with discontinuous input functions. One is via the event system (see [Advanced events and pre-equilibration](Advanced events and pre-equilibration)), the other is via input functions. The former is more flexible, while the latter is typically easier to use. This wiki page will show the required information to be able to use the latter.
For this purpose, we use the following model:
DESCRIPTION
"Simple pulse test"
PREDICTOR
t T min time 0 200
COMPARTMENTS
cyt V pl vol. 1
STATES
stateA C nmol/l conc. cyt 1
INPUTS
pulse C nmol/l conc. "step2(t,10,50,0,100,10)"
REACTIONS
-> stateA CUSTOM "pulse"
stateA -> CUSTOM "1.0"
DERIVED
OBSERVABLES
A_obs C au conc. 1 1 "stateA"
ERRORS
A_obs "1.0"
CONDITIONS
init_stateA "0"
Now compile, simulate and plot the system using the following commands:
arInit;
arLoadModel('pulseTest');
arCompileAll;
arPlot;
From the plot it can be concluded that the simulation completely skips over the simulation. To avoid this, add events at the points of discontinuity. In order to automatically scan for events in the inputs, invoke arFindInputs
. This command will scan the model inputs for step1 and step2 commands and add events at these points.
arFindInputs;
arPlot;
From the plot, it can be concluded that the events are now properly taken into account. Note that this approach only accounts for discontinuities due to step functions in the inputs. Other types of discontinuities are not covered by arFindInputs
and require use of the actual event system described in [Advanced events and pre-equilibration](Advanced events and pre-equilibration).
- Installation and system requirements
- Setting up models
- First steps
- Advanced events and pre-equilibration
- Computation of integration-based prediction bands
- How is the architecture of the code and the most important commands?
- What are the most important fields of the global variable ar?
- What are the most important functions?
- Optimization algorithms available in the d2d-framework
- Objective function, likelhood and chi-square in the d2d framework
- How to set up priors?
- How to set up steady state constraints?
- How do I restart the solver upon a step input?
- How to deal with integrator tolerances?
- How to implement a bolus injection?
- How to implement washing and an injection?
- How to implement a moment ODE model?
- How to run PLE calculations on a Cluster?