I am making a population distribution model with ODEs and DDEs in DeSolve with the method lsoda. In this model I want to have an influx of the population at a specific time (a specific day). A very simple example:
dn1dt=influx - mortality
The influx (x) needs to occur at time (t) = y (in days). If it is not day y, I don't want an influx.
At the moment I have written the influx as influx=function(t,y,x){ifelse((t==y), x, 0))
, but I am running into the problem of a changing time step due to the method I am using (lsoda). Due to the changing time step, I will not hit the specific time (y) that will trigger the influx.
I am just starting out to work with a changing time step, so I am not sure how to deal with this problem. Please let me know if anything is unclear.