1 Introduction

Nonlocal models have been introduced to address certain phenomena which local models fail to describe satisfactorily. Delayed reaction-diffusion in biology [1], swarm of organisms [2], pedestrian traffic [3], flocking of birds [4,5,6], plane waves in solids [7], elasticity of nano-beams [8], and material damage [9, 10] are some examples of problems where nonlocal models are useful. Material damage models in particular are of significant interest, being used for failure prediction of critical materials and structures. Physical features in damage (evolving cracks and distributed failure) and small-scale heterogeneities can be naturally modeled using nonlocal approaches [11, 12], and would be otherwise difficult to describe or prohibitively expensive to compute with classical local approaches. Peridynamics, as a nonlocal extension of continuum mechanics [13, 14], has been successful in modeling damage evolution and material failure [13, 15, 16]. Dynamic brittle fracture [17,18,19], fatigue and thermally induced cracking [16, 20], fracture in porous and granular materials [21,22,23], failure of composites [24, 25], and corrosion damage [26,27,28,29,30] are among some applications of this formulation in modeling material damage.

In peridynamics (PD), material behavior at each point x depends on the interactions of that point with all of the points \( \hat{\boldsymbol{x}} \) in its neighborhood [14]. This neighborhood (usually a line segment in 1D, a disk in 2D, and a sphere in 3D) centered at x is called the “horizon region” of x and is denoted by Hx. Hx is the subdomain where nonlocal interactions exist for x.

Mathematical models of physical behavior using this approach are in the form of integro-differential equations, as spatial derivatives in the classical PDEs are replaced by convolution integrals that integrate the pairwise interactions of x with the points in Hx. Integration has significantly more relaxed smoothness and continuity requirements compared with differentiation, and hence, it allows for more robust handling of discontinuities, such as cracks. While nonlocality facilitates describing material degradation and provides certain advantages for incorporating small-scale features into large-scale models [31, 32], it also adds a significant computational cost, due to the convolution integral involved, compared with local models.

Two types of numerical methods have been commonly used for the discretization of PD models. One popular method that offers much flexibility for arbitrary/unguided damage/fracture evolution is a meshfree method based on the one-point Gaussian quadrature of the integral operator [33, 34]. If the total number of nodes in the domain is N and the number of nodes inside the horizon of each point is M, the computational cost at each time step in an explicit algorithm will be O(NM). Note that in one-dimension, \( =\frac{\delta }{L}N \), where L is the length of the domain and δ is the horizon size (see Fig. 1). Therefore, for a fixed horizon size, M itself varies as O(N), and the computational cost is O(N2).

Fig. 1
figure 1

Nonlocal interactions of point x with its neighboring points \( \hat{\boldsymbol{x}} \) (in its horizon regionHx) in a schematic of a peridynamic body Ω

Finite element methods (FEM) have also been used to discretize PD models: in some of such models, each pairwise interaction (bond) is represented as a truss element [35, 36], while others use continuous or discontinuous Galerkin (DG) discretization methods, for example [37,38,39]. In all FEM-based discretizations of PD models, explicit solutions also cost O(N2) per time step. We note that regular FEM discretizations are not used for modeling of problems in which discontinuities appear due to the inherent difficulties of the method (see [37]). This is the main reason that only truss-based or DG methods have been used in PD models of failure/fracture, in addition to the most successful, meshfree discretization.

Coupling local models (discretized, e.g., with FEM) with PD models (discretized, e.g., with the meshfree method) has been seen as one way to increase the efficiency of simulations with PD models [40, 41]. These approaches are only beneficial when the region where nonlocality is helpful or dominates, covers only a small portion of the system modeled (e.g., small localized damage or crack growth). The advantage is lost in problems in which, for example, failure is affecting a large part of the domain [15, 19].

Note that in the methods mentioned above for discretizing nonlocal models, M increases exponentially with the problem’s number of spatial dimensions. Indeed, assume that the length scale of the domain is L and the grid spacing in each direction is Δx. If δ is the radius of the neighborhood (also called the “horizon size”, or simply “the horizon”), then N = \( {\left(\frac{L}{\Delta x}\right)}^d \) and \( M\propto {\left(\frac{\delta }{\Delta x}\right)}^d \) where d is the dimension of the problem. Computational cost per times step can then be expressed as \( \left[{\left(\frac{L}{\Delta x}\right)}^d\cdotp {\left(\frac{\delta }{\Delta x}\right)}^d\right] \).

In Fourier spectral methods, the solution is transformed to Fourier space (if the solution is assumed periodic), and the governing equations is reformulated based on the transformed solution. In the case of classical PDEs, spatial derivatives transform to multiplication operators, and the PDE reduces to a system of ODEs in Fourier space, which is far easier to solve [42]. For nonlocal models, Fourier transformation disentangles the convolution integral and reduces it to a multiplication in the spectral space. The only major cost in the spectral method is the Fourier transform itself, and its inverse. For this, the well-known fast Fourier transform (FFT) algorithms are available, at a cost of O(N log N) [42,43,44]. Not only is the cost of the Fourier spectral method significantly lower than the two other numerical methods used to discretize PD models, but the FFT is also easily parallelized, further increasing the potential advantages of this approach.

Although the spectral method seems to be a promising candidate for computing solutions to nonlocal problems, the assumption of periodicity limits its application. Most real-world problems are not periodic. A few recent studies have introduced Fourier spectral methods for periodic nonlocal models. For example, this method has been used for the nonlocal Allen-Cahn equation [45], nonlocal damage models [46], and peridynamic nonlocal operators for diffusion and wave propagation problems [47,48,49,50]. In all these cases, the problems considered were periodic. Spectral methods have also been used for the fractional-in-space reaction-diffusion equation in rectangular domains, where sine/cosine transforms were employed to impose homogeneous Dirichlet/Neumann boundary conditions [51]. Another method, while not spectral, uses the FFT to diagonalize the stiffness matrixes arising in FE and collocation discretization methods for nonlocal problems with non-periodic boundary conditions [52, 53]. Although the order of computation is N log N, the method is restricted to simple domain shapes like a square in 2D. The method is also dependent to the horizon shape. The authors of [52] state that the method is not applicable to domains with complex geometry, or to heterogeneous domains, and is challenging to use in 3D.

While the periodicity of the solution is inherent in Fourier spectral methods, there exist ways to overcome this limitation and apply them to general problems with complex domains and arbitrary boundary conditions [54,55,56]. Volume penalization is one such method.

Penalization methods have been used with the local Navier-Stokes PDE to introduce solid obstacles/boundaries in fluid flows, without changing the equations and discretization. A rigorous, simple volume-penalization method based on Brinkman model for flow in porous media [57] is developed by Angot et al. [58]. In [58], a large viscous term is added to the equation in the solid region to impose a Dirichlet (no-slip) boundary condition for the fluid-solid contact. Kevlahan and Ghidaglia [54] used this method with the Fourier spectral method in fluid dynamics problems. In these methods, the solution (velocity) is penalized by a substantially higher viscosity in the solid region to enforce a zero-velocity boundary condition. The method was applied for modeling flow over stationary or moving solid obstacles with complex geometries, inside periodic or confined fluid domains [59,60,61]. Volume penalization has also been used to enforce no-flux (Neumann-type) boundary conditions in advection-diffusion problems solved with the spectral method [62]. Another example for this efficient method is the 3D simulation of bumblebee flight in wind flow [63, 64].

In the present study, we introduce a spectral method to obtain efficient solutions to nonlocal equations of the peridynamic type for transient diffusion with arbitrary, non-periodic boundary conditions, using the volume-penalization technique. In Section 2, the PD formulation and boundary conditions implementation in PD problems are briefly discussed. Spectral methods and volume penalization for PD problems are introduced in Section 3. Stability analysis is provided in Section 4 and two examples with non-periodic BCs are solved in Section 5. Convergence studies are provided in Section 6.

2 Peridynamic Nonlocal Formulation

We start our development of spectral methods for peridynamic models with the PD diffusion equation in 1D. The methods described here are, however, applicable to other PD models, as well as to any other model with convolution integrals. Equation (1) is the general form of the PD diffusion equation in 1D [65]:

$$ \frac{\partial u\left(x,t\right)}{\partial t}=\nu {\mathcal{L}}_{\delta }u\left(x,t\right)+f\left(x,t\right) $$
(1)

where x is the position in the 1D domain Ω, u(x, t) is the unknown (the solution field) at point x and time t, ν is the diffusivity, \( {\mathcal{L}}_{\delta } \) is the PD Laplacian operator (see below), and f is a source term. For a fixed time t , the PD Laplacian can be expressed as:

$$ {\mathcal{L}}_{\delta }u(x)={\int}_{H_x}\mu \left(\hat{x}-x\right)\left[u\left(\hat{x}\right)-u(x)\right]\mathrm{d}\hat{x} $$
(2)

where μ(x) is a non-negative even function, called the kernel function that defines the nonlocal interactions in neighborhood of spatial points [65,66,67]. In this work, we take μ to be an integrable function with compact support. Since \( \mu \left(\hat{x}-x\right)=\mu \left(x-\hat{x}\right) \), we have:

$$ {\mathcal{L}}_{\delta }u(x)={\int}_{H_x}\mu \left(x-\hat{x}\right)u\left(\hat{x}\right)\mathrm{d}\hat{x}-u(x){\int}_{H_x}\mu \left(x-\hat{x}\right)\mathrm{d}\hat{x} $$
(3)

Assume μ(x) is defined over (−∞, +∞) , with μ = 0 outside of the horizon of x=0. With μ(x) being a given function, let \( \beta ={\int}_{-\infty}^{+\infty}\mu (x)\mathrm{d}x \). The PD Laplacian becomes [66]:

$$ {\mathcal{L}}_{\delta }u=\mu \ast u-\beta u $$
(4)

where (∗) denotes the convolution integral operation.

2.1 Peridynamic Boundary Conditions

In problems specified by classical local theories, constraints are in the form of boundary conditions imposed on the surfaces of the 3D domain. In nonlocal problems, constraints are in the form of specified values on regions outside of the domain, where they have nonlocal interactions with parts of the domain [68]. Therefore, in the nonlocal problems constrained-volume and volume-constraints are used instead of boundaries and boundary conditions, respectively [68]. Such description of course depends on the domain definition. For example, volume constraints may also be considered to be inside the domain. In this study however, the domain refers to the space where u(x, t) is not specified and is solved for. Nevertheless, in many practical applications of peridynamics, imposing local-type boundary conditions is desired, for practical reasons.

Local boundary conditions can be enforced on a peridynamic body (Ω), for example, via extending the domain by δ in the normal direction of the surface ∂Ω. Quantities on the constrained volume, which is the domain extension Γ, are specified such that the local boundary condition is effectively reproduced on ∂Ω [69,70,71,72]. Values on Γ are, in fact, volume constraints acting to enforce local boundary conditions. Figure 2 schematically shows the peridynamic body Ω, its boundary ∂Ω, and the constrained-volume Γ.

Fig. 2
figure 2

Schematic of a peridynamic domain (Ω), its boundary (∂Ω), and its constrained volume (Γ)

One way to impose volume constraints on Γ with minimal or no difference from imposing local boundary conditions on ∂Ω, is the scheme discussed in [69, 70], known as the “fictitious nodes method.” The terminology of this scheme refers to Γ as a “fictitious” region since it is not a part of the domain. Note that in 2D and 3D this method will not be exact except for the simplest geometries [70]. In this scheme, the volume constraints are implicit and time-dependent, i.e., values on Γ vary in time and are related to the values in the body Ω at that time. This type of implicit volume constraint can effectively impose a local BC on Ω. The enforcement of some local BCs using the fictitious region method for the one-dimensional case follows.

To enforce the local Dirichlet BC:

$$ {\left.u\left(\cdotp, t\right)\right|}_{\mathrm{\partial \Omega }}=u\left(\delta, t\right)={u}_b $$
(5)

with respect to the 1D configuration in Fig. 3, and a given ub, values on Γ should satisfy:

$$ {\left.u\left(\cdotp, t\right)\right|}_{\Gamma}={u}_{\Gamma}\left(x,t\right)=2{u}_b-u\left(2\delta -x,t\right) $$
(6)
Fig. 3
figure 3

Schematic for the fictitious domain (constrained volume Γ) and the peridynamic body Ω in 1D. Time-dependent values on Γ can be set to enforce some prescribed local boundary condition at x = δ

In order to apply the local Neumann BC:

$$ {\left.\frac{\partial u}{\partial x}\left(\cdotp, t\right)\right|}_{\mathrm{\partial \Omega }}=\frac{\partial u}{\partial x}\left(\delta, t\right)={q}_b, $$
(7)

given qb, values in the constrained region are set as:

$$ {\left.u\left(\cdotp, t\right)\right|}_{\Gamma}={u}_{\Gamma}\left(x,t\right)=-2{q}_b\left(\delta -x\right)+u\left(2\delta -x,t\right) $$
(8)

With this approach, similar to the Dirichlet BC, the Neumann BC is imposed by assigning value of u rather than the values of its derivative. Note that Eq. (8) is new and different from the approach given in [69] where a source term is added in order to reproduce the Neumann BC. This specific form of Eq. (8) will show advantages when the spectral method will be used (see Section 3.2 below).

3 Spectral Method for Peridynamics with Volume Penalization

3.1 Spectral Method

Let u(x,t) be a complex-valued function defined over the periodic domain x ∈ T=[0,2π] with 0 identified with 2π, and evolve in time t > 0. Then u(x, t) can be expressed with the infinite Fourier series in space:

(9)

where k is integer, \( \zeta =\sqrt{-1} \), and:

(10)

are the Fourier coefficients of u for different values of k. Equation (10) is also called the Fourier transform of u while Eq. (9) is the inverse Fourier transform relation.

Let the source term f(x, t) and the kernel function with the form below, be also complex-valued functions defined over the periodic domain Τ.

$$ \mu (x)=\left\{\begin{array}{c}\mathrm{even}\ \mathrm{function}\kern1.75em \left|x\right|\le \delta \\ {}0\kern7.75em \left|x\right|>\delta \end{array}\right. $$
(11)

Then, the PD diffusion equation over the periodic domain Τ is:

$$ \frac{\partial u}{\partial t}=\nu \left(\mu {\ast}_{\mathrm{T}}u-\beta u\right)+f $$
(12)

where (∗Τ) denotes the “circular convolution” integral (aka “cyclic” or “periodic convolution”) [73, 74]:

$$ \mu {\ast}_{\mathrm{T}}u={\int}_{\mathrm{T}}\mu \left(x-\hat{x}\right)u\left(\hat{x},t\right)\mathrm{d}\hat{x} $$
(13)

We approximate u(x,t) by the truncated (finite) Fourier series of u:

(14)

Based on the finite Fourier series approximation, two similar, but not necessarily identical, numerical schemes can be used for solving Eq. (12). One method is the Fourier-Galerkin method [75] in which the following weak form is solved:

$$ {\int}_0^{2\uppi}\left[\frac{\partial {u}^N}{\partial t}-\nu \left({\mu}^N{\ast}_{\mathrm{T}}{u}^N\right)+\nu \beta {u}^N-{f}^N\right]{e}^{-\zeta kx}\mathrm{d}x=0\kern1em \mathrm{for}\ \mathrm{each}\ k=-\frac{N}{2},\dots, \frac{N}{2}-1 $$
(15)

Here μN and fN are the finite Fourier series approximations for μ and f. The integration on each term in Eq. (15) is the Fourier transform of that term. Equation (15) is then equivalent to:

(16)

We observe that the circular convolution is transformed into a product operation of Fourier coefficients. In the Fourier-Galerkin method the ODE in Eq. (16) is solved for the Fourier coefficients of uN. The solution can be transformed to the physical space with the inverse relation given by Eq. (14).

Another approach is the Fourier Collocation method [75] which is the one we will use in the present study. This method focuses on the solution in the physical space. The approximated solution in Eq. (14) is represented by its values at grid points xi = iΔx, with \( \Delta x=\frac{2\pi }{N} \) and i ∈ {0, …, N − 1 }. In this method, uN(x, t) satisfies the strong form below at the collocation points xi:

$$ \frac{\partial {u}_i^N}{\partial t}-\nu \left({\mu}_i^N{\ast}_{\mathrm{T}}{u}_i^N\right)+\nu \beta {u}_i^N-{f}_i^N=0 $$
(17)

Since μ and u are approximated by finite Fourier series, the circular convolution can be evaluated by the inverse transform of the product of Fourier coefficients according to the convolution theorem [74]:

(18)

where \( {\mathcal{F}}^{-1} \) refers to the inverse Fourier transform operation.

For practical applications of this method, a discrete-level operation is required to compute the Fourier transform and its inverse. The obvious choice is the discrete Fourier transform (DFT) [75]:

$$ \tilde{u}_{k}(t)=\frac{1}{N}\sum \limits_{i=0}^{N-1}{u}^N\left({x}_i,t\right){e}^{-\zeta k{x}_i} $$
(19)

and its inverse relation (iDFT)

$$ {u}^N\left({x}_i,t\right)=\sum \limits_{k=-N/2}^{N/2-1}\tilde{u}_{k}(t){e}^{\zeta k{x}_i} $$
(20)

Note that \( \tilde{u}_{k} \) are approximations to the exact Fourier coefficients \( \tilde{u}_{k} \).

Employing DFT, the Fourier Galerkin method yields to:

$$ \frac{\mathrm{d}{\tilde{u}}_k}{\mathrm{d}t}-\nu \overset{\sim }{\left({\mu}^N{\ast}_{\mathrm{T}}{u}^N\right)}+\nu \beta \tilde{u}_{k}-\tilde{f}_{k}=0 $$
(21)

By the convolution theorem for DFT [73] we obtain:

$$ \frac{\mathrm{d}{\tilde{u}}_k}{\mathrm{d}t}=\nu {\overset{\sim }{\mu}}_k\tilde{u}_{k}\Delta x-\nu \beta \tilde{u}_{k}+\tilde{f}_{k} $$
(22)

Using DFT and iDFT for transformation, the Fourier Collocation method in Eq. (17) becomes:

$$ \frac{\partial {u}_i^N}{\partial t}=\nu {\mathbf{\mathcal{F}}}_{\boldsymbol{D}}^{-\mathbf{1}}\left({\overset{\sim }{\mu}}_k\tilde{u}_{k}\Delta x\right)-\nu \beta {u}_i^N+{f}_i^N $$
(23)

where \( {\mathbf{\mathcal{F}}}_{\boldsymbol{D}}^{-\mathbf{1}} \) denotes the inverse DFT. Let S denote the arc length of T (in our case S = 2π). If the periodic domain of computation is not [0, S), i.e., it does not start at the origin at its left end, for example if it is [\( -\frac{S}{2},\frac{S}{2} \)), then the kernel function may need to be shifted depending on the DFT solver (see Appendix 1).

The dominant computational cost in both methods is computing the DFT and its inverse, which are O(N log N) operations via FFT algorithms [43, 44]. This is a significant improvement over the O(N2) cost for the meshfree collocation with one-point Gaussian quadrature or the FE methods used for PD problems. The extension of the spectral method to higher dimension is straightforward.

The above scheme works only for problems with periodic boundary conditions. We propose a penalization scheme that will allow us to apply spectral methods to general PD models with non-periodic boundary conditions in the next section.

3.2 Volume Penalization

We employ the volume penalization (VP) technique developed for local problems in [54, 58], to impose arbitrary volume constraints in a general PD problem.

In this method, the one-dimensional domain Ω is extended by δ at both ends as the constrained volume (Γ) to apply the nonlocal boundary conditions. The idea in the VP scheme is to consider periodicity for this extended domain, i.e., Τ = Ω ∪ Γ, and penalize the solution in the constrained domain to maintain the desired constraint values (see Fig. 4).

Fig. 4
figure 4

Extension of 1D peridynamic non-periodic domain (Ω ∪ Γ) to the periodic domain Τ used in spectral method with volume penalization

The PD diffusion equation is extended by adding a penalization term, which is zero on Ω, but takes large values on Γ:

$$ \frac{\partial {u}_{\varepsilon}\left(x,t\right)}{\partial t}=\nu {\mathcal{L}}_{\delta }{u}_{\varepsilon}\left(x,t\right)+f\left(x,t\right)-\frac{\chi \left(x,t\right)}{\varepsilon}\left[{u}_{\varepsilon}\left(x,t\right)-{u}_{\Gamma}\left(x,t\right)\right] $$
(24)

In this equation ε is a small number called here the penalization factor, uε is the solution to the penalized PD diffusion equation, uΓ(x, t) is the volume constraint value at point x Γ and time t, and χ(x, t) is the following mask function:

$$ \chi \left(x,t\right)=\left\{\begin{array}{cc}1& x\in \Gamma \\ {}0& x\in \Omega \end{array}\right. $$
(25)

For sufficiently small ε, the penalization term dominates on Γ:

$$ \nu {\mathcal{L}}_{\delta }{u}_{\varepsilon}\left(x,t\right)+f\left(x,t\right)\ll \frac{1}{\varepsilon}\left[{u}_{\varepsilon}\left(x,t\right)-{u}_{\Gamma}\left(x,t\right)\right], $$
(26)

leading to:

$$ \frac{\partial {u}_{\varepsilon}\left(x,t\right)}{\partial t}\cong -\frac{1}{\varepsilon}\left[{u}_{\varepsilon}\left(x,t\right)-{u}_{\Gamma}\left(x,t\right)\right]\kern1.5em \mathrm{on}\kern0.5em x\in \Gamma . $$
(27)

Accordingly, this penalization term enforces an exponential decay for uε to uΓ over the constrained domain. This effectively enforces the desired local boundary condition on ∂Ω if uΓ(x, t) is assigned via the scheme described in Section 2. Discussion on convergence of uε to u as ε goes to zero is provided in Section 6.

To apply the spectral method, uε is approximated with the finite Fourier series \( {u}_{\varepsilon}^N \)on the periodic domain (Τ). To avoid complexity in notation, let \( y={u}_{\varepsilon}^N \). The spatially discretized version of Eq. (24) in 1D for using the boundary-adapted spectral method (BASM) is:

$$ \frac{\partial {y}_i^n}{\partial t}=\nu {\mathbf{\mathcal{F}}}_{\boldsymbol{D}}^{-\mathbf{1}}\left({\overset{\sim }{\mu}}_k\tilde{y}_{k}^n\Delta x\right)-\nu \beta {y}_i^n+{f}_i^n-\frac{\chi_i}{\varepsilon}\left({y}_i^n-{y}_{\Gamma, i}^n\right) $$
(28)

where the superscript n refers to nth time step. A convergence study with respect to the spatial discretization size is provided in Section 6.

Any applicable temporal integration scheme may be used to now solve the first-order ODE in Eq. (29), and update the solution at each time step. With the Forward Euler method, for example, we have:

$$ {y}_i^{n+1}\approx {y}_i^n+\Delta t\frac{d{y}_i^n}{dt} $$
(29)

where Δt is the time step. The stability restriction on the time step size for this explicit method is derived in the next section.

Note that although in this study the penalized region is taken to be identical to the constrained volume (Γ), it is possible to consider decoupling of the δ-thick volume constraint and the penalization domain, where Γ is a subdomain of the penalized region. Indeed, this would be necessary in the case of non-rectangular domains in higher dimensions. The decoupling seems also relevant if one wishes to study the behavior of solutions when δ approaches zero in the limit, or to study the influence of the size of the penalized region. However, for the sake of simplicity, we take the horizon size and penalization thickness to be identical in the present work.

4 Stability Analysis

Here we follow the stability analysis in [33] to find the restriction on time steps for the BASM with VP using the explicit Euler time integration scheme. It can be shown that Eq. (29) in the physical space is algebraically equivalent to:

$$ \frac{d{y}_i^n}{dt}=\nu \sum \limits_{j=0}^{N-1}{\mu}_{i-j}{y}_j^n\Delta x-\nu \beta {y}_i^n+{f}_i^n-\frac{\chi_i}{\varepsilon}\left({y}_i^n-{y}_{\Gamma, i}^n\right) $$
(30)

where μi − j = μ(xi − xj). Note that the term in the summation above is zero for all xj ∉ [xi − δ, xi + δ]. Although similar, the discretized volume integral in Eq. (30) is not identical to one-point Gaussian quadrature used in the meshfree method. Functions are approximated with the truncated Fourier series, which is not the case in the conventional meshfree method.

With Forward Euler (first-order explicit) temporal integration, Eq. (30) becomes:

$$ \frac{y_i^{n+1}-{y}_i^n}{\Delta t}=\nu \sum \limits_j{\mu}_{i-j}{y}_j^n\Delta \mathrm{x}-\nu \beta {y}_i^n+{f}_i^n-\frac{\chi_i}{\varepsilon}\left({y}_i^n-{y}_{\Gamma, i}^n\right) $$
(31)

Take:

$$ {y}_i^n={\lambda}^n{e}^{\zeta k{x}_i} $$
(32)

where λ is a complex number. Substituting Eq. (32) to Eq. (31), results in:

$$ \frac{\lambda^{n+1}-{\lambda}^n}{\Delta t}{e}^{\zeta k{x}_i}=\nu \sum \limits_j{\mu}_{i-j}{\lambda}^n{e}^{\zeta k{x}_j}\Delta x-\nu \beta {\lambda}^n{e}^{\zeta k{x}_i}+{f}_i^n-\frac{\chi_i}{\varepsilon}\left({\lambda}^n{e}^{\zeta k{x}_i}-{u}_{\Gamma, i}^n\right) $$
(33)

For simplicity, let \( {u}_{\Gamma, i}^n=0 \), \( {f}_i^n=0 \), and \( \rho =\frac{\lambda^{n+1}}{\lambda^n} \) for every i and n, then:

$$ \frac{\rho -1}{\Delta t}=\nu \sum \limits_j{\mu}_{i-j}{e}^{\zeta k\left({x}_j-{x}_i\right)}\Delta x-\nu \beta -\frac{\chi_i}{\varepsilon } $$
(34)

Since μi − j = μj − i, let p = j − i, and xp = xj − xi, we obtain:

$$ \frac{\rho -1}{\Delta t}=\nu \sum \limits_p{\mu}_p{e}^{\zeta k{x}_p}\Delta x-\nu \beta -\frac{\chi_i}{\varepsilon } $$
(35)

If \( m=\frac{\delta }{\Delta x} \) is integer, then, since μp = μp and xp =  − xp:

$$ \sum \limits_{p=-m}^{+m}{\mu}_p{e}^{\zeta k{x}_p}\Delta x=\sum \limits_{p=1}^m\left({\mu}_p{e}^{\zeta k{x}_p}\Delta x+{\mu}_{-p}{e}^{\zeta k{x}_{-p}}\Delta x\right)+{\mu}_0\Delta x=2\sum \limits_{p=0}^m{\mu}_p\cos \left(k{x}_p\right)\Delta x=\sum \limits_{p=-m}^m{\mu}_p\cos \left(k{x}_p\right)\Delta x $$
(36)

Substituting Eq. (39) into Eq. (38) results in:

$$ \frac{\rho -1}{\Delta t}=\nu \left(\sum \limits_{p=-m}^m{\mu}_p\cos \left(k{x}_p\right)\Delta x-\beta \right)-\frac{\chi_i}{\varepsilon } $$
(37)

Define M:

$$ M=\nu \left(\sum \limits_{p=-m}^m{\mu}_p\cos \left(k{x}_p\right)\Delta x-\beta \right) $$
(38)

Then:

$$ \rho =\left(M-\frac{\chi_i}{\varepsilon}\right)\Delta t+1 $$
(39)

To maintain stability, we seek Δt such that |ρ| ≤ 1. Therefore:

$$ \left|\left(M-\frac{\chi_i}{\varepsilon}\right)\Delta t+1\right|\le 1 $$
(40)

or,

$$ -1\le \left(M-\frac{\chi_i}{\varepsilon}\right)\Delta t+1\le 1 $$
(41)

or equivalently:

$$ 0\le \left(\frac{\chi_i}{\varepsilon }-M\right)\Delta t\le 2 $$
(42)

In order to satisfy the left inequality in Eq. (42), since χi is either 0 or 1, and that ε and Δt are positive quantities, we need M ≤ 0. According to Eq. (38), this imposes the following condition on μ(x):

$$ \sum \limits_{p=-m}^m{\upmu}_p\cos \left(k{x}_p\right)\Delta x\le \beta ={\int}_{-\delta}^{\delta}\mu (x)\mathrm{d}x $$
(43)

This condition holds for sufficiently small ∆x, since:

$$ {\int}_{-\delta}^{\delta}\mu (x)\cos (kx)\mathrm{d}x\le {\int}_{-\delta}^{\delta}\mu (x)\mathrm{d}x $$
(44)

Most kernel functions in use satisfy the requirement in Eq. (48).

The inequality in Eq. (44) also requires:

$$ \Delta t\le \frac{2}{\frac{\chi_i}{\varepsilon }-M} $$
(45)

From Eqs. (38) and (48):

$$ -M\le 2\nu \beta $$
(46)

According to Eqs. (45) and (46), and that χi is either 0 or 1, the following restriction on Δt for stable solution is suggested:

$$ \Delta t\le \frac{2}{\frac{1}{\varepsilon }+2\nu \beta}. $$
(47)

Even if the restriction above is obtained assuming zero values for uΓ and f, we find that it is also sufficient for obtaining stable results for the examples shown in Section 5, with nonzero uΓ and f.

From Eq. (47), we see that penalization puts a stronger restriction on the time step compared with the condition found with the conventional meshfree method [69]. However, the cost due to the increased number of time steps is likely to be overcome by the gains in the complexity order (in terms of node number) when computing the convolution integral with FFT. Note that the increased number time steps does affect the complexity order, since according to Eq. (47), the time step size does not depend on N.

We also note that, even though our method is purely explicit, we do not have the standard CFL stability constraint that appears in local problems; namely, Δtmax ∝ (Δx2/ν). Indeed, Δtmax depends on the size of the horizon size (implicitly through β), but does not depend at all on Δx (see also [33]). While this may seem surprising at first, as it allows for extremely high spatial resolutions to be stable with relatively low temporal resolutions (in contrast to local problems), in fact it is expected due to the convolution structure of the nonlocal equation. Namely, at a given spatial location x, the convolution integral incorporates all information within a ball of δ, which is then propagated forward in time. Thus, the expected CFL constraint for nonlocal problems depends on δ, which is essentially what we see in Eq. (47).

5 Example Problems and Discussion

We now compare the performance of the PD spectral method with the regular integration (one-point Gaussian quadrature) of the convolution integral in the PD Laplacian. Then, we analyze two one-dimensional nonlocal diffusion problems to demonstrate the capability of the BASM introduced. The first problem has local Dirichlet boundary conditions at both ends, while the second has local Neumann boundary conditions at both ends.

For these examples we need to select a kernel function μ(x). According to [76], one possible choice for the kernel function is of the form:

$$ \mu \left(\boldsymbol{x}\right)=\frac{\left(4-\alpha \right)\left(3-\alpha \right)}{\delta^{\left(3-\alpha \right)}}\left(1-\frac{\left|x\right|}{\delta}\right)\frac{1}{{\left|x\right|}^{\alpha }} $$
(48)

where α can take values 0, 1, and 2, for example (for details see [76]). For the case α = 0, we have:

$$ \mu (x)=\frac{12}{\delta^3}\left(1-\frac{\left|x\right|}{\delta}\right) $$
(49)

Chen and Bobaru [76] showed that a constructive approach to a peridynamic kernel leads to the choice of α = 2. Here, however, we choose α = 0 for simplicity and to avoid the singularity when calculating \( \beta ={\int}_{H_0}\mu (x)\mathrm{d}x \). For the case α = 0, this integral is \( \frac{12}{\delta^2} \). For the other values of α, β can be calculated using the Cauchy principal value [77].

5.1 Efficiency of the Peridynamic Spectral Method

Here we compute \( {\mathcal{L}}_{\delta }u \) for u = sin(πx) with δ = 0.2 in x ∈ [−1, 1] via two methods: the direct numerical integration using one-point Gaussian quadrature:

$$ {\left({\mathcal{L}}_{\delta }u\right)}_i=\sum \limits_{j=i-\mathrm{round}\left(\delta /\Delta x\right)}^{i+\mathrm{round}\left(\delta /\Delta x\right)}{\mu}_{i-j}{u}_j\Delta x-\beta $$
(50)

and the spectral method:

$$ {\left({\mathcal{L}}_{\delta }u\right)}_i={\mathbf{\mathcal{F}}}_{\boldsymbol{D}}^{-\mathbf{1}}\left({\overset{\sim }{\mu}}_k\tilde{u}_{k}\Delta x\right)-\beta $$
(51)

The kernel function μ is the one defined by Eq. (49), and therefore \( \beta =\frac{12}{\delta^2} \).

\( {\mathcal{L}}_{\delta }u \) is computed using both methods for several discretization sizes, with N varying between 28 to 220. Computations are performed using MATLAB 2018a on a Dell-Precision T7810 workstation PC, with twenty logical Intel(R) Xeon(R) CPU E5-2687 W v3 @3.10 GHz processors, and 64 GB of installed memory. The computational times for each method to calculate \( {\mathcal{L}}_{\delta }u \) for various discretization sizes are provided in Table 1.

Table 1 Comparison of run-times between the one-point Gaussian quadrature and the spectral method in calculating the peridynamic Laplacian

As observed, the time for one-point Gaussian quadrature is O(N2), while the spectral method performs even more efficient than O(N log N). The reason for the over-performance of the spectral method may be due to the efficient FFT solver in MATLAB, which uses optimized algorithms with respect to data size and structure.

5.2 Transient Diffusion with Dirichlet Boundary Conditions

We now solve an example of PD transient diffusion problem with local Dirichlet BCs (inhomogeneous), using the BASM, and compare the numerical solution with the analytical solution. Consider, for example:

$$ u\left(x,t\right)=\frac{2x}{L}+{e}^{-\nu t}\sin \left(\frac{2\pi x}{L}\right) $$
(52)

The function in Eq. (52) is the exact solution to the following nonlocal diffusion problem over the domain \( \Omega =\left[-\frac{L}{2},\frac{L}{2}\right] \):

$$ \frac{\partial u\left(x,t\right)}{\partial t}=\nu {\mathcal{L}}_{\delta }u\left(x,t\right)+f\left(x,t\right), $$
(53)

with

$$ f\left(x,t\right)=\nu \left\{\frac{6{L}^2}{\delta^4{\pi}^2}\left[\cos \left(\frac{2\pi \delta}{L}\right)-1\right]+\frac{12}{\delta^2}-1\right\}{e}^{-\nu t}\sin \left(\frac{2\pi x}{L}\right) $$
(54)

the initial condition:

$$ u\left(x,0\right)=\frac{2x}{L}+\sin \left(\frac{2\pi x}{L}\right) $$
(55)

and the local Dirichlet boundary conditions:

$$ u\left(-\frac{L}{2},t\right)=-1 $$
(56)
$$ u\left(\frac{L}{2},t\right)=1 $$
(57)

The manufactured solution u(x, t) in Eq. (52) has a special property: with the fictitious nodes scheme described in Section 2, the values of u in \( \left[-\frac{L}{2}-\delta, \kern0.5em -\frac{L}{2}\right) \) and \( \left(\frac{L}{2},\kern0.5em \frac{L}{2}+\delta \right] \), satisfy the volume constraint relationship in Eq. (6). This property then makes it easier to find the f(x, t) above. Without this property, one can still find f(x, t) analytically, but as a relatively more complex piecewise function.

To solve this problem with the proposed method, we select L = 2, ν = 0.2, δ = 0.2, and the total diffusion time tmax = 15. The computational domain is then extended to \( \mathrm{T}=\Omega \cup \Gamma :\left[-\frac{L}{2}-\delta, \frac{L}{2}+\delta \right)=\left[-2.2,2.2\right) \), with [−2.2, −2) and (2, 2.2) being the constrained domains Γ1 and Γ2 respectively. Note that the computational domain interval does not include x = 2.2 due to the periodicity of the spectral method that mandates x = 2.2 be identical to x =  − 2.2. Choosing the number of spatial nodes to be a power of two (N = 2P) has certain benefits in parallelization of FFT algorithms [44]. The extended domain [−2.2, 2.2) is discretized with N = 29 nodes. The time step and penalization factor are selected as Δt = 5 × 10−4 and =5 × 10−4, respectively. The algorithm for the implementation of the proposed method is provided in the Appendix 1, and the corresponding MATLAB code is provided in Online Resource 1. According to the fictitious nodes scheme described in Section 2, volume constraint values on Γ are calculated explicitly from Eqs. (58) and (59), using the solution on Ω at the previous time step. For \( x\in {\Gamma}_1:\left[-\frac{L}{2}-\delta, -\frac{L}{2}\right) \):

$$ {y}_{\varGamma 1}\left({x}_i,{t}^{n+1}\right)=2{u}_{b1}-y\left(2\delta -{x}_i,{t}^n\right), $$
(58)

where ub1 is the Dirichlet BC value given in Eq. (56), and y is \( {u}_{\varepsilon}^N \): the numerical solution using the BAS method with VP. For \( x\in {\Gamma}_2:\left(\frac{L}{2},\frac{L}{2}+\delta \right) \), the equation below applies the boundary condition:

$$ {y}_{\varGamma 2}\left({x}_i,{t}^{n+1}\right)=2{u}_{b2}-y\left(\ 2L+2\delta -{x}_i,{t}^n\right), $$
(59)

where ub2 is the BC value given in Eq. (57). Note that the volume constraints can be applied implicitly as well by replacing tn with tn + 1 in Eqs. (58) and (59), where one need to iterate until \( {y}_{\Gamma}^{n+1} \) converges.

Figure 5 shows the time snapshots of the nonlocal diffusion process. We observe the excellent match with the analytical nonlocal solution for this non-periodic problem.

Fig. 5
figure 5

Comparison between the analytical solution of a nonlocal 1D diffusion process, with non-periodic (Dirichlet) boundary conditions, and the solution obtained by the peridynamic spectral method with volume penalization

The absolute error distribution, normalized by the infinity norm of the initial data function (\( \frac{\left|u-{u}_{\varepsilon}^N\right|}{{\left\Vert {u}_0\right\Vert}_{\infty }} \)) is plotted in Fig. 6. We observe the rise and decay of the error in time, in the interior region of the domain Ω, while the error near the boundaries rises and approaches to permanent amount (see Video 1).

Fig. 6
figure 6

Time snapshots of the relative error in 1D nonlocal diffusion with non-periodic (Dirichlet) boundary conditions using the peridynamic spectral method with volume penalization. at = 5; bt = 15

The maximum relative error (\( \frac{{\left\Vert u-{u}_{\varepsilon}^N\right\Vert}_{\infty }}{{\left\Vert {u}_0\right\Vert}_{\infty }} \)) is plotted versus diffusion time in Fig. 7. The slope discontinuity in this plot can be understood by observing the behavior in Video 1: the location of the maximum relative error switches to the boundaries, as time progresses.

Fig. 7
figure 7

Variation of the maximum relative error in time for the 1D nonlocal diffusion example with non-periodic (Dirichlet) boundary conditions, using the peridynamic spectral method with volume penalization

This plot suggests that the observed error time-evolution consists of two periods: at first, the error in the domain interior dominates, while later the error near the boundaries becomes more important. Our parametric studies in Appendix 2 show that the decaying error on the interior originates from the spatial discretization and is reduced with grid refinement. The error near the boundaries, however, depends of the penalization factor and is reduced by selecting a smaller ε. Convergence studies for the total error in terms of discretization size and penalization parameter are given in Section 6.

While the main benefit of the BASM for PD is its low complexity compared with the alternative discretization methods of the nonlocal equations (the meshfree method or the FEM), wide availability of commercial multithreaded or GPU-enhanced FFT solvers allows us to further increase computational efficiency minimal additional coding effort. For example, with minimal modification of the code (see the Online Resource 1), we used MATLAB built-in FFT solver on a NVIDIA Quadro K2200 GPU to further accelerate computations for the problem described in this section, when the problem size is large. In Table 2 we show the computational time of the BASM with and without GPU, and also the time for the meshfree method.

Table 2 Comparison of run-times for the transient diffusion problem between the BASM (with and without GPU), and the meshfree method with Gaussian quadrature (GQ)

Note that due to the stricter stability criterion caused by the penalization, the BASM used 3 × 104 time steps to simulate the 15 s of diffusion in the example above, while the meshfree method used only 900 steps. Nevertheless, the BAS method shows orders of magnitude gains in efficiency compared with the one-point Gaussian quadrature.

For N = 216 or coarser spatial discretizations, GPU-based computations do not improve the run-time compared with the CPU-only case, which is expected due to the time consumed by data transfer onto the GPU. When the problem size is larger, however, minimal changes to a few lines of code lead to significant speed-up (see Table 2). Note also that MATLAB’s built-in fft function is multithreaded in 2D or higher dimensions, but not in 1D.

5.3 Transient diffusion with Neumann Boundary Conditions

To demonstrate the capability of the proposed method in solving PD problems with arbitrary boundary conditions, we now discuss an example with Neumann BCs. Consider the function:

$$ u\left(x,t\right)=\frac{2x}{L}+{e}^{-\nu t}\cos \left(\frac{2\pi x}{L}\right), $$
(60)

the exact solution for the nonlocal diffusion equation in Eq. (53) on the interval \( \left[\hbox{--} \frac{L}{2},\frac{L}{2}\right] \), with

$$ f\left(x,t\right)=\nu \left\{\frac{6{L}^2}{\delta^4{\pi}^2}\left[\cos \left(\frac{2\pi \delta}{L}\right)-1\right]+\frac{12}{\delta^2}-1\right\}{e}^{-\nu t}\cos \left(\frac{2\pi x}{L}\right), $$
(61)

initial condition

$$ u\left(x,0\right)=\frac{2x}{L}+\cos \left(\frac{2\pi x}{L}\right), $$
(62)

and local Neumann BCs:

$$ \frac{\partial u}{\partial x}\left(-\frac{L}{2},t\right)=1 $$
(63)
$$ \frac{\partial u}{\partial x}\left(\frac{L}{2},t\right)=1. $$
(64)

Similar to the previous example for Dirichlet BC, the manufactured solution in Eq. (60) satisfies the volume constraint relationship in Eq. (8) when x ∈ Γ1 or Γ2.

For this problem, L, δ, ν, and tmax, are the same as in the previous example in Section 5.1. We use the explicit implementation of the fictitious nodes scheme for applying the volume constraints corresponding to Neumann BC (see Eq. (8)). For \( x\in {\Gamma}_1:\left[-\frac{L}{2}-\delta, -\frac{L}{2}\right) \) we get:

$$ {y}_{\varGamma 1}\left({x}_i,{t}^{n+1}\right)=-2{q}_{b1}\left(\delta -{x}_i\right)+y\left(2\delta -{x}_i,{t}^n\right), $$
(65)

while for \( x\in {\Gamma}_2:\left(\frac{L}{2},\frac{L}{2}+\delta \right) \), we have:

$$ {y}_{\varGamma 2}\left({x}_i,{t}^{n+1}\right)=-2{q}_{b2}+y\left(\ 2L+2\delta -{x}_i,{t}^n\right) $$
(66)

Values for both qb1and qb2 are 1 according to Eqs. (63) and (64). For the numerical solution, N, Δt, and ε are the same as in the previous example.

Figure 8 shows the evolution in time of the numerical solution y in comparison with the exact nonlocal solution u. The results support the fact that the BAS method is capable of solving peridynamic problems with arbitrary boundary conditions.

Fig. 8
figure 8

Comparison between the analytical solution of a nonlocal 1D diffusion process, with non-periodic Neumann boundary conditions, and the solution obtained by the peridynamic spectral method with volume penalization

As mentioned in the introduction section, volume penalization is only one way to use Fourier spectral methods on irregular domains with arbitrary boundary conditions. Alternative BAS methods for peridynamics can be constructed, if one employs other boundary adapting schemes such as the smoothed boundary method [55, 56].

6 Convergence

In this section we first provide a brief background on error estimates for the volume penalization method, and then present convergence studies with respect to the penalization and spatial discretization for the example problem shown in Section 5.2.

Angot et al. [58] proved that the solution of Navier-Stokes equation with the volume penalization in a periodic domain converges to the solution of Navier-Stokes equation with the proper exact boundary conditions, as ε goes to zero. The error in the main domain for that case is shown to be at most of the O(ε3/4). In the case of the classical diffusion equation, Kevlahan and Ghidaglia [54] showed for a specific problem that the error between the penalized periodic solution and the exact solution to the diffusion equation with non-periodic boundary conditions is at most O(ε1/2). They observed that the computed error is O(ε).

While a rigorous mathematical convergence analysis and error estimate for nonlocal diffusion equation with penalization and spectral method would be ideal, in this study we only provide some numerical results. The complete theoretical analysis is left for the future. We perform convergence studies on the example with two Dirichlet BCs discussed in Section 5.2.

First we study the convergence of the penalized periodic solution \( {u}_{\varepsilon}^N \) (the solution to Eq. (24)), to the exact solution (Eq. (52)) of the un-penalized diffusion equation with Dirichlet BC. To this aim, we need to choose a relatively large N, and relatively small time step and keep them fixed while decreasing ε in each test. This makes the discretization and temporal integration errors minor compared with the penalization error which we want to investigate. We need to also choose a time span to approach the steady state where according to the observations in Figs. 6 and 7 permanent penalization error is dominated and remains relatively constant. The selected parameters for this convergence study are N = 215, Δt = 1.97 × 10−4, and tmax = 30, while ε−1 value varies for each test. Δt satisfies Eq. (47) restriction with the smallest penalization factor used in this convergence study (ε = 1 × 10−4). Figure 9 shows the relative error versus ε−1 for each test.

Fig. 9
figure 9

Convergence study in terms of penalization factor for the peridynamic spectral method with volume penalization on the problem with Dirichlet boundary conditions shown in Section 5.2

The results show that the penalization error varies with O(ε), which is consistent with observations for the penalized classical diffusion equation [59].

To observe the convergence behavior with respect to spatial discretization size, we compare the maximum error in the whole time span for various N values, while keeping constant the relatively small values of Δt and ε. To this aim, we obtained the error \( \underset{0<t<{t}_{\mathrm{max}}}{\max}\frac{{\left\Vert u-{u}_{\varepsilon}^N\right\Vert}_{\infty }}{{\left\Vert {u}_0\right\Vert}_{\infty }} \), with respect to different N values in five tests with ε = 5 × 10−6, and Δt = 9.99 × 10−6. Again, Δt satisfies the stability condition given in Eq. (47). Results are plotted in Fig. 10.

Fig. 10
figure 10

Convergence study with respect to the spatial discretization size for the spectral method with volume penalization on the problem with Dirichlet boundary conditions shown in Section 5.2

As observed, the spatial convergence rate of peridynamic BASM is Ox2) for this example problem. This is similar to meshfree-collocation method with one-point Gaussian quadrature [33].

Note that the all the comparisons of the solutions with exact solution for obtaining errors are considered within the domain of interest Ω = T\Γ which disregards the solution values on the penalized region Γ.

The general error of the peridynamic BASM is bounded by the summation of the penalization error, spatial discretization errors (finite Fourier series approximation and DFT), and the explicit time integration error which for Forward Euler is known to be Ot).

For the presented example with two Dirichlet BCs, the error of the introduced method appears to be bounded by O(ε) + Ox2) + Ot).

7 Conclusions

In this study, we introduced a boundary-adapted spectral method (BASM) for peridynamic (PD) transient diffusion problems with arbitrary boundary conditions. The spectral approach transforms the convolution integral into a multiplication in the Fourier space, resulting in computations that scale as O(N log N). We demonstrated the efficiency of this method by comparing it with the commonly used one-point Gaussian quadrature method for spatial integration in a peridynamic model. In 1D, a transient diffusion problem with roughly sixteen million nodes is solved in a few hours with the spectral method whereas the one-point Gaussian quadrature approach would require over 12 years (!) to complete. We also showed that using MATLAB’s built-in FFT solver on GPU (by performing minimal changes to the code) produces significant speed-ups for the larger scale problems. The source code for this example was provided in Online Resource 1.

A stability analysis for the peridynamic BASM (with the volume-penalization approach) with Forward-Euler time integration for peridynamic transient diffusion problems suggested that the restriction on the time-step varies linearly with the penalization factor, for a sufficiently large one. We examined the performance of the method introduced for arbitrary boundary conditions with two examples of peridynamic transient diffusion using local Dirichlet and Neumann boundary conditions. We compared our numerical results against exact nonlocal solutions, constructed using the method of manufactured solutions. Our convergence studies show that the error scales linearly with the penalization factor and quadratically with the discretization size. The method can be easily extended to other peridynamic/nonlocal models, in 1D and in higher dimensions.