1 Introduction

The property of waves to travel over large distances and long time without changing their shape is an important feature used in current technologies, such as communication devices and other electromagnetic products. The governing equations for electromagnetic problems are the Maxwell’s equations and it is to these we seek approximate solutions in this paper. To make the numerical approximation to the solution accurate either low order methods on fine meshes, which can be computationally costly, or high-order methods on coarser meshes can be used. The latter approach is usually preferable for large scale problems.

Several high-order methods in computational electromagnetics have been proposed, such as high-order finite-difference time-domain (FDTD) methods [26, 28], discontinuous Galerkin (DG) methods [4, 8, 13, 14], and pseudo-spectral methods [9, 10, 27], to name a few. High-order explicit FDTD methods require a restrictive stability condition and wide stencils, which complicate the enforcement of boundary conditions. Unconditionally stable alternating-direction-implicit (ADI) FDTD methods have been developed to circumvent the time step constraints [6, 18, 24, 25, 29], however, methods are difficult to generalize to high order and treating complex geometry is not straightforward.

DG methods achieve high-order convergence rates by approximating the function using local high order polynomials and are an excellent choice for problems where a high quality mesh can be generated. The main drawbacks of DG methods are their restrictive time step at a high order of accuracy and the duplication of degrees of freedom on the edges of elements.

Another avenue to handle time dependent wave problems is the Hermite-Taylor method, which consists of a Hermite interpolation procedure in space and a Taylor method in time [11] (see also [12] for a review of Hermite methods). The key idea is to evolve, in time, the numerical solution as well as its space derivatives through order m to achieve a \((2\,m+1)\) order accurate method using only \((m+1)^d\) degrees of freedom per element in d-dimensions.

As was shown for linear symmetric hyperbolic problems in [11], this method provides a stability condition that only depends on the largest wave-speed, independent of the order. Hence, large time-step sizes can be used for these high-order methods and therefore ease the computational burden for large-scale problems. As the \((m+1)^d\) degrees of freedom in a Hermite method are collocated at a single node the imposition of general boundary conditions can be challenging. Typically, in addition to the physical boundary conditions the method needs to be augmented with a relatively large number of numerical boundary conditions (sometimes called compatibility boundary conditions or, more recently, inverse Lax-Wendroff conditions). While this has been successfully done for the wave equation on both Cartesian and curvilinear meshes in [20], it has proven difficult to use this technique for first order hyperbolic systems.

A possible solution to this is to use a hybrid DG-Hermite method [7] for Maxwell’s equations. The method in [7] takes advantage of the flexibility of DG solvers to handle complex geometries and boundary conditions by considering two non-overlapping meshes, an unstructured mesh for the DG method and a staircased Cartesian mesh where the Hermite method is used. This approach requires a hybrid structured-unstructured mesh and the use of local time-stepping to maintain large time-step sizes in the Hermite method. In [5] an overset grid method that combines a Hermite method (on Cartesian meshes) and a DG method (on structured curvilinear meshes) for the wave equation was proposed. This method does not require a hybrid non-overlapping mesh and as such it is somewhat more geometrically flexible but again, it is not easy to extend to first order hyperbolic systems.

In this work, we propose an alternative solution for imposing boundary conditions for Maxwell’s equations within the framework of Hermite methods. Our new method is based on the correction function method (CFM). The CFM was first proposed in [21] to handle Poisson’s equation with interface conditions and continuous coefficients in a finite-difference context. Given a numerical solution (for example from a finite difference method) that has been updated near but not on the boundary from the CFM seeks a polynomial approximation to the solution in the vicinity of a boundary or interface using a minimization procedure. A functional that is based on a square measure of the residual of the original PDE problem and that also contains terms from the finite difference solver is minimized over a suitable space of polynomials. Once this polynomial approximation, also called the correction function, is found, the numerical solution can be corrected so that it satisfies the boundary conditions to a high order of accuracy. The CFM has been used for Poisson’s equation [22, 23], the wave equation [1], and for electromagnetic problems with both interface and boundary [15,16,17].

In this paper we introduce a CFM-Hermite-Taylor method. An advantage of using Hermite based methods for the base scheme is that the Hermite stencil remains the same regardless of its order. This is not the case for FDTD methods. Additionally, the Hermite-Taylor method directly provides a space-time polynomial approximating the solution that is required in the CFM functional. In this paper we focus exclusively on the case when the geometry of the problem can be represented on a Cartesian mesh or on a logically Cartesian curvilinear mesh. Already in this setting the Hermite stencil provides a good advantage but we expect that in future work where we treat interfaces and non-grid aligned boundaries the advantage will be even greater.

We are focusing exclusively on the enforcement of boundary conditions. Other important concerns, such as the preservation of the divergence-free constraints and the energy, will not be addressed here.

The paper is organized as follows. We introduce Maxwell’s equations with the considered boundary conditions in Sect. 2. In Sect. 3, the one-dimensional Hermite-Taylor method is described in detail and some remarks are provided for higher dimensional cases. The correction function method is introduced and described in detail in the Hermite-Taylor setting in Sect. 4. Finally, numerical examples in one dimension (1-D) and two dimensions (2-D) that verify the properties of the Hermite-Taylor CFM are presented in Sect. 5.

2 Problem Definition

In this work, we seek approximate solutions to Maxwell’s equations

$$\left\{\begin{aligned} \begin{aligned} &\mu \,\partial _t {\varvec{H}} + \nabla \times {\varvec{E}} =\, 0, \\ &\epsilon \,\partial _t {\varvec{E}} - \nabla \times {\varvec{H}} =\, 0,\\ &\nabla \cdot (\epsilon \,{\varvec{E}}) =\, 0,\\ &\nabla \cdot (\mu \,{\varvec{H}})=\, 0 \end{aligned} \end{aligned}\right.$$
(1)

in the domain \(\varOmega \subset {\mathbb {R}}^d\) with \(d=1,2\) and the time interval \(I=[t_0,t_f]\). Here \({\varvec{H}}\) is the magnetic field, \({\varvec{E}}\) is the electric field, \(\mu\) is the magnetic permeability, and \(\epsilon\) is the electric permittivity. To complete the system (1), we consider the initial conditions

$$\left\{\begin{aligned} \begin{aligned} {\varvec{H}}({\varvec{x}},t_0) =&\,\, {\varvec{H}}_0 \quad \text {in } \varOmega ,\\ {\varvec{E}}({\varvec{x}},t_0) =&\,\, {\varvec{E}}_0 \quad \text {in } \varOmega \end{aligned} \end{aligned}\right.$$

and the boundary conditions on the electromagnetic fields.

In this work, we focus on the following boundary conditions:

  1. (i)

    perfect electric conductor (PEC)

    $$\begin{aligned} {\varvec{n}}\times {\varvec{E}} = 0 \quad \text {on } \varGamma \times I, \end{aligned}$$
    (2)
  2. (ii)

    perfect magnetic conductor (PMC)

    $$\begin{aligned} {\varvec{n}}\times {\varvec{H}} = 0 \quad \text {on } \varGamma \times I, \end{aligned}$$
    (3)
  3. (iii)

    impedance boundary condition

    $$\begin{aligned} {\varvec{E}}\times {\varvec{n}} +Z\,{\varvec{n}}\times ({\varvec{H}}\times {\varvec{n}})= 0 \quad \text {on } \varGamma \times I. \end{aligned}$$
    (4)

Here \(Z=\sqrt{\tfrac{\mu }{\epsilon }}\) is the impedance, \(\varGamma\) is the boundary of the domain \(\varOmega\), and \({\varvec{n}}\) is the outward unit normal to \(\varGamma\). For further discussions on Maxwell’s equations with these boundary conditions and results on their well-posedness, we refer the reader to [2, 19]. Note that we consider the non-homogeneous case of these boundary conditions to facilitate the verification of the Hermite-Taylor CFM. We denote the given right-hand side function by \({\varvec{g}}(x,y,t)\).

3 Hermite-Taylor Method

In the following, a brief review of the Hermite-Taylor method, introduced by Goodrich et al. [11], is provided. For simplicity, we consider the one-dimensional case and include some comments regarding higher dimensions.

The Hermite method uses a mesh staggered in both space and time as illustrated in Fig. 1.

Fig. 1
figure 1

Illustration of the Hermite-Taylor procedure to evolve the data from \((x_{i+1},t_{n-1})\) to \((x_{i+1},t_{n})\). The Hermite interpolation procedure and the Taylor method are denoted respectively by \({\mathcal {I}}\) and \({\mathcal {T}}\). The primal and dual nodes are respectively represented by black squares and blue circles

Consider the domain \(\varOmega = [x_\ell , x_r]\) and a time interval \(I = [t_0,t_f]\). We then define the primal mesh to be

$$\begin{aligned} x_i = x_\ell + i\,\Delta x, \quad i=0,\cdots ,N_x, \quad \Delta x = \frac{x_r-x_\ell }{N_x}. \end{aligned}$$

Here \(N_x\) is the number of cells on the primal mesh. The dual mesh is then defined as the cell centers of the primal mesh

$$\begin{aligned} x_{i+1/2} = x_\ell + (i+1/2)\,\Delta x, \quad i=0,\cdots ,N_x-1. \end{aligned}$$

The approximate solution on the primal mesh is centered at times

$$\begin{aligned} t_n = t_0 + n\,\Delta t, \quad n=0,\cdots ,N_t, \quad \Delta t = \frac{t_f-t_0}{N_t}, \end{aligned}$$

while the approximation on the dual mesh is centered at times

$$\begin{aligned} t_{n+1/2} = t_0 + (n+1/2)\,\Delta t, \quad n=0,\cdots ,N_t-1. \end{aligned}$$

Here \(N_t\) is the number of time steps.

The Hermite-Taylor method requires three processes.

  1. (i)

    Hermite interpolation

    Assume that the values of the electromagnetic fields and their derivatives through order m (or sufficiently accurate approximation of these) are available on the primal mesh at \(t_{n-1}\). Then, for each cell in the primal mesh, for each electromagnetic field, we construct the unique polynomial of degree \(2\,m+1\) coinciding with the electromagnetic field and its derivatives through order m at the endpoints of the cell, that is the Hermite interpolant of the electromagnetic field. In Fig. 1, this step is represented by \({\mathcal {I}}\).

  2. (ii)

    Recursion relation

    The recursion relation constructs a space-time polynomial, referred as a Hermite-Taylor polynomial in this work, approximating each electromagnetic field. Considering a cell and a given Hermite interpolant of each electromagnetic field on this cell, we identify the derivatives of the electromagnetic field as scaled coefficients of the polynomial at the cell center. By expanding, in time, each scaled coefficient in a Taylor polynomial and enforcing the PDE at the cell center, we obtain a recursion relation for the coefficients of the Hermite-Taylor polynomials. This step is represented in Fig. 1 by either blue dashed circles or black dashed squares.

  3. (iii)

    Time evolution

    Finally, we update the electromagnetic fields and their derivatives through order m at the dual mesh points by simply evaluating the Hermite-Taylor polynomials. This step is represented by \({\mathcal {T}}\) in Fig. 1.

Let us now detail each time step of the method.

3.1 Hermite Interpolation

Assuming that the space derivatives through order m of the electromagnetic fields at the initial time \(t_0\) are available on the primal mesh, we compute the \((2\,m+1)\) degree Hermite interpolant \(p_{i+1/2}^f(x)\) on each cell \([x_i, x_{i+1}]\) satisfying

$$\begin{aligned} \frac{\text{d}^\ell p_{i+1/2}^f(x_i,t_0)}{\text{d}x^\ell } = \frac{\text{d}^\ell f(x_i,t_0)}{\text{d}x^\ell }, \quad \frac{\text{d}^\ell p_{i+1/2}^f(x_{i+1},t_0)}{\text{d}x^\ell } = \frac{\text{d}^\ell f(x_{i+1},t_0)}{\text{d}x^\ell }, \quad \ell =0,\cdots ,m. \end{aligned}$$

Here f is either the magnetic field H or the electric field E. We then obtain a polynomial approximating each electromagnetic field on the cell \([x_i,x_{i+1}]\) and centered at the cell center \(x_{i+1/2}\),

$$\begin{aligned} \begin{aligned} H(x,t)|_{t=t_0} \approx&\,\, p^H_{i+1/2}(x) = \sum _{\ell =0}^{2\,m+1} c^H_\ell (t)|_{t=t_0}\,\bigg (\frac{x-x_{i+1/2}}{\Delta x}\bigg )^\ell , \\ E(x,t)|_{t=t_0} \approx&\,\, p^E_{i+1/2}(x) = \sum _{\ell =0}^{2\,m+1} c^E_\ell (t)|_{t=t_0}\,\bigg (\frac{x-x_{i+1/2}}{\Delta x}\bigg )^\ell , \end{aligned} \end{aligned}$$

where \(c^H(t)\) and \(c^E(t)\) are time-dependent coefficients.

3.2 Recursion Relation

Let us now compute a Hermite-Taylor polynomial approximating each electromagnetic field. To do so, we expand the coefficients in a Taylor polynomial of degree q centered at \(t_0\), which leads to

$$\left\{\begin{aligned} \begin{aligned} H(x,t) \approx&\,\, p^H_{i+1/2}(x,t) = \sum _{\ell =0}^{2\,m+1} \sum _{s=0}^q c^H_{\ell ,s}\,\bigg (\frac{x-x_{i+1/2}}{\Delta x}\bigg )^\ell \,\bigg (\frac{t-t_{0}}{\Delta t}\bigg )^s, \\ E(x,t) \approx&\,\, p^E_{i+1/2}(x,t) = \sum _{\ell =0}^{2\,m+1} \sum _{s=0}^q c^E_{\ell ,s}\,\bigg (\frac{x-x_{i+1/2}}{\Delta x}\bigg )^\ell \,\bigg (\frac{t-t_{0}}{\Delta t}\bigg )^s. \end{aligned} \end{aligned}\right.$$
(5)

Here \(c^H_{\ell ,0}\) and \(c^E_{\ell ,0}\) are known from the initial data and the interpolation step. Consider Maxwell’s equations in 1-D with constant coefficients,

$$\begin{aligned} \begin{aligned} \frac{\partial H}{\partial t} =&\,\, -\frac{1}{\mu }\frac{\partial E}{\partial x}, \\ \frac{\partial E}{\partial t} =&\,\, -\frac{1}{\epsilon }\frac{\partial H}{\partial x}. \end{aligned} \end{aligned}$$

For smooth solutions, we then have

$$\left\{\begin{aligned} \begin{aligned} \frac{\partial ^{\ell +s+1}H}{\partial t^{s+1}\partial x^\ell }=&\,\, -\frac{1}{\mu }\frac{\partial ^{\ell +s+1}E}{\partial t^{s}\partial x^{\ell +1}},\\ \frac{\partial ^{\ell +s+1}E}{\partial t^{s+1}\partial x^\ell }=&\,\, -\frac{1}{\epsilon }\frac{\partial ^{\ell +s+1}H}{\partial t^{s}\partial x^{\ell +1}}. \end{aligned} \end{aligned}\right.$$
(6)

Substituting H and E by their Hermite-Taylor approximations \(p_{i+1/2}^H(x,t)\) and \(p_{i+1/2}^E(x,t)\) in the system (6) and evaluating them at \((x_{i+1/2},t_0)\), we obtain the following recursion relations for the coefficients:

$$\begin{aligned} c^H_{\ell ,s} = -\frac{(\ell +1)\,\Delta t}{\mu \,s\,\Delta x}\,c^E_{\ell +1,s-1}, \quad c^E_{\ell ,s} = -\frac{(\ell +1)\,\Delta t}{\epsilon \,s\,\Delta x}\,c^H_{\ell +1,s-1}, \quad \ell = 0,\cdots ,2\,m+1, \quad s=1,\cdots ,q. \end{aligned}$$

Knowing \(c^H_{\ell ,0}\) and \(c^E_{\ell ,0}\), these recursion relations allow the computation of the Hermite-Taylor polynomials approximating the electromagnetic fields.

3.2.1 Variable Coefficients Problems

For spatially variable coefficients, the recursion relations for the polynomial coefficients involve high-order derivatives of the coefficients. As in [11], we consider high-order derivatives of the coefficients \(u(x) = \frac{1}{\mu (x)}\) and \(e(x) = \frac{1}{\epsilon (x)}\) and take advantage of the Leibnitz’ rule.

For sufficiently smooth solutions and coefficients u and e, we have

$$\left\{\begin{aligned} \begin{aligned} \frac{\partial ^{\ell +s+1}H}{\partial t^{s+1}\partial x^\ell }=&\,\, -\frac{\partial ^\ell }{\partial x^\ell } \bigg (u\,\frac{\partial ^{s+1}E}{\partial t^{s}\partial x}\bigg ) = \sum _{i=0}^\ell \left( {\begin{array}{c}\ell \\ i\end{array}}\right) \frac{\partial ^{\ell -i}u}{\partial x^{\ell -i}}\frac{\partial ^{i+s+1}E}{\partial t^s\partial x^{i+1}},\\ \frac{\partial ^{\ell +s+1}E}{\partial t^{s+1}\partial x^\ell }=&\,\, -\frac{\partial ^\ell }{\partial x^\ell } \bigg (e\,\frac{\partial ^{s+1}H}{\partial t^{s}\partial x}\bigg ) = \sum _{i=0}^\ell \left( {\begin{array}{c}\ell \\ i\end{array}}\right) \frac{\partial ^{\ell -i}e}{\partial x^{\ell -i}}\frac{\partial ^{i+s+1}H}{\partial t^s\partial x^{i+1}}. \end{aligned} \end{aligned}\right.$$
(7)

Identifying the coefficients of the Hermite-Taylor polynomials as scaled derivatives and enforcing the system (7) at \((x_{i+1/2},t_0)\), we obtain

$$\begin{aligned} \begin{aligned} c^H_{\ell ,s} =&\,\, -\sum _{i=0}^{\ell } \frac{(i+1)\,\Delta t\, \Delta x^{\ell -i-1}}{(\ell -i)!\,s}\,\frac{\partial ^{\ell -i} u}{\partial x^{\ell -i}}\,c^E_{i+1,s-1}, \\ c^E_{\ell ,s} =&\,\, -\sum _{i=0}^{\ell } \frac{(i+1)\,\Delta t\, \Delta x^{\ell -i-1}}{(\ell -i)!\,s}\,\frac{\partial ^{\ell -i} e}{\partial x^{\ell -i}}\,c^H_{i+1,s-1} \end{aligned} \end{aligned}$$

for \(\ell = 0,\cdots ,2\,m+1\) and \(s=1,\cdots ,q\).

We note that this step can be generalized for other problems including linear, non-linear, and variable coefficient problems. We refer the reader to [12] for more details.

3.3 Time Evolution

Finally, we evolve the electromagnetic fields and their space derivatives through order m on the dual mesh nodes, located at \((x_{i+1/2},t_{1/2})\) for the cell \([x_i, x_{i+1}]\), by evaluating (5),

$$\begin{aligned} \frac{\partial ^{\ell } p^H_{i+1/2}(x_{i+1/2},t_{1/2})}{\partial x^\ell }, \quad \frac{\partial ^{\ell } p^E_{i+1/2}(x_{i+1/2},t_{1/2})}{\partial x^\ell }, \quad \ell =0,\cdots ,m. \end{aligned}$$

A similar process is repeated to evolve the data from the dual mesh at \(t_{1/2}\) to the primal mesh at \(t_1\) and therefore to complete the time step. The overall procedure is repeated until the final time is reached. Figure 1 illustrates the Hermite-Taylor method at a given primal node.

Remark 1

For linear constant coefficients hyperbolic problems, the Taylor expansion in time of the coefficients of the Hermite polynomials is computed exactly for q sufficiently large [11], for example \(q=2\,m+1\) in (5) for the one-dimensional case. In general, we set \(q=\nu \,(2\,m+1)\) in \({\mathbb {R}}^{\nu }\) to obtain an exact time expansion of the coefficients.

Remark 2

In higher dimensions, the primal mesh is defined as the classical Cartesian mesh while the dual nodes are defined at the cell center. Hence, this differs from the mesh used in FDTD methods. As for the Hermite interpolation procedure, approximations are computed using a tensor product of one-dimensional Hermite polynomials. We refer the interested reader to [11] for more details on the Hermite-Taylor setting for higher dimensions.

As mentioned before, a challenge for the Hermite-Taylor method is to enforce general boundary conditions. Indeed, this method requires to know all information on the boundary, including the space derivatives through order m, which are usually not available. In the next section, we present a way to obtain the needed information using the CFM.

4 Correction Function Method (CFM)

In this section, we describe the CFM that computes approximations to the electromagnetic fields and their derivatives through order m at the nodes located on the boundary of the domain. There are two key ingredients to the CFM: the minimization of functionals describing the electromagnetic fields near the boundary, and careful definition of the space-time domains of the functionals along the boundary. We refer to a space-time domain of a functional as a local patch. Once the minimization procedure is completed, we obtain space-time polynomials, called correction functions, approximating each electromagnetic field in the vicinity of the boundary. The correction functions are used to update the solution at the boundary nodes. In the following, we first describe the method in detail in 1-D and then generalize it in higher dimensions.

4.1 The Hermite-CFM in 1-D

On the mesh in Fig. 1, the first step has allowed for the update of the Hermite solution on the dual mesh at time level \(t_{n-1/2}\) and the second step has allowed for the update of the numerical solution on the primal mesh at \(t_{n}\), except near the boundary. At \((x_0,t_n)\) and \((x_{N_x},t_n)\) for \(n=1,\cdots ,N_t\) the solution will be updated using the CFM.

We define a node where the numerical solution is updated using the Hermite-Taylor method as a Hermite node and a node where the numerical solution is computed using the CFM we denote as a CF node. In the following, the subscript i refers to the ith CF node in the mesh and the superscript n refers to the time level \(t_n\). In the one-dimensional case, \(i=0\) and \(i=1\) refer respectively to the boundary nodes \(x_0\) and \(x_{N_x}\).

We further note that although the functional just to be defined can depend on time, as manifested by the n superscript, (for example to account for a moving geometry) but for all the problems considered here it will not. When there is no time dependence all the small linear system of equations (one at each CF node) resulting from the quadratic optimization problem, will not change in time and can thus be formulated, factored, and stored once and for all before the time stepping loop. Consequently, the complexity of the Hermite-CFM will approach that of the Hermite method in the limit \(h \rightarrow 0\).

The CFM minimizes a functional unique to each CF node composed of three parts

$$\begin{aligned} J_i^n = {\mathcal {G}}_i^n + {\mathcal {B}}_i^n + {\mathcal {H}}_i^n. \end{aligned}$$
(8)

Here, \({\mathcal {G}}_i^n\) weakly enforces the governing equations, \({\mathcal {B}}_i^n\) weakly enforces the boundary conditions, and \({\mathcal {H}}_i^n\) weakly enforces that the correction functions match the Hermite solution near the ith CF node.

The domains over which the different terms in the functional are computed are not the same. The domain of \({\mathcal {B}}_i^n\) should include the part of the boundary in the vicinity of the ith CF node to weakly enforce the boundary conditions. The domain of \({\mathcal {H}}_i^n\) should be the same as the space-time domains of the Hermite nodes closest to the ith CF node. We then weakly enforce the correction functions to match the Hermite solution in the domain of \({\mathcal {H}}_i^n\) while avoiding extrapolation procedures of the Hermite solution. Finally, the domain of integration for \({\mathcal {G}}^n_i\) should enclose the ith CF node, the domain of integration for \({\mathcal {B}}_i^n\) and the domain of integration for \({\mathcal {H}}_i^n\) to enforce Maxwell’s equations over the whole local patch of the functional \(J_i^n\).

As an example for the CF node \(x_0\) at time level \(t_n\), \({\mathcal {G}}_0^n\) contains the residual of the PDE and it is integrated over the rectangular space-time region (the local patch) consisting of the direct product of the space interval \(S_0=[x_0,x_{3/2}]\) with the time interval \(I_n=[t_{n-1},t_n]\) as illustrated in Fig. 2.

Fig. 2
figure 2

Illustration of the domain of integration \(S_0\times I_n\) of \({\mathcal {G}}_0^n\). The primal CF and Hermite nodes are respectively represented by green squares and black squares while the dual Hermite nodes are represented by blue circles. The CFM seeks the information located at \((x_0,t_{n})\) which is enclosed by the red circle. The space-time local patch \(S_0\times I_n\) is denoted by a dashed magenta box

We then have

$$\begin{aligned} {\mathcal {G}}_0^n(H^n_{h,0},E^n_{h,0}) = \frac{\ell _0}{2} \,\int _{I_n}\!\int _{S_0} ((\mu \,\partial _t H^n_{h,0}+\partial _x E^n_{h,0})^2 + (\epsilon \,\partial _t E^n_{h,0} + \partial _x H^n_{h,0})^2) \mathrm {d}x \mathrm {d}t, \end{aligned}$$

where \(\ell _0 = x_{3/2}-x_0 = 1.5\,\Delta x\) is the characteristic length of the space interval \(S_0\). Here \(H^n_{h,0}\) and \(E^n_{h,0}\) are the sought correction functions approximating the electromagnetic fields and are used to update the numerical solution at \((x_0,t_n)\).

The term \({\mathcal {B}}_0^n\) contains the residual of the boundary condition at \(x_0\) and it is integrated over the time interval \(I_n\) as shown in Fig. 3. As an example, we have

$$\begin{aligned} {\mathcal {B}}_0^n(E^n_{h,0}) = \frac{1}{2} \, \int _{I_n} (E^n_{h,0}(x_0,t)-g_E(t))^2\,\mathrm {d}t \end{aligned}$$

for the boundary condition (2).

Fig. 3
figure 3

Illustration of the domain of integration \(I_n\) at \(x_0\) of \({\mathcal {B}}_0^n\). The primal CF and Hermite nodes are respectively represented by green squares and black squares while the dual Hermite nodes are represented by blue circles. The CFM seeks the information located at \((x_0,t_{n})\) which is enclosed by the red circle. The intersection between the boundary and the local patch, that is the line connecting \((x_0,t_{n-1})\) to \((x_0,t_n)\), is denoted by a dashed purple line

We now require the correction functions to weakly match the Hermite solution over the space-time domains of the primal Hermite node \(x_1\) and the dual Hermite node \(x_{1/2}\). This is what connects the two methods and is needed for the minimization problem to be well-posed. The first part of \({\mathcal {H}}_0^n\) contains the Hermite-Taylor polynomials \(H^*(x,t) = p_{1/2}^H(x,t)\) and \(E^*(x,t) = p_{1/2}^E(x,t)\), which are associated with the cell of the dual Hermite node \(x_{1/2}\), and it is integrated over the rectangular region consisting of the direct product of the space interval \(S^{{\mathcal {H}}}_{0,d} = [x_{0},x_{1}]\) with the time interval \([t_{n-1},t_{n-1/2}]\). The second part of the term \({\mathcal {H}}_0^n\) contains the Hermite-Taylor polynomials \(H^*(x,t)=p_{1}^H(x,t)\) and \(E^*(x,t)=p_{1}^E(x,t)\), and it is integrated over the rectangular space-time region consisting of the direct product of the space interval \(S^{{\mathcal {H}}}_{0,p} = [x_{1/2},x_{3/2}]\), which is the cell associated with the primal Hermite node \(x_1\) with the time interval \([t_{n-1/2},t_n]\). The space-time regions \(S^{{\mathcal {H}}}_{0,d}\times [t_{n-1},t_{n-1/2}]\) and \(S^{{\mathcal {H}}}_{0,p}\times [t_{n-1/2},t_{n}]\) are illustrated in Fig. 4. We then have

$$\begin{aligned} \begin{aligned} {\mathcal {H}}_0^n(H^n_{h,0},E^n_{h,0}) =&\,\, \frac{c_H}{2}\,\int _{t_{n-1}}^{t_{n-1/2}} \int _{S_{0,d}^{\mathcal {H}}} ((H^n_{h,0}-H^*)^2 + (E^n_{h,0}-E^*)^2)\mathrm {d}x\mathrm {d}t \\ \qquad+&\,\, \frac{c_H}{2}\,\int _{t_{n-1/2}}^{t_n} \int _{S_{0,p}^{\mathcal {H}}} ((H^n_{h,0}-H^*)^2 + (E^n_{h,0}-E^*)^2)\mathrm {d}x\mathrm {d}t, \end{aligned} \end{aligned}$$
(9)

where \(c_H\) is a given penalization function that is such that \(0< c_H(\Delta x)\leqslant 1\).

Fig. 4
figure 4

Illustration of the domains of integration \(S_{0,d}^{\mathcal {H}} \times [t_{n-1},t_{n-1/2}]\) and \(S_{0,p}^{\mathcal {H}} \times [t_{n-1/2},t_n]\) of \({\mathcal {H}}_0^n\). The primal CF and Hermite nodes are respectively represented by green squares and black squares while the dual Hermite nodes are represented by blue circles. The CFM seeks the information located at \((x_0,t_{n})\) which is enclosed by the red circle. The domains \(S_{0,d}^{\mathcal {H}} \times [t_{n-1},t_{n-1/2}]\) and \(S_{0,p}^{\mathcal {H}} \times [t_{n-1/2},t_n]\), where we enforce the correction functions to match the Hermite-Taylor polynomials, is denoted by a dashed blue box

A similar procedure is used to define the local patch and the functional associated with the second CF node \(x_{N_x}\) at the time level \(t_n\).

4.1.1 The Linear System of Equations that Solves the Optimization Problem

At each CF node we must solve the following problem:

$$\begin{aligned} \begin{aligned}&\text {find } ({H}^n_{h,i},{E}^n_{h,i}) \in V \times V \text { such that }({H}^n_{h,i},{E}^n_{h,i}) = \underset{{v},{w}\in V}{\arg \min }\, J_i^n({v},{w}). \end{aligned} \end{aligned}$$
(10)

Here \(V = {\mathbb {Q}}^k\big (S_i\times I_n \big )\) is the space of polynomials of degree k. In this work, we use space-time Legendre polynomials. In our one-dimensional example \(i=0,1\). Note that although \(n=1,\cdots ,N_t\), since the boundary does not change in time, there is in fact only one optimization problem for each CF node.

We formally compute the gradient of \(J_i^n\) with respect to the coefficients of the polynomial approximations \(H^n_{h,i}\) and \(E^n_{h,i}\), and use that it vanishes at a minimum to find a solution to the minimization problem (10). This leads to a linear system

$$\begin{aligned} M_i^n\, {\varvec{c}}_i^n = {\varvec{b}}_i^n, \end{aligned}$$

where \({\varvec{c}}_i^n\) contains the coefficients of \(H^n_{h,i}\) and \(E^n_{h,i}\).

Again, since the boundary of the domain does not move, we have \(M_i = M_i^n\), so the matrices \(M_i\), their scaling and LU factorization are found in a pre-computation step. Consequently, the only computations needed at each time step is the computation of the right-hand side \({\varvec{b}}_i^n\), followed by forward and backward substitutions to find \({\varvec{c}}_i^n\).

4.1.2 Summary of the Hermite-CFM in 1-D

Given the numerical solution on the primal mesh at \(t_{n-1}\), the algorithm of the Hermite-Taylor CFM to evolve the numerical solution at \(t_{n}\) is:

  1. (i)

    update the numerical solution on the dual mesh at \(t_{n-1/2}\) using the Hermite-Taylor method and store the Hermite-Taylor polynomials needed for the CFM;

  2. (ii)

    update the numerical solution on the primal Hermite node at \(t_{n}\) using the Hermite-Taylor method and store the Hermite-Taylor polynomials needed for the CFM;

  3. (iii)

    update the numerical solution at the CF nodes using the CFM by computing the right-hand sides \({\varvec{b}}_i^n\) and solve for \({\varvec{c}}_i^n\). This is done independently for each i and can thus be done in parallel without any communication step.

4.2 The Hermite-CFM in 2-D

We only consider piecewise rectangular domains composed of straight lines between primal nodes. For higher dimensions, the spatial domain of a local patch is adapted depending on the geometry of the boundary and where the Hermite solution is available in the vicinity of its CF node while the time domain \(I_n\) remains the same. The spatial domain \(S_i\) of a local patch needs to satisfy three constraints:

  1. (i)

    the ith CF node must be inside;

  2. (ii)

    part of the boundary of the domain close to the ith CF node must be contained in it;

  3. (iii)

    it must contain the cells of the Hermite nodes closest to the ith CF node.

Examples of the spatial domains of local patches in 2-D that satisfy these constraints are shown in Figs. 5, 6, and 7. For simplicity, we omit the subscript associated with the CF node in the description of the local patches.

Let us first consider a CF node \((x_i,y_0)\) along an edge as depicted in Fig. 5. In this case, the spatial domain of the local patch is \(S = [x_{i-1},x_{i+1}]\times [y_0,y_{3/2}]\) while its intersection with the boundary of the domain, \(S\cap \varGamma\), is the line connecting the points \((x_{i-1},y_0)\) and \((x_{i+1},y_0)\). The spatial domains where we weakly enforce the Hermite solution are \(S_d^{{\mathcal {H}}} = [x_{i-1},x_{i+1}]\times [y_{0},y_{1}]\) over the time interval \([t_{n-1},t_{n-1/2}]\) and \(S_p^{{\mathcal {H}}} = [x_{i-1/2},x_{i+1/2}]\times [y_{1/2},y_{3/2}]\) over the time interval \([t_{n-1/2},t_n]\).

Fig. 5
figure 5

Illustration of a two-dimensional local patch for a bottom edge CF node. The left and right plots show respectively the spatial component of the local patch over the time intervals \([t_{n-1},t_{n-1/2}]\) and \([t_{n-1/2},t_n]\). The primal CF and Hermite nodes are respectively represented by green squares and black squares while the dual Hermite nodes are represented by blue circles. The CFM seeks the information located at \((x_i,y_0)\), which is enclosed by the red circle. The spatial domain S of local patches is denoted by a dashed magenta box. The part of the boundary \(\varGamma\) included in the local patch is represented by a dashed purple line. The spatial domains \(S_d^{{\mathcal {H}}}\) and \(S_p^{{\mathcal {H}}}\) where we enforce the correction functions to match the Hermite-Taylor polynomials are denoted by a dashed blue box

For a CF node located at a corner \((x_0,y_0)\) as illustrated in Fig. 6, we have \(S = [x_0,x_{3/2}]\times [y_0,y_{3/2}]\), \(S_d^{{\mathcal {H}}} = [x_{0},x_{1}]\times [y_{0},y_{1}]\), and \(S_p^{{\mathcal {H}}} = [x_{1/2},x_{3/2}]\times [y_{1/2},y_{3/2}]\). The intersection of S with the boundary is composed of the line connecting \((x_0,y_0)\) to \((x_0,y_{3/2})\) and that connecting \((x_0,y_0)\) to \((x_{3/2},y_0)\).

Fig. 6
figure 6

Illustration of a two-dimensional local patch for a bottom-left corner CF node. The left and right plots show respectively the spatial component of the local patch over the time intervals \([t_{n-1},t_{n-1/2}]\) and \([t_{n-1/2},t_n]\). The primal CF and Hermite nodes are respectively represented by green squares and black squares while the dual Hermite nodes are represented by blue circles. The CFM seeks the information located at \((x_0,y_0)\), which is enclosed by the red circle. The spatial domain S of local patches is denoted by a dashed magenta box. The part of the boundary \(\varGamma\) included in the local patch is represented by a dashed purple line. The spatial domains \(S_d^{{\mathcal {H}}}\) and \(S_p^{{\mathcal {H}}}\) where we enforce the correction functions to match the Hermite-Taylor polynomials are denoted by a dashed blue box

As a last example, we consider the situation in Fig. 7 where a CF node is located at a reentrant corner \((x_i,y_i)\). We then have \(S=[x_{i-1},x_{i+3/2}]\times [y_{j-1},y_{j+3/2}]\). The spatial domain where the Hermite solution is enforced \(S_d^{\mathcal {H}}\) over the time interval \([t_{n-1},t_{n-1/2}]\) is the union of \([x_{i-1},x_{i+1}]\times [y_{j},y_{j+1}]\) and \([x_{i},x_{i+1}]\times [y_{j-1},y_{j}]\). The spatial domain where the Hermite solution is enforced \(S_p^{\mathcal {H}}\) over the time interval \([t_{n-1/2},t_n]\) is the union of \([x_{i-1/2},x_{i+3/2}]\times [y_{j+1/2},y_{j+3/2}]\) and \([x_{i+1/2},x_{i+3/2}]\times [y_{j-1/2},y_{j+1/2}]\). The intersection between the spatial domain S of the local patch and the boundary is composed of the line connecting \((x_i,y_{j-1})\) to \((x_i,y_j)\) and that connecting \((x_{i-1},y_j)\) to \((x_i,y_j)\).

Fig. 7
figure 7

Illustration of a two-dimensional local patch for a reentrant corner CF node. The left and right plots show respectively the spatial component of the local patch over the time intervals \([t_{n-1},t_{n-1/2}]\) and \([t_{n-1/2},t_n]\). The primal CF and Hermite nodes are respectively represented by green squares and black squares while the dual Hermite nodes are represented by blue circles. The CFM seeks the information located at \((x_i,y_i)\), which is enclosed by the red circle. The spatial domain S of local patches is denoted by a dashed magenta box. The part of the boundary \(\varGamma\) included in the local patch is represented by a dashed purple line. The spatial domains \(S_d^{{\mathcal {H}}}\) and \(S_p^{{\mathcal {H}}}\) where we enforce the correction functions to match the Hermite-Taylor polynomials are denoted by a dashed blue box

Let us now consider Maxwell’s equations in three dimensions (3-D) and seek polynomial approximations of the magnetic field and the electric field in each local patch, that is \({\varvec{H}}^n_{h,i}\) and \({\varvec{E}}^n_{h,i}\) for \(i=0,\cdots ,N_\varGamma\) and \(n=1,\cdots ,N_t\). Here \(N_\varGamma\) is the total number of CF nodes. The first part of the functional (8) becomes

$$\begin{aligned} \begin{aligned} {\mathcal {G}}_i^n({\varvec{H}}^n_{h,i},{\varvec{E}}^n_{h,i}) =&\,\, \frac{\ell _i}{2} \,\int _{I_n}\!\int _{S_i} ((\mu \,\partial _t {\varvec{H}}^n_{h,i} + \nabla \times {\varvec{E}}^n_{h,i})\cdot (\mu \,\partial _t {\varvec{H}}^n_{h,i} + \nabla \times {\varvec{E}}^n_{h,i}) \\& + ( \epsilon \,\partial _t {\varvec{E}}^n_{h,i} - \nabla \times {\varvec{H}}^n_{h,i})\cdot ( \epsilon \,\partial _t {\varvec{E}}^n_{h,i} - \nabla \times {\varvec{H}}^n_{h,i})\\& +(\nabla \cdot (\mu \, {\varvec{H}}^n_{h,i}))^2 + (\nabla \cdot (\epsilon \, {\varvec{E}}^n_{h,i}))^2)\mathrm {d}{\varvec{x}}\mathrm {d}t, \end{aligned} \end{aligned}$$

where \(\ell _i = \beta \,h\) is the characteristic length of the spatial domain \(S_i\) that depends on the mesh size h and \(\beta >0\). The second part of the functional \(J_i^n\) that weakly enforces the boundary conditions is either

$$\begin{aligned} {\mathcal {B}}_i^n({\varvec{E}}^n_{h,i}) = \frac{1}{2} \,\int _{I_n}\!\int _{\varGamma \cap S_i} ({\varvec{n}}\times {\varvec{E}}^n_{h,i} - {\varvec{g}}_E)\cdot ({\varvec{n}}\times {\varvec{E}}^n_{h,i} - {\varvec{g}}_E)\, \mathrm {d}s\mathrm {d}t \end{aligned}$$

for the boundary condition (2),

$$\begin{aligned} {\mathcal {B}}_i^n({\varvec{H}}^n_{h,i}) = \frac{1}{2} \, \int _{I_n}\!\int _{\varGamma \cap S_i} ({\varvec{n}}\times {\varvec{H}}^n_{h,i} - {\varvec{g}}_H) \cdot ({\varvec{n}}\times {\varvec{H}}^n_{h,i} - {\varvec{g}}_H)\, \mathrm {d}s\mathrm {d}t \end{aligned}$$

for the boundary condition (3) or

$$\begin{aligned} {\mathcal {B}}_i^n({\varvec{H}}^n_{h,i},{\varvec{E}}^n_{h,i})&= \frac{1}{2} \, \int _{I_n}\!\int _{\varGamma \cap S_i} ({\varvec{E}}_{h,i}^n\times {\varvec{n}} +Z\,{\varvec{n}}\times ({\varvec{H}}_{h,i}^n\times {\varvec{n}}) - {\varvec{g}})\\&\quad \cdot ({\varvec{E}}_{h,i}^n\times {\varvec{n}} +Z\,{\varvec{n}}\times ({\varvec{H}}_{h,i}^n\times {\varvec{n}}) - {\varvec{g}})\, \mathrm {d}s \mathrm {d}t \end{aligned}$$

for the boundary condition (4).

The final part of \(J_i^n\) that weakly enforces the correction functions to match the Hermite solution is given by

$$\begin{aligned} \begin{aligned} {\mathcal {H}}_i^n(({\varvec{H}}^n_{h,i},{\varvec{E}}^n_{h,i}) =& \, \frac{c_H}{2} \int _{t_{n-1}}^{t_{n-1/2}}\int_{S^{\mathcal {H}}_{i,d}} ({(\varvec{H}}^n_{h,i}-{\varvec{H}}^*)\cdot ({\varvec{H}}^n_{h,i}-{\varvec{H}}^*) + ({\varvec{E}}^n_{h,i}-{\varvec{E}}^*)\cdot ({\varvec{E}}^n_{h,i}-{\varvec{E}}^*))\,\mathrm {d}{\varvec{x}} \mathrm {d}t \\ & \,+\frac{c_H}{2} \int _{t_{n-1/2}}^{t_{n}}\int _{S^{\mathcal {H}}_{i,p}} ({(\varvec{H}}^n_{h,i}-{\varvec{H}}^*)\cdot {(\varvec{H}}^n_{h,i}-{\varvec{H}}^*) + {\varvec{E}}^n_{h,i}-{\varvec{E}}^*)\cdot ({\varvec{E}}^n_{h,i}-{\varvec{E}}^*))\,\mathrm {d}{\varvec{x}} \mathrm {d}t \end{aligned} \end{aligned}$$

We then have the following problem statement:

$$\begin{aligned} \begin{aligned}&\text {find } ({\varvec{H}}^n_{h,i},{\varvec{E}}^n_{h,i}) \in V \times V \text { such that }({\varvec{H}}^n_{h,i},{\varvec{E}}^n_{h,i}) = \underset{{\varvec{v}},{\varvec{w}}\in V}{\arg \min }\, J_i^n({\varvec{v}},{\varvec{w}}) \end{aligned} \end{aligned}$$
(11)

for \(i=0,\cdots ,N_\varGamma\) and \(n=1,\cdots ,N_t\). Here

$$\begin{aligned} V = \big \{ {\varvec{v}} \in \big [{\mathbb {Q}}^k(S_i\times I_n )\big ]^3 \big \}. \end{aligned}$$

As in 1-D, we use that the gradient of the functional \(J_i^n\) with respect to the coefficients of the polynomial approximations \({\varvec{H}}_{h,i}^n\) and \({\varvec{E}}_{h,i}^n\) vanishes at a minimum to obtain a linear system of equations to solve. The dimension of the minimization problems is independent of the mesh size and the time step size, and is \(3\,(k+1)^{3}\) in 2-D and \(6\,(k+1)^{4}\) in 3-D. However, the number of minimization problems \((N_\varGamma +1)\,N_t\) increases as the mesh size and the time step size diminish. Once the minimization problem is solved on a local patch, the electromagnetic fields and their space derivatives through order m are estimated at its CF node using \({\varvec{H}}^n_{h,i}\) and \({\varvec{E}}^n_{h,i}\).

Remark 3

The terms in \({\mathcal {G}}_i^n\) enforcing the residual of Maxwell’s equations (1) are scaled by \(\ell _i\) to guarantee that all the terms in \({\mathcal {G}}_i^n\) and \({\mathcal {B}}_i^n\) behave in a similar way as the mesh size diminishes [21]. Let us assume that the correction functions are polynomials of degree k that leads to an accuracy of \({\mathcal {O}}(\ell _i^{k+1})\) and that \(k=2\,m\). Using \({\varvec{H}}_i^n = {\varvec{H}} + {\mathcal {O}}(\ell _i^{k+1})\) and \({\varvec{E}}_i^n = {\varvec{E}} + {\mathcal {O}}(\ell _i^{k+1})\) in the functional \(J_i^n\), we have that the terms in \({\mathcal {G}}_i^n\) and \({\mathcal {B}}_i^n\) behave as \({\mathcal {O}}(\ell _i^{2\,k+5})\) while the term in \({\mathcal {H}}_i^n\) scales as \({\mathcal {O}}(\ell _i^{2\,k+6})\). Hence, the functional \(J_i^n\) is dominated by the boundary conditions and Maxwell’s equations as \(\ell _i\) diminishes.

Remark 4

The number of matrices to construct can be further reduced depending on the geometry of the domain and the physical properties of the material \(\mu\) and \(\epsilon\). As an example, let us consider a two-dimensional geometry discretized with a Cartesian mesh with \(\Delta x = \Delta y\). We also assume the boundary \(\varGamma\) of the domain to coincide only with primal nodes. For problems with constant coefficients on a rectangular domain, the number of matrices is reduced to eight because the spatial domain \(S_i\) of local patches on an edge translates along it. If reentrant corners are also considered, there is a maximum of twelve matrices to compute.

Remark 5

Assuming that the correction functions are polynomials of degree k that lead to an accuracy of \({\mathcal {O}}(\ell _i^{k+1})\), we then have \(k\geqslant 2\,m\) to preserve the accuracy of a \((2\,m+1)\) order Hermite-Taylor method. As was remarked for FDTD methods in [16], the CFM impacts the stability of the original method because of the Hermite-Taylor polynomials \({\varvec{H}}^*\) and \({\varvec{E}}^*\). Since a rigorous proof of the stability of the proposed method is out of reach for the moment, we investigate numerically its stability properties in Sect. 5.

5 Numerical Examples

In this section, we numerically investigate the stability of the proposed method and perform convergence studies in 1-D and 2-D.

5.1 Examples in 1-D

Let us seek approximate solutions to Maxwell’s equations

$$\begin{aligned} \begin{aligned} \mu \,\partial _t H + \partial _x E =&\,\, 0, \\ \epsilon \,\partial _t E + \partial _x H =&\,\, 0 \end{aligned} \end{aligned}$$

in the domain \(\varOmega = [x_\ell , x_r]\) and the time interval \(I=[t_0,t_f]\). The initial conditions are \(H(x,t_0) = a(x)\) and \(E(x,t_0) = b(x)\), and we focus on the boundary conditions \(E(x_\ell ,t) = g_\ell (t)\) and \(E(x_r,t) = g_r(t)\). Here a(x), b(x), \(g_\ell (t)\), and \(g_r(t)\) are known functions.

In this subsection, we use the Hermite-Taylor CFM with \(1\leqslant m \leqslant 5\). We set the degree of the correction functions to be \(2\,m\). The CFM should not therefore impact the convergence rate of the Hermite-Taylor method.

5.1.1 Stability

Let us first investigate the stability of the Hermite-Taylor CFM. We consider \(\varOmega = [0,1]\), and set \(\mu =1\) and \(\epsilon =1\). The stability condition of the Hermite-Taylor method depends only on the largest wave speed and is given here by \(\Delta t < h\), where h is the mesh size. As mentioned in Remark 5, the stability of the Hermite-Taylor method is impacted by the CFM because we use Hermite-Taylor polynomials \({\varvec{H}}^*\) and \({\varvec{E}}^*\) in the minimization problem (11). Although we do not have a rigorous proof of the stability of the Hermite-Taylor CFM, we provide numerical evidences of it by investigating the eigenvalues of the global matrix associated with the method.

Since Maxwell’s equations are a linear system of PDEs and assuming \(g_\ell = g_r = 0\), the proposed numerical method can be written as

$$\begin{aligned} {\varvec{W}}_p^{n+1} = A\,{\varvec{W}}_p^n, \end{aligned}$$

where A is a square matrix of dimension \(2\,(N_x+1)\,(m+1)\) and \({\varvec{W}}_p^n\) is a vector containing all the degrees of freedom on the primal mesh at time \(t_n\). A stable method should have all the eigenvalues of A inside the unit circle of the complex plane. In the following, we compute numerically the eigenvalues of A and consider that the scheme is stable if the spectral radius \(\rho (A)\) of the matrix A is at most one with an error of \({\mathcal {O}}(10^{-10})\).

Fig. 8
figure 8

Absolute difference between one and the spectral radius of the matrix A as a function of the mesh size, the CFL constant and the penalization parameter \(c_H\) for various values of m. For the left plot, the CFL constant is set to 0.9 and \(c_H = 1\). For the middle plot, the mesh size is \(h=\tfrac{1}{80}\) and \(c_H=1\). For the right plot, the CFL constant is set to 0.9 and \(h=\tfrac{1}{80}\)

The left plot of Fig. 8 illustrates the absolute difference between one and the spectral radius of the matrix A, denoted \(\rho (A)\), as a function of the mesh size for a CFL constant of 0.9, \(c_H=1\) and various values of m. For \(m\leqslant 4\), we observe that the method is stable for a sufficiently small mesh size. In other words, the eigenvalues of A are moving inside the unit circle as the mesh is refined. This is expected since the terms in \({\mathcal {H}}_i^n\) impacting the stability scale as \({\mathcal {O}}(\ell _i^{2\,k+6})\) while the other terms in \(J_i^n\) scale as \({\mathcal {O}}(\ell _i^{2\,k+5})\). For \(m=5\), we do not observe a clear improvement as the mesh size diminishes for the considered CFL constant. This motivates us to diminish the CFL constant and the value of \(c_H\) to improve the stability of the Hermite-Taylor CFM.

The middle plot of Fig. 8 illustrates the absolute difference between one and \(\rho (A)\) as a function of the CFL constant for \(h=\tfrac{1}{80}\), \(c_H=1\) and various values of m. We clearly have a stable method as the CFL constant diminishes.

The right plot of Fig. 8 illustrates the absolute difference between one and the spectral radius of the matrix A as a function of \(c_H\) for a CFL constant of 0.9, \(h=\tfrac{1}{80}\) and various values of m. For all m, a smaller value of the penalization coefficient \(c_H\) helps to obtain a stable method.

To give further evidences of that, Fig. 9 illustrates the absolute difference between one and \(\rho (A)\) as a function of the CFL constant for \(m=5\), \(h\in \big \{\tfrac{1}{20},\tfrac{1}{100},\tfrac{1}{250},\tfrac{1}{500},\tfrac{1}{750},\tfrac{1}{1\,000}\big \}\) and \(c_H \in \big \{1,\tfrac{1}{10},\tfrac{1}{100}\big \}\). A smaller penalization coefficient \(c_H\) does not improve the stability of the proposed method for coarser meshes. In these cases, we therefore need to lower the CFL constant.

Fig. 9
figure 9

Absolute difference between one and the spectral radius of the matrix A as a function of the CFL constant for \(m=5\), and various mesh sizes and values of \(c_H\). The left, middle, and right plots are respectively for \(c_H=1\), \(c_H=\frac{1}{10}\), and \(c_H = \frac{1}{100}\)

Based on these results, the stability of the Hermite-Taylor CFM improves by reducing the CFL constant and the value of the penalization coefficient \(c_H\). Moreover, the stability of this method improves as the mesh size diminishes, which suggests that larger CFL constants could be used for finer meshes.

5.1.2 Condition Number of CFM Matrices

Let us now investigate the impact of h, \(c_H\), and the CFL constant on the condition number of the matrices \(M_i\) coming from the minimization procedure used in the CFM. Figure 10 illustrates the maximum condition number of these matrices as a function of the mesh size, the CFL constant and the penalization parameter \(c_H\) for various values of m. We observe that the condition number increases as the mesh size diminishes and, more precisely, scales as \(\tfrac{1}{h}\) for all different settings. We also notice that the condition number first diminishes as the CFL constant decreases, then appears to stabilize at a constant. Finally, the condition number increases as \(c_H\) diminishes and scales as \(\frac{1}{c_H}\). Hence, an arbitrary small value of \(c_H\) cannot be taken to avoid poorly conditioned matrices coming from the CFM. It is then preferable to diminish the CFL constant to obtain a stable method.

Fig. 10
figure 10

Maximum condition number of the matrices coming from the CFM as a function of the mesh size, the CFL constant and the penalization parameter \(c_H\) for various values of m. For the left plot, the CFL constant is set to 0.9 and \(c_H = 1\). For the middle plot, the mesh size is \(h=\tfrac{1}{80}\) and \(c_H=1\). For the right plot, the CFL constant is set to 0.9 and \(h=\tfrac{1}{80}\)

5.1.3 Accuracy

In the following, we use \(c_H=1\) and \(k=2\,m\) for all settings. We set the CFL constant at 0.9 for \(m=1\) and \(m=2\), 0.5 for \(m=3\) and \(m=4\), and 0.25 for \(m=5\). The computed spectral radius is maximum one up to an error of \(10^{-12}\) for all considered mesh sizes.

Let us now verify the convergence order of the proposed method. We consider a domain \(\varOmega = [\tfrac{1}{3},\tfrac{4}{3}]\), a time interval \(I = [0,1]\), \(\mu =1\), and \(\epsilon =1\). We set the initial and boundary data so find that the solution to the problem is

$$\left\{\begin{aligned} \begin{aligned} H(x,t) =&\,\, \sin (250\,x)\,\sin (250\,t), \\ E(x,t)=&\,\, \cos (250\,x)\,\cos (250\,t). \end{aligned} \end{aligned}\right.$$
(12)

Figure 11 shows how the errors follow the expected \((2\,m+1)\) rates of convergence.

Fig. 11
figure 11

Convergence plots in the maximum norm for a standing mode problem using the Hermite-Taylor CFM with different values of m in 1-D. Here \({\varvec{U}} = [H,E]^\text{T}\)

5.2 Examples in 2-D

Let us consider the transverse magnetic (\(\hbox {TM}_z\)) mode. We seek approximate solutions to Maxwell’s equations

$$\left\{\begin{aligned} \begin{aligned} &\mu \,\partial _t H_x + \partial _y E_z =\, 0,\\ &\mu \,\partial _t H_y - \partial _x E_z =\, 0,\\ &\epsilon \,\partial _t E_z - \partial _x H_y + \partial _y H_x =\, 0,\\ &\partial _x H_x + \partial _y H_y =\, 0\\ \end{aligned} \end{aligned}\right.$$
(13)

in the domain \(\varOmega \subset {\mathbb {R}}^2\) and the time interval I with initial conditions for \(H_x\), \(H_y\), and \(E_z\). The boundary conditions are either

$$\begin{aligned}&E_z = g_E, \end{aligned}$$
(14)
$$\begin{aligned}&n_x\,H_y - n_y\,H_x =g_H \end{aligned}$$
(15)

or

$$\begin{aligned} \begin{bmatrix} -n_y\,E_z + Z\,n_y\,(n_y\,H_x-n_x\,H_y)\\ n_x\,E_z - Z\,n_x\,(n_y\,H_x-n_x\,H_y) \end{bmatrix} = {\varvec{g}}. \end{aligned}$$
(16)

We consider two geometries of the domain, that is a square \(\varOmega = [\tfrac{1}{3},\tfrac{4}{3}]\times [\tfrac{1}{6},\tfrac{7}{6}]\) and one with reentrant corners, which is named cross domain and is illustrated in Fig. 12.

Fig. 12
figure 12

Geometry of a cross domain in 2-D

We set \(k=2\,m\) and \(c_H=1\). The CFL constant is 0.9 for \(m=1\), 0.5 for \(m=2\), and 0.25 for \(m=3\). In the following, we numerically investigate the stability of the Hermite-Taylor CFM and perform convergence studies for both geometries.

5.2.1 Stability

Since the total number of degrees of freedom on the primal mesh in 2-D, given by \(3\,(N_x+1)\,(N_y+1)\,(m+1)^2\) where \(N_x\) and \(N_y\) are the number of cells in respectively the x and y directions, is very large, we cannot compute the spectral radius of the matrix A for small mesh sizes, as in 1-D. To provide numerical evidences of the stability of the proposed method, we therefore compute the maximum norm of the electromagnetic fields over 10 000 time steps using the trivial solution, but with initial data, that is the electromagnetic fields and their derivatives through order m, to be random numbers in \(]-10\,\epsilon _M,10\,\epsilon _M[\). Here \(\epsilon _M\) is the machine precision. We set \(\mu =1\) and \(\epsilon =1\). Figure 13 illustrates the evolution of the maximum norm of the electromagnetic fields using different values of m and boundary conditions for the cross domain and different mesh sizes.

Fig. 13
figure 13

Evolution of the maximum norm of the numerical solution for different values of m and boundary conditions using the cross domain in 2-D. The left, middle, and right columns are respectively for \(m=1\), \(m=2\), and \(m=3\). The top, middle, and bottom rows are for the boundary conditions (14), (15), and (16). Here \({\varvec{U}} = [H_x,H_y,E_z]^\text{T}\)

These results suggest that the method is stable.

5.2.2 Accuracy

For the convergence studies, we consider the time interval \(I=[0,1]\), and set \(\mu =1\) and \(\epsilon = 1\). The initial conditions and boundary conditions are chosen in such a way that the solution is given by

$$\begin{aligned} \begin{aligned} H_x =&\,\, -\frac{1}{\sqrt{2}}\sin (\omega \,\uppi \,x)\,\cos (\omega \,\uppi \,y)\,\sin (\sqrt{2}\,\omega \,\uppi \,t), \\ H_y =&\,\, \frac{1}{\sqrt{2}}\cos (\omega \,\uppi \,x)\,\sin (\omega \,\uppi \,y)\,\sin (\sqrt{2}\,\omega \,\uppi \,t), \\ E_z =&\,\, \sin (\omega \,\uppi \,x)\,\sin (\omega \,\uppi \,y)\,\cos (\sqrt{2}\,\omega \,\uppi \,t) \end{aligned} \end{aligned}$$

with \(\omega = 20\). Figure 14 illustrates convergence plots for different values of m, boundary conditions and geometries in 2-D. As expected, we observe a \((2\,m+1)\) rate of convergence in the maximum norm for the Hermite-Taylor CFM.

Fig. 14
figure 14

Convergence plots in the maximum norm for a standing mode problem using for different values of m, boundary conditions and geometries in 2-D. The left, middle, and right columns are respectively for the boundary conditions (14), (15), and (16). The top and bottom rows are for the square and cross domains. Here \({\varvec{U}} = [H_x,H_y,E_z]^\text{T}\)

Figure 15 illustrates convergence plots for the divergence-free constraint on the magnetic field. We observe a \(2\,m\) rate of convergence as expected.

Fig. 15
figure 15

Convergence plots of the divergence of the magnetic field in the \(L^2\) norm for a standing mode problem using for different values of m, boundary conditions and geometries in 2-D. The left, middle, and right columns are respectively for the boundary conditions (14), (15), and (16). The top and bottom rows are for the square and cross domains. Here \({\varvec{H}} = [H_x,H_y]^\text{T}\)

Let us now consider an initial Gaussian pulse on the electric field and PEC boundary conditions, that is \(E_z=0\), on all the boundary of the domain. The square domain \(\varOmega = [0,1]\times [0,1]\) and the cross domain are considered with the time domain \(I=[0,2]\). The initial conditions are given by \(H_x=H_y=0\) and

$$\begin{aligned} E_z = \text{e}^{- \frac{r^2}{2\,\sigma ^2}}. \end{aligned}$$

Here \(r^2 = (x-0.5)^2+(y-0.5)^2\) and \(\sigma = 0.035\). We set \(\mu =1\) and \(\epsilon =1\).

To our knowledge, there is no known analytic solution for this problem. Hence, we perform self-convergence studies. The reference solution \({\varvec{U}}^* = [H_x^*,H_y^*,E_z^*]^\text{T}\) is computed using the seventh-order Hermite-Taylor CFM with \(h=\frac{1}{800}\). We use meshes with \(h=\big \{\frac{1}{25}, \frac{1}{50}, \frac{1}{100}, \frac{1}{200}, \frac{1}{400}\big \}\), so all nodes used in the coarser meshes are also part of the reference solution mesh.

Figure 16 illustrates the self-convergence plots for the square domain. We obtain the expected \((2\,m+1)\) order of convergence for the electromagnetic fields, while a \(2\,m\) order of convergence is observed for the magnetic field divergence. The reference electromagnetic fields at the final time are shown in Fig. 17.

Fig. 16
figure 16

Self-convergence plots for a Gaussian pulse problem using for different values of m and the square domain in 2-D. The left and right plots are respectively for the error on the electromagnetic fields in the maximum norm and the error on the divergence of the magnetic field in the \(L^2\) norm. Here \({\varvec{U}} = [H_x,H_y,E_z]^\text{T}\) and \({\varvec{H}} = [H_x,H_y]^\text{T}\)

Fig. 17
figure 17

The components \(H_x\), \(H_y\), and \(E_z\) for a Gaussian pulse problem using a square domain with the seventh-order Hermite-Taylor CFM and \(h=\frac{1}{800}\) at the final time

Figure 18 illustrates the self-convergence plots for the cross domain. The numerical solution does not convergence in the maximum norm. These results are explained by the reentrant corners in the cross domain. In this setting, the solution has a singular part that hinders the performance of the numerical method [3]. The reference solution of the cross domain is shown in Fig. 19, where strong variations in the magnetic field are observed at the reentrant corners.

Fig. 18
figure 18

Self-convergence plots for a Gaussian pulse problem using for different values of m and the cross domain in 2-D. The left and right plots are respectively for the error on the electromagnetic fields in the maximum norm and the error on the divergence of the magnetic field in the \(L^2\) norm. Here \({\varvec{U}} = [H_x,H_y,E_z]^\text{T}\) and \({\varvec{H}} = [H_x,H_y]^\text{T}\)

Fig. 19
figure 19

The components \(H_x\), \(H_y\), and \(E_z\) for a Gaussian pulse problem using a cross domain with the seventh-order Hermite-Taylor CFM and \(h=\frac{1}{800}\) at the final time

As a final numerical example, we consider a variable coefficients problem. In this situation, we use a manufactured solution given by

$$\begin{aligned} \begin{aligned} H_x =&\,\, -x\,\text{e}^{-x\,y}\,\sin (2\,\uppi \,t), \\ H_y =&\,\, y\,\text{e}^{-x\,y}\,\sin (2\,\uppi \,t),\\ E_z =&\,\, \sin (2\,\uppi \,x\,y)\,\cos (2\,\uppi \,t) \end{aligned} \end{aligned}$$

with \(\mu (x,y) = \sin (5\,\uppi \,x\,y)+2\) and \(\epsilon (x,y) = 2\,\text{e}^{x\,y}\). Note that source terms were considered in Maxwell’s equations (13). We consider the cross domain and the time interval \(I=[0,1]\). We enforce impedance boundary condition (16). Figure 20 illustrates the convergence plots for the electromagnetic fields and the divergence of the magnetic field for different values of m.

Fig. 20
figure 20

Convergence plots for a manufactured solution problem with variable coefficients using for different values of m, the boundary condition (16) and the cross domain in 2-D. The left and right plots are respectively for the error on the electromagnetic fields in the maximum norm and the error on the divergence of the magnetic field in the \(L^2\) norm. Here \({\varvec{U}} = [H_x,H_y,E_z]^\text{T}\) and \({\varvec{H}} = [H_x,H_y]^\text{T}\)

For \(m=1\), we observe a lower rate of convergence than expected. Based on previous numerical examples and the convergence of the magnetic field divergence, finer meshes should exhibit the expected order of convergence. As for \(m=2\), we obtain the expected convergence order for the electromagnetic fields and the divergence-free constraint on the magnetic field. Finally, the error on the electromagnetic fields with \(m=3\) is already very low for coarser meshes, making it hard to observe the seventh-order convergence of the method, while a clear sixth-order convergence is observed for the divergence of the magnetic field.

6 Conclusion

In this work, we have proposed a new method to handle boundary conditions for the Hermite-Taylor method for first order hyperbolic problems based on the CFM. Our method relies on a functional to be minimized that is a square measure of the residual of Maxwell’s equations, the boundary conditions, and the polynomial approximations of the electromagnetic fields coming from the Hermite-Taylor method. Once the minimization problems are solved, the information needed on the boundary, that is both electromagnetic fields and their space derivatives through order m, are computed. Numerical examples suggest that the Hermite-Taylor CFM is stable under a loose CFL constant and the value of the penalization coefficient. Convergence rates of the Hermite-Taylor CFM have been verified in 1-D and 2-D with different boundary conditions and geometries of the domain. Future work will focus on embedded boundary and interface problems.