Skip to content

Fix OneStepMethod's initial guess.

Michal Tóth requested to merge bugfix/onestepmethod-initialguess into master

Fix 2 joined bugs. Make constrained case of OneStepMethod::apply use xnew as initial guess. Fixed GridOperator::interpolate edge case when &xold==&x.

Note that applying changes to OneStepMethod without changing interpolate breaks it because the initial guess is rewritten by the initial/boundary condition function in the one-stage method.

Long version: -OneStepMethod has two apply(...) functions. The simpler one handles unconstrained solutions and correctly uses xnew as the initial guess in the first stage. The second apply function handles constrained solutions and uses an extra interpolate step to have the correct boundary condition. As the initial guess it always chooses the previous stage. We fix that to use xnew in stage 1. -OneStepMethod delegates the interpolate to its IGOS -InstationaryGridOperatorSomething. In my case, it is OneStepGridOperator that sets time for local_assembler, and calls GridOperator::interpolate. -GridOperator::interpolate calls generic Dune::PDELab::interpolate that rewrites x with initial/boundary condition function and GridOperator then rewrites unconstrained DoFs with provided vector. If both target and source vectors (named x, xold) are references to the same vector, they end up equal to the initial/boundary function. This is the second fixed bug. If they are referring to the same vector, a temporary is created to store values of the source vector. -Methods that have one stage, e.g. implicit Euler method, are affected by both bugs. Correcting the initial guess in OneStepMethod makes the bug in the GridOperator::interpolate show itself.

Merge request reports