Singularity swap quadrature for nearly singular line integrals on closed curves in two dimensions
Abstract
This paper presents a quadrature method for evaluating layer potentials in two dimensions close to periodic boundaries, discretized using the trapezoidal rule. It is an extension of the method of singularity swap quadrature, which recently was introduced for boundaries discretized using composite Gauss-Legendre quadrature. The original method builds on swapping the target singularity for its preimage in the complexified space of the curve parametrization, where the source panel is flat. This allows the integral to be efficiently evaluated using an interpolatory quadrature with a monomial basis. In this extension, we use the target preimage to swap the singularity to a point close to the unit circle. This allows us to evaluate the integral using an interpolatory quadrature with complex exponential basis functions. This is well-conditioned, and can be efficiently evaluated using the fast Fourier transform. The resulting method has exponential convergence, and can be used to accurately evaluate layer potentials close to the source geometry. We report experimental results on a simple test geometry, and provide a baseline Julia implementation that can be used for further experimentation.
1 Introduction
In integral equation methods, one of the long-standing challenges is the evaluation of layer potentials for targets points close to the source geometry. The integrals by which these layer potentials are computed are referred to as nearly singular, since the integrand is evaluated close to a singularity. This near singularity reduces the smoothness of the integrand, thereby severely reducing the accuracy of common quadrature rules such as Gauss-Legendre and the trapezoidal rule. To tackle this, many specialized quadrature methods have been proposed for the case of the domain being a one-dimensional line. For panel-based Gauss-Legendre quadrature in the plane, the high-order method of [7] (often referred to as the Helsing-Ojala method) is efficient and well-established. For the trapezoidal rule, which is exponentially convergent on a closed curve, several fixed-order methods have been proposed that reduce the impact of the near singularity by means of a local correction, see e.g. [5, 6, 8]. In addition, exponentially convergenent near evaluation is available through the “globally compensated” quadrature method introduced in [7] and extended in [3].
Recently, the method of singularity swap quadrature (SSQ) was proposed in [1]. The method evaluates nearly singular line quadratures in two and three dimensions by first “swapping” the singularity from the target point in the plane to the preimage of the target point in the curve’s parameterization. After the swap, the integral can be evaluated using interpolatory quadrature with a monomial basis, following the method of [7]. This was shown to improve the accuracy for curved panels compared to [7], and allowed the method to be extended to line integrals in three dimensions.
The SSQ method was in [1] described for curves discretized using panel-based Gauss-Legendre quadrature. In this brief follow-up, we show how the method can be extended to closed curves in the plane that have been discretized using the trapezoidal rule, resulting in a global correction with exponential convergence. In doing so, we assume that the reader has at least some familiarity with the original method.
2 Method
Since we are considering the problem in two dimensions, let us identify with , and let be a closed curve parameterized by a smooth function , with . Furthermore, let be a smooth function defined on , which we will refer to as the density. For a point , typically lying close to , our integrals of interest are here
(1) | ||||
(2) |
Being periodic, these integrals are suitable for discretization using an N-point trapezoidal rule, due to its exponential convergence [9]. The quadrature nodes are then , , with and the quadrature weights . We will now outline how these discretized integrals can be evaluated using SSQ. Throughout, we will assume that we only have access to the discrete values of the functions , and at the nodes, and not to their analytic definitions.
2.1 The Cauchy integral
We begin with the simplest (and perhaps most common) case, the Cauchy integral,
(3) |
Let us now assume that is close to , which corresponds to the integrand in (3) having a singularity close to the real line at the preimage such that
(4) |
In [4] and [2], it is shown that this significantly reduces the convergence rate of the trapezoidal rule, with the error being proportional to . In order to reduce the error for small , we will now show how to evaluate using SSQ.
Step one is to find the preimage , using Newton’s method applied to a Fourier expansion of . We apply a Fast Fourier Transform (FFT) to the node values to get the truncated Fourier series
(5) | ||||
(6) |
where , assuming odd, and are the Fourier coefficients of . This has a one-time cost of , for a given discretization. Substituting this expansion into (4), we can find at an cost using Newton’s method (assuming iterations to convergence). A good initial guess for is the corresponding -value of the grid point on that is closest to ,
(7) |
We assume that is parametrized in a counter-clockwise direction, so that implies interior to , and vice versa.
Step two is to swap out the singularity using a function that regularizes the integrand, and leads to an integrable singularity. Contrary to the Gauss-Legendre panel case, we can not regularize the denominator using the factor , as the latter is not periodic. Instead, we use , which corresponds to swapping the singularity to a point close to the unit circle (this will be evident shortly). Then,
(8) |
The function is now the original integrand with the singularity at removed, and we expect it to be smooth. Since its values are known at the equidistant nodes , we use an FFT to compute its truncated Fourier series (at an cost), such that
(9) |
This can be interpreted as our integral being approximated by an interpolatory quadrature on the unit circle, which we can evaluate to high accuracy as long as the coefficients decay sufficiently fast. The integrals can be evaluated analytically (at an cost) by rewriting them as contour integrals on the unit circle . Let
(10) | ||||
(11) | ||||
(12) |
Then and
(13) | ||||
(14) | ||||
(15) |
We can evaluate this integral using the residue theorem. If (or equivalently , corresponding to being an interior point), then the integrand has a simple pole at , with residue
(16) |
In addition, if , then the integrand has a pole of order at the origin, with residue
(17) |
The two residues cancel for and (i.e. ), so we get
(18) |
This completes the method, which has a total cost of per target point.
The method can perhaps be understood in terms of Fourier coefficents. The accuracy of the trapezoidal rule depends on the regularity of the integrand, which in term is reflected in the decay of the Fourier coefficients of the integrand. As seen in fig. 1, these appear to decay as . In constrast, the coefficients decay rapidly and with a rate that stays nearly constant as .


A weakness of the method is that in order to find , one must evaluate the analytic continuation of using a truncated Fourier series, which naturally is most accurate close to . For far away from the rootfinding process will struggle, and the accuracy of SSQ can deteriorate. However, this happens at ranges where the base trapezoidal rule is sufficiently accurate.
Remark 1
The reader may note that one could in fact apply a variant of the Helsing-Ojala quadrature directly to (3). First solve interpolation problem
(19) |
where and . Then evaluate the layer potential as
(20) |
where the integrals can be exactly evaluated using residue calculus, just as is done above for the unit circle. This will in fact work perfectly fine for some geometries (the unit circle in particular), but the interpolation problem can be severely ill-conditioned in a way that is hard to control, since it depends on the geometry itself. This could potentially be investigated further, but that is deemed beyond the scope of this work.
2.2 Higher order integrals
For higher order integrals (), we have
(21) |
Evaluating this integral with SSQ is completely analogous to the case when , with the difference that we instead regularize with , such that
(22) |
We then need expressions for the integrals
(23) |
Evaluating the residues in the same way as for the case, we get the general expression for integer ,
(24) |
2.3 Log kernel
Consider now the log integral, also known as the Laplace single-layer potential, for a real-valued density ,
(25) | ||||
(26) |
where is assumed to be a smooth function. Proceeding in a similar fashion as before, we find and separate the integral as
(27) |
The first integral is now regularized, and can be evaluated using the trapezoidal rule. The second integral we rewrite using a truncated Fourier series and the relation , such that we can evaluate it using SSQ,
(28) |
Just as with , the integrals can be transformed into integrals on the unit circle,
(29) |
Note that this is not necessarily a closed contour integral, as there is a branch cut in the complex logarithm that needs to be taken into account. We will now show to evaluate depending on the sign of .
2.3.1
Beginning with the case (or ), we note that on the entire unit disc. We can therefore choose the branch cut of the complex logarithm such that it never intersects the unit circle. This choice allows us to evaluate the integral in (29) as a contour integral on the unit circle, with a possible pole of order at the origin,
(30) |
Since , we only need the real part of at . We then have that is for computed as
(31) |
2.3.2
We are now left with the case (or ). Here, at at point on the unit disk, so the integral of on the unit circle must intersect the branch cut in the plane going from to infinity. We choose the branch cut such that it passes through the point . We define and to be the limits approaching from above and below in the plane, such that
(32) |
Then the integral on the unit circle is,
(33) |
In order to evaluate this, we let be the closed contour following the unit circle from to , then going from to on the negative side of the branch cut, and then going from to on the positive side of the branch cut,
(34) |
The integrand is analytic inside , except for a pole of order at the origin when , with residue given by (30). The integrals along the branch cut are
(35) | ||||
(36) |
Combining the results, and just as before keeping only the real part of the integral, we arrive at the final results for ,
(37) |
3 Experiments
In order to demonstrate the method outlined above, we here report experimental results for the by now well-known “starfish” geometry . The method has been implemented in Julia, and is available online as open source together with the scripts that produce the numerical in this manuscript111https://github.com/ludvigak/TrapzSSQ.jl.
3.1 Laplace double layer potential
As a first demonstration, we reuse the Laplace test problem from [1]. That is, we evaluate the solution to the Laplace equation in the domain bounded by , with boundary condition . The solution to this problem can be represented using the Laplace double layer potential (DLP) , which leads to a second-kind integral equation in the real-valued density . Once this integral equation is solved, the layer potential can be evaluated in the domain using quadrature, and compared to the exact solution .


In fig. 2 we show results for the Laplace DLP when is discretized using points that are equidistant in the parametrization . The layer potential is evaluated using the trapezoidal rule on a grid inside the domain, but for points close to the boundary we also evaluate using SSQ and compare the results. As expected, evaluation using the trapezoidal rule leads to errors near the boundary, while SSQ is accurate at all points where it is used. However, full machine precision accuracy is not recovered; the maximum error in SSQ close to the boundary is .
3.2 Convergence
For a more systematic investigation of the method, we create the following setup. Let be the starfish domain from the previous section, and discretize it using points. We then create 100 evaluation points as , where and . In order to test points both interior and exterior to , we use . For a range of , we then compute the integrals using both trapezoidal and singularity swap quadrature, and for each save the maximum error across all . The density and reference solution used are:








-
•
For we use the and compute the reference solution using adaptive Gauss-Kronrod quadrature.
-
•
For and interior points () we use , with reference solution .
-
•
For and exterior points () we use , with reference solution .
The results of this investigation are shown in fig. 3. As expected, the convergence rate of the trapezoidal rule depends strongly on the distance to the boundary, which is not the case for SSQ. There appears to be a weak dependence on the rate for interior points, but that could be an effect of the chosen test problem. More concerning is that lowest attainable error appears to increase for smaller when . It is unclear what causes this effect, although in experiments there appears to be an upper bound to the error growth.
4 Conclusions
We have extended the singularity swap quadrature (SSQ, [1]) method to closed 2D curves discretized using the trapezoidal rule. This extension builds on the simple observation that interpolatory quadrature can be used on a periodic integrand if the problem is first swapped to the unit circle. The method relies on representing quantities as Fourier expansions, and as a consquence the domintaing cost of the method is that of applying the fast Fourier transform (FFT).
The method is accurate, exponentially convergent, and relatively simple to implement (and we provide source code). The fact that the cost is per target point makes the method unfeasible for large problems, but that is a consequence of the underlying trapezoidal rule being global (and exponentially convergent). For maximum efficiency, composite Gauss-Legendre quadrature with the original SSQ likely remains the better option.
In the original SSQ paper, it was shown that the method can be applied to line integrals in 3D by finding the singularity preimage through analytic continuation of the squared-distance function. The same technique can be applied to the present method, for closed curves in three dimensions. What remains is analytical evaluation of the integrals of the interpolatory quadrature. This is straightforward for the logarithmic kernel, but the integrals corresponding to power-law kernels are more challenging. Deriving expressions for these is currently work in progress.
Acknowledgements
The key contributions of this work were made with support from the Knut and Alice Wallenberg Foundation, under grant no. 2016.0410.
References
- af Klinteberg and Barnett [2020] L. af Klinteberg and A. H. Barnett. Accurate quadrature of nearly singular line integrals in two and three dimensions by singularity swapping. BIT Numer. Math., 2020. doi:10.1007/s10543-020-00820-5.
- af Klinteberg et al. [2022] L. af Klinteberg, C. Sorgentone, and A. K. Tornberg. Quadrature error estimates for layer potentials evaluated near curved surfaces in three dimensions. Comput. Math. Appl., 111:1–19, 2022. doi:10.1016/j.camwa.2022.02.001.
- Barnett et al. [2015] A. Barnett, B. Wu, and S. Veerapaneni. Spectrally Accurate Quadratures for Evaluation of Layer Potentials Close to the Boundary for the 2D Stokes and Laplace Equations. SIAM J. Sci. Comput., 37(4):B519–B542, 2015. doi:10.1137/140990826.
- Barnett [2014] A. H. Barnett. Evaluation of Layer Potentials Close to the Boundary for Laplace and Helmholtz Problems on Analytic Planar Domains. SIAM J. Sci. Comput., 36(2):A427–A451, 2014. doi:10.1137/120900253.
- Beale and Lai [2001] J. T. Beale and M.-C. Lai. A Method for Computing Nearly Singular Integrals. SIAM J. Numer. Anal., 38(6):1902–1925, 2001. doi:10.1137/S0036142999362845.
- Carvalho et al. [2018] C. Carvalho, S. Khatri, and A. D. Kim. Asymptotic analysis for close evaluation of layer potentials. J. Comput. Phys., 355:327–341, 2018. doi:10.1016/j.jcp.2017.11.015.
- Helsing and Ojala [2008] J. Helsing and R. Ojala. On the evaluation of layer potentials close to their sources. J. Comput. Phys., 227(5):2899–2921, 2008. doi:10.1016/j.jcp.2007.11.024.
- Nitsche [2022] M. Nitsche. Corrected trapezoidal rule for near-singular integrals in axi-symmetric Stokes flow. Adv. Comput. Math., 48(5):57, 2022. doi:10.1007/s10444-022-09973-z.
- Trefethen and Weideman [2014] L. N. Trefethen and J. A. C. Weideman. The Exponentially Convergent Trapezoidal Rule. SIAM Rev., 56(3):385–458, 2014. doi:10.1137/130932132.