Open charleskawczynski opened 5 days ago
What I propose we do is:
post_
-hooks to precompute_
-hooks, and appropriately put 1 precompute hook before each explicit / implicit set of calls-- should be easy.precompute_explicit!
to the very end of the timestep, and conditionally remove the first precompute_explicit!
call, based on whether it's the first step or not. This way, we still have the same number of calls (the last precompute_explicit!
will allow us to share the precomputed variables in the callbacks + the beginning of the next timestep).
There are two fundamental issues with our
post_explicit!
andpost_implicit!
hooks:First, the name is bad in that they convey when in the time marching algorithm they are called, and not what they are actually used for, which is to precompute variables that are shared between multiple function calls.
Second, the implementation is wrong in that it does not allow users to supply different functions to
post_explicit!
andpost_implicit!
. Concretely,post_explcit!
precomputes variables for upcoming implicit stages, before they are run, butpost_explcit!
is also called at the very end of the timestep, in preparation for precomputing variables in the callbacks, and the explicit stage of the next timestep. Therefore, it must contain precomputed quantities for both implicit and explicit. Thepost_implicit!
is called after every newton iteration, which means that it must precompute variables for the next implicit newton iteration, as well as the final explicit update. Therefore,post_implicit!
must also contain precomputed quantities for both implicit and explicit.This is very unfortunate because while the implementation is correct when
post_explicit!
andpost_explicit!
point to the same function that precompute all variables, and the change to this implementation allowed us to reduce the number of totalprecompute
calls by 1, it also resulted in us not being able to split these calls, which could have a more significant impact, especially for implicit simulations with multiple newton iterations.