The equations of patchwork.mesh.hierarchy, declared on the code that implements them and checked by the tests.
A 1D or 2D nested patch hierarchy with mpiarray-backed fields.
- levels
- hL=rLh0,r≥2 on every axis and level
- nesting
- loL≡hiL≡0(modr),[rloL,rhiL)⊂patches of L−1⋃box
- ring volume
- V=2πrcΔrΔz,rc=21(r0+r1)
- radial face
- Ar=2πrfΔz
- axial face
- Az=π(r12−r02)=2πrcΔr
- plane
- V=ΔxΔy,A=Δy or Δx (2D);V=Δx,A=1 (1D)
- Assumes
- one refinement ratio r for all axes and levels; patch boxes half open, in cells of their level
- proper nesting by a margin is not required by
add_patch; regrid enforces it - in (r,z): 2D, r0≥0, the radius not periodic; the ring volumes and areas are exact, so the faces of a cell close it and fine faces add up to the coarse one
Deposit the charge of markers on the node-centered field name, patch by patch.
- cloud in cell
- q00=q(1−ξ)(1−η),q10=qξ(1−η),q01=q(1−ξ)η,q11=qξη,ξ=hxx−xi, η=hyy−yj
- line
- q0=q(1−ξ),q1=qξ
- splines
- qk=qd∏Bp(rd−kd),rd=hdxd−xd,0(degree p; p=1 above)
- gather
- E(x)=corners c∑wc(x)Ec(the transpose: interpolate)
- Assumes
- each marker in the finest patch that holds it; the values are charges, not a density
- a marker gathers the field of its own patch, which may jump at a coarse-fine edge
- the halos and the copies of shared nodes are summed afterwards (
accumulate_halos) - from degree 2 on a stencil folds onto the edge nodes of the marker's patch where it would reach past them (at coarse-fine edges, walls and periodic seams alike): the charge is kept, the shape there is not the spline's
- Built from
A new hierarchy with patches over the tagged cells, and the fields moved to it.
- grow
- T~L=growb(TL∪coarsenr(growm(T~L+1)))∩ΩL,L=Lmax,…,0
- allowed
- AL=shrinkm(⋃new boxes of L)∖{cells with forbidden fine cells}
- boxes
- BL+1=r⋅cluster(T~L∩AL)
- transfer
- unew={uoldI(uL−1new)on an old patch of the levelelse
- Assumes
- b =
buffer, m = nesting (cells of the level below; the domain's edge does not count as an edge) - I the bilinear (renormalised) interpolation, or for a conservative field the conservative fill after a restriction
- the base level is kept; levels above the last tagged one are dropped
- halos stay zero unless
fill_halos
- References
- Built from