zoomy_core.symsolver.strategies.chorin

zoomy_core.symsolver.strategies.chorin#

The Chorin projection solver, written once for every backend: a hyperbolic predictor, a pressure solve and a correction, from the three systems of the model’s pressure split (pred, press, corr). time_order 2 / 3 wraps stages in SSP-RK2 / RK3 and imex=Imex.ssp2 uses IMEX-SSP2(2,2,2) with projected stages.

Module Contents#

Classes#

Projection

What a projection stage solves for: the pressure, or its increment over a lagged one.

ChorinTemplate

The projection solver of a pressure split pred / press / corr, with nsm the predictor pred; step is the projection step and march, dt and initial_aux are inherited from HyperbolicTemplate.

Functions#

pressure

Solve press for its own rows with the rest of Q frozen: one linear solve (GMRES) of the affine residual A(P) = R(P) - R(0), or Newton from the current pressure with newton=(tol, maxit).

correct

Overwrite the rows of corr by its update formula (the correction by the solved pressure).

predictor_nsm

The predictor NSM of a pressure split on the full state (pad_to_square): positive Rusanov, the hydrostatic rescaling on every row but h, b and the pressure rows, press and corr sizing the LSQ stencil; reconstruction a ReconstructionSpec (default order 1). Pass it with press, corr to a symbolic Chorin solver’s setup.

API#

class zoomy_core.symsolver.strategies.chorin.Projection#

Bases: zoomy_core.misc.options.Option

What a projection stage solves for: the pressure, or its increment over a lagged one.

Initialization

Initialize self. See help(type(self)) for accurate signature.

standard#

‘standard’

increment#

‘increment’

class zoomy_core.symsolver.strategies.chorin.ChorinTemplate(pred, press, corr, *, cfl, time_order=1, pressure_newton=None, projection=Projection.standard, **config)#

Bases: zoomy_core.symsolver.strategies.hyperbolic.HyperbolicTemplate

The projection solver of a pressure split pred / press / corr, with nsm the predictor pred; step is the projection step and march, dt and initial_aux are inherited from HyperbolicTemplate.

References

  • Chorin 1968, https://doi.org/10.1090/S0025-5718-1968-0242392-2

  • Almgren, Bell, Crutchfield 2000, https://doi.org/10.1137/S1064827599357024

Initialization

Set the split and the configuration of HyperbolicTemplate; cfl is divided by 2 order - 1.

Args

  • pressure_newton: (tol, maxit) for a nonlinear pressure constraint solved by Newton, else None.

  • projection: a Projection.

step(Q, Qaux, p, time, dt, mesh, *, dt_rule=None)#

One time step: the outer SSP-RK over projection stages; with imex=Imex.ssp2 every stage solves the implicit source and is then projected.

Args

  • dt_rule: the first stage picks dt.

Returns

(Q, Qaux, dt).

abstract precice_march(*args, **kwargs)#

Not supported: raises NotImplementedError.

stage(Q, Qaux, p, time, dt, mesh, dt_rule=None)#

One projection stage: predictor, pressure solve, correction; returns (Q, dt).

Args

  • dt_rule: dt is chosen only by the predictor’s flux, so the stage keeps the aux it is given.

project(Q, p, time, dt, mesh, lag=None)#

The pressure solve and the correction of Q.

Args

  • lag: None: solve for the pressure. Else the lagged pressure P^n: correct with it, solve press on that state for dP (the corrector is linear in the pressure) and correct Q with P^n + dP.

predictor(Q, Qaux, p, time, dt, mesh, dt_rule=None)#

Euler flux step, then the implicit slots as Lie sub-steps (implicit with imex, else explicit Euler); returns (Q, dt).

zoomy_core.symsolver.strategies.chorin.pressure(press, Q, p, time, dt, mesh, newton=None)#

Solve press for its own rows with the rest of Q frozen: one linear solve (GMRES) of the affine residual A(P) = R(P) - R(0), or Newton from the current pressure with newton=(tol, maxit).

References

  • Saad, Schultz 1986, https://doi.org/10.1137/0907058

  • Knoll, Keyes 2004, https://doi.org/10.1016/j.jcp.2003.08.010

zoomy_core.symsolver.strategies.chorin.correct(corr, Q, p, time, dt, mesh)#

Overwrite the rows of corr by its update formula (the correction by the solved pressure).

zoomy_core.symsolver.strategies.chorin.predictor_nsm(pred, press, corr, reconstruction=None)#

The predictor NSM of a pressure split on the full state (pad_to_square): positive Rusanov, the hydrostatic rescaling on every row but h, b and the pressure rows, press and corr sizing the LSQ stencil; reconstruction a ReconstructionSpec (default order 1). Pass it with press, corr to a symbolic Chorin solver’s setup.