  Many boundary element integral equation kernels are based on the Green's
functions of the Laplace and Helmholtz equations in three dimensions. These
include, for example, the Laplace, Helmholtz, elasticity, Stokes, and Maxwell's
equations. Integral equation formulations lead to more compact, but dense
linear systems. These dense systems are often solved iteratively via Krylov
subspace methods, which may be accelerated via the fast multipole method. There
are advantages to Galerkin formulations for such integral equations, as they
treat problems associated with kernel singularity, and lead to symmetric and
better conditioned matrices. However, the Galerkin method requires each entry
in the system matrix to be created via the computation of a double surface
integral over one or more pairs of triangles. There are a number of
semi-analytical methods to treat these integrals, which all have some issues,
and are discussed in this paper. We present novel methods to compute all the
integrals that arise in Galerkin formulations involving kernels based on the
Laplace and Helmholtz Green's functions to any specified accuracy. Integrals
involving completely geometrically separated triangles are non-singular and are
computed using a technique based on spherical harmonics and multipole
expansions and translations, which results in the integration of polynomial
functions over the triangles. Integrals involving cases where the triangles
have common vertices, edges, or are coincident are treated via scaling and
symmetry arguments, combined with automatic recursive geometric decomposition
of the integrals. Example results are presented, and the developed software is
available as open source.

Computational Physics;Mathematical Software;Numerical Analysis