Allow skipping setting the RHS to zero in MoL

Create issue
Issue #956 closed
Erik Schnetter created an issue

By default, MoL initialises the RHS variables to zero before calling the CalcRHS routines. This is (a) superfluous in a well-written code, and (b) makes it impossible to re-use a RHS that has been calculated ahead of time, e.g. at the end of the previous time step.

This patch adds a parameter to disable this behaviour.

Keyword:

Comments (6)

  1. Roland Haas
    • removed comment

    The proposed change seems harmless. ok to apply. not clearing has the advantage that any possible poisoning stays visible in regions not overwritten by the use thorn.

  2. Roland Haas
    • removed comment

    Thinking about this a bit more, what happens in the following situation:

    • Carpet poisons new memory incl. the RHS when it is first allocated
    • most thorns put nothing into the ghost zones when computing the RHS, so they stay poisoned
    • in the buffer zones, until the full RK step is done, the poison accumulates possibly creating an overflow and/or triggering a NaN check inside MoL_Add (if it was turned on)

    Is this what would happen?

  3. Erik Schnetter reporter
    • removed comment

    Yes, this is what would happen.

    Without the nan checks, the nans would not cause a problem, except possibly slow things down.

    The upshot is: don't do this; if you don't set all RHS grid points yourself, then don't use this flag.

  4. Log in to comment