[petsc-dev] fixing bugs in resolution of TSEvent's

Ilya Fursov ilya.foursov.7bd at gmail.com
Mon Jul 17 07:22:37 CDT 2023


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20230717/cbebf70e/attachment.html>


More information about the petsc-dev mailing list