Skip to content
Projects

Nodal Poisson

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

NodalPoisson

classsource

Solve −∇2ϕ=f-\nabla^2\phi = f on the nodes of a patch hierarchy.

problem
−∇2ϕ=f in Ω,ϕ=ϕD or ∂nϕ=g on faces,ϕ=Uk in bodies Bk-\nabla^2 \phi = f \ \text{in } \Omega, \qquad \phi = \phi_D \ \text{or} \ \partial_n \phi = g \ \text{on faces}, \qquad \phi = U_k \ \text{in bodies } B_k
stencil
App+=g, Aqq+=g, Apq=Aqp−=gper leaf-cell edge pq along a,g=h⊥2ha (2D), 1h (1D)A_{pp} \mathrel{+}= g,\ A_{qq} \mathrel{+}= g,\ A_{pq} = A_{qp} \mathrel{-}= g \quad \text{per leaf-cell edge } pq \text{ along } a, \qquad g = \frac{h_\perp}{2 h_a} \ \text{(2D)}, \ \frac{1}{h} \ \text{(1D)}
uniform
App=2hyhx+2hxhy,Ap,x±=−hyhx,Ap,y±=−hxhyA_{pp} = \frac{2h_y}{h_x} + \frac{2h_x}{h_y}, \qquad A_{p,x\pm} = -\frac{h_y}{h_x}, \qquad A_{p,y\pm} = -\frac{h_x}{h_y}
reduced
(T⊤AT)FF ϕF=T⊤Vf−(T⊤AT)FD ϕD+T⊤bN+WU,V=diag(Vp)(T^\top A T)_{FF}\,\phi_F = T^\top V f - (T^\top A T)_{FD}\,\phi_D + T^\top b_N + W U, \qquad V = \mathrm{diag}(V_p)
charge
T⊤Vf→T⊤q(solve(charge=q))T^\top V f \to T^\top q \quad (\texttt{solve(charge=q)})
consistent
A=T⊤G⊤M1G T,V→M0(consistent mass: the Q1 elements; lumped M1 and V: the stencil above)A = T^\top G^\top M_1 G\, T, \qquad V \to M_0 \quad \text{(consistent mass: the Q1 elements; lumped } M_1 \text{ and } V \text{: the stencil above)}
neumann
bN,p+=12∣e∣ gfor each end p of a boundary edge eb_{N,p} \mathrel{+}= \tfrac12 |e|\, g \quad \text{for each end } p \text{ of a boundary edge } e
cut edge
App+=gθ,bp+=gθ Uk,θ=max⁡(θfound,θmin)A_{pp} \mathrel{+}= \frac{g}{\theta}, \qquad b_p \mathrel{+}= \frac{g}{\theta}\, U_k, \qquad \theta = \max(\theta_\mathrm{found}, \theta_\mathrm{min})
shortley weller
App=hxhy∑axes(2a−(a−+a+)+2a+(a−+a+)),Ap,±=− hxhy 2a±(a−+a+)A_{pp} = h_x h_y \sum_\mathrm{axes} \Big(\frac{2}{a_-(a_- + a_+)} + \frac{2}{a_+(a_- + a_+)}\Big), \qquad A_{p,\pm} = -\,h_x h_y\,\frac{2}{a_\pm(a_- + a_+)}
cylindrical
g=2π rˉ h⊥2ha,rˉ=12(re+rK),Vp=∑K∋p2π 12(rp+rK) ∣K∣4,Ap,r±=−Vp(2a±(a−+a+)±1rp(a−+a+))g = 2\pi\,\bar r\,\frac{h_\perp}{2 h_a}, \quad \bar r = \tfrac12(r_e + r_K), \qquad V_p = \sum_{K \ni p} 2\pi\,\tfrac12(r_p + r_K)\,\frac{|K|}{4}, \qquad A_{p,r\pm} = -V_p\Big(\frac{2}{a_\pm(a_- + a_+)} \pm \frac{1}{r_p (a_- + a_+)}\Big)
reaction
(A+T⊤diag(Vc) T) ϕ=…(A + T^\top \mathrm{diag}(V c)\, T)\,\phi = \ldots
Order
2
Assumes
  • unlisted faces are grounded; no permittivity: for a charge pass ρ/ε0\rho / \varepsilon_0
  • lumped and consistent mass share one assembly from the edge mass blocks (patchwork.spaces.mass); the consistent one takes no bodies and keeps the lumped Neumann load
  • Cartesian control volumes and conductances by default, also on an (r,z)(r, z) hierarchy; metric='cylindrical' weights each conductance by 2π2\pi times the mean radius of its half cell and each control volume by 2π2\pi times that of its quarter cells (the finite volumes of −1r∂r(r∂rϕ)−∂z2ϕ-\frac1r\partial_r(r\partial_r\phi) - \partial_z^2\phi, lumped), with the 1r ∂rϕ\frac{1}{r}\,\partial_r\phi term in the Shortley-Weller rows
  • a reaction c ϕc\,\phi (set_reaction) adds the lumped Vp cpV_p\, c_p to the diagonal, e.g. a Newton Jacobian
  • the Shortley-Weller rows at regular cut nodes (four equal cells, not hanging), the diagonal-only cut elsewhere; they make the matrix unsymmetric
  • θ\theta by 48 bisections of inside, or the body's fraction; θmin\theta_\mathrm{min} = min_fraction (10−310^{-3})
  • the order is in the volume-weighted L2L_2 norm; in the maximum norm about 1.86 on nested patches (an O(1)O(1) truncation error on the interface nodes)
References
Built from