zoomy_core.symsolver.discretization.residual

zoomy_core.symsolver.discretization.residual#

The semi-discrete residual and the pieces of one time step, written once for every backend: RK stage, MOOD, aux, implicit slots and hygiene. They compose the vocabulary and are composed by the strategies.

Module Contents#

Functions#

residual

Semi-discrete right-hand side -div(face terms) - interior NCP, plus the explicit source and diffusion slots, and the implicit ones unless an implicit stage takes them.

stage_aux

Pointwise aux of a stage state (e.g. hinv = 1/h).

explicit_step

One SSP-RK step of the method of lines, of order rk (default the reconstruction order).

mood_step

A-posteriori MOOD: an order-2 candidate step, inadmissible cells redone at first order, and the whole step at first order if that still fails; the repairs keep the candidate’s dt.

full_aux

Pointwise aux, then the derivative (mesh-gradient) aux, whose boundary samples are the BC ghosts at time.

derivative_rows

(rows, functions): the state rows the derivative aux differentiates (static tuple) and whether it differentiates aux functions too.

post_step

Model hygiene on the new state, then its aux; returns (Q, Qaux).

implicit_source

Implicit Euler on the source at time, Y - Q - dt S(Y, aux(Y)) = 0, by a per-cell root solve with the derivative aux frozen at Q.

implicit_step

The SystemModel’s implicit slots over the step ending at time: implicit diffusion, then implicit Euler on the source.

imex_step

One step of the IMEX Runge-Kutta tableau: each stage is an explicit (MOOD-guarded) Euler step of the residual without implicit slots plus a per-cell Newton solve of the implicit source.

API#

zoomy_core.symsolver.discretization.residual.residual(nsm, Q, Qaux, p, time, dt, mesh, order, demote=False, coupled=None, implicit_terms=True, dt_rule=None)#

Semi-discrete right-hand side -div(face terms) - interior NCP, plus the explicit source and diffusion slots, and the implicit ones unless an implicit stage takes them.

Args

  • demote: MOOD demotion of the reconstruction (see reconstruct).

  • coupled: (mask, flux), faces carrying a shared answer.

  • dt_rule: dt is not known yet; the face kernel also returns the wave speed S and dt = dt_rule(S).

Returns

dQ, or (dQ, dt) with dt_rule.

References

  • LeVeque 2002, https://doi.org/10.1017/CBO9780511791253

  • Pares 2006, https://doi.org/10.1137/050628052

zoomy_core.symsolver.discretization.residual.stage_aux(nsm, Q, Qaux, p, time, dt, mesh)#

Pointwise aux of a stage state (e.g. hinv = 1/h).

zoomy_core.symsolver.discretization.residual.explicit_step(nsm, Q, Qaux, p, time, dt, mesh, order, demote=False, coupled=None, implicit_terms=True, rk=None, dt_rule=None)#

One SSP-RK step of the method of lines, of order rk (default the reconstruction order).

Args

  • dt_rule: the first stage picks dt from its own face wave speeds.

Returns

Q, or (Q, dt) with dt_rule.

References

  • Shu, Osher 1988, https://doi.org/10.1016/0021-9991(88)90177-5

  • Gottlieb et al. 2001, https://doi.org/10.1137/S003614450036757X

zoomy_core.symsolver.discretization.residual.mood_step(nsm, Q, Qaux, p, time, dt, mesh, order, coupled=None, implicit_terms=True, rk=None, dt_rule=None)#

A-posteriori MOOD: an order-2 candidate step, inadmissible cells redone at first order, and the whole step at first order if that still fails; the repairs keep the candidate’s dt.

References

  • Clain et al. 2011, https://doi.org/10.1016/j.jcp.2011.02.026

zoomy_core.symsolver.discretization.residual.full_aux(nsm, Q, Qaux, p, time, dt, mesh)#

Pointwise aux, then the derivative (mesh-gradient) aux, whose boundary samples are the BC ghosts at time.

zoomy_core.symsolver.discretization.residual.derivative_rows(nsm)#

(rows, functions): the state rows the derivative aux differentiates (static tuple) and whether it differentiates aux functions too.

zoomy_core.symsolver.discretization.residual.post_step(nsm, Q, Qaux, p, time, dt, mesh)#

Model hygiene on the new state, then its aux; returns (Q, Qaux).

zoomy_core.symsolver.discretization.residual.implicit_source(nsm, Q, Qaux, p, time, dt, mesh)#

Implicit Euler on the source at time, Y - Q - dt S(Y, aux(Y)) = 0, by a per-cell root solve with the derivative aux frozen at Q.

zoomy_core.symsolver.discretization.residual.implicit_step(nsm, Q, Qaux, p, time, dt, mesh)#

The SystemModel’s implicit slots over the step ending at time: implicit diffusion, then implicit Euler on the source.

zoomy_core.symsolver.discretization.residual.imex_step(nsm, Q, Qaux, p, time, dt, mesh, order, tableau, mood=False, coupled=None, dt_rule=None, project=None)#

One step of the IMEX Runge-Kutta tableau: each stage is an explicit (MOOD-guarded) Euler step of the residual without implicit slots plus a per-cell Newton solve of the implicit source.

Args

  • project: Chorin: project(Y, time, dt, i) -> (Y', B) maps stage i (the final combination: i omitted) onto the constraint, B = Y' - Y on the corrected rows.

  • dt_rule: dt from the cell states’ wave speeds; returns (Q, dt).

References

  • Pareschi, Russo 2005, https://doi.org/10.1007/s10915-004-4636-4