zoomy_core.symsolver.vocabulary

zoomy_core.symsolver.vocabulary#

The finite-volume vocabulary of the hyperbolic solver: one Block per mesh operation, implemented under the same name by every backend. Arrays are (rows, cells) or (rows, faces), faces meaning all faces in mesh order, and mesh is always an argument.

Module Contents#

Classes#

cells

(kernel, Q, Qaux, p, time, dt, mesh) -> kernel in every cell, with time, dt and the cell centre passed when the kernel declares them.

faces

(kernel, QL, QR, AL, AR, p, mesh) -> kernel on every face with its unit normal (owner to neighbour, outward at a boundary).

face_aux

(Qaux, mesh) -> (AL, AR), the owner and neighbour aux per face (the inner cell on both sides at a boundary).

face_wavespeed

(kernel, Q, Qaux, p, mesh) -> max |eigenvalue| per face over its two cells.

face_inradius

(mesh) -> per-face cell size: min inradius of the adjacent cells.

boundary_states

(ghost, Q, Qaux, p, time, mesh) -> (Qg, Qauxg): the ghost state per boundary face (kernel boundary_ghost_state) and the inner cell’s aux.

boundary_ghosts

(ghost, Q, Qaux, p, time, mesh) -> the ghost per boundary face, as boundary_states without the aux.

boundary_traces

(bc, Q, QL, QR, Qaux, p, time, mesh) -> QR holding the outer face state bc(QL) on boundary faces (the partner face’s QL on a periodic seam).

pointwise

(kernel, X, Xaux, p) -> the kernel in every column of X (cells, faces or boundary faces); no time, step or position.

cell_traces

(Q, mesh) -> (QL, QR), the owner’s and neighbour’s cell value per face; QR on a boundary face is a placeholder for boundary_traces.

gradient

(W, Wg, mesh) -> LSQ gradient of every row of W per cell, boundary faces closed from the ghost values Wg. (W, Wg, (eta, h), eps, mesh): in row eta a neighbour k with W[h, k] <= eps enters cell i’s stencil as min(W[eta, k], W[eta, i]) (the hydrostatic extension of the free surface, reconstruction. shore_extension).

minmod

(rows, W, Wg, G, mesh) -> limiter factors in [0, 1] per row and cell (1 off rows): the largest keeping every face extrapolation within the bounds of the face neighbours and boundary ghosts Wg. (rows, W, Wg, G, (eta, h), eps, mesh): the bounds of row eta from the neighbour values of gradient’s shore form.

venkatakrishnan

As minmod, the smooth Venkatakrishnan factor (eps^2 = h^2).

barth_jespersen

As minmod, the Barth-Jespersen factor.

front_cells

(Q, G, phi, (depth, w), tol, mesh) -> cell mask: the cells whose depth h_f = Q[depth] + phi[depth] G[w] . r_f falls below -(1/tol - 1) Q[depth] at a face f (G the gradients of the reconstruction variables, phi their limiter factors, r_f from the cell centre to the face centre), i.e. whose positivity factor h / (h - min_f h_f) is below tol.

extrapolate

(W, G, phi, mesh) -> (WL, WR): each cell’s W moved to the face centre by phi * G; WR on a boundary face is a placeholder for boundary_traces.

divergence

(Wm, Wp, mesh) -> per cell sum_f |f| Wm / |V| over the faces it owns plus |f| Wp / |V| over the faces it neighbours.

edge_source

(kernel, Q, QL, QR, Qaux, p, mesh) -> per cell the interior nonconservative integral over each of its edges (order >= 2).

derivative_aux

(spec, Q, Qaux, mesh[, Qg, rows]) -> Qaux with the derivative rows of spec refilled from mesh gradients; with rows, only those states’ derivatives, their boundary faces taken from the ghosts Qg.

put

(Q, rows, values) -> Q with the static state rows rows replaced.

take

(Q, rows) -> the static state rows rows of Q.

zeros

(n, mesh) -> an (n, cells) array of zeros.

diffusion

(kernel, bc, Q, Qaux, p, time, mesh) -> per cell div(A grad Q) of the diffusion tensor kernel (explicit; RHS sign, A > 0 diffuses), face flux n.A.grad_f: the two-point flux plus a correction, grad_f the mean of the two cells’ LSQ gradients with the two-point difference as its part along the cell-to-cell vector (boundary faces: the ghost of bc, the tangential part from the cell gradient). A cut face (distributed) carries no flux.

diffusion_tpfa

(kernel, bc, Q, Qaux, p, time, mesh) -> per cell the two-point part of diffusion: per face n.A.n (Q_out - Q_in) / d, A the mean of the two cells’ tensors, Q_out the BC ghost across a boundary face, the partner cell across a periodic seam.

diffusion_correction

(kernel, bc, Q, Qaux, p, time, mesh) -> per cell the rest of diffusion beyond diffusion_tpfa (the tangential and non-orthogonal part of the face flux; zero in 1-D), so that diffusion = diffusion_tpfa + diffusion_correction.

implicit_diffusion

(kernel, bc, Q, Qaux, p, time, dt, mesh) -> one Crank-Nicolson step of the two-point part of diffusion from time to time + dt, its correction explicit at Q (deferred correction).

inadmissible

(kernel, Q, Qaux, p) -> cell mask: an admissibility row < 0 or a non-finite value.

clean_round_off

(Q, rows, tol) -> Q with the entries of the static rows in [-tol, 0) set to 0 (round-off below zero of a quantity declared non-negative).

halo

(X, mesh) -> X with the copies of other ranks’ cells current (serial: X); after every stencil update.

minimum

(a, b) -> elementwise minimum, NaN propagating, for graph-valued arguments (sp.Min would walk a shared graph as a tree).

reduce_min

Global minimum (all ranks).

reduce_max

(X) -> the largest entry (NaN propagates).

reduce_any

Global any (all ranks).

select

(mask, A, B) -> A where mask else B, per cell or per face.

coupled_faces

(mesh) -> face mask of the coupled boundary faces.

interface_states

(Q, mesh) -> states of the cells next to the coupled faces.

interface_flux

(sides, aux, side, Q, Qaux, peer, p, mesh) -> per face this participant’s row of one Riemann problem posed low -> high (row 0 for side = 0), zero off the coupled faces; both sides pose the same problem.

lifted_interface_flux

(sides, aux, n_aux, side, own, peer, rows, p, mesh) -> per face the rows rows of this participant’s side of one Riemann problem posed low -> high in the model of sides (the interface model) on the interface states own, peer ((rows of that model, coupled faces)), the aux rebuilt from each state alone (aux on a zero aux of n_aux rows; aux False: the zero aux); zero off the coupled faces. Both sides pose the same problem.

characteristic_ghost

(A, own, Aown, peer, p, mesh) -> per coupled face the transmission state towards a peer of another model: with A_n = sum_d A(own, Aown)[:, :, d] n_d (A the quasilinear matrix kernel, n the outward normal) the characteristics l_k . q that enter (lambda_k < 0) from peer, those that leave from own; peer where the eigenvectors of A_n are singular, own where peer is all zero (no peer data yet). own, Aown, peer and the result are (rows, coupled faces).

ghost_flux

(sides, aux, own, Aown, ghost, p, mesh) -> per face the own cell’s row of the Riemann problem (own, ghost) posed along the outward normal of the coupled faces, zero elsewhere; Aown on the own side, aux(ghost) on the other (the pointwise aux formula on a zero aux; aux False: Aown). own, Aown, ghost are (rows, coupled faces).

replace_row

(A, i, B) -> A with row i taken from B.

coupled_ghosts

(Qg, own, face, mesh) -> the boundary ghosts Qg with the coupled faces’ replaced by 2 face - own (own, face: (rows, coupled faces)).

overlap_cells

(mesh) -> cell mask of the overlap: the cells across the coupled interface that hold the peer’s values.

overlap_states

(Q, mesh) -> (rows, mirror cells): the own cells the peer holds as its overlap.

overlap_fill

(Q, peer, mesh) -> Q with the overlap cells’ columns from peer (rows, overlap cells).

io

Output effects; save_state / load_state: the restart pair of the march state.

couple

Effects of one preCICE participant.

check

Run-time checks.

Functions#

march_error

The message of a failed check.march, or None: the march stopped before time_end (a step that does not advance the time) or ended with a non-finite state (q_max = max |Q|). The C++ runtimes print the same text (rt_common.H).

API#

class zoomy_core.symsolver.vocabulary.cells#

Bases: zoomy_core.symsolver.core.Block

(kernel, Q, Qaux, p, time, dt, mesh) -> kernel in every cell, with time, dt and the cell centre passed when the kernel declares them.

class zoomy_core.symsolver.vocabulary.faces#

Bases: zoomy_core.symsolver.core.Block

(kernel, QL, QR, AL, AR, p, mesh) -> kernel on every face with its unit normal (owner to neighbour, outward at a boundary).

class zoomy_core.symsolver.vocabulary.face_aux#

Bases: zoomy_core.symsolver.core.Block

(Qaux, mesh) -> (AL, AR), the owner and neighbour aux per face (the inner cell on both sides at a boundary).

class zoomy_core.symsolver.vocabulary.face_wavespeed#

Bases: zoomy_core.symsolver.core.Block

(kernel, Q, Qaux, p, mesh) -> max |eigenvalue| per face over its two cells.

class zoomy_core.symsolver.vocabulary.face_inradius#

Bases: zoomy_core.symsolver.core.Block

(mesh) -> per-face cell size: min inradius of the adjacent cells.

class zoomy_core.symsolver.vocabulary.boundary_states#

Bases: zoomy_core.symsolver.core.Block

(ghost, Q, Qaux, p, time, mesh) -> (Qg, Qauxg): the ghost state per boundary face (kernel boundary_ghost_state) and the inner cell’s aux.

class zoomy_core.symsolver.vocabulary.boundary_ghosts#

Bases: zoomy_core.symsolver.core.Block

(ghost, Q, Qaux, p, time, mesh) -> the ghost per boundary face, as boundary_states without the aux.

class zoomy_core.symsolver.vocabulary.boundary_traces#

Bases: zoomy_core.symsolver.core.Block

(bc, Q, QL, QR, Qaux, p, time, mesh) -> QR holding the outer face state bc(QL) on boundary faces (the partner face’s QL on a periodic seam).

class zoomy_core.symsolver.vocabulary.pointwise#

Bases: zoomy_core.symsolver.core.Block

(kernel, X, Xaux, p) -> the kernel in every column of X (cells, faces or boundary faces); no time, step or position.

class zoomy_core.symsolver.vocabulary.cell_traces#

Bases: zoomy_core.symsolver.core.Block

(Q, mesh) -> (QL, QR), the owner’s and neighbour’s cell value per face; QR on a boundary face is a placeholder for boundary_traces.

class zoomy_core.symsolver.vocabulary.gradient#

Bases: zoomy_core.symsolver.core.Block

(W, Wg, mesh) -> LSQ gradient of every row of W per cell, boundary faces closed from the ghost values Wg. (W, Wg, (eta, h), eps, mesh): in row eta a neighbour k with W[h, k] <= eps enters cell i’s stencil as min(W[eta, k], W[eta, i]) (the hydrostatic extension of the free surface, reconstruction. shore_extension).

References

class zoomy_core.symsolver.vocabulary.minmod#

Bases: zoomy_core.symsolver.core.Block

(rows, W, Wg, G, mesh) -> limiter factors in [0, 1] per row and cell (1 off rows): the largest keeping every face extrapolation within the bounds of the face neighbours and boundary ghosts Wg. (rows, W, Wg, G, (eta, h), eps, mesh): the bounds of row eta from the neighbour values of gradient’s shore form.

References

class zoomy_core.symsolver.vocabulary.venkatakrishnan#

Bases: zoomy_core.symsolver.core.Block

As minmod, the smooth Venkatakrishnan factor (eps^2 = h^2).

References

class zoomy_core.symsolver.vocabulary.barth_jespersen#

Bases: zoomy_core.symsolver.core.Block

As minmod, the Barth-Jespersen factor.

References

class zoomy_core.symsolver.vocabulary.front_cells#

Bases: zoomy_core.symsolver.core.Block

(Q, G, phi, (depth, w), tol, mesh) -> cell mask: the cells whose depth h_f = Q[depth] + phi[depth] G[w] . r_f falls below -(1/tol - 1) Q[depth] at a face f (G the gradients of the reconstruction variables, phi their limiter factors, r_f from the cell centre to the face centre), i.e. whose positivity factor h / (h - min_f h_f) is below tol.

References

class zoomy_core.symsolver.vocabulary.extrapolate#

Bases: zoomy_core.symsolver.core.Block

(W, G, phi, mesh) -> (WL, WR): each cell’s W moved to the face centre by phi * G; WR on a boundary face is a placeholder for boundary_traces.

References

class zoomy_core.symsolver.vocabulary.divergence#

Bases: zoomy_core.symsolver.core.Block

(Wm, Wp, mesh) -> per cell sum_f |f| Wm / |V| over the faces it owns plus |f| Wp / |V| over the faces it neighbours.

class zoomy_core.symsolver.vocabulary.edge_source#

Bases: zoomy_core.symsolver.core.Block

(kernel, Q, QL, QR, Qaux, p, mesh) -> per cell the interior nonconservative integral over each of its edges (order >= 2).

References

class zoomy_core.symsolver.vocabulary.derivative_aux#

Bases: zoomy_core.symsolver.core.Block

(spec, Q, Qaux, mesh[, Qg, rows]) -> Qaux with the derivative rows of spec refilled from mesh gradients; with rows, only those states’ derivatives, their boundary faces taken from the ghosts Qg.

class zoomy_core.symsolver.vocabulary.put#

Bases: zoomy_core.symsolver.core.Block

(Q, rows, values) -> Q with the static state rows rows replaced.

class zoomy_core.symsolver.vocabulary.take#

Bases: zoomy_core.symsolver.core.Block

(Q, rows) -> the static state rows rows of Q.

class zoomy_core.symsolver.vocabulary.zeros#

Bases: zoomy_core.symsolver.core.Block

(n, mesh) -> an (n, cells) array of zeros.

class zoomy_core.symsolver.vocabulary.diffusion#

Bases: zoomy_core.symsolver.core.Block

(kernel, bc, Q, Qaux, p, time, mesh) -> per cell div(A grad Q) of the diffusion tensor kernel (explicit; RHS sign, A > 0 diffuses), face flux n.A.grad_f: the two-point flux plus a correction, grad_f the mean of the two cells’ LSQ gradients with the two-point difference as its part along the cell-to-cell vector (boundary faces: the ghost of bc, the tangential part from the cell gradient). A cut face (distributed) carries no flux.

References

class zoomy_core.symsolver.vocabulary.diffusion_tpfa#

Bases: zoomy_core.symsolver.core.Block

(kernel, bc, Q, Qaux, p, time, mesh) -> per cell the two-point part of diffusion: per face n.A.n (Q_out - Q_in) / d, A the mean of the two cells’ tensors, Q_out the BC ghost across a boundary face, the partner cell across a periodic seam.

References

class zoomy_core.symsolver.vocabulary.diffusion_correction#

Bases: zoomy_core.symsolver.core.Block

(kernel, bc, Q, Qaux, p, time, mesh) -> per cell the rest of diffusion beyond diffusion_tpfa (the tangential and non-orthogonal part of the face flux; zero in 1-D), so that diffusion = diffusion_tpfa + diffusion_correction.

References

class zoomy_core.symsolver.vocabulary.implicit_diffusion#

Bases: zoomy_core.symsolver.core.Block

(kernel, bc, Q, Qaux, p, time, dt, mesh) -> one Crank-Nicolson step of the two-point part of diffusion from time to time + dt, its correction explicit at Q (deferred correction).

References

class zoomy_core.symsolver.vocabulary.inadmissible#

Bases: zoomy_core.symsolver.core.Block

(kernel, Q, Qaux, p) -> cell mask: an admissibility row < 0 or a non-finite value.

class zoomy_core.symsolver.vocabulary.clean_round_off#

Bases: zoomy_core.symsolver.core.Block

(Q, rows, tol) -> Q with the entries of the static rows in [-tol, 0) set to 0 (round-off below zero of a quantity declared non-negative).

class zoomy_core.symsolver.vocabulary.halo#

Bases: zoomy_core.symsolver.core.Block

(X, mesh) -> X with the copies of other ranks’ cells current (serial: X); after every stencil update.

class zoomy_core.symsolver.vocabulary.minimum#

Bases: zoomy_core.symsolver.core.Block

(a, b) -> elementwise minimum, NaN propagating, for graph-valued arguments (sp.Min would walk a shared graph as a tree).

is_commutative#

True

is_extended_real#

True

class zoomy_core.symsolver.vocabulary.reduce_min#

Bases: zoomy_core.symsolver.core.Block

Global minimum (all ranks).

class zoomy_core.symsolver.vocabulary.reduce_max#

Bases: zoomy_core.symsolver.core.Block

(X) -> the largest entry (NaN propagates).

class zoomy_core.symsolver.vocabulary.reduce_any#

Bases: zoomy_core.symsolver.core.Block

Global any (all ranks).

class zoomy_core.symsolver.vocabulary.select#

Bases: zoomy_core.symsolver.core.Block

(mask, A, B) -> A where mask else B, per cell or per face.

class zoomy_core.symsolver.vocabulary.coupled_faces#

Bases: zoomy_core.symsolver.core.Block

(mesh) -> face mask of the coupled boundary faces.

class zoomy_core.symsolver.vocabulary.interface_states#

Bases: zoomy_core.symsolver.core.Block

(Q, mesh) -> states of the cells next to the coupled faces.

class zoomy_core.symsolver.vocabulary.interface_flux#

Bases: zoomy_core.symsolver.core.Block

(sides, aux, side, Q, Qaux, peer, p, mesh) -> per face this participant’s row of one Riemann problem posed low -> high (row 0 for side = 0), zero off the coupled faces; both sides pose the same problem.

class zoomy_core.symsolver.vocabulary.lifted_interface_flux#

Bases: zoomy_core.symsolver.core.Block

(sides, aux, n_aux, side, own, peer, rows, p, mesh) -> per face the rows rows of this participant’s side of one Riemann problem posed low -> high in the model of sides (the interface model) on the interface states own, peer ((rows of that model, coupled faces)), the aux rebuilt from each state alone (aux on a zero aux of n_aux rows; aux False: the zero aux); zero off the coupled faces. Both sides pose the same problem.

class zoomy_core.symsolver.vocabulary.characteristic_ghost#

Bases: zoomy_core.symsolver.core.Block

(A, own, Aown, peer, p, mesh) -> per coupled face the transmission state towards a peer of another model: with A_n = sum_d A(own, Aown)[:, :, d] n_d (A the quasilinear matrix kernel, n the outward normal) the characteristics l_k . q that enter (lambda_k < 0) from peer, those that leave from own; peer where the eigenvectors of A_n are singular, own where peer is all zero (no peer data yet). own, Aown, peer and the result are (rows, coupled faces).

class zoomy_core.symsolver.vocabulary.ghost_flux#

Bases: zoomy_core.symsolver.core.Block

(sides, aux, own, Aown, ghost, p, mesh) -> per face the own cell’s row of the Riemann problem (own, ghost) posed along the outward normal of the coupled faces, zero elsewhere; Aown on the own side, aux(ghost) on the other (the pointwise aux formula on a zero aux; aux False: Aown). own, Aown, ghost are (rows, coupled faces).

class zoomy_core.symsolver.vocabulary.replace_row#

Bases: zoomy_core.symsolver.core.Block

(A, i, B) -> A with row i taken from B.

class zoomy_core.symsolver.vocabulary.coupled_ghosts#

Bases: zoomy_core.symsolver.core.Block

(Qg, own, face, mesh) -> the boundary ghosts Qg with the coupled faces’ replaced by 2 face - own (own, face: (rows, coupled faces)).

class zoomy_core.symsolver.vocabulary.overlap_cells#

Bases: zoomy_core.symsolver.core.Block

(mesh) -> cell mask of the overlap: the cells across the coupled interface that hold the peer’s values.

class zoomy_core.symsolver.vocabulary.overlap_states#

Bases: zoomy_core.symsolver.core.Block

(Q, mesh) -> (rows, mirror cells): the own cells the peer holds as its overlap.

class zoomy_core.symsolver.vocabulary.overlap_fill#

Bases: zoomy_core.symsolver.core.Block

(Q, peer, mesh) -> Q with the overlap cells’ columns from peer (rows, overlap cells).

class zoomy_core.symsolver.vocabulary.io#

Output effects; save_state / load_state: the restart pair of the march state.

write#

‘Effect(…)’

save_state#

‘Effect(…)’

load_state#

‘Effect(…)’

class zoomy_core.symsolver.vocabulary.couple#

Effects of one preCICE participant.

References

init#

‘Effect(…)’

max_dt#

‘Effect(…)’

read#

‘Effect(…)’

write#

‘Effect(…)’

advance#

‘Effect(…)’

window_complete#

‘Effect(…)’

read_round_trip#

‘Effect(…)’

read_iterate#

‘Effect(…)’

repeat#

‘Effect(…)’

class zoomy_core.symsolver.vocabulary.check#

Run-time checks.

cfl#

‘Effect(…)’

march#

‘Effect(…)’

zoomy_core.symsolver.vocabulary.march_error(time, time_end, dt, n_step, q_max)#

The message of a failed check.march, or None: the march stopped before time_end (a step that does not advance the time) or ended with a non-finite state (q_max = max |Q|). The C++ runtimes print the same text (rt_common.H).