From: Rainer M. <ra...@tb...> - 2008-10-27 09:12:28
|
Hi Eric, Yes, you are right here! We had realized this problem - unlike we thought/hoped previously such discontinuities in the right-hand-side also require re-initialization of the solver. Actually, in the current CVS the IntegratorInstance_setVariableValue() responds directly to the ResetCvodeOnEvent option (instead of the event processing function as previously). Now that you provide an example where this really shows the expected problems, I guess we should rename this option, or remove it completely and use resetting as default behaviour. Thanks, Rainer On Sat, 25 Oct 2008, Eric Fernandez wrote: > Hi, > > I think I have solved an issue using integratorInstance_setVariableValue(). In one of my simulations, I was "injecting" at every step of an integration (at each loop of the while(!IntegratorInstance_timeCourseCompleted(engine){IntegratorInstance_integrateOneStep(engine)}) of a program similar to the odeSolver) the value of one parameter of my model, to simulate the timecourse of a drug injected in a cell, which was read from an external file, as a map<double, double> representing <time, drug_concentration>. > > The first simulations leaded to many integration solving errors such as "At t = 5.01293 and h = 5.14192e-08, the error test failed repeatedly or with |h| = hmin.", etc... > > I had the idea to use the same technique than for the ResetCvodeOnEvent, using engine->valid = 0; at each step of the integration, because after all the effect of setVariableValue is equivalent to an event: forcing arbitrarily the change of a model variable value. And then it worked wonderfully with no error at all! I would suggest that this Reset should therefore be performed after each use of integratorInstance_setVariableValue(). Otherwise, is there any reason not to do it ? I did not notice significant slowdown. Rainer, what do you think ? I did not want to do any change to the CVS before you could review this "trick" as I was unsure if there may be some collateral damage (can it lead to undetected false integration values ?) forcing a reset in this case. > > Regards, > Eric > |