We are aware of "issues" with TSEvent and appreciate you working on it. Another user reported problems last week https://gitlab.com/petsc/petsc/-/issues/1414 which we resolved in an associated MR, you might want to check those changes to see how/if they would interact with your MR. As that MR indicates we are far from confident that current code is correct.
Barry > On Jul 17, 2023, at 8:22 AM, Ilya Fursov <ilya.foursov....@gmail.com> wrote: > > Dear to whom is may concern, > > A while ago I tried to use TS events in my time stepping code, and I found > erroneous behaviour of the event resolution algorithm. For that particular > example it resulted in long series of extremely small time steps. After > examining the TSEvent handler code, I found some places with obvious errors, > but in general it was difficult to figure out exactly what was going on, and > whether there were other errors. > > I decided to try and fix that stuff myself, and my choice was to refactor the > code from scratch. I abandoned the current (in my opinion, obscure) code > design of TSEventHandler, and wrote my own version, however using some ideas > from the original code. The refactoring mostly affected the algorithmic part > in tsevent.c source file. The original constructors/destructors, > setters/getters have almost not changed. Also, some tiny changes occurred in > ts.c and tsadapt.c, where interaction with events took place. > > I've made a number of tests, ensuring the new code runs smoothly. These tests > also revealed the current/old petsc code results in lots of errors. I didn't > take notes on the exact numbers, but from my impression, the old code failed > in 70%-90% of my tests. > > So, I would like to contribute to the project what I've done. Well, I've > never done such thing before, I hope the process goes smoothly. > I've read the instructions on submitting the code, and one thing I wanted to > ask - > Do I need to start a feature branch from "release" integration branch? > On one hand, I only did bug fixing. On the other hand, I've replaced one > public API function (plus a runtime option), albeit a very small one, which > didn't work well with the logic of the new code. > > Please advise if there might be any other things to consider while submitting > the code. > > Best Regards, > Ilya