<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>I think Jed is right. Rather than giving a list of times, it is better to provide user-defined callback function (or functions?) for detecting the non-smoothness or hitting a time before ts->final_time. MATLAB Ode solvers call these discontinuities as 'EVENTS' and provide callback functions to detect them. http://www.mathworks.com/help/matlab/ref/ode23.html. <div><br></div><div>In the power grid project that I'm involved in, there can be three possibilities (could be more) when the DAE integrator needs to be stopped.<div><br></div><div>i) An exogenous event such as a random disturbance at a given prespecified time.<br>ii) The removal of this disturbance at another prespecified time. (only for analysis)</div><div>iii) The removal of this disturbance due to some switching (switch on/off) based on threshold crossing (the threshold crossing and  switching action could be at the same time or delayed).</div><div>iv) Some switching action due to abnormal conditions.</div><div><br></div><div><span style="font-size: 12pt; ">Later on in the project, we will be passing the states from TS at the end of each time step to a commercial software that decides the switching logic and passes the switching times back to TS PostStep() interface. Thus, there could be a need of stopping TS based on the switching times.</span></div><div><br></div><div>Another example of event detection is in circuit simulation where in the zero crossing of the waveform needs to be detected. </div><div><span style="font-size: 12pt; "><br></span></div><div><span style="font-size: 12pt; ">I think having callback functions for 'EVENTS' would be the right approach.</span></div><div><span style="font-size: 12pt; "><br></span></div><div>I recently requested for a couple of features in TS and Jed, Barry, and Emil kindly :) agreed</div><div>i) <span style="font-size: 12pt; ">The feature of hitting the exact time has been added to the adaptive time-step controller and can be accessed via -ts_exact_final_time MATCHSTEP.</span><span style="font-size: 12pt; "> Note that this is not available with methods that don't use an adaptive controller.</span></div><div><span style="font-size: 12pt; ">ii) TS can be stopped at any given time via TSPostStep() by calling TSSetConvergedReason() with the flag TS_CONVERGED_USER.</span></div><div><span style="font-size: 12pt; "><br></span></div><div><span style="font-size: 12pt; ">Shri</span></div><div><hr id="zwchr"><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;"><div class="gmail_extra">On Mon, Dec 10, 2012 at 8:36 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 I'd the ability to provide to TS a list of times at which I'd like the ODE integrator have exactly match that time on a time-step (that is adjust the delta t near that time to hit it exactly).  This is something Shri needs.</blockquote>
</div><br></div><div class="gmail_extra">Is this general enough to add to the library itself? He can write an adaptive controller that hits any times he wants.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
As a library feature, I'd be more interested in having a controller that attempted to hit the zeros of a user-provided functional (because that could be used for other forms of model nonsmoothness).</div>
</blockquote><br></div></div></div></body></html>