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#
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. |
|
Pointwise aux of a stage state (e.g. |
|
One SSP-RK step of the method of lines, of order |
|
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 |
|
Pointwise aux, then the derivative (mesh-gradient) aux, whose boundary samples
are the BC ghosts at |
|
|
|
Raise at setup on a derivative aux the backend would read as 0: an entry of a
system’s |
|
Model hygiene on the new state, then its aux; returns |
|
Implicit Euler on the source at |
|
The SystemModel’s implicit slots over the step ending at |
|
The implicit part of an IMEX-RK stage at |
|
One step of the IMEX Runge-Kutta |
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, split_diffusion=False)#
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 (seereconstruct).coupled:(mask, flux), faces carrying a shared answer.dt_rule:dtis not known yet; the face kernel also returns the wave speedSanddt = dt_rule(S); with the order-2 edge source at mostdt_ruleof the cells’ own speeds too, as that term moves the cell states (ANALYSIS 48).split_diffusion: withoutimplicit_terms, the implicit diffusion’s part beyond its two-point fluxes (diffusion_correction) stays explicit, here (IMEX-RK: the two-point part is the stage’s implicit term).
Returns
dQ, or(dQ, dt)withdt_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, split_diffusion=False)#
One SSP-RK step of the method of lines, of order
rk(default the reconstruction order).Args
dt_rule: the first stage picksdtfrom its own face wave speeds.split_diffusion: seeresidual.
Returns
Q, or(Q, dt)withdt_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, split_diffusion=False)#
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; withdt_rule(the step from the face wave speeds) at most that, from their own face speeds, as the candidate’s are those of the order-2 states and do not bound the first-order Riemann problems (ANALYSIS 48).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, coupled=None)#
Pointwise aux, then the derivative (mesh-gradient) aux, whose boundary samples are the BC ghosts at
time;coupled:(own, face)per coupled face, whose ghost samples are then the mirror images2 face - ownof the coupling’s face states.
- 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.check_derivative_aux(systems, targets, backend)#
Raise at setup on a derivative aux the backend would read as 0: an entry of a system’s
aux_registry/aux_input_registrythat is not a plainderivative(alimited_derivativeno symbolic solver computes), or whose target this backend does not differentiate (targets, e.g.("state", "function");unknown: a compound such ash*zetathat no backend computes, which the model must write by the chain rule over its state rows).Args
systems: the NSMs the backend runs (a Chorin split: predictor, pressure, corrector).targets: thetarget_kinds ofderivativeentries this backend computes.backend: its name, for the message.
- 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 atQ.
- 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.implicit_stage(nsm, Y, Qaux, p, time, dt, mesh)#
The implicit part of an IMEX-RK stage at
timeoverdt(A_iitimes the step):X - Y - dt (D(X) + S(X)) = 0,Dthe two-point part of the implicit diffusion (diffusion_tpfa),Sthe implicit source. Without diffusion a per-cell root (implicit_source), else one Newton solve over the mesh with the pointwise aux following the iterate and the derivative aux frozen atY.References
Pareschi, Russo 2005, https://doi.org/10.1007/s10915-004-4636-4
Knoll, Keyes 2004, https://doi.org/10.1016/j.jcp.2003.08.010
- 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 the implicit solve of the stage (implicit_stage). The implicit partgis the source and the two-point part of the implicit diffusion; the rest of that diffusion’s flux (diffusion_correction, zero in 1-D and on Cartesian faces without mixed entries) is in the explicit partf.Args
project: Chorin:project(Y, time, dt, i) -> (Y', B)maps stagei(the final combination:iomitted) onto the constraint,B = Y' - Yon the corrected rows.dt_rule:dtfrom the cell states’ wave speeds; returns(Q, dt).
References
Pareschi, Russo 2005, https://doi.org/10.1007/s10915-004-4636-4