Skip to content
Projects

Edge space

The equations of patchwork.spaces.edges, declared on the code that implements them and checked by the tests.

CompositeEdges

classsource

The edges of the leaf cells of a 1D, 2D or 3D hierarchy, and the operators on them.

gradient
(Gϕ)e=ϕend(e)−ϕstart(e)(G\phi)_e = \phi_{\mathrm{end}(e)} - \phi_{\mathrm{start}(e)}
hanging edges
(T1e)f=sfsc∑jwj(ξf) ec,jover the coarse cell’s edges j parallel to f (one on a coarse edge, two in a coarse face)(T_1 e)_f = \frac{s_f}{s_c} \sum_j w_j(\boldsymbol{\xi}_f)\, e_{c,j} \quad \text{over the coarse cell's edges } j \text{ parallel to } f \text{ (one on a coarse edge, two in a coarse face)}
commuting
G T=T1 G TG\,T = T_1\,G\,T
nodal operator
(T⊤G⊤M1 G T)FF=ANodalPoisson(lumped: the five-point stencil; consistent: the Q1 stiffness)\big(T^\top G^\top M_1\, G\, T\big)_{FF} = A_\mathrm{NodalPoisson} \quad \text{(lumped: the five-point stencil; consistent: the Q1 stiffness)}
Assumes
  • 2D and 3D Cartesian; edges addressed on the finest lattice
  • a coarse edge and the fine edges that tile it are different edges; the fine ones hang, as do (3D) fine edges inside a coarse face
References
Built from

deposit_paths

functionsource

The current of charges moving along straight paths, integrated over the paths: (n1,).

pieces
jlower+=q Δxhx(1−ηmid),jupper+=q Δxhx ηmid,likewise for the y-edgesj_\mathrm{lower} \mathrel{+}= q\,\frac{\Delta x}{h_x}(1 - \eta_\mathrm{mid}), \qquad j_\mathrm{upper} \mathrel{+}= q\,\frac{\Delta x}{h_x}\,\eta_\mathrm{mid}, \qquad \text{likewise for the } y\text{-edges}
continuity
(GT)⊤j=T⊤(Q(x1)−Q(x0))(G T)^\top j = T^\top\big(Q(\mathbf{x}_1) - Q(\mathbf{x}_0)\big)
product
a1b1−a0b0=Δa bˉ+aˉ Δbfor linear a(t),b(t)a_1 b_1 - a_0 b_0 = \Delta a\,\bar b + \bar a\,\Delta b \quad \text{for linear } a(t), b(t)
work
j⊤e=∑kqk∫x0x1E⋅dlj^\top e = \sum_k q_k \int_{\mathbf{x}_0}^{\mathbf{x}_1} \mathbf{E}\cdot d\mathbf{l}
Assumes
  • straight paths, clipped to the leaf cells of every patch and integrated on the patch's block by mpifield's compiled path deposit, which cuts them at its cell faces and integrates the edge functions (linear along a piece in 2D, quadratic in 3D) exactly; _deposit_pieces (Simpson's rule on the finest-lattice pieces) is the NumPy reference
  • QQ the bilinear node deposit (CompositeNodes.deposit); conserved across patch edges and periodic seams to round-off
  • pieces outside the domain deposit nothing
References
Built from
  • deposit
  • mpifield.edges.EdgeWeighting

evaluation

functionsource

The field of an edge field at points (ndim, k): one (k, n1) matrix per axis.

whitney
Ex=(1−η) elower+η eupperhx,Ey=(1−ξ) eleft+ξ erighthy(2D; in 3D bilinear across the four parallel edges)E_x = \frac{(1-\eta)\,e_\mathrm{lower} + \eta\,e_\mathrm{upper}}{h_x}, \qquad E_y = \frac{(1-\xi)\,e_\mathrm{left} + \xi\,e_\mathrm{right}}{h_y} \quad \text{(2D; in 3D bilinear across the four parallel edges)}
deposit
j=Ex⊤vx+Ey⊤vy(deposit, the transpose)j = E_x^\top v_x + E_y^\top v_y \quad (\texttt{deposit}\text{, the transpose})
Assumes
  • (ξ,η)(\xi, \eta) the fractions from the lower-left corner of the leaf cell; the tangential component is constant along every edge
  • apply to edge values with their hanging edges filled (T1eT_1 e); a point outside the domain gets zero
References

mass

functionsource

The edge mass matrix M1: e^T M1 e is the integral of |E|^2.

energy
e⊤Me=∫∣E∣2 dA(no ε0)e^\top M e = \int |\mathbf{E}|^2\, dA \quad \text{(no } \varepsilon_0\text{)}
lumped
Mee=∑K∋eh⊥2h∥M_{ee} = \sum_{K \ni e} \frac{h_\perp}{2 h_\parallel}
consistent
MK=h⊥h∥(1/31/61/61/3)per cell and directionM_K = \frac{h_\perp}{h_\parallel} \begin{pmatrix} 1/3 & 1/6 \\ 1/6 & 1/3 \end{pmatrix} \quad \text{per cell and direction}
Assumes
  • lumped: the vertex (trapezoidal) quadrature, diagonal; its entries are the edge conductances of the nodal stencil
  • consistent: the exact integral of the products of the linear profiles
  • for a field on hanging edges use T1⊤MT1T_1^\top M T_1
Built from