Skip to content
Projects

Smooth-membership FMM

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

comoving_fields

functionsource

Energy, potential and field with the boxes attached to the centre of mass.

frame
U(x)=Utree(x−(c(x)−c0)),c=∑imixi∑imiU(\mathbf x) = U_\mathrm{tree}\big(\mathbf x - (\mathbf c(\mathbf x) - \mathbf c_0)\big), \qquad \mathbf c = \frac{\sum_i m_i \mathbf x_i}{\sum_i m_i}
field
Ei→Ei−miM Fnetqi,Fnet=∑jqjEj\mathbf E_i \to \mathbf E_i - \frac{m_i}{M}\,\frac{\mathbf F_\mathrm{net}}{q_i}, \qquad \mathbf F_\mathrm{net} = \sum_j q_j \mathbf E_j
Assumes
  • the boxes follow the centre of mass, so UU is translation invariant and its exact gradient has zero net force: energy and momentum both conserved by a symplectic integrator
Built from

SmoothFMM

classsource

Potential energy and exact-gradient forces of line charges on a BoxTree.

membership
wL(z)=∏e∈edgess(te),s(t)=6u5−15u4+10u3,u=t+12,te=signed distance into the leafbw_L(z) = \prod_{e \in \text{edges}} s(t_e), \qquad s(t) = 6u^5 - 15u^4 + 10u^3, \quad u = \frac{t + 1}{2}, \qquad t_e = \frac{\text{signed distance into the leaf}}{b}
energy
U=−2∑routeswmwm′ qiqj Φ(zi−zj)U = -2\sum_\mathrm{routes} w_m w_{m'}\, q_i q_j\, \Phi(z_i - z_j)
force
Fi=−∂U∂xi=2qi∑m∋i[wmGm+Φm∇wm]\mathbf F_i = -\frac{\partial U}{\partial \mathbf x_i} = 2 q_i \sum_{m \ni i} \big[w_m \mathbf G_m + \Phi_m \nabla w_m\big]
softening
Φ(r)={ln⁡a−1112+12(3u−32u2+13u3)u=r2/a2<1ln⁡rr≥a,∇Φ=(3−3u+u2) da2  (r<a)\Phi(r) = \begin{cases} \ln a - \frac{11}{12} + \frac12\left(3u - \frac32 u^2 + \frac13 u^3\right) & u = r^2/a^2 < 1 \\ \ln r & r \ge a \end{cases}, \qquad \nabla\Phi = \frac{(3 - 3u + u^2)\,\mathbf d}{a^2} \ \ (r < a)
Assumes
  • a NumPy prototype for a few thousand line charges; static square cells (BoxTree), the M2L, L2L and L2P of FlatQuadtree.fmm in complex NumPy
  • s(t)+s(−t)=1s(t) + s(-t) = 1 (C2C^2): the weights are a partition of unity for a band b≤b \le the smallest leaf half-width; edges on the root boundary keep weight 1; b=0b = 0 is hard membership
  • the Φm∇wm\Phi_m \nabla w_m term makes F\mathbf F the exact gradient of UU; the triangle truncation (symmetric=True) makes mutual pair forces exactly antisymmetric
  • compact softening, a cloud of density (1−r2/a2)2(1 - r^2/a^2)^2, a=εa = \varepsilon: the far field is exactly the point charge's
References