Boltzmann electrons on the quadtree: the tree leaves as the quadrature of a nonlinear source.
A gridless ion code has no mesh to put a fluid electron model on. The quadtree leaves are an adaptive partition of the plane, so put the Boltzmann electron charge of each leaf, -n0 A_L exp(phi_L / T), at quadrature points inside it and solve the nonlinear problem phi = G(q_ions + q_e(phi)) with the same summation the ions use. This example does that on the textbook case with an exact answer, Debye shielding of a test line charge in a neutral background (linear regime: phi = 2 Q K0(r / lambda_D); nonlinear regime: the radial Poisson-Boltzmann ODE), with direct sums over the leaf charges, and measures what the solve costs.
Source: examples/boltzmann_tree.py. Run it yourself with python examples/boltzmann_tree.py [--output examples/output] [--quick] (needs pip install "tree-d-3d[examples]").
Figures
Section titled “Figures”Loading interactive figure…
the potential against radius from the tree solve, the linearised analytic solution 2 Q K0(r / lambda_D) and the radial nonlinear ODE, for a weak and a strong test charge.
Loading interactive figure…
potential evaluations to converge against the leaf size over the Debye length at a strong test charge (Q = 1.5, phi / T up to about 5), for damped Picard (fixed point) and Jacobian-free Newton-Krylov, both with continuation in the test charge; the damped Picard cost is independent of the resolution, the unpreconditioned Newton-Krylov cost grows with it.
Loading interactive figure…
error of the tree solution against the radial ODE against the leaf size, with one and four quadrature points per leaf: roughly first order, with the leaf-charge representation (point charges plus a mean self-potential) as the limit.
Loading interactive figure…
the adaptive leaves coloured by their electron charge for the strong test charge; refinement follows the potential gradient, not the ions.
--quick uses coarser trees (about ten minutes instead of hours); --smoke is the tiny configuration the test suite runs (a minute). Needs Plotly (pip install 'tree-d-3d[examples]') and SciPy.