Skip to content
Development documentation — This site follows the main branch and may differ from an installed release. View the changelog.

Direct solver

The Direct solver evaluates every source-element contribution at every target. It evaluates the triangle_p0 source discretization without a solver approximation, serving both as a solver for small problems and as the reference used to measure Treecode and FMM approximation error.

PropertyDescription
CostO(MN)O(MN) for NN sources and MM targets
Element kerneltriangle P0 (fixed)
Normal field boundaryfree
Geometry planNone; evaluation reads the current q_elem
[sim]
field_solver = "direct"
field_bc_mode = "free"

Integrate surface charge over each triangle

Section titled “Integrate surface charge over each triangle”

BEACH places the constant density σi=qi/Ai\sigma_i=q_i/A_i on the triangle of area AiA_i. triangle_p0 is the only element kernel and is implicit rather than selected in the configuration:

ϕi(r)=kcTiσirrdS,Ei(r)=kcTiσirrrr3dS.\phi_i(\mathbf{r})= k_c\int_{T_i}\frac{\sigma_i}{\lVert\mathbf{r}-\mathbf{r}'\rVert}\,dS', \qquad \mathbf{E}_i(\mathbf{r})= k_c\int_{T_i}\sigma_i \frac{\mathbf{r}-\mathbf{r}'}{\lVert\mathbf{r}-\mathbf{r}'\rVert^3}\,dS'.

BEACH evaluates these integrals with an analytic kernel based on edge logarithms and the solid angle. The same panel kernel is used for far and near interactions.

Potential is continuous on the panel, and self potential uses its principal value. The normal field has the surface-charge jump

E±=EPV±σi2ϵ0ni.\mathbf{E}^{\pm}=\mathbf{E}^{\mathrm{PV}} \pm\frac{\sigma_i}{2\epsilon_0}\mathbf{n}_i.

Therefore, each element needs a normal_plus or normal_minus vacuum side. Set [mesh].surface_side for OBJ input or surface_side on every [[mesh.templates]] entry. outward_closed is valid only for consistently oriented closed two-manifolds.

Current requirements are:

  • finite triangles with positive area
  • a resolved vacuum side for every element
  • direct, treecode, fmm, or auto, which selects between direct and fmm

The former [field] table and sim.softening key have been removed. Leaving either in a configuration fails as an unknown table or key.

See examples/panel_direct.toml for a complete configuration.

Add self terms to element-center potentials

Section titled “Add self terms to element-center potentials”

Element-center potential written to outputs such as potential_history.csv uses the analytic panel integral including the source element. It therefore includes the finite triangle-P0 self potential without adding a separate empirical coefficient.

Computing the potential at every element center with Direct costs O(N2)O(N^2). A small history stride can therefore add substantial cost separately from field evaluations at particle positions.

Coordinates are normalized according to field_normalization, and fields and potentials are converted back to SI. See Field evaluation for the equations and options.

Direct holds no geometry tree or expansion coefficients and reads the current mesh%q_elem at evaluation. The snapshot remains fixed within a batch; deposited charge is committed at batch end and enters the field of the next batch, as for the other solvers.

Separate errors using Direct as the reference

Section titled “Separate errors using Direct as the reference”

Direct has no solver approximation error, but it still contains errors from:

  • surface-mesh resolution and geometry
  • particle time stepping and collision detection
  • periodic and outer-model assumptions when those models are present

Agreement with Direct therefore validates the Treecode or FMM approximation, not convergence of the full physical solution. Refine the source mesh and particle time step independently.