TrixiParticles.jl icon indicating copy to clipboard operation
TrixiParticles.jl copied to clipboard

Handling mandatory callbacks for specific methods

Open LasNikas opened this issue 1 year ago • 6 comments

For some methods such as TVF and OpenBC an update each full time step is necessary. That makes the update callback in #440 mandatory for a simulation.

We can't just check , e.g. in the Semidiscretization, whether the update callback is in the callbackset or not since the callbackset is directly passed to solve.

@efaulhaber @svchb any thoughts on that?

LasNikas avatar Apr 03 '24 13:04 LasNikas

I can't think of anything. @sloede ?

efaulhaber avatar Apr 04 '24 09:04 efaulhaber

A possible workaround might be TrixiParticlesCallbackSet(semi, callbacks...) I have no better idea...

LasNikas avatar Apr 04 '24 10:04 LasNikas

Solved in #442, right? The methods requiring callbacks have a flag callback_used, which is updated in the initialization of the callback. If not, an error will be thrown.

efaulhaber avatar Jun 19 '24 08:06 efaulhaber

yes, exactly.

LasNikas avatar Jun 19 '24 09:06 LasNikas

However, the problem is - as discussed in #442 - :

one can run one proper simulation with a system and then reuse this system for simulations without UpdateCallback.

LasNikas avatar Jun 19 '24 12:06 LasNikas

Our solution for this now is to reset the flag callback_used to false in semidiscretize and in restart_with!. This still doesn't prevent users from solving the same ODEProblem again without the callback, but this really is an edge case.

efaulhaber avatar Jun 20 '24 07:06 efaulhaber