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.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
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 [1] (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. [2,3,4]. In addition, exponentially convergent near evaluation is available through the “globally compensated” quadrature method introduced in [1] and extended in [5].
Recently, the method of singularity swap quadrature (SSQ) was proposed in [6]. 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 parametrization. After the swap, the integral can be evaluated using interpolatory quadrature with a monomial basis, following the method of [1]. This was shown to improve the accuracy for curved panels compared to [1], and allowed the method to be extended to line integrals in three dimensions.
The SSQ method was in [6] 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.
An essential component of our method is the use of trigonometric interpolation. For the logarithmic kernel, it can therefore be viewed as an extension of the product quadrature of Kress [7] to the nearly singular case. This was also noted by Bao et al. [8], who have proposed an extension of SSQ for the trapezoidal rule, in parallel with and independent of this work. Their approach starts with a Laurent expansion of the kernel on the unit circle, whereas the present work uses a Fourier expansion after singularity swapping, but they arrive at a method that appears equivalent to the present work for the logarithmic and Cauchy kernels. This corresponds to integrals \(I_L\) and \(I_1\) below; they do not consider higher order singularities. In addition, they study application of the method on non-periodic integrals and the Helmholtz equation.
2 Method
Since we are considering the problem in two dimensions, let us identify \(\mathbb {R}^2\) with \(\mathbb {C}\), and let \(\varGamma \) be a closed curve parametrized by a smooth function \(\gamma (t) = g_1(t) + i g_2(t)\), with \(t \in [0, 2\pi )\). Furthermore, let \(\sigma \) be a smooth function defined on \(\varGamma \), which we will refer to as the density. With some abuse of notation, we will denote \(\sigma (t)=\sigma (\gamma (t))\). For a point \(z\in \mathbb {C}\), typically lying close to \(\varGamma \), our integrals of interest are here
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 \(\gamma (t_j)\), \(j=0,\dots ,N-1\), with \(t_j = 2\pi j/N\) and the quadrature weights \(w_j=2\pi /N\). 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 \(\sigma \), \(\gamma \) and \(\gamma '\) 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,
Let us now assume that z is close to \(\varGamma \), which corresponds to the integrand in (3) having a singularity close to the real line at the preimage \(t^\star \in \mathbb {C}\) such that
under the complexification of \(\gamma \). In Klinteberg et al. [10] and Barnett [11], it is shown that this significantly reduces the convergence rate of the trapezoidal rule, with the error being proportional to \(e^{-N |{\text {Im}}{t^\star }|}\). In order to reduce the error for small \({\text {Im}}t^\star \), we will now show how to evaluate \(I_1(z)\) using SSQ.
Step one is to find the preimage \(t^\star \) that satisfies (4). Geometrically, the complexification of \(\gamma \) corresponds to following curved lines that extend from \(\varGamma \) in an approximately normal direction (see e.g. [10, fig. 4]). There are many different methods available for finding \(t^\star \). Noteworthy examples include the local and global approximations used together with Newton’s method in [10], and the novel quadrature-based method introduced in [8]. Studying the merits of the various approaches is beyond the scope of this work. However, we note that the computationally most efficient method probably is to use a local expansion, such as a truncated Taylor expansion of \(\gamma \) at each grid point.
For simplicity we will here use a global approximation for finding \(t^\star \). This corresponds to Newton’s method applied to a Fourier expansion of \(\gamma \). We apply a Fast Fourier Transform (FFT) to the node values \(\gamma (t_0),\dots ,\gamma (t_{N-1})\) to get the truncated Fourier series
where \(K=\frac{N-1}{2}\), assuming N odd, and \(\hat{\gamma }_k\) are the Fourier coefficients of \(\gamma \). This has a one-time cost of \(\mathcal {O}(N\log N)\), for a given discretization. Substituting this expansion into (4), we can find \(t^\star \) at an \(\mathcal {O}(N)\) cost using Newton’s method (assuming \(\mathcal {O}(1)\) iterations to convergence). A good initial guess for \(t^\star \) is the corresponding t-value of the grid point on \(\varGamma \) that is closest to z,
We assume that \(\varGamma \) is parametrized in a counter-clockwise direction, so that \({\text {Im}}t^\star > 0\) implies z interior to \(\varGamma \), 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 \(\left( \gamma (t)-\gamma (t^\star )\right) ^{-1}\) using the factor \((t-t^\star )\), as the latter is not periodic. Instead, we use \((e^{it}-e^{it^\star })\), which corresponds to swapping the singularity to a point close to the unit circle (this will be evident shortly). Then,
The function f is now the original integrand with the singularity at \(t^\star \) removed,
and we expect f to be smooth. Since its values are known at the equidistant nodes \(t_0, \dots , t_{N-1}\), we use an FFT to compute its truncated Fourier series (at an \(\mathcal {O}(N\log N)\) cost), such that
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 \(\hat{f}_k\) decay sufficiently fast. The integrals \(p_k\) can be evaluated analytically (at an \(\mathcal {O}(N)\) cost) by rewriting them as contour integrals on the unit circle S. Let
Then \(e^{ikt} = \xi (t)^k\) and
We can evaluate this integral using the residue theorem. If \(|\zeta |<1\) (or equivalently \({\text {Im}}t^\star >0\), corresponding to z being an interior point), then the integrand has a simple pole at \(\zeta \), with residue
In addition, if \(k \le 0\), then the integrand has a pole of order \(1-k\) at the origin, with residue
The two residues cancel for \(k \le 0\) and \(|\zeta |<1\) (i.e. \({\text {Im}}t^\star >0\)), so we get
This completes the method, which has a total cost of \(\mathcal {O}(N + N\log N)\) per target point.
The method can perhaps be understood in terms of Fourier coefficients. 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 \(e^{-|k{\text {Im}}t^\star |}\). In contrast, the coefficients \(\hat{f}_k(t^\star )\) decay rapidly and with a rate that stays nearly constant as \(z\rightarrow \varGamma \).
Example results for the Cauchy integral on the starfish geometry and density from Sect. 3.2, for two different \(t^\star \). The Fourier coefficients of the integrand in (3) decay approximately as \(\rho ^{-|k|}\), where \(\rho =e^{|{\text {Im}}t_0|}\), meaning that the decay rate worsens as \(z\rightarrow \varGamma \). On the other hand, the coefficients of the regularized function f in (10) decay rapidly, with a rate that stays approximately constant as \(z\rightarrow \varGamma \). Note that F in the legend denotes Fourier coefficients, i.e. \(F[f](k)=\hat{f}_k\)
A weakness of the method is that in order to find \(t^\star \), one must evaluate the analytic continuation of \(\gamma \) using a truncated Fourier series, which naturally is most accurate close to \(\varGamma \). For z far away from \(\varGamma \) the rootfinding process will struggle, and the accuracy of SSQ can in some cases deteriorate. However, this typically happens at ranges where the base trapezoidal rule is sufficiently accurate by a wide margin, and can be avoided by a coarse filter that only tries to find \(t^\star \) for points that are within a cutoff distance from \(\varGamma \) based on the grid spacing h.
Remark 1
The reader may note that one could in fact apply a variant of the Helsing–Ojala quadrature directly to (3). First solve the interpolation problem
where \(\tau _i=\gamma (t_i)\) and \(\sigma _i=\sigma (t_i)\). Then evaluate the layer potential as
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 (\(m > 1\)), we have
Evaluating this integral with SSQ is completely analogous to the case when \(m=1\), with the difference that we instead regularize with \((e^{it}-e^{it^\star })^m\), such that
It is worth noting that the Fourier coefficients \(\hat{f}_k\) of this definition of f decay like those in Fig. 1, with a rate that is independent of m. Once we have them, we next need expressions for the integrals
Evaluating the residues in the same way as for the \(m=1\) case, we get the general expression for integer \(m \ge 1\),
2.3 Log kernel
Consider now the log integral, also known as the Laplace single-layer potential, for a real-valued density \(\sigma \),
where f is assumed to be a smooth function. Proceeding in a similar fashion as before, we find \(t^\star \) and separate the integral as
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 \(\log |r|={\text {Re}}\log r\), such that we can evaluate it using SSQ,
Just as with \(p_k\), the integrals \(q_k\) can be transformed into integrals on the unit circle,
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 \(q_k(t^\star )\) depending on the sign of \({\text {Im}}t^\star \).
2.3.1 \({\text {Im}}t^\star <0\)
Beginning with the case \(|\zeta |>1\) (or \({\text {Im}}t^\star <0\)), we note that \(\xi -\zeta \ne 0\) 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 (30) as a contour integral on the unit circle, with a possible pole of order \(1-k\) at the origin,
Since \(\hat{f}_0 \in \mathbb {R}\), we only need the real part of \(q_k\) at \(k=0\). We then have that \({\varvec{q}}\) is for \({\text {Im}}t^\star <0\) computed as
2.3.2 \({\text {Im}}t^\star >0\)
We are now left with the case \(|\zeta |<1\) (or \({\text {Im}}t^\star >0\)). Here, \(\xi -\zeta =0\) at a point on the unit disk, so the integral of \(\log (\xi -\zeta )\) on the unit circle must intersect the branch cut in the \(\xi \) plane going from \(\zeta \) to infinity. We choose the branch cut such that it passes through the point \(\xi =1\). We define \(1^+\) and \(1^-\) to be the limits approaching 1 from above and below in the plane, such that
Then the integral on the unit circle S is,
In order to evaluate this, we let C be the closed contour following the unit circle from \(1^+\) to \(1^-\), then going from \(1^-\) to \(\zeta \) on the negative side of the branch cut, and then going from \(\zeta \) to \(1^+\) on the positive side of the branch cut,
The integrand is analytic inside C, except for a pole of order \(1-k\) at the origin when \(k \le 0\), with residue given by (31). The integrals along the branch cut are
Combining the results, and just as before keeping only the real part of the \(k=0\) integral, we arrive at the final results for \({\text {Im}}t^\star >0\),
2.4 Computing weights at linear cost
We sometimes wish to evaluate our target integrals (1) and (2) multiple times for the same density \(\sigma \). Instead of computing the Fourier components \(\hat{f}_k(t^\star )\) every time, we can then compute the corresponding quadrature weights \(w_j^m(t^\star )\) once and reuse them later. For the power-law kernel (2), this corresponds to
We expand the discrete Fourier transform, where \(\omega = e^{-2\pi i/N}\),
Rearranging, we can identify the weights as
which can be computed using an FFT. The process is completely analogous for the log kernel (1). However, for the power-law kernel it is possible express the weights in closed form. Substituting \(p_k^m\) using (25) and inserting \(\omega ^{jk}=e^{-ikt_j}\),
We can write this more compactly as
where \(S_m\) is defined as follows: Letting \(r= e^{i(t^\star -t_j)}\), for \({\text {Im}}t^\star >0\)
where the last step is given by the closed form of a geometric sum. Similarly, for \({\text {Im}}t^\star <0\) we have that
With (43) together with (46) and (47), we thus have compact closed-form expressions that allow us to compute \(w_j^m\) and evaluate (2) at an \(\mathcal {O}(N)\) cost. They can be evaluated and implemented for any m, preferably using a symbolic toolbox (see e.g. the accompanying code [12]). An equivalent closed-form expression was also derived in [8] for the case \(m=1\).
The above simplification to a closed form expression is unfortunately not possible for the log kernel, where the summation terms are of the form \(r^k/k\). Instead we still have to rely on using the FFT.
3 Experiments
In order to demonstrate the method outlined above, we here report experimental results for the by now well-known “starfish” geometry \(\gamma (t) = (1 + 0.3 \cos 5t) e^{it}\), \(\gamma \in [0, 2\pi )\). The method has been implemented in Julia [13], and is available online as open source on GitHub together with the scripts that produce the numerical in this manuscript [12].
3.1 Laplace double-layer potential
As a first demonstration, we reuse the Laplace test problem from [6]. That is, we evaluate the solution to the Laplace equation \(\varDelta u=0\) in the domain bounded by \(\varGamma \), with boundary condition \(u=u_e(z)=\log \left| {3+3i-z}\right| \). The solution to this problem can be represented using the Laplace double-layer potential (DLP) \(u(z)={\text {Im}}I_1(z)\), which leads to a second-kind integral equation in the real-valued density \(\sigma \). Once this integral equation is solved, the layer potential u(z) can be evaluated in the domain using quadrature, and compared to the exact solution \(u_e(z)\).
In Fig 2 we show results for the Laplace DLP when \(\varGamma \) is discretized using \(N=400\) points that are equidistant in the parametrization t. This results in a density that is resolved to machine precision, as measured by the decay of its Fourier coefficients. The layer potential is evaluated using the trapezoidal rule on a \(400 \times 400\) 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 on the level of machine precision in the interior of the domain and \(\mathcal {O}(1)\) 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 \(\mathcal {O}(10^{-13})\). The reason for this loss of precision is not known, but it is in line with the results when applying SSQ to Gauss–Legendre panels [6].
In Fig. 3, we repeat the above experiment with \(N=150\) points, which results in the density \(\sigma \) not being fully resolved. Here the far-field error is \(\mathcal {O}(10^{-10})\), but SSQ is not able to recover more than five digits of accuracy near the convex regions with high curvature. This is also a phenomenon whose exact cause is not known, but which is in line with the original SSQ algorithm.
3.2 Convergence
For a more systematic investigation of the method, we create the following setup. Let \(\varGamma \) be the starfish domain from the previous section, and discretize it using N points. We then create 100 evaluation points as \(z=\gamma (t^\star )\), where \({\text {Re}}t^\star \in [0, 2\pi )\) and \({\text {Im}}t^\star =d\). In order to test points both interior and exterior to \(\varGamma \), we use \(d = \{\pm 0.01, \pm 0.02, \pm 0.04\}\). For a range of N, we then compute the integrals \(I_L, I_1, I_2, I_3\) using both trapezoidal and singularity swap quadrature, and for each N save the maximum error across all z. The density \(\sigma \) and reference solution used are:
-
For \(I_L\) we use the \(\sigma (t) = g_1(t)g_2(t)\) and compute the reference solution using adaptive Gauss-Kronrod quadrature (as implemented in the Julia package QuadGK [14]).
-
For \(I_m\) and interior points (\({\text {Im}}t^\star >0\)) we use \(\sigma (\tau )=\tau ^3 + \tau \), with reference solution \(I_m(z)=2 \pi i \sigma ^{(m)}(z)/(m-1)!\).
-
For \(I_m\) and exterior points (\({\text {Im}}t^\star <0\)) we use \(\sigma (\tau )=\tau ^{-1}\), with reference solution \(I_m(z)=2\pi i z^{-m}\).
The density \(\sigma \) is a smooth function in all of the above cases. For \(I_L\) and for \(I_m\) with interior points it is fully resolved when N is very small. For \(I_m\) with exterior points it is fully resolved when \(N\approx 200\).
The results of this investigation are shown in Fig. 4. As expected, the convergence rate of the original trapezoidal rule depends strongly on the distance to the boundary. In contrast, the convergence rate for SSQ should not depend on the distance to the boundary if the singularity is perfectly swapped. Here, this is indeed the case for the exterior points, where the rate of convergence reflects the resolution of the smooth integrand. There appears to be a weak dependence between the rate and the distance 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 d when \(m>1\). 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, [6]) 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 relies on the fast Fourier transform (FFT) for precomputation on the geometry and, in case of the logarithmic kernel, for evaluation. For the power-law kernel, closed form expressions are derived such that the FFT is not needed at evaluation time.
The method is accurate, exponentially convergent, and relatively simple to implement (and we provide source code). The fact that the cost is \(\mathcal {O}(N)\) (for power-law) or \(\mathcal {O}(N \log N)\) (for log) 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.
References
Helsing, J., Ojala, R.: On the evaluation of layer potentials close to their sources. J. Comput. Phys. 227(5), 2899–2921 (2008). https://doi.org/10.1016/j.jcp.2007.11.024
Beale, J.T., Lai, M.-C.: A method for computing nearly singular integrals. SIAM J. Numer. Anal. 38(6), 1902–1925 (2001). https://doi.org/10.1137/S0036142999362845
Carvalho, C., Khatri, S., Kim, A.D.: Asymptotic analysis for close evaluation of layer potentials. J. Comput. Phys. 355, 327–341 (2018). https://doi.org/10.1016/j.jcp.2017.11.015
Nitsche, M.: Corrected trapezoidal rule for near-singular integrals in axi-symmetric Stokes flow. Adv. Comput. Math. 48(5), 57 (2022). https://doi.org/10.1007/s10444-022-09973-z
Barnett, A., Wu, B., Veerapaneni, S.: 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). https://doi.org/10.1137/140990826
af Klinteberg, L., Barnett, A.H.: Accurate quadrature of nearly singular line integrals in two and three dimensions by singularity swapping. BIT Numer. Math. (2020). https://doi.org/10.1007/s10543-020-00820-5
Kress, R.: Linear Integral Equations, 3rd edn. Springer, New York (2014). https://doi.org/10.1007/978-1-4614-9593-2
Bao, G., Hua, W., Lai, J., Zhang, J.: Singularity swapping method for nearly singular integrals based on trapezoidal rule (2023). arXiv:2305.05855
Trefethen, L.N., Weideman, J.A.C.: The exponentially convergent trapezoidal rule. SIAM Rev. 56(3), 385–458 (2014). https://doi.org/10.1137/130932132
af Klinteberg, L., Sorgentone, C., Tornberg, A.K.: Quadrature error estimates for layer potentials evaluated near curved surfaces in three dimensions. Comput. Math. Appl. 111, 1–19 (2022). https://doi.org/10.1016/j.camwa.2022.02.001
Barnett, A.H.: 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). https://doi.org/10.1137/120900253
af Klinteberg, L.: TrapzSSQ.jl, v1.0.0. Zenodo, (2023). https://doi.org/10.5281/zenodo.10058195
Bezanson, J., Edelman, A., Karpinski, S., Shah, V.B.: Julia: a fresh approach to numerical computing. SIAM Rev. 59(1), 65–98 (2017). https://doi.org/10.1137/141000671
JuliaMath. QuadGK.jl, v.2.8.2 (2023). URL https://github.com/JuliaMath/QuadGK.jl
Acknowledgements
The key contributions of this work were made with support from the Knut and Alice Wallenberg Foundation, under Grant No. 2016.0410.
Funding
Open access funding provided by Mälardalen University.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
The author has no conflicts no interest to declare.
Additional information
Communicated by Stefano De Marchi.
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
af Klinteberg, L. Singularity swap quadrature for nearly singular line integrals on closed curves in two dimensions. Bit Numer Math 64, 11 (2024). https://doi.org/10.1007/s10543-024-01013-0
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s10543-024-01013-0