From: Rainer M. <ra...@tb...> - 2006-09-06 16:29:03
|
On Wed, 6 Sep 2006, James Lu wrote: > hi Rainer: > > In looking at the adjoint code again, I saw that IntegratorInstance_reset > calls IntegratorInstance_set, which consists of calls: CvodeData_initialize > and IntegratorInstance_initializeSolver. > > I just found that the bug in running examples/adj_sensitivity.c is associated > with the IntegratorInstance_set called after the forward phase. In fact, what > is need is IntegratorInstance_initializeSolver: CvodeData_initialize > shouldn't be called before the adjoint phase starts. > > Could you tell me circumstances in which IntegratorInstance_reset is used? > And is it possible (perhaps after some reorganization) to have access to > simply IntegratorInstance_initializeSolver...what is the best way to go about > it? > > thanks, > > James Hi James, > circumstances in which IntegratorInstance_reset is used? It is used in iterative forward integration runs, i.e. re-initialization of the solver to initial conditions. After one integration the calling application can either use a completely new settings structure, or just change some settings of the current settings. Then _reset will call CvodeData_initialize to get all initial conditions from the odeModel and then re-init the solver structures. As discussed with you in private emails, it might be a good idea to untangle a first creation of a solver and the reinitialization. The latter is required in two cases: a) a completely new run of the solver, starting with initial conditions at time zero, for this _reset and _set functions can be used b) cases where either the calling application (_setVariableValue) or an event changes an ODE variable during one integration run Actually, once a CVODE solver structure is created from an SBML/odeModel, it can be used as it is forever and only requires CVodeReinit, because the dimensionality NEQ of the problem should not change. The reason this is mixed is mainly because we found the Reinit function only some months ago. This is currently also true for sensitivity analysis, because its dimension NSENS also never can change, as it is done for all constants of the model. However, we plan to have a custom sensitivity analysis, where parameters can be chosen by the calling application. So the sensitivity code requires a different handling and cannot just be reinit-ed during runs because NSENS might change. Rainer |