1 Background

We consider the Helmholtz equation:

$$\begin{aligned} {\mathcal H}u := -\Delta u(\mathbf x ) - \frac{\omega ^2}{c^2(\mathbf x )}u(\mathbf x ) = f(\mathbf x ), \quad \mathbf {x}\in \varOmega \subseteq {\mathbb R}^d, \end{aligned}$$
(1)

plus boundary (or radiation) conditions, where \(\omega \) is the frequency, \(c(\mathbf x )>0\) is the wave speed, and \(f(\mathbf x )\) is the source distribution, which we suppose to be compactly supported.

The numerical solution of the Helmholtz equation (1) in the high-frequency regime, i.e., \(\omega \gg 1\), is notoriously hard to compute. From Shannon’s sampling principle [90], to resolve a general wave field oscillating at frequency \(\omega \), a mesh size \(h={\mathcal O}(\omega ^{-1})\) is necessary and sufficient. Hence, the number of intrinsic degrees of freedom (DOFs) is \({\mathcal O}(\omega ^{d})\), implying that the theoretical optimal overall complexity to solve (1) is \({\mathcal O}(\omega ^{d})\). In general, an overall complexity of optimal order is difficult to achieve due to two typical challenges:

  • how to design a discretization that can achieve both accuracy and stability without oversampling; and

  • how to solve the resulting linear system in linear complexity, up to poly-log factors, as the frequency becomes large.

Methods used to discretize the Helmholtz equation can be broadly categorized depending on the level of adaptivity that they exploit. We refer to adaptive discretizations as discretizations that depend on the medium and the source.

Examples of non-adaptive discretization are: standard finite differences [63, 77], standard continuous or discontinuous finite elements [34, 52, 53, 83, 98], and spectral methods [79, 100, 101], among many others. They are very general in the sense that they can be used for a variety of different problems. However, in the case of the Helmholtz equation they yield either pollution error,Footnote 1 inducing oversampled sparse discretizations [4, 6] whose associated linear systems can be solved in optimal complexity [28, 29, 91, 104, 109], or quasi-optimal sparse discretizations whose associated linear systems are prohibitively expensive to solve [44, 101] in the high-frequency regime.Footnote 2

Adaptive methods, on the other hand, aim to leverage à priori knowledge of the solution of the Helmholtz equation, such as its known oscillatory behavior. In practice, adaptive methods have mostly focused on adaptivity to the medium, such as polynomial Galerkin methods with hp refinement [3, 70, 73, 96, 107, 111], specially optimized finite differences [23, 45, 92, 93, 102] and finite elements [4, 99], enriched finite elements [30,31,32,33], plane wave methods [5, 21, 42, 43, 46, 69, 74], generalized plane wave methods [54, 55], locally corrected finite elements [17, 38, 82], and discretizations with specially chosen basis functions [7, 8, 76], among many others. They have been especially successful on reducing the pollution effect by accurately capturing the dispersion relation. However, in the high-frequency regime, either they are not asymptotically quasi-optimal for heterogeneous media or they yield linear systems that cannot be solved in quasi-linear time with current algorithms.Footnote 3

New advances on adaptive discretizations [14, 41, 49, 78] seem to indicate that quasi-optimality of the discretization, while still yielding linear systems amenable to fast solvers, can be achieved if the discretization depends on the medium and the source simultaneously. These fully adaptive discretizations aim to leverage analytical knowledge about the solution, such as asymptotic expansions, which in the case of the solution of the Helmholtz equation can take the form of the geometric optics ansatz:

$$\begin{aligned} u(\mathbf {x}) \approx \text{ superposition } \text{ of } \left\{ A_n(\mathbf x ) e^{i\omega \phi _n(\mathbf x )}\right\} _{n=1}^N, \end{aligned}$$
(2)

in which the phases \(\phi _n(\mathbf x )\) and amplitudes \(A_n(\mathbf x )\) depend on the medium, domain boundary, and source, but they are independent of the frequency.

Indeed, phase-based methods [41, 49, 78] are instances of fully adaptive discretizations. These methods use (2) to build an approximation space by modulating a polynomial basis with an oscillatory component using the phase functions, which need to be computed beforehand.

However, computing the appropriate global phase functions \(\phi _n(\mathbf {x})\) in the whole domain is a challenging task for a general medium with varying speed; different phase functions may be defined in different regions, whose boundaries are difficult to determine à priori; the error on the solution is proportional to the approximation error of the phase function times \(\omega \),Footnote 4 implying that the phase functions need to be computed extremely accurately, thus, making the computation of the phase functions the bottleneck in such approaches.

In the present paper, we propose a ray-based method based on the geometric optics ansatz, in which the phase functions are not explicitly computed, thus bypassing the bottleneck. The method relies on a linear approximation of the phase functions in the form

$$\begin{aligned} \phi _n(\mathbf {x}) \approx \phi _n(\mathbf {x}_0) + \nabla \phi _n(\mathbf {x}_0) \cdot (\mathbf {x}- \mathbf {x}_0) = \phi _n(\mathbf {x}_0) + \vert \nabla \phi _n(\mathbf {x}_0) \vert \widehat{\mathbf{d }}_n(\mathbf {x}_0) \cdot (\mathbf {x}- \mathbf {x}_0); \end{aligned}$$
(3)

where \(\widehat{\mathbf{d }}_n(\mathbf {x}_0) := \frac{\nabla \phi _n(\mathbf {x})}{|\nabla \phi _n(\mathbf {x})|} \) are called the ray directions [12] or the dominant wave directions [14]. The dominant wave directions are extracted from a low-frequency probing wave field, namely a solution to a low-frequency problem, i.e., the Helmholtz equation with the same medium and source, but at a much lower frequency \(\widetilde{\omega } = {\mathcal O}(\omega ^{1/2})\).

The underpinning property used in this approach is that the phase functions are independent of the frequency, and the extraction of their gradient is a stable operation using signal processing algorithms, such as numerical micro-local analysis (NMLA) [10,11,12]. The resulting linear system is sparse, and it can be solved efficiently using state-of-the-art preconditioners such as [28, 29, 91, 104, 109].

1.1 Results

The main result of this paper is an algorithm to solve the Helmholtz equation in the high-frequency regime with an optimal asymptotic cost \({\mathcal O}(\omega ^d)\), up to poly-log factors, with respect to the number of intrinsic degrees of freedom.

The performance of the algorithms owes to the following two ideas:

  • we build a fully adaptive discretization based on the geometric optics ansatz and local linear approximation of the phase functions whose gradients are learned from a low-frequency problem solved using standard finite elements; the resulting discretization is stable and asymptotically accurate; in particular, the error converges to zero as \({\mathcal O}(\omega ^{ -\frac{1}{2}})\), as the frequency increases;

  • we solve the resulting linear system using state-of-the-art preconditioners with linear complexity, up to poly-logarithmic factors.

The adaptive discretization is built by learning the dominant wave directions specific to the medium and source distribution. In particular, we probe the same medium using the same source, i.e., solving a low-frequency Helmholtz equation

$$\begin{aligned} -\Delta \widetilde{u}(\mathbf x ) - \frac{\widetilde{ \omega }^2}{c^2(\mathbf x )}\widetilde{u}(\mathbf x ) = f(\mathbf x ), \quad \mathbf {x}\in \varOmega \subseteq {\mathbb R}^d, \end{aligned}$$
(4)

plus suitable boundary (or radiation) conditions with the same \(c(\mathbf {x}), f(\mathbf {x})\) and a relative low-frequency \(\widetilde{\omega }\). The computed wave field is post-processed by NMLA or other signal processing tools to locally estimate the dominant wave directions; both the number of dominant wave directions and the directions can vary from point to point, thus, providing the flexibility to deal with general media. The estimated wave directions are then used to enrich a finite element space, which is used to discretize the original high-frequency Helmholtz equation.

In particular, we develop a simple ray-based finite element method (ray-FEM) in 2D for smooth media as a proof of concept study of our proposed approach. We start with a finite element mesh with mesh size h satisfying \(wh={\mathcal O}(1)\), i.e., a few points per wavelength. First, the low frequency is chosen by \(\widetilde{\omega } \sim \sqrt{\omega }\) such that Eq. (4) is solved quasi-optimality on such mesh since \(\widetilde{\omega }^2h={\mathcal O}(1)\) [71]. Then NMLA [10,11,12] (see Sect. 3) is applied to the computed low-frequency wave field to estimate the local dominant wave directions.

The estimated dominant wave directions are then used to enrich the local finite element basis following (2) in order to discretize the high-frequency Helmholtz equation on the same mesh.

We develop an efficient preconditioner to solve the resulting linear system iteratively using GMRES [88]. The preconditioner is based on the method of polarized traces [109]. Numerical experiments show that it is possible to solve the linear system in \({\mathcal O}(N)\) complexity with a possible poly-logarithmic factor for a smooth medium, where N is the total number of unknowns.

Moreover, once a more accurate wave field is computed, it can be used to get a better estimation of the dominant wave directions, which can be used to improve the high-frequency wave field iteratively. If necessary, the solution for the high-frequency Helmholtz equation can also be processed by NMLA to improve the estimation of local dominant wave directions which can be used to further improve the high-frequency solution.

1.2 Related work

In this section we briefly review related approaches to solve the Helmholtz equation, and we compare some of them with the approach proposed in this paper.

As stated in the prequel, it is difficult to design a sparse discretization that can achieve both accuracy and stability under the condition \(\omega h = {\mathcal O}(1)\) as \(\omega \) becomes large. This is mainly due to the pollution effect in error estimates for finite element methods [4, 6], i.e., the ratio between numerical error and best approximation error from a discrete finite element space is \(\omega \) dependent.

From a physical point of view, the wave field governed by the Helmholtz equation contains waves propagating in all directions and satisfying a specific dispersion relation. As a consequence, numerical errors due to dispersion or interpolation for these propagating modes will propagate as physical waves to pollute the whole computed wave field. In particular, a compact stencil on a mesh that is comparable to the wavelength cannot approximate the dispersion relations for propagating waves in all direction uniformly well as \(\omega \rightarrow \infty \) [6].

In order to minimize (or eliminate, if possible) the pollution effect, various approaches have been proposed lately in the literature. Approaches based on polynomial basis coupled with nonstandard variational formulations (such as [75]) have been proposed in order to approximate the Helmholtz operator so that the resulting discrete problems have better stability properties. For example, with an appropriate choice of coefficients, low-order compact finite-difference discretizations can effectively reduce the dispersion error [35, 58, 80]. Other instances of such approaches are the generalized finite element method (GFEM) [4] and continuous interior penalty finite element method (CIP-FEM) [107, 111], the interpolated optimized finite-difference method (IOFD) [93, 94], Galerkin methods with hp refinement [70, 72, 73], among many others. These methods successfully reduce the pollution error; however, they require either a more restrictive condition on the mesh size or the degree of the polynomial approximation to be \(\omega \) dependent, resulting on a large increase in the size and interconnectivity of the associated linear systems as the frequency increases.

On the other hand, many approaches rely on specially designed basis in order to accurately represent the solution. One of such approaches is the multiscale Petrov–Galerkin method [17, 38, 82]; the method relies on local corrections, which are numerically computed in a fine mesh, to the basis functions. This method is stable and quasi-optimal under the minimal resolution condition \(\omega H = {\mathcal O}(1)\) and \(m = {\mathcal O}(\log \omega )\) for the coarse mesh H and an oversampling parameter m. However, the condition on the fine mesh size, h, to solve the local subscale correction is the same as the standard FEM. It requires \(\omega ^{3/2} h = {\mathcal O}(1) \) for stability [107] and \(\omega ^2 h = {\mathcal O}(1)\) for quasi-optimality [71].

Other instances of such approaches are methods that incorporate appropriate oscillatory behavior into the basis of Galerkin methods. The key issue for this strategy is how to design the oscillatory basis. Since the Helmholtz solutions locally behave like plane waves, one approach is to incorporate plane waves with a predetermined equi-spaced distribution in directions into the basis. For example, products of plane waves with local finite elements basis are used in the generalized finite element methods (GFEMs) [71], partition of unity finite element methods (PUFEM) [5], virtual element methods (VEM) [81], discontinuous Galerkin (DG) methods [36, 42, 46], and ultra-weak variational formulation (UWVF) [18, 20, 21]. Trefftz-type methods [47] use local solutions of the Helmholtz equation as the basis functions, which in the case of piece-wise constant media are plane waves.

It is well known that these plane wave-based methods need fewer DOFs to achieve better accuracy than the conventional finite element methods [47, 64]. A comparison of these methods can be found in [37, 39, 51, 64]. However, these methods have two caveats: They normally perform poorly when the source is not zero, and it is not clear how to choose the number of plane wave directions à priori. In order to achieve a good accuracy, a fine, \(\omega \)-dependent [47], resolution in the angle space is required. This refinement in the angle space will not only increase the DOFs significantly but also make the resulting linear system extremely ill-conditioned due to the numerical coherence of the elements of the basis.

Other basis functions can be utilized, such as Bessel functions [49, 67, 68] to improve the adaptivity to the curvature of the solution’s wavefront and also reduce the linear dependence of the basis. Moreover, generalized plane waves [54,55,56] in the form \(e^{P(\mathbf {x})}\) with an appropriate complex polynomial \(P(\mathbf {x})\) are developed to achieve high-order convergence for smooth heterogeneous media. Another instance of methods using other basis functions is the discontinuous enrichment method (DEM) [31,32,33, 97], which combines Lagrange multipliers on the mesh interfaces to enforce continuity of the solution with approximation spaces composed by sums of continuous polynomials and discontinuous plane waves, leading to a reduction of the number of DOFs.

A more adaptive approach to solve the high-frequency Helmholtz equation is based on the geometric optics ansatz of the wave field (2). In the ansatz, phases and amplitudes are independent of frequency and hence are non-oscillatory and smooth except at a measure zero set, e.g., focus points, caustics, corners in a smooth medium. Once the phase functions of the wave fronts are available, the oscillatory pattern of the wave field is known; phase-based numerical methods [14, 41, 49, 78] explicitly incorporate these known phases into the basis functions to significantly improve both stability and accuracy.

As discussed in the prequel, computing the global phase functions for general media is a challenging task. Meanwhile, a phase function can be locally approximated by a linear function with a leading term \(\widehat{\mathbf{d }}_n(\mathbf {x}_0) \cdot \mathbf {x}\), where \(\widehat{\mathbf{d }}_n(\mathbf {x}_0)\) is the local dominant wave direction and can be extracted stably by signal processing algorithms. With precomputed dominant wave directions by ray tracing [15, 16, 22, 49], the dominant plane wave method [14] incorporates them into the local basis to combine the advantages of phase-based methods and plane wave methods. Since only the dominant directions of wave fronts relevant to the problem are involved in this approach, the number of degrees of freedom can be kept minimal, and ill-conditioning of the resulting linear system due to redundancy can be reduced.

Finally, under the stronger assumption that the medium can be written as a homogeneous background plus a compactly supported perturbation, the Helmholtz equation can be converted to a second-kind integral equation by introducing the Green’s function corresponding to the background, resulting in the so-called Lippmann–Schwinger equation. Recent advances have shown that it is possible to solve the Lippmann–Schwinger equation, and hence the Helmholtz equation, in optimal time [110]. In this paper, however, we treat a more general case.

1.3 Outline of the paper

Here is an outline of this paper. We first describe the ray-FEM using the geometric optics ansatz as the motivation and study its approximation property in Sect. 2. In Sect. 3 we introduce the NMLA with its stability and local ray direction error analyzed in “Appendices A and B.” Section 4 provides the full presentation of the numerical algorithm whose empirical complexity is given in Sect. 5. Numerical results are presented in Sect. 6. Conclusions and future works are summarized in Sect. 7.

2 The ray-FEM method

In this section we describe the ray-FEM method for the Helmholtz equation and its rationale. We explain briefly the geometric optic ansatz and how it is approximated locally via a superposition of plane waves propagating in a set of dominant directions. We then proceed to explain how these plane waves are incorporated into the finite element basis to improve both stability and accuracy of the numerical solution to the high-frequency Helmholtz equation.

In this section we suppose that the dominant directions are known exactly. In Sect. 3 we will describe how to learn the dominant wave directions by probing the medium using low-frequency waves.

We use the following boundary value problem in 2D to illustrate our method,

$$\begin{aligned} \left\{ \begin{array}{rl} -\Delta u - k^2(\mathbf {x}) u = f, &{}\quad \text{ in } \quad \varOmega , \\ \frac{\partial u}{\partial n} + i\beta k(\mathbf {x}) u = g, &{}\quad \text{ on } \quad \partial \varOmega , \end{array} \right. \end{aligned}$$
(5)

where \(\varOmega \) is an open bounded Lipschitz domain in \(\mathbb {R}^2\), \(k(\mathbf {x}) = \omega /c(\mathbf {x})\) is the inhomogeneous wave number, \(f \in L^2(\varOmega )\) is the source, and \(g \in L^2(\partial \varOmega )\) is the boundary data. Moreover, we suppose that both source and boundary data are frequency independent. Equation (5) is usually referred to as the Helmholtz equation with impedance boundary conditions. This equation was chosen in order to easily impose other types of boundary conditions by modifying the coefficient \(\beta \). Specifically, the Dirichlet boundary condition corresponds to \(\beta = \infty \) and the first-order absorbing boundary condition to \(\beta = \pm 1\). Moreover, it is easy to extend (5) to incorporate absorbing boundary conditions implemented via PML [13], as it will be performed in the numerical experiments in Sect. 6.3.

2.1 Geometric optics ansatz

The standard derivation of the geometric optics ansatz uses WKJB approximation [57, 60, 87] (or the Lüneberg–Kline expansion [61]) for the solution to the Helmholtz equation (1):

$$\begin{aligned} u(\mathbf {x}) \sim e^{i\omega \phi (\mathbf {x})} \sum _{\ell = 0}^{\infty } \frac{A_{\ell }(\mathbf {x})}{\omega ^{\ell } }. \end{aligned}$$
(6)

By taking \(\omega \rightarrow \infty \) and considering only the first term one has

$$\begin{aligned} u(\mathbf x ) = A(\mathbf x ) e^{i\omega \phi (\mathbf x )} + O \left( \frac{1}{\omega } \right) , \end{aligned}$$
(7)

where A is usually called the amplitude and \(\phi \) the phase. The key features of the geometric optics ansatz are:

  • A and \(\phi \) are independent of the frequency \(\omega \);

  • A and \(\phi \) depend on the medium, \(c(\mathbf {x})\), and the source distribution, \(f(\mathbf {x})\).

Moreover, except for a small set of points, e.g., source/focus points, caustics, and discontinuities of the medium, A and \(\phi \) are smooth functions satisfying the following PDE system for \(f = {\mathcal O}(\omega ^0)\),

$$\begin{aligned} \text{(eikonal) } \quad |\nabla \phi | = \frac{1}{c}, \qquad \text{(transport) } \quad 2\nabla \phi \cdot \nabla A + A \Delta \phi = 0. \end{aligned}$$
(8)

As long as the medium is smooth and no caustic occurs, the asymptotic expansion (6) holds in the sense that the difference between the exact solution of the Helmholtz equation and an N-term truncation of the expansion (6) can be made arbitrarily smooth for all \(\mathbf x \) provided N is taken sufficiently large. This has been justified in [62] for oscillatory initial value problems of hyperbolic equations and further made rigorous in the theory of Fourier integral operators [48]. In practice, the one-term asymptotic expansion (7), namely the so-called geometric optics term, usually yields sufficiently accurate asymptotic solutions [1, 2, 59, 65, 66, 85, 86].

The coefficients \(\{A_l\}\) in the asymptotic expansion (6) satisfy a recursive system of transport equations [1, 2, 86] which are coupled with the eikonal equation. Under the assumption that the medium is smooth and no caustic occurs, one may solve the transport equations to estimate the coefficients \(\{A_l\}\) in different formulations [1, 2, 65]. Since the geometric optics term is oscillatory when \(\omega \ne 0\), it should be understood in the \(L^2\) sense rather than the \(L^{\infty }\) sense.

Assuming that the medium is smooth and no caustic occurs, the asymptotic expansion (7) will not fail as long as the frequency parameter \(\omega \) is not zero, but the resulting difference between the asymptotic expansion (7) and the exact solution may be large in the \(L^2\) norm as the frequency approaches zero [86]. Given an inhomogeneous medium, however, it is hard to pin down how large \(\omega \) should be so that the asymptotic expansion (7) is accurate up to a certain specified accuracy, as this is closely related to both fluctuations and correlation lengths of the normalized propagation speed of the medium [106] and the frequency parameter \(\omega \). We refer the reader to [27] for further details on the geometric optics ansatz.

2.2 Local plane wave approximation

In general, the phase function, \(\phi \), and the amplitude function, A, are multivalued functions corresponding to multiple arrivals of wave fronts [9]. Hence, one can further decompose the geometric optics ansatz into a superposition of several wave fronts in the form:

$$\begin{aligned} u(\mathbf x ) = \text{ superposition } \text{ of } \{A_{n}(\mathbf x ) e^{i\omega \phi _{n}(\mathbf x )}\}_{n=1}^{N(\mathbf {x})} + O \left( \frac{1}{\omega } \right) , \end{aligned}$$
(9)

where \(N(\mathbf {x})\) is the number of fronts/rays passing through \(\mathbf {x}\), and the phases \(\phi _n\) and amplitudes \(A_n\) are single valued functions satisfying the eikonal/transport equations (8), each defined in a suitable domain with suitable boundary conditions [9].

Based on the above geometric optics ansatz, one can derive a local plane wave approximation at any point where \(\phi _n\) and \(A_n\) are smooth with variations on a \({\mathcal O}(1)\) scale. Indeed, using Taylor expansions on a small neighborhood around an observation point \(\mathbf x _0\) for the n-th wave front, we have,

$$\begin{aligned} u(\mathbf {x}) = \left( A_{n}(\mathbf x _{0})\! +\! \nabla \!A_{n}(\mathbf x _{0}) (\mathbf {x}\!-\! \mathbf {x}_0) \right) e^{ i\omega \left( \phi _{n} (\mathbf {x}_0) + \nabla \phi (\mathbf {x}_0) \cdot (\mathbf {x}- \mathbf {x}_0 ) \right) }\! +\! \mathcal {O} \left( \! h^2 \!+\! \omega h^2 \!+\! \frac{1}{\omega }\! \right) , \end{aligned}$$
(10)

for \(|\mathbf {x}-\mathbf {x}_0|<h\ll 1\).

Define

$$\begin{aligned} \widehat{\mathbf{d }}_{n}:=\frac{\nabla \phi _n(\mathbf {x}_0)}{|\nabla \phi _n(\mathbf {x}_0) |} = c(\mathbf {x}_0) \nabla \phi _n(\mathbf {x}_0) \end{aligned}$$
(11)

as the ray directions of the wave fronts at \(\mathbf {x}_0\), \(k(\mathbf {x}_0) = \omega /c(\mathbf {x}_0)\), and

$$\begin{aligned} B_{n}(\mathbf {x}) = (A_{n}(\mathbf x _{0}) + \nabla A_{n}(\mathbf x _{0}) (\mathbf {x}- \mathbf {x}_0) )e^{i\omega (\phi _{n}(\mathbf x _{0})-\nabla \phi (\mathbf {x}_0)\cdot \mathbf {x}_0)} \end{aligned}$$
(12)

the affine complex amplitude. By replacing (11) and (12) in (10) we have

$$\begin{aligned} u(\mathbf {x}) = B_{n}(\mathbf {x}) e^{ i k(\mathbf {x}_0) \widehat{\mathbf{d }}_{n} \cdot \mathbf {x}} + \mathcal {O} \left( h^2 + \omega h^2 + \frac{1}{\omega } \right) , \end{aligned}$$
(13)

for \(|\mathbf {x}-\mathbf {x}_0|<h\ll 1\).

From (9) and (13), we have that u can be approximated locally by a superposition of plane waves propagating in certain directions with affine complex amplitudes. Moreover, as \(\omega \rightarrow \infty \), such that \( \omega h={\mathcal O}(1)\), the asymptotic error for the local plane wave approximation (13) is \({\mathcal O}(\omega ^{-1})\), which is of the same order as the asymptotic error for the original geometric optics ansatz (9). We use (13) as the motivation to construct local finite element basis with mesh size \(h={\mathcal O}(\omega ^{-1})\), in which an affine function is multiplied by plane waves oscillating in those ray directions, resulting in local approximations similar to (13).

2.3 Ray-based FEM formulation

We use a finite element method to compute the solution to (5), whose standard weak formulation is given by

$$\begin{aligned} \text{ Find } u \in H^1(\varOmega ), \text{ such } \text{ that } \mathcal {B}(u,v) = \mathcal {F}(v), \quad \forall v \in H^1(\varOmega ), \end{aligned}$$
(14)

where

$$\begin{aligned}&\mathcal {B}(u,v) := \int _{\varOmega }\nabla u \cdot \nabla \overline{v} dV - \int _{\varOmega } k^2u\overline{v}dV + i\beta \oint _{\partial \varOmega } k u \overline{v}dS, \end{aligned}$$
(15)
$$\begin{aligned}&\mathcal {F}(v) := \int _{\varOmega }f\overline{v}dV + \oint _{\partial \varOmega }g\overline{v}dS. \end{aligned}$$
(16)

The domain, \(\varOmega \), is discretized with a standard regular triangulated mesh, with mesh size h. The resulting mesh is denoted by \(\mathcal {T}_h = \{K\}\), where K represents a triangle of the mesh. Using the aforementioned mesh, we define two approximation spaces for the variational formulation (14):

  • the standard FEM (S-FEM), where we use low-order \(\mathbb {P}1\) finite elements, i.e., piece-wise bilinear functions;

  • the ray-FEM, where we use \(\mathbb {P}1\) finite elements multiplied by plane waves as in (13).

For a given element \(K \in \mathcal {T}_h\), we denote by \(V_j\) and \(\mathbf x _j, j = 1,2,3\), the vertices of K and their coordinates, respectively. Moreover, we denote by \(\{\varphi _j(\mathbf {x}) \}_{j = 1}^3\) a partition of unity consisting of piece-wise bilinear functions satisfying \(\varphi _j(\mathbf {x}_i) = \delta _{ij}\), \(i, j = 1,2,3\), where \(\delta _{ij}\) is the Kronecker delta. The basis given by \(\{\varphi _j(\mathbf {x}) \}_{j = 1}^3\) is usually called the nodal basis for Lagrange \(\mathbb {P}1\) finite elements. The standard local approximation space is given by

$$\begin{aligned} V_{S}(K) = \text{ span } \{ \varphi _j(\mathbf x ), j = 1,2,3 \}, \end{aligned}$$
(17)

and the global \(\mathbb {P}1\) finite element space

$$\begin{aligned} V_{S}(\mathcal {T}_h) = \left\{ v\in C^0(\overline{\varOmega }) : v|_K \in V_S(K), \forall K \in \mathcal {T}_h\right\} . \end{aligned}$$
(18)

To define the ray-FEM we enrich the \(\mathbb {P}1\) finite elements by incorporating the ray information. Letting \(\{\widehat{\mathbf{d }}_{j,l}\}_{l = 1}^{n_j}\) be \(n_j\) ray directions at the vertex \(V_j\), we define the ray-based local approximation space by

$$\begin{aligned} V_{Ray}(K) = \text{ span } \left\{ \varphi _j(\mathbf x )e^{ik_j\widehat{\mathbf{d }}_{j,l}\cdot \mathbf x }, \quad k_j = k(\mathbf x _j), \quad j = 1,2,3, \quad l = 1,\ldots ,n_j \right\} , \end{aligned}$$

and the global ray-FEM space by

$$\begin{aligned} V_{Ray}(\mathcal {T}_h) = \left\{ v\in C^0(\overline{\varOmega }) : v|_K \in V_{Ray}(K), \forall K \in \mathcal {T}_h \right\} . \end{aligned}$$

We can define the standard FEM method by

$$\begin{aligned} \text{ Find } u \in V_{S}(\mathcal {T}_h), \text{ such } \text{ that } \mathcal {B}(u,v) = \mathcal {F}(v), \quad \forall v \in V_{S}(\mathcal {T}_h). \end{aligned}$$
(19)

Analogously, we define the ray-FEM method by

$$\begin{aligned} \text{ Find } u \in V_{Ray}(\mathcal {T}_h), \text{ such } \text{ that } \mathcal {B}(u,v) = \mathcal {F}(v), \quad \forall v \in V_{Ray}(\mathcal {T}_h). \end{aligned}$$
(20)

2.4 Approximation property of ray-FEM with exact ray information

We provide a simple computation to estimate the approximation error of the ray-FEM space. In particular, we compute an asymptotic bound on \(\inf _{u_h \in V_{Ray}(\mathcal {T}_h)} || u - u_h ||_{L^2(\varOmega )}\), where u is the solution to the Helmholtz equation (1). We achieve the bound by estimating the interpolating error using \(V_{Ray}(K)\) as a basis.

In the computation we assume that the ray direction, which is the gradient of the phase function \(\phi \), and the phase function itself are exactly known. For simplicity, we assume \(N = 1\) for the asymptotic formula in (9); i.e., only one ray crosses each point of the domain, and thus, no caustic occurs. Similar results can be derived for the multiple-ray crossing case: \(N > 1\). In addition we suppose that f, the source, is zero inside the domain; otherwise, singularities in the amplitude may appear. Under those circumstances A and \(\phi \) are smooth. From the geometric optics ansatz, we have

$$\begin{aligned} u(\mathbf x ) = A(\mathbf x ) e^{i\omega \phi (\mathbf x )} + {\mathcal O}\left( \omega ^{-1} \right) . \end{aligned}$$
(21)

We denote by \(N_h\) the total number of vertices on the mesh \(\mathcal {T}_h\), by \( \lbrace \mathbf {x}_j \rbrace _{j = 1}^{N_h}\) the coordinates of all mesh nodes, and by \(\lbrace \varphi _j(\mathbf {x}) \rbrace _{j = 1}^{N_h}\) their corresponding nodal basis functions for the standard \(\mathbb {P}1\) element.

We note that \( e^{i\omega [ \phi (\mathbf x _j) - \nabla \phi (\mathbf x _j) \cdot \mathbf x _j ]}\) is a constant for the nodal basis associated to \(\mathbf {x}_j\) in an element K. From this observation we can easily deduce that the local ray-FEM space can be rewritten as

Hence, the nodal interpolation of the solution can be written as

$$\begin{aligned} u_I := \sum _{j=1 }^{N_h} A(\mathbf x _j)\varphi _j(\mathbf x ) e^{i\omega [ \phi (\mathbf x _j) + \nabla \phi (\mathbf x _j) \cdot ( \mathbf x - \mathbf x _j) ]}, \end{aligned}$$
(22)

which by construction lies within the global ray-FEM space \(V_{Ray}(\mathcal {T}_h)\).

Let \(S_j\) be the support of \(\varphi _j(\mathbf x )\), and \(|S_j| \sim {\mathcal O}(h^2)\) be the area of \(S_j\). Then using the triangular inequality and the smoothness assumptions, we have

To be more precise, \(h^2 \vert A \vert _{H^2(\varOmega )} \) comes from the interpolation error estimate [95], and \(\omega h^2 \Vert A \Vert _{L^{\infty }(\varOmega )} \Vert \nabla ^2 \phi \Vert _{L^{\infty }(\varOmega )}\) comes from the Taylor expansion of \(\phi (\mathbf {x})\) near \(\mathbf {x}_j\), where the constant for \(\lesssim \) is a generic positive constant only depending on the domain \(\varOmega \). This implies that

$$\begin{aligned} \inf _{u_h \in V_{Ray}(\mathcal {T}_h)} || u - u_h ||_{L^2(\varOmega )} \lesssim h^2 \vert A \vert _{H^2(\varOmega )} + \omega h^2 \Vert A \Vert _{L^{\infty }(\varOmega )} \Vert \nabla ^2 \phi \Vert _{L^{\infty }(\varOmega )} + {\mathcal O}(\omega ^{-1}) . \end{aligned}$$
(23)

Or, asymptotically,

$$\begin{aligned} \inf _{u_h \in V_{Ray}(\mathcal {T}_h)} || u - u_h ||_{L^2(\varOmega )} = {\mathcal O}(h^2 + \omega h^2 + \omega ^{-1} ). \end{aligned}$$
(24)

Moreover, if the exact rays are known and the mesh size follows \(h \sim \omega ^{-1}\), then we have

$$\begin{aligned} \inf _{u_h \in V_{Ray}(\mathcal {T}_h)} || u - u_h ||_{L^2(\varOmega )} = {\mathcal O}(\omega ^{-1}), \end{aligned}$$
(25)

i.e., that the approximation error decays linearly with \(\frac{1}{\omega }\), without oversampling.

Remark 1

The ray information can be incorporated into other Galerkin basis in the same fashion. For example, in the hybrid numerical asymptotic method of [41], the basis functions are constructed by multiplying nodal piece-wise bilinear functions to oscillating functions with phase factors; the plane wave DG method of [14] employs the products of small degree polynomials and dominant plane waves as basis functions; the phase-based hybridizable DG method of [78] considers basis functions as products of polynomials and phase-based oscillating functions. Moreover, the phase or ray information in these methods is obtained from solving the eikonal equation with ray tracing and related techniques.

3 Learning local dominant ray directions

In Sect. 2 we use geometric optics to provide the motivation for the ray-FEM by building an adaptive approximation space that incorporates ray information specific to the underlying Helmholtz equation. However, the ray directions, which depend on the medium and source distribution, are unknown quantities themselves; hence, they need to be computed or estimated. One way is to compute the global phase function, by either ray tracing or solving the eikonal equation, and take its gradient. As discussed in the introduction, computing the global phase function in a general varying medium can be extremely difficult.

In the present paper, we propose a totally different approach. This novel approach is based on learning the dominant ray directions by probing the same medium with the same source but using a relative low-frequency wave. To be more specific, we first solve the Helmholtz equation (4) with the same speed function \(c(\mathbf {x})\), right-hand side \(f(\mathbf {x})\) and boundary conditions but with a relative low-frequency \(\widetilde{\omega } \sim \sqrt{\omega }\) on a mesh with size \(h={\mathcal O}(\widetilde{\omega }^{-2}) ={\mathcal O}(\omega ^{-1})\) with a standard finite element method, which is quasi-optimal in that regime. Then the local dominant ray directions are estimated based on the computed low-frequency wave field. The key point is that the low-frequency wave has probed the medium specific to the problem globally while only local dominant ray directions need to be learned, which allows us to handle multiple arrivals of wave fronts locally. In particular, we use NMLA, which is simple, stable, and robust, to extract the dominant ray directions locally. However, this is a signal processing task that can be accomplished using other methods such as Prony’s method [19], Pisarenko’s method [84], MUSIC [89], matrix pencil [50], wavefront tracking methods [103], among many others. The main advantage of NMLA is that it was explicitly designed for capturing the dominant directions; in particular, NMLA was designed to be more robust to perturbations of the underlying model.

3.1 NMLA

In this subsection, for the sake of completeness, we provide a brief introduction to NMLA developed in [11, 12]. If we suppose that a wave field is locally a weighted superposition of plane waves having the same wave number and propagating in different directions, then the aim of NMLA is to extract the directions and the weights by sampling and processing the wave field locally. In the sequel, we use a 2D example to illustrate the method, which can be easily extended to 3D cases [12].

Suppose that a wave field, denoted by \(u(\mathbf {x})\), is composed of N plane waves around an observation point \(\mathbf {x}_0\),

$$\begin{aligned} u(\mathbf {x})= \sum _{n=1}^{N} B_{n}e^{ik(\mathbf {x}-\mathbf {x}_0)\cdot \widehat{\mathbf{d }}_n}, \quad | \widehat{\mathbf{d }}_n |=1. \end{aligned}$$
(26)

We suppose that we can sample the wave field, \(u(\mathbf {x})\), and its derivative on a circle \(S_r(\mathbf {x}_0)\) centered at \(\mathbf {x}_0\) with radius r. The wave field can be written under the model assumption in (26) as

$$\begin{aligned} u(\mathbf x _0 + r\widehat{\mathbf{s }})= \sum _{n=1}^{N} B_{n}e^{i\alpha \widehat{\mathbf{s }}\cdot \widehat{\mathbf{d }}_n}, \quad \alpha =kr, ~\widehat{\mathbf{s }}\in \mathbb {S}^1. \end{aligned}$$
(27)

Furthermore, we define the angle variables \(\theta = \theta (\widehat{\mathbf{s }})\) and \(\theta _n = \theta (\widehat{\mathbf{d }}_n)\) such that \(\widehat{s} = (\cos \theta , \sin \theta )\), \(\widehat{\mathbf{d }}_n = (\cos \theta _n, \sin \theta _n)\), and \(\mathbf {x}(\theta ) = \mathbf x _0 + r \widehat{\mathbf{s }}(\theta )\). Using the angle-based notation, we sample the impedance quantity on the circle \(S_r(\mathbf {x}_0)\),

$$\begin{aligned} U(\theta ) := \frac{1}{ik} \partial _{r} u(\mathbf x (\theta )) + u(\mathbf x (\theta )), \end{aligned}$$
(28)

which removes any possible ambiguity due to resonance [11] and improves the robustness to noise for solutions to the Helmholtz equation. Then we apply the filtering operator \(\mathcal {B}\) to the impedance quantity

$$\begin{aligned} \mathcal {B}U(\theta ) := \frac{1}{2L_{\alpha }+1} \sum \limits _{l=-L_{\alpha }}^{L_{\alpha }}\frac{(\mathcal {F}U)_l e^{il\theta }}{(-i)^l (J_l(\alpha )-i J_l'(\alpha ))} , \end{aligned}$$
(29)

where \(L_{\alpha } = \max (1, [\alpha ], [\alpha + (\alpha )^{\frac{1}{3}} -2.5])\), \(J_l\) is the Bessel function of order l, \(J'_l\) is its derivative, and

$$\begin{aligned} \left( \mathcal {F}U\right) _l := \frac{1}{2\pi } \int _0^{2\pi } U(\theta ) e^{-il \theta } d \theta \end{aligned}$$
(30)

is the l-th Fourier coefficient of U. It is shown in [11] that

$$\begin{aligned} \mathcal {B}U(\theta ) = \sum _{n=1}^{N}B_nS_{L_{\alpha } }(\theta - \theta _n), \end{aligned}$$
(31)

where \( S_{L}(\theta ) = \frac{\sin ([2L+1]\theta /2)}{[2L+1]\sin (\theta /2)} \). As a consequence, we have that if \(\alpha =kr\rightarrow \infty \) then

$$\begin{aligned} \lim _{\alpha \rightarrow \infty }\mathcal {B} U(\theta ) = \left\{ \begin{array}{ll} B_n, &{} \quad \text {if } \theta = \theta _n (\text {or }\widehat{\mathbf{s }} = \widehat{\mathbf{d }}_n );\\ 0, &{} \quad \text {otherwise}. \end{array} \right. \end{aligned}$$
(32)

Then it is possible to obtain the directions and the amplitudes by picking the peaks in the filtered data in (31); see details in Algorithm 2.

However, for applications, the measured data are never a perfect superposition of plane waves; therefore, we provide, for completeness, stability and error estimates for NMLA from [11] in “Appendix A.” In principle, for a single wave, as long as the perturbation is relatively small with respect to the true plane wave signal, say the relative noise level do not surpass \(25 \%\), the estimation error is \({\mathcal O}(\frac{1}{kr})\). In other words, the larger the radius of the circle compared to wavelength the more accurate the estimation is.

In our application, the datum is the numerical solution of the Helmholtz equation. In addition to noises and numerical errors, there are perturbations due to two model errors :

  • the geometric optics ansatz has an asymptotic error of order \({\mathcal O}(\omega ^{-1})\) [see (9)];

  • in the geometric optics ansatz the wave field at a point is a superposition of curved wave fronts. In particular, the curvature of the wave fronts results in a compromise in the choice of the radius of the sampling circle to be of order \({\mathcal O}(\omega ^{-\frac{1}{2}})\) for the NMLA in order to achieve the stability and the minimal error of order \({\mathcal O}(\omega ^{-\frac{1}{2}})\).

A detailed analysis is provided in “Appendix B.” We mention that the accuracy of NMLA can be improved by a curvature correction for a single point source; we refer the reader to “Appendix C” for details. Below is a summary of the NMLA (plus curvature correction) algorithm.

figure a
figure b
figure c

3.2 Approximation property of numerical ray-FEM

In this section we incorporate the errors from the estimation of the ray directions into the approximation error for the ray-FEM method, in which ray directions are first estimated by applying Algorithm 1 to the solution of the Helmholtz equation with a relatively low frequency. The estimated ray directions are then used to generate the approximation space. With the same assumptions as in Sect. 2.4, we estimate an upper bound on

$$\begin{aligned} \inf _{u_h \in V_{Ray}^h(\mathcal {T}_h)} \Vert u - u_h \Vert _{L^2(\varOmega )}, \end{aligned}$$
(33)

when the ray-FEM space, \(V_{Ray}^h(\mathcal {T}_h)\), is constructed using the estimated ray directions from high-frequency waves by NMLA.

From “Appendix B,” the error estimation of dominant ray directions is \(\mathcal {O}(\omega ^{-1/2})\). The numerical ray-FEM space \(V_{Ray}^h(\mathcal {T}_h)\) is defined similar to \(V_{Ray}(\mathcal {T}_h)\) with the exact ray directions \(\lbrace \widehat{\mathbf{d }}_j \rbrace \) replaced by the ones \(\lbrace \widehat{\mathbf{d }}_j^h \rbrace \) estimated by NMLA and \(\vert \widehat{\mathbf{d }}_j - \widehat{\mathbf{d }}_j^h \vert \sim \mathcal {O}(\omega ^{-1/2})\).

We denote by

$$\begin{aligned} u_I^h = \sum _{j=1 }^{N_h} A(\mathbf x _j)\varphi _j(\mathbf x ) e^{i\omega \left[ \phi (\mathbf x _j) + 1/c(\mathbf x _j) \widehat{\mathbf{d }}_j^h \cdot ( \mathbf x - \mathbf x _j) \right] } \end{aligned}$$
(34)

the nodal interpolation of the solution in \(V_{Ray}^h(\mathcal {T}_h)\) analogous to the definition of \(u_I\) in (22). Then we have

Hence,

(35)

Under the same smoothness assumption as in Sect. 2.4, the constant for \(\lesssim \) only depends on the domain, and more compactly, we have that

$$\begin{aligned} \inf _{u_h \in V_{Ray}^h(\mathcal {T}_h)} \Vert u - u_h \Vert _{L^2(\varOmega )} = {\mathcal O}(h^2 + \omega h^2 + \omega ^{1/2}h + \omega ^{-1} ). \end{aligned}$$
(36)

Comparing with (24) and (36), the error in the estimation of dominant ray directions due to NMLA leads to the extra term \(\omega ^{1/2}h\), which is the leading order in the high-frequency regime. Specifically, if \(\omega h = {\mathcal O}(1)\), then we have

$$\begin{aligned} \inf _{u_h \in V_{Ray}^h(\mathcal {T}_h)} \Vert u - u_h \Vert _{L^2(\varOmega )} = {\mathcal O}(\omega ^{-1/2}). \end{aligned}$$
(37)

We point out that the desirable convergence rate in this case is \({\mathcal O}(\omega ^{-1})\), which has the same order as the geometric optics ansatz. However, as analyzed in “Appendix B,” for a general wave field, the optimal achievable asymptotic error of the estimation of the dominant wave directions using NMLA is \({\mathcal O}(\omega ^{-1/2})\). This is indeed the bottleneck to improve the convergence order. In particular, the leading term of the approximation error for the numerical ray-FEM comes from \(\Vert u_I - u_I^h \Vert _{L^2(\varOmega )}\), which is \(\omega h \vert \widehat{\mathbf{d }}_j - \widehat{\mathbf{d }}_j^h\vert \sim \vert \widehat{\mathbf{d }}_j - \widehat{\mathbf{d }}_j^h\vert \sim \omega ^{-1/2}\) if \(\omega h ={\mathcal O}(1)\). Still, we can obtain a higher-order approximation for some special cases. For example, we can use second-order curvature correction version of NMLA for single point source in homogeneous media to improve the ray estimation to \({\mathcal O}(\omega ^{-1})\), meaning that we can obtain the optimal convergence order in this special case.

4 Algorithms

In this section we provide the full algorithm for the ray-FEM including a fast iterative solver based on a modification of the method of polarized traces for the resulting linear systems. In order to streamline the presentation and to make the algorithm easier to understand, we introduce several subroutines.

More specifically, we separate the full algorithm into three conceptual stages:

  1. 1.

    probing the medium by solving a relatively low-frequency Helmholtz equation with the standard FEM;

  2. 2.

    learning the dominant ray directions from the low-frequency-probed wave field by NMLA;

  3. 3.

    solving the high-frequency Helmholtz equation in the ray-FEM space.

If necessary the second stage can be iteratively applied to the high-frequency wave field computed in stage 3 to improve the estimation of dominant ray directions and then repeat stage 3 to obtain more accurate high-frequency wave field.

We remind the reader that the ultimate objective of the algorithm presented in this paper (i.e., Algorithm 7) is to solve the Helmholtz equation (1) at frequency \(\omega \) with a total \({\mathcal O}(\omega ^d)\) (up to poly-logarithmic factors) computational complexity. In order to achieve this objective, we discretize the PDE with a mesh size \(h = {\mathcal O}(\omega ^{-1})\), which leads to a total of \({\mathcal O}(\omega ^d)\) number of degrees of freedom and a sparse linear system with \({\mathcal O}(\omega ^d)\) number of nonzeros. Then we develop a fast iterative solver with quasi-linear complexity to solve the resulting linear system after discretization. Below is a more detailed description of the three stages. Finally, following the notation defined in the prequel, we denote the triangular mesh by \(\mathcal {T}_h\).

4.1 Probing

We first solve the low-frequency Helmholtz equation (4) with \(\widetilde{\omega } \sim \sqrt{\omega }\) in the same medium and with the same source on \(\mathcal {T}_h\). The low-frequency problem is solved using the standard finite element method (S-FEM) with linear elements as prescribed by Algorithm 4.

figure d

Let \(\mathbf u _{\widetilde{\omega }, h}\) = S-FEM (\(\widetilde{\omega }, h, c, f, g\)) denote the S-FEM solution of the low-frequency Helmholtz equation on \(\mathcal {T}_h\). Since \(\tilde{\omega }^2 h = \mathcal {O}(1)\), S-FEM is quasi-optimal in the norm \(\Vert \cdot \Vert _{ \mathcal {H}} := \Vert \nabla \cdot \Vert _{L^2} + k \Vert \cdot \Vert _{L^2} \) [71], and it has an optimal \(L^2\) error estimate [107].

4.2 Learning

Once the low-frequency problem has been solved, we extract the dominant ray directions from \(\mathbf u _{\widetilde{\omega }, h}\) using NMLA as described in Sect. 3.1 around each mesh node. We utilize the smoothness of the phase functions, and hence the smoothness of the ray directions field to reduce the computational cost. The reduction is achieved by restricting the learning of the dominant ray directions to vertices of a coarse mesh down-sampled from \(\mathcal {T}_h\). Such remeshed coarse mesh is denoted by \(\mathcal {T}_{h_c} = \lbrace K^c \rbrace \), where \(h_c={\mathcal O}(\sqrt{h})\). The resulting dominant ray directions are then linearly interpolated onto the fine mesh \(\mathcal {T}_h\).

Note that at each vertex of \(\mathcal {T}_{h_c}\), the wave field \(\mathbf u _{\widetilde{\omega }, h}\) on the fine mesh \(\mathcal {T}_h\) is used by NMLA to estimate the dominant ray directions. There are three sources of errors in the learning stage:

  • numerical errors of \(\mathbf u _{\widetilde{\omega }, h}\);

  • model errors in the geometric optics ansatz;

  • interpolation errors.

The numerical error for \(\mathbf u _{\widetilde{\omega }, h}\) by Algorithm 4 in the \(L^2\) norm [107] is \({\mathcal O}(\widetilde{\omega }h^2 + \widetilde{\omega }^2h^2) = {\mathcal O}(\omega ^{-1})\), which is negligible with respect to the model error in the geometric optics ansatz. The error introduced by the geometric optics approximation and NMLA is \({\mathcal O}(\widetilde{\omega }^{-\frac{1}{2}})\) as shown in Sect. 3.1 and “Appendix B.” The error due to the linear interpolation on \(\mathcal {T}_{h_c}\) to obtain the ray direction estimations at every vertex on \(\mathcal {T}_h\) is \({\mathcal O}(h_c^2)={\mathcal O}(h)={\mathcal O}(\omega ^{-1})\), which is much smaller than the model error in the geometric optics ansatz. Hence, the overall error in the ray direction estimation based on NMLA on \(\mathbf u _{\widetilde{\omega }, h}\) and interpolation is \({\mathcal O}(\widetilde{\omega }^{-\frac{1}{2}})\). The dominant ray direction estimation algorithm is summarized in Algorithm 5. For each node \(\mathbf {x}_j\) on mesh \(\mathcal {T}_h\), the number of dominant ray directions is denoted by \(n_j\), \(\varvec{d}_{\omega ,h}^{j} = \lbrace \mathbf d _{\omega , h}^{j, l} \rbrace _{l = 1}^{n_{j}} \).

figure e

4.3 High-frequency solver

Once the dominant ray directions on \(\mathcal {T}_h\) have been computed, we can construct the ray-FEM space \(V_{Ray}(\mathcal {T}_h)\) and solve the high-frequency Helmholtz equations following (20), which is implemented in Algorithm 6.

figure f

In general, the accuracy of the solution computed by Algorithm 6 using the ray-FEM method depends on the accuracy of the computed dominant wave directions. From Sect. 4.2, the accuracy order of the learning stage from the low-frequency wave field is \({\mathcal O}(\widetilde{\omega }^{-\frac{1}{2}})\), and following the error analysis of Sect. 3.2, the consequent ray-FEM solution has the same order of accuracy. However, the iterative ray-FEM Helmholtz solver, as presented in Algorithm 7, provides a way to improve approximations for both dominant ray directions and the high-frequency wave field.

figure g

Remark 2

Extensive numerical experiments and “Appendix A” indicate that the NMLA process in learning dominant ray directions stage is remarkably stable even for noisy plane wave data. Hence, the iterative process in Algorithm 7 usually needs very few iterations to reach the desired accuracy. Typically, we only need one or two iterations in our numerical tests.

Remark 3

Since NMLA can not be used to estimate ray directions near the point source, a slight modification of Algorithm 7 is used for solving a point source inside domain problem. First, we approximate the right-hand side with the associated column of the mass matrix (normalized by mesh size h). Moreover, we use a standard finite element basis function at the source point. For vertices near the source, we apply the radial directions (exact ray directions in homogeneous medium) in the construction of the approximation space for the ray-FEM method. Meanwhile, for vertices away from the source, we find the dominant ray directions by NMLA. Under this modification, ray-FEM can capture the phase accurately and it will be demonstrated numerically in Sect. 6.2.

4.4 Fast linear solver

To achieve the quasi-linear overall complexity mentioned in the introduction, it is necessary to solve the linear system resulting from both standard and ray-based FEMs, which we write in a generic form as

$$\begin{aligned} \mathbf {H}\mathbf {u}= \mathbf {f}, \end{aligned}$$
(38)

in a linear complexity (up to poly-logarithmic factors). This solver is, in fact, the computational bottleneck of Algorithms 4 and 6.

For a smooth medium, this can be achieved by modifying the method of polarized traces [109], of which we provide a brief review here. For further details we refer the interested readers to [109]. The method of polarized traces is a domain decomposition method that encompasses the following aspects:

  • layered domain decompositions;

  • absorbing boundary conditions between subdomains implemented via PML [13];

  • transmission conditions issued from a discrete Green’s representation formula;

  • efficient preconditioners arising from localization of the waves via an incomplete Green’s formula.

The first two aspects can be effortlessly implemented. Consider a layered partition of \(\varOmega \) into L slabs, or layers \(\{ \varOmega ^{\ell } \}_{\ell =1}^{L}\). Define \(f^{\ell }\) as the restriction of f to \(\varOmega ^{\ell }\), i.e., \(f^{\ell } = f\chi _{\varOmega ^{\ell }}\); define the local Helmholtz operators as

$$\begin{aligned} {\mathcal H}^{\ell } u := \left( -\triangle - \omega ^2/ c^2 \right) u \qquad \text {in } \varOmega ^{\ell }, \end{aligned}$$
(39)

with absorbing boundary conditions implemented via PML around the slabs.

The method of polarized traces aims at solving the global linear system in (38) by solving the local systems \(\mathbf {H}^{\ell }\), which are the discrete version of (39).

In order to solve the global system, or in this case, to find a good approximate solution, we need to “glue” the subdomains together. This is achieved via a discrete Green’s integral formula deduced by imposing discontinuous solutions.

In the original formulation of the method of polarized traces [109], the Green’s representation formula was used to build a global surface integral equation (SIE) at the interfaces between slabs. The SIE was solved using an efficient preconditioner coupled with a multilevel compression of the discrete kernels to accelerate the online stage of the algorithm. The original algorithm had an embarrassingly parallel superlinear off-line complexity which was amortized among a large number of right-hand sides, which represents a typical situation in exploration geophysics.

In the context of the present paper, the linear systems issued from the ray-based FEM depend on the source distribution, making it impossible to amortize a superlinear off-line cost. In order to reduce the off-line cost we use a matrix-free formulation (see Chapter 2 in [108]) with a domain decomposition in thin layers. In this case, the cost per iteration is linear with respect to the number of degrees of freedom, depending on the growth or the auxiliary degrees of freedom corresponding to the PML’s. Finally, the convergence is normally achieved in \(\mathcal {O}(\log {\omega })\) iterations, as it will be shown in the sequel.

5 Complexity

In this section we provide an overall complexity analysis of our algorithm for the high-frequency Helmholtz equation (1) in terms of \(\omega \), and it is summarized in Table 1. The overall complexity includes the complexity in learning ray directions by NMLA (shown in Table 2) and the complexity of the linear solver for the discretized systems from both standard FEMs for low-frequency and ray-FEMs for high-frequency Helmholtz equations.

Table 1 Overall computational complexities with respect to \(\omega \) given that the mesh size scaled as \(h = {\mathcal O}(\omega ^{-1})\)
Table 2 Computational complexities of estimating ray directions on a coarse mesh \(\mathcal {T}_{h_c}\) with \(h_c ={\mathcal O}(\omega ^{-\frac{1}{2}})\) and a fine mesh \(\mathcal {T}_{h}\) with \(h ={\mathcal O}(\omega ^{-1})\)

5.1 Ray learning

As described in Sect. 4.2, Algorithm 5 applies NMLA to computed wave fields with low-frequency \(\widetilde{\omega } \sim \sqrt{\omega }\) or high-frequency \(\omega \). It first estimates ray directions at vertices on a down-sampled coarse mesh \(\mathcal {T}_{h_c}\) and then interpolates the ray directions to the vertices on a fine mesh \(\mathcal {T}_{h}\). We remind the reader the following scalings: \(h={\mathcal O}(\omega ^{-1})\), \(h_c={\mathcal O}(\sqrt{h})={\mathcal O}(\omega ^{-\frac{1}{2}})\). These scalings allow us to strike a balance among the number of observation points at which NMLA is used to estimate ray directions, the radius of the sampling circle, and the corresponding number of sampling points on the circle so as to resolve the wave field to reach the optimal accuracy of NMLA with desired total computational complexity.

The dominant computational cost of the ray learning is coming from the application of NMLA to the high-frequency wave field. Here we analyze its complexity in 2D case. As shown in “Appendix B,” the least error that can be achieved by NMLA is \({\mathcal O}(\omega ^{-\frac{1}{2}})\) when the radius r of the sampling circle centered at an observation point is \({\mathcal O}(\omega ^{-\frac{1}{2}})\). Hence, the number of points sampled on the circle to resolve the wave field with frequency \(\omega \) is \(M_{\omega }= {\mathcal O}(\omega r) = {\mathcal O}(\omega ^{\frac{1}{2}})\). Since NMLA is a linear filter based on the Fourier transform in the angle space, the corresponding computational complexity is \({\mathcal O}(M_{\omega }\log M_{\omega })\) [12]. The number of observation points that we need to perform NMLA is the number of vertices on the coarse mesh which is \({\mathcal O}(h_c^{-2})={\mathcal O}(\omega )\). Hence, the computational cost to obtain the ray directions at the vertices on the coarse mesh by NMLA is \({\mathcal O}(\omega ^{\frac{3}{2}}\log \omega )\). Finally, the ray directions estimated at the vertices on the coarse mesh by NMLA are linearly interpolated onto the fine mesh \(\mathcal {T}_{h}\). Interpolation is a linear operation, and hence, its computational complexity is \({\mathcal O}(\omega ^2)\).

Table 2 provides the complexity of ray learning stage for both high-frequency and low-frequency wave fields, where d is the dimension and \(C_{NMLA}\), \(C_{ray, h_c}\), \(C_{Int}\), and \(C_{ray, h}\) are the computation complexity of NMLA at a single vertex, NMLA on the under-sampled coarse mesh, interpolation of local ray directions to the fine mesh, and the full algorithm for learning local ray directions at frequency \(\omega \) on the fine mesh \(\mathcal {T}_{h}\), respectively.

5.2 Helmholtz solver

The most computationally intensive component in the whole ray-FEM algorithm is solving the linear systems after discretization of the Helmholtz equation. Algorithm 7 solves both \(\mathbf u _{\widetilde{\omega }, h} = S-FEM (\widetilde{\omega }, h, c, f, g)\) and \(\mathbf u _\mathbf{d _{\omega }, h} = Ray-FEM (\omega , h, c, f, g, \lbrace \varvec{ d}_{\omega ,h}^j \rbrace _{j=1}^{N_h} )\) on the same mesh \(\mathcal {T}_{h}\). Each solver is composed of three steps: the assembling step, the setup step, and the iterative solve step.

Since the basis functions are locally supported, the resulting matrix is sparse. The complexity of the assembling step is of the same order as the degrees of freedom \(N_h={\mathcal O}(\omega ^d)\).

In the setup stage, the computational domain is decomposed into subdomains of thin layers whose width is comparable to the characteristic wavelength. The local problems in each subdomain are factorizedFootnote 5 using a multifrontal method [26] coupled with a nested dissection ordering [40] in \({\mathcal O}(\sqrt{N_{h}})\) time for the high-frequency problem (or \({\mathcal O}(\sqrt{N_{h}} \log ^3 {N_{h}})\) time for the low-frequency problem, depending on the width of the auxiliary PML for each subdomain in terms of the wavelength). Given that the layers are \({\mathcal O}(1)\) elements thick, we have to factorize \({\mathcal O}(\sqrt{N_{h}})\) subsystems, which results in a total \({\mathcal O}(N_{h})\) (or \({\mathcal O}(N_{h} \log ^3{N_{h}})\) for the low-frequency problem) asymptotic complexity for the setup step.

Finally, for the iterative solve step, each application of the preconditioner involves 6 local solves per layer, each one performed with \({\mathcal O}(\sqrt{N_{h}})\) ( or \({\mathcal O}(\sqrt{N_{h}} \log ^2{N_{h}})\)) complexity. Given that we have \({\mathcal O}(\sqrt{N_{h}})\) layers, we have an overall \({\mathcal O}(N_{h})\) (or \({\mathcal O}(N_{h} \log {N_{h}})\) for the low-frequency problem) complexity per iteration. Extensive numerical experiments suggest that the number of iterations to converge is \({\mathcal O}(\log {N_{h}})\) for both high- and low-frequency solves for smooth media. Hence, the empirical overall complexity is \({\mathcal O}(N_{h} \log {N_{h}})\) for the high-frequency solve and \({\mathcal O}(N_{h} \log ^3{N_{h}})\) for the low-frequency one, which as stated before in Table 1.

6 Numerical experiments

In this section we provide several numerical experiments to test the proposed ray-FEM and corroborate our claims. For all cases, the domain of interest is \(\varOmega = (-1/2,1/2)^2\) with different source terms and boundary conditions. \(\varOmega \) is discretized using a standard triangular mesh. The integrals to assemble the mass and stiffness matrices in (15), the right-hand side in (16), and the \(L^2\) errors of the ray-FEM solutions are numerically computed by using a high-order Gaussian quadrature rule.Footnote 6

The algorithm described in this paper was implemented in MATLAB, and the numerical experiments were executed using MATLAB 2015b in a dual socket server with 2 Intel Xeon E5-2670 with 384 GB of RAM.

6.1 Convergence tests

In the first test, the exact solution to the Helmholtz equation with the Robin boundary condition is the wave field (normalized by the frequency \(\omega \)) corresponding to a point source outside the domain. It is given by

$$\begin{aligned} u_{ex}(x,y) = \sqrt{\omega }H_0^{(1)}\left( \omega \sqrt{(x-2)^2 + (y-2)^2}\right) . \end{aligned}$$
(40)

Numerically, we choose a mesh size to solve the Helmholtz equation (1) with wave speed \(c(\mathbf {x})\equiv 1\), source \(f(\mathbf {x})\equiv 0\), and exact impedance boundary data such that the number of points per wave length (NPW) is 6 for different \(\omega \)’s. We test convergence for both the ray direction estimation by NMLA and the final numerical solution by the ray-FEM.

First, a probing wave with low-frequency \(\widetilde{\omega } = \sqrt{\omega }\) is solved by the standard FEM. Then NMLA is applied to the low-frequency probing wave to get an estimation of the local dominant ray directions \(\mathbf d _{\widetilde{w}}\). Instead of using the regular NMLA for the plane wave decomposition, we use NMLA with curvature correction (see details in Algorithm 3 and “Appendix C”) to estimate the ray information of a circular wave front. The estimated local ray directions are then used in the ray-FEM to produce the first numerical solution \(u_\mathbf{d _{\widetilde{w}}}\) to the high-frequency Helmholtz equation.

We employ one more iteration in the framework of the iterative ray-FEMs by applying NMLA to \(u_\mathbf{d _{\widetilde{w}}}\) to get an improved local ray direction estimation \(\mathbf d _w\) and then use it again in the ray-FEM to get a more accurate numerical solution \(u_\mathbf{d _w}\) to the high-frequency Helmholtz equation.

Table 3 and the left column of Fig. 1 show that the NMLA and ray-FEM algorithm are stable, and the error for both the ray estimation and the numerical solution by the ray-FEM with fixed NPW, i.e., \(\omega h = {\mathcal O}(1)\), asymptotically decreases as the frequency increases. Moreover, they show that one more iteration using the iterative ray-FEM can improve the accuracy of final numerical solution to the order of \({\mathcal O}(\omega ^{-1})\), which is of the same order when the exact ray direction \(\mathbf d _{ex}\) is used in the ray-FEM, due to the asymptotic error of the geometric optics ansatz.

NMLA with curvature correction plays an important role to achieve the above optimal convergence orders. As discussed in “Appendix C,” it can improve the angle estimation for a perfect point source solution from \({\mathcal O}(\omega ^{-1/2})\) to a much higher convergence order \({\mathcal O}(\omega ^{-3})\). However, the noise level coming from low-frequency problem solved by S-FEM, together with the interpolation error, which are all \({\mathcal O}(\omega ^{-1})\), dominate the overall error. As a consequence, the low-frequency ray estimation error \(\Vert \mathbf d _{\widetilde{w}}-\mathbf d _{ex}\Vert \) is \({\mathcal O}(\omega ^{-1})\). Using similar estimate in Sect. 3.2, one can show that the approximation error for the high-frequency numerical ray-FEM space is at least \({\mathcal O}(\omega ^{-1})\) if \(\mathbf d _{\widetilde{w}}\) is incorporated into the high-frequency basis functions. Again we apply NMLA with curvature correction to the numerically computed high-frequency ray-FEM solution to get ray estimation \(\mathbf d _{w}\) with \(\Vert \mathbf d _w-\mathbf d _{ex}\Vert = {\mathcal O}(\omega ^{-1})\) and further get the final ray-FEM solution \(u_\mathbf{d _w}\) with \(\Vert u - u_h \Vert _{L^2(\varOmega )} ={\mathcal O}(\omega ^{-1})\).

Table 3 Errors of one point source problem for fixed NPW = 6. \(\theta _{ex}\) is the exact ray angle; \(\theta (\mathbf d _{\widetilde{\omega }})\) and \(\theta (\mathbf d _{\omega })\) are ray angle estimations using low and high-frequency waves, respectively; \(u_\mathbf{d _{\widetilde{\omega }}}\), \(u_\mathbf{d _{\omega }} \), and \(u_\mathbf{d _{ex}} \) are ray-FEM solutions using low-frequency ray estimation \(\mathbf d _{\widetilde{\omega }}\), high-frequency ray estimation \(\mathbf d _{\omega }\), and exact ray \(\mathbf d _{ex}\), respectively
Fig. 1
figure 1

Tests with point source/sources outside the domain, NPW = 6. Left one point source; right four point sources; top ray direction errors; middle errors of ray-FEM solutions with ray directions estimated by NMLA; bottom errors of ray-FEM solutions with exact ray directions

Next we show that our method can handle multiple wave fronts by probing the whole domain and extracting dominant ray directions locally. The setup is exactly as above except that there are four point sources. The exact solution is given by

$$\begin{aligned} u_{ex}(x,y)= & {} \sqrt{\omega }H_0^{(1)}\left( \omega \sqrt{(x+20)^2 + (y+20)^2}\right) \nonumber \\&+\, 2\sqrt{\omega }H_0^{(1)} \left( \omega \sqrt{(x-20)^2 + (y-20)^2}\right) \nonumber \\&+\, 0.5\sqrt{\omega }H_0^{(1)}\left( \omega \sqrt{(x+20)^2 + (y-20)^2}\right) \nonumber \\&-\, \sqrt{\omega }H_0^{(1)}\left( \omega \sqrt{(x-20)^2 + (y+20)^2}\right) . \end{aligned}$$
(41)

The main difficulty of this example compared to the single point source case is that the low-frequency wave solution by the standard FEM contains multiple wave fronts at each point due to the interference of multiple sources. The numerical results are shown in the right column of Fig. 1. In this case, the NMLA with curvature correction does not apply so that we have to use the standard NMLA for the plane wave decomposition as described in Sect. 3.1 to estimate local dominant ray directions. As analyzed in Sect. 3.2 and “Appendix B,” the expected error for ray direction estimation and numerical solution is of order \({\mathcal O}(\omega ^{-1/2})\) due to the curved wave fronts. The numerical results show that the ray-FEM meets the expected asymptotic error as the frequency increases.

6.2 Phase errors

Here we show that the ray-FEM method can capture the phase and satisfy the dispersion relation more accurately. We test our algorithm with a point source inside the domain, given its importance in many practical applications, in particular, in exploration geophysics, in which the sources are often modeled as point sources. Moreover, in applications oriented toward inverse and imaging problems, having a numerical method that produces the correct phase in the far field is of great importance in order to properly locate features in the image.

In this experiment we focus our attention on the far field since our current method can not deal with singularities in amplitude and phase at source points. We test a point source located at \(\mathbf {x}_0 = (-0.4, -0.4)\) with frequency \(\omega = 80 \pi \) in a homogeneous medium. Following Remark 3, we use radial directions (exact directions in homogeneous medium) for vertices \(\mathbf {x}\) near the source with \(\vert \mathbf {x}- \mathbf {x}_0 \vert \le 0.1\) and estimate ray directions for other vertices; see the left part of Fig. 2 for the ray direction field.

To demonstrate the accurate phase of the numerical solutions, we plot the real part of computed wave field on a 90 degree part of an annulus [93], with the radial coordinate varying on an interval of about two wavelengths. The location where the real part is maximal or minimal, according to the exact solution, is indicated by a straight line; see the right part of Fig. 2.

Fig. 2
figure 2

One point source inside a homogeneous medium, \(\omega = 80\pi \), NPW \(=\) 6. Left ray directions captured by NMLA; right polar plot of the ray-FEM solution, \(r/ \lambda \): the number of wavelengths away from the source

Next we fix the frequency \(\omega = 250 \pi \) and use radial directions as ray directions in the source neighborhood \(\lbrace \mathbf {x}: \vert \mathbf {x}- \mathbf {x}_0 \vert \le 0.064 \rbrace \). When the number of grid points per wavelength is increased, Fig. 3 depicts the behavior of both the ray-FEM solution and the standard FEM solution. From the figure we can easily observe the superiority of the ray-FEM on minimizing the phase error, even using relatively coarse meshes.

Fig. 3
figure 3

Polar plots of the ray-FEM solution and the s-FEM solution with \(\omega = 250\pi \). \(r/ \lambda \): the number of wavelengths away from the source

In a heterogeneous medium, a ray-FEM solution is given by Fig. 4 with the source located inside. We also provide an experiment where we show the ability of the method introduced in this paper to handle wave fields with caustics; see Fig. 5. Again radial directions are used for local ray directions near the source point within \(\lbrace \mathbf {x}: \vert \mathbf {x}- \mathbf {x}_0 \vert \le 0.1 \rbrace \).

Fig. 4
figure 4

One point source inside a heterogeneous medium with the Gaussian wave speed \(c(x,y) = 3 - 2.5e^{ -((x +0.125)^2 + (y-0.1)^2)/0.8^2}\), \(\omega = 80\pi \), NPW = 10. Left ray directions captured by NMLA; right wave field computed by ray-FEM

Fig. 5
figure 5

One point source inside a heterogeneous medium with the sinusoidal wave speed \(c(x,y) = 1+ 0.5\sin (2\pi x)\), \(\omega = 80\pi \), NPW \(=\) 10. Left wave speed; right wave field computed by ray-FEM

6.3 Complexity tests

In this subsection we test the computational complexity for the ray-FEM. A key step of the algorithms presented is solving the sparse linear systems generated by the ray-FEM using iterative methods with a performant preconditioner, e.g., domain decomposition techniques coupled with high-quality absorbing/transmission boundary conditions. In our tests, we use a modification of the method of polarized traces to solve the linear systems resulting from both the standard FEM and ray-FEM as described in Sect. 4.4.

We solve the Helmholtz equation with a point source in both a homogeneous and heterogeneous medium. We compute for many different frequencies, using Algorithm 7 with only one iteration of the ray-FEM, the solution to the Helmholtz equation posed on \(\varOmega \) with absorbing boundary conditions implemented via PML. For each frequency we report the execution time of the low- and high-frequency problems and the time spent in processing the data using NMLA to extract the dominant ray information.

As explained in Sect. 4, in order to process the data using NMLA we need to solve the low-frequency problem in a slightly larger domain. The size of the larger domain is given by the sampling radius of the NMLA. For the sake of simplicity, we use a low-frequency subdomain, \(\varOmega _\mathrm{low} = (-1,1)\times (-1,1)\), i.e., four times bigger than the original domain. The size can be reduced in order to lower the computational cost for the low-frequency problem.

The main issue with the low-frequency solver in our case is related to the PML, since the PML may not be very effective given that each thin slab contains less than one wavelength across. In order to decrease the number of iterations to converge, we increase the number of PML points logarithmically with the frequency. This implies a slightly more expensive setup cost and solve cost as shown in Figs. 6 left and 7 left.

Figure 6 shows the runtime for solving the Helmholtz equation with a point source inside a homogeneous medium. We can observe that the overall cost is \({\mathcal O}(N)\) up to poly-logarithmic factors as shown in our complexity study. The low-frequency solver has a slightly higher asymptotic cost in this case, given the ratio between the width of the PML and the characteristic wavelength inside the domain.

Figure 7 shows the runtime for solving the Helmholtz equation with a point source inside a heterogeneous medium. We can observe the same scaling as before, albeit with slightly larger constants.

Fig. 6
figure 6

Runtime for solving the Helmholtz equation with a homogeneous wave speed using GMRES preconditioned with the method of polarized traces. The tolerance was set up to \(10^{-7}\). Left runtime for solving the low-frequency problem. Right Runtime for solving the high-frequency problem with the adaptive basis

Fig. 7
figure 7

Runtime for solving the Helmholtz equation with a heterogeneous wave speed using GMRES preconditioned with the method of polarized traces. The tolerance was set up to \(10^{-7}\). Left runtime for solving the low-frequency problem. Right runtime for solving the high-frequency problem with the adaptive basis

7 Conclusion

In this work we present a numerical method, the ray-FEM, for the high-frequency Helmholtz equation in smooth media based on learning problem-specific basis functions to represent the wave field. The key information, local ray directions, is extracted from a relatively low-frequency wave field that has probed the whole domain. These local ray directions are then incorporated into the basis to improve both stability and accuracy in the computation for a high-frequency wave field. Moreover, both local ray directions and the high-frequency wave field can be further improved through more iterations. Numerical tests suggest that our method only requires a fixed number of points per wavelength with an asymptotic convergence as the frequency becomes large. By designing a fast solver for the discretized linear systems an overall complexity of order \({\mathcal O}(\omega ^d\log ^3 \omega )\) is achieved.

However, the ray-FEM cannot handle singularities of both the amplitude and phase on a given mesh. We will develop a hybrid method that combines a local asymptotic expansion near the source and the ray-FEM away from the source in our future work.

Acknowledgements

Zhao is partially supported by NSF Grant (1418422 and 1622490). Qian is partially supported by NSF Grants (1522249 and 1614566).