Modify dependent variable in stiff solver (vode)

220 Views Asked by At

I am using the dvode ODE solver from netlib to solve a stiff sparse system (the application is atmospheric chemistry). On the first call of the subroutine dvode completes a set of initialisation tasks, and takes the array of initial value of the dependent variable y as input. In subsequent calls, the routine performs the actual integration and the array y is used as output only.

For various reasons, I need to modify one element of the dependent array y during the integration. As y is used as output for all but the first call to dvode, modifications to the input values of y are ignored. It appears the relevant data are stored in a workspace array.

Is there any way to coerce dvode to let me change the value of the dependent array during the integration? I don't want to mess with the internals of the solver, and if possible I want to avoid altering the workspace arrays, since there may be all kinds of dependencies that will be difficult to foresee. I have tried alternating between initialisation and integration calls, but this makes things much slower.

If there is no clear solution, I would also consider trying another (Fortran-compatible) solver for stiff, highly non-linear ODEs.

0

There are 0 best solutions below