Skip to content
Projects

Electrodes

The equations of tree_d_3d.electrodes, declared on the code that implements them and checked by the tests.

BoundaryIntegralElectrodes

classsource

Conductors held at prescribed potentials, by the single-layer boundary integral.

boundary integral
−2ke∫Γσ(y)ln⁡∣x−y∣ dsy  −  2ke∑jqjln⁡∣x−rj∣=Vk,x∈Γk-2k_e\int_{\Gamma}\sigma(\mathbf y)\ln|\mathbf x - \mathbf y|\,ds_y \;-\; 2k_e\sum_j q_j\ln|\mathbf x - \mathbf r_j| = V_k, \qquad \mathbf x \in \Gamma_k
collocation
S Q=V/ke−ϕfreeraw,ϕfreeraw(mi)=−∑jqjln⁡∣mi−rj∣2\mathsf S\,\mathbf Q = \mathbf V / k_e - \boldsymbol\phi_\mathrm{free}^\mathrm{raw}, \qquad \phi_\mathrm{free}^\mathrm{raw}(\mathbf m_i) = -\sum_j q_j \ln|\mathbf m_i - \mathbf r_j|^2
self term
Skk=−2Lk∫−Lk/2Lk/2ln⁡∣t∣ dt=2(1−ln⁡Lk2)S_{kk} = -\frac{2}{L_k}\int_{-L_k/2}^{L_k/2}\ln|t|\,dt = 2\left(1 - \ln\frac{L_k}{2}\right)
panels
Sik={ϕseg(mi; k)∣mi−mk∣<nnearLk−∑g=1Gwgln⁡∣mi−yk,g∣2otherwiseS_{ik} = \begin{cases} \phi_\mathrm{seg}(\mathbf m_i;\, k) & |\mathbf m_i - \mathbf m_k| < n_\mathrm{near} L_k \\ -\sum_{g=1}^{G} w_g \ln|\mathbf m_i - \mathbf y_{k,g}|^2 & \text{otherwise} \end{cases}
far points
yk,g=ak+ξg(bk−ak),ξg=xg+12,wg=ωg2,error O((L/r)2G)\mathbf y_{k,g} = \mathbf a_k + \xi_g (\mathbf b_k - \mathbf a_k), \qquad \xi_g = \frac{x_g + 1}{2}, \quad w_g = \frac{\omega_g}{2}, \qquad \text{error } O\big((L/r)^{2G}\big)
field
ϕ(x)=ke[∑k nearQk ϕseg(x;k)+∑k far∑gQkwg ϕpt(x−yk,g)−∑jqjln⁡∣x−rj∣2]\phi(\mathbf x) = k_e\Big[\sum_{k\ \mathrm{near}} Q_k\, \phi_\mathrm{seg}(\mathbf x; k) + \sum_{k\ \mathrm{far}} \sum_g Q_k w_g\, \phi_\mathrm{pt}(\mathbf x - \mathbf y_{k,g}) - \sum_j q_j \ln|\mathbf x - \mathbf r_j|^2\Big]
images
ϕpt(x−y)→∑ι∈{1,M}sι GP(x−ι y),sM=±1 (Neumann, Dirichlet),ϕ→ϕ+Vface\phi_\mathrm{pt}(\mathbf x - \mathbf y) \to \sum_{\iota \in \{1, \mathsf M\}} s_\iota\, G_P(\mathbf x - \iota\,\mathbf y), \qquad s_{\mathsf M} = \pm 1 \text{ (Neumann, Dirichlet)}, \qquad \phi \to \phi + V_\mathrm{face}
Order
potential: 2, force: 2
Assumes
  • a first-kind single-layer equation; straight panels of uniform charge QkQ_k (piecewise-constant density), collocated at their midpoints mk\mathbf m_k
  • GG = far_points = 2 Gauss-Legendre nodes xgx_g, weights ωg\omega_g, per far panel; panels within nnearn_\mathrm{near} = near_field = 4 of their lengths enter exactly (segment_field)
  • S\mathsf S is not symmetric: up to DIRECT_LIMIT panels dense and LU-factorised once, O(P3)O(P^3), and O(P2)O(P^2) per solve; above it GMRES with a block-Jacobi preconditioner (runs of PRECONDITIONER_BLOCK consecutive panels) and multipole-tree products, O(P)O(P) per iteration, the iterations growing slowly with PP
  • no conductor at infinity and no constraint on the total charge: the reference length of the logarithm is the unit of length, and a lone conductor of logarithmic capacity 1 (a circle of radius 1) makes S\mathsf S singular
  • keep panels shorter than the gaps between surfaces; the order is in the panel length
  • with a period PP along yy the point kernel is the row sum GPG_P (periodic_log_kernel) and the near panel copies, shifted by ±P\pm P, enter exactly; a face M\mathsf M mirrors every charge about it, and the conductors' potentials are measured from a Dirichlet face's VfaceV_\mathrm{face}
Built from

periodic_log_kernel

functionsource

Potential (K,) and field (2, K) of a row of unit line charges, period period along y.

potential
GP(d)=∑m=−∞∞−ln⁡∣d−mPy^∣2=−ln⁡[2(cosh⁡2πdxP−cos⁡2πdyP)]+2ln⁡2πPG_P(\mathbf d) = \sum_{m=-\infty}^{\infty} -\ln|\mathbf d - m P \hat{\mathbf y}|^2 = -\ln\Big[2\Big(\cosh\frac{2\pi d_x}{P} - \cos\frac{2\pi d_y}{P}\Big)\Big] + 2\ln\frac{2\pi}{P}
field x
−∂xGP=2πP sinh⁡(2πdx/P)cosh⁡(2πdx/P)−cos⁡(2πdy/P)-\partial_x G_P = \frac{2\pi}{P}\,\frac{\sinh(2\pi d_x/P)}{\cosh(2\pi d_x/P) - \cos(2\pi d_y/P)}
field y
−∂yGP=2πP sin⁡(2πdy/P)cosh⁡(2πdx/P)−cos⁡(2πdy/P)-\partial_y G_P = \frac{2\pi}{P}\,\frac{\sin(2\pi d_y/P)}{\cosh(2\pi d_x/P) - \cos(2\pi d_y/P)}
stable
cosh⁡a−cos⁡b=2sinh⁡2a2+2sin⁡2b2\cosh a - \cos b = 2\sinh^2\frac a2 + 2\sin^2\frac b2
Assumes
  • a row of unit line charges a period PP apart along yy, in the log kernel, without kek_e; the divergent sum is renormalised so that GP+ln⁡∣d∣2→0G_P + \ln|\mathbf d|^2 \to 0 as d→0\mathbf d \to 0
  • far from the row (∣dx∣≫P|d_x| \gg P) GP→−2π∣dx∣/P+2ln⁡(2π/P)G_P \to -2\pi|d_x|/P + 2\ln(2\pi/P): the potential of a charged sheet, 2π/P2\pi/P per unit charge on either side
  • cosh⁡a−cos⁡b\cosh a - \cos b is evaluated as 2sinh⁡2(a/2)+2sin⁡2(b/2)2\sinh^2(a/2) + 2\sin^2(b/2) (no cancellation near a charge) and by its exponential asymptote above ∣a∣=30|a| = 30

segment_field

functionsource

Potential (K,) and field (2, K) of uniformly charged straight segments.

potential
ϕseg=−2L∫0Lln⁡(u−s)2+v2 ds=−2L[uln⁡ra−(u−L)ln⁡rb−L+∣v∣ϑ]\phi_\mathrm{seg} = -\frac{2}{L}\int_0^L \ln\sqrt{(u - s)^2 + v^2}\, ds = -\frac{2}{L}\Big[u\ln r_a - (u - L)\ln r_b - L + |v|\vartheta\Big]
field along
Eseg⋅t^=2Lln⁡rarb\mathbf E_\mathrm{seg}\cdot\hat{\mathbf t} = \frac{2}{L}\ln\frac{r_a}{r_b}
field across
Eseg⋅n^=2Lsign⁡(v) ϑ,ϑ=atan2⁡(u,∣v∣)−atan2⁡(u−L,∣v∣)\mathbf E_\mathrm{seg}\cdot\hat{\mathbf n} = \frac{2}{L}\operatorname{sign}(v)\,\vartheta, \qquad \vartheta = \operatorname{atan2}(u, |v|) - \operatorname{atan2}(u - L, |v|)
Assumes
  • unit total charge spread evenly along a straight segment of length LL, in the log kernel, without kek_e
  • uu, vv the target's coordinates along and across the segment from its start; rar_a, rbr_b the distances to its ends; n^=(−ty,tx)\hat{\mathbf n} = (-t_y, t_x)
  • on the segment the normal field (the jump of the surface charge) is taken as zero; at an end the potential is finite and the field diverges logarithmically

TabulatedField

classsource

Potential and field sampled on a regular grid, interpolated bilinearly.

bilinear
f(x,y)=(1−fx)(1−fy) fi,j+fx(1−fy) fi+1,j+(1−fx)fy fi,j+1+fxfy fi+1,j+1f(x, y) = (1 - f_x)(1 - f_y)\, f_{i,j} + f_x (1 - f_y)\, f_{i+1,j} + (1 - f_x) f_y\, f_{i,j+1} + f_x f_y\, f_{i+1,j+1}
cell
fx=x−x0Δx−i∈[0,1],i=min⁡ ⁣(⌊x−x0Δx⌋,nx−2)f_x = \frac{x - x_0}{\Delta x} - i \in [0, 1], \qquad i = \min\!\left(\left\lfloor \frac{x - x_0}{\Delta x} \right\rfloor, n_x - 2\right)
Order
potential: 2, field: 2
Assumes
  • a regular grid; potential and field interpolated separately, so E=−∇ϕ\mathbf E = -\nabla\phi holds only to the interpolation error
  • points outside the grid take the value at the nearest edge