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#
What a projection stage solves for: the pressure, or its increment over a lagged one. |
|
The projection solver of a pressure split |
Functions#
Raise unless |
|
Solve |
|
Overwrite the rows of |
|
The predictor NSM of a pressure split on the full state ( |
API#
- class zoomy_core.symsolver.strategies.chorin.Projection#
Bases:
zoomy_core.misc.options.OptionWhat 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.HyperbolicTemplateThe projection solver of a pressure split
pred/press/corr, withnsmthe predictorpred;stepis the projection step andmarch,dtandinitial_auxare inherited fromHyperbolicTemplate.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;cflis divided by2 order - 1.Args
pressure_newton:(tol, maxit)for a nonlinear pressure constraint solved by Newton, elseNone.projection: aProjection.
- step(Q, Qaux, p, time, dt, mesh, *, dt_rule=None, dirichlet=None, pressures=None)#
One time step: the outer SSP-RK over projection stages; with
imex=Imex.ssp2every stage solves the implicit source and is then projected.Args
dt_rule: the first stage picksdt.dirichlet:(mask, (P_1, .., P_m)): the pressure solve of SSP-RK stageikeeps the cellsmaskat the pressureP_i(the overlap of a Schwarz-coupled participant,precice_march); not withImex.ssp2.pressures: a list that receives each stage’s pressure.
Returns
(Q, Qaux, dt).
- overlap_rings()#
The fewest overlap rings of
precice_marchin this configuration: 2 per SSP-RK projection stage (the predictor’s flux and its derivative aux each reach one ring further), plus one. Measured at reconstruction order 1 with a one-ring LSQ stencil (gate 54, VAM(1)): one ring less is off by 1e-13 .. 5e-8 in some configurations (the increment projection’s lagged correction reaches one ring further); wider derivative stencils need more.
- precice_march(Q, Qaux, p, time, mesh)#
The march as one preCICE participant coupled by overlapping Schwarz: the mesh reaches across the coupled interface into the peer’s domain (the overlap,
zoomy_core.mesh.overlap), one step per time window of an implicit coupling scheme. Every coupling iteration takes the whole step from the window start, the overlap holding the peer’s state at the window start: the predictor and the aux run over the overlap too (the overlap must be wide enough that their invalid outer rings do not reach the own cells’ stencils), the pressure solve keeps the overlap’s pressure at the peer’s of its last iteration (a Dirichlet subdomain solve) and the participant writes its mirror cells (overlap_states, all rows). preCICE repeats the window until the exchanged data converge; at the fixed point every own-cell equation of the step reads the peer’s values, the single-domain step (to the coupling and pressure tolerances). With several SSP-RK stages (time_order2, 3) the exchanged rows are the state, then each stage’s pressure (the Dirichlet data of that stage’s solve); the overlap must then cover the stencils of every stage (overlap_rings, which the backends enforce). Constant step = the window, reconstruction order 1, no MOOD, no IMEX-SSP2, no implicit diffusion (a second solve over both domains).References
Toselli, Widlund 2005 (overlapping Schwarz), https://doi.org/10.1007/b137868
Chourdakis et al. 2022, https://doi.org/10.12688/openreseurope.14445.2
- stage(Q, Qaux, p, time, dt, mesh, dt_rule=None, dirichlet=None)#
One projection stage: predictor, pressure solve, correction; returns
(Q, dt).Args
dt_rule:dtis chosen only by the predictor’s flux, so the stage keeps the aux it is given.dirichlet: seestep.
- project(Q, p, time, dt, mesh, lag=None, dirichlet=None)#
The pressure solve and the correction of
Q.Args
lag:None: solve for the pressure. Else the lagged pressureP^n: correct with it, solvepresson that state fordP(the corrector is linear in the pressure) and correctQwithP^n + dP.dirichlet:(mask, P): the pressure of the cellsmaskisP(withlag, the increment there isP - P^n).
- 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.check_overlap(template, layers)#
Raise unless
layersoverlap rings covertemplate’s step (overlap_rings).
- zoomy_core.symsolver.strategies.chorin.pressure(press, Q, p, time, dt, mesh, newton=None, dirichlet=None)#
Solve
pressfor its own rows with the rest ofQfrozen: one linear solve (GMRES) of the affine residualA(P) = R(P) - R(0), or Newton from the current pressure withnewton=(tol, maxit).dirichlet=(mask, G): the cellsmaskkeep the pressureG(the rows of the cellsmaskare the identity: the subdomain solve of overlapping Schwarz, the other cells’ equations readingGthere).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
corrby 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 buth,band the pressure rows,pressandcorrsizing the LSQ stencil;reconstructionaReconstructionSpec(default order 1). Pass it withpress,corrto a symbolic Chorin solver’ssetup.