703
Views
1
CrossRef citations to date
0
Altmetric
Research Article

A time-spectral method for initial-value problems using a novel spatial subdomain scheme

ORCID Icon & ORCID Icon | (Reviewing editor)
Article: 1529280 | Received 22 Mar 2018, Accepted 17 Sep 2018, Published online: 29 Oct 2018

Abstract

We analyse a novel subdomain scheme for time-spectral solution of initial-value partial differential equations. In numerical modelling spectral methods are commonplace for spatially dependent systems, whereas finite difference schemes are typically applied for the temporal domain. The Generalized Weighted Residual Method (GWRM) is a fully spectral method that spectrally decomposes all specified domains, including the temporal domain, using multivariate Chebyshev polynomials. The Common Boundary-Condition method (CBC) here proposed is a spatial subdomain scheme for the GWRM. It solves the physical equations independently from the global connection of subdomains in order to reduce the total number of modes. Thus, it is a condensation procedure in the spatial domain that allows for a simultaneous global temporal solution. It is here evaluated against the finite difference methods of Crank-Nicolson and Lax-Wendroff for two example linear PDEs. The CBC-GWRM is also applied to the linearised ideal magnetohydrodynamic (MHD) equations for a screw pinch equilibrium. The growth rate of the most unstable mode was efficiently computed with an error <0.1%.

PUBLIC INTEREST STATEMENT

A new subdomain scheme for a recently developed time-spectral method (GWRM) is presented and compared with the original global subdomain scheme of the GWRM as well as with two finite difference methods, namely those of Crank-Nicolson and Lax-Wendroff. The new subdomain scheme, named the Common-Boundary-Condition (CBC) scheme, seeks to separate the computations of the physical equations of each subdomain and those involving internal and external boundary conditions. This is done in order to decrease the total number of modes that need to be solved globally. Furthermore, time-parallelization of the physical equations of each subdomain is shown to be possible. We believe the results are of significance in numerical modelling due to the large matrix systems often associated with spectral methods. The CBC-scheme is presented as a potential remedy.

1. Introduction

In the field of fusion plasma physics it is often necessary to solve complex sets of linear PDEs. A particular example is the sub-discipline devoted to the analysis of linearised magnetohydrodynamic equilibria and the evolution of unstable modes (Bateman, Schneider, & Grossmann, Citation1974; Cao & Cai, Citation2018; Furth, Killeen, & Rosenbluth, Citation1963; Glasser, Greene, & Johnson, Citation1976; Scheffel, Citation2011; Strauss, Citation1976; Yang et al., Citation2018). The analysis consists of linearising the governing magnetohydrodynamic equations, assuming an equilibrium, introducing a perturbation, and then calculating the mode growth rate. The existence of multiple time scales requires many time steps to resolve. It would be beneficial to average over small scale dynamics efficiently in order to obtain the dominant unstable mode.

The efforts of increasing the efficiency and accuracy of time dependent numerical schemes are long standing. A natural step to take is classically provided by the method of lines (Heath, Citation2005; Schiesser, Citation1991). For a more recent application to controllability analysis, see for example (Respondek, Citation2010). Here a finite difference approximation is often used for the spatial domain, whereas an ODE models the continuous temporal dependence along each fixed line (or surface) in the spatial domain. The spatial discretization can also be done by a finite element or spectral approach, in which case the time-dependent coefficients of the approximate solution expansion in spatial basis functions are found from solving a set of ODEs. The systems of ODEs associated with these methods are often stiff, thus there is motivation for exploring different approaches for solving the PDEs. Authors such as (Morchoisne, Citation1979), (Peyret & Taylor, Citation1983), (Tal-Ezer, Citation1986, Citation1989), and (Bar-Yoseph, Moses, Zrahia, & Yarin, Citation1995), to name a few, have pioneered the concept of time-spectral methods. A number of pseudo-spectral methods with polynomial basis functions such as Fourier, Legendre, and Chebyshev polynomials, with their respective advantages have been analyzed by the various authors. In the works by (Dutt, Citation1990) and (Maerschalck & Gerritsma, Citation2005) a space-time Chebyshev collocation method was implemented to solve initial value problems in a least-squared sense.

Following this trajectory we see that space-time spectral methods have seen multiple variations and a host of interesting applications. In the articles of (Fakhar-Izadi & Dehghan, Citation2014, Citation2018) a space-time method was applied to partial integro-differential equations on irregular domains. The basis functions used were Legendre polynomials in both space and time. It was shown that the space-time spectral method exhibited exponential convergence and high accuracy results. These results were not only found for the smooth solutions, but also for non-smooth solutions.

Another venue of space-time spectral methods can be seen in the field of fractional derivatives. In (Hanert & Piret, Citation2014) a Chebyshev pseudospectral method was developed and implemented on anomalous transport models, specifically relying on fractional-order derivatives in order to describe transport properties more effectively. In the article both space and time terms were represented by Chebyshev polynomials. The conclusion was that pseudospectral methods, due to being global methods (convergence and accuracy aside), are more apt to handle fractional differential equations because here the global behaviour is necessarily included.

Most, if not all, spectral methods mentioned have in one way or another sought to discretize the spatial and temporal domains at the nodes of the basis functions. This is done in order to approximate integrals with some form of Gaussian quadrature. The consequence being that one needs to transform back and forth between physical and spectral space multiple times. The time-spectral method proposed here, with its many similarities with other spectral methods, is distinguished in that it seeks to limit all computations to the spectral space.

The time-spectral method GWRM (Generalized Weighted Residual Method) proposed in (Scheffel, Citation2012) is a fully spectral method that spectrally decomposes all domains including spatial, temporal, and parameter domains. Multivariate Chebyshev polynomials are used to represent all domains in a solution ansatz. The GWRM executes all computations in spectral space, that is no collocation points are used. The only spatial points that are taken into consideration are the points where the spatial subdomains overlap. The spatial subdomains overlap in order to maintain two-point contact. It has been shown (Scheffel & Mirza, Citation2012) that for a system of PDEs with spatial derivatives of order S, employing v variables (equations), the minimum number of interboundary contact points need to be at least P=S/v in order to transfer external boundary value information properly across the spatial domain. Taking the 1D Burger equation as an example, where S=2 and v=1, P should be at least 2. This subdomain method ensures spectral accuracy in the entire domain. Unfortunately, the resulting global matrix equations associated with solving the algebraic equations may become excessively large (Boyd, Citation2000; Canuto, Hussaini, Quarteroni, & Tang, Citation2006; Kopriva, Citation2009).

There are several popular methods for dealing with this issue. One such method is to use parallel algorithms that solve for large sparse matrices (Mittal & Al-Kurdi, Citation2002; Spagnoli, Humphrey, Price, & Kelmelis, Citation2011), and another is to create independent spatial domains that can be solved locally with boundary-solvers that connect the subdomains (Canuto et al., Citation2006; Giraldo & Restelli, Citation2007; Kopriva, Citation2009; Peraire & Persson, Citation2010; Scheffel & Mirza, Citation2012). The idea of reducing the global degrees of freedom was first implemented with the static condensation method (Guyan, Citation1964), and thereafter has seen many variations that make the algorithm more general and dynamic (Qu, Citation2004).

This brings us to the current spatial subdomain scheme, termed the Common Boundary-Condition (CBC) Method. For each iteration towards the solution this method solves the physical equations locally and separately, that is in each subdomain, but the boundary and patching conditions that connect the subdomains are solved globally. By calculating the relationship between the local physical equations (secondary degrees of freedom) and the external boundary conditions (primary degrees of freedom), the overall degrees of freedom can be substantially reduced. Combined with the time-spectral method, the CBC subdomain scheme takes into account the temporal modes, and adjusts the boundary and patching conditions throughout the entire temporal domain.

The paper is organized as follows. Section 2 briefly summarizes the time-spectral GWRM. The new spatial subdomain scheme that has been implemented is also laid out. Next follows a solution of test problems in section 3. The test problems include the linearised 1D Burger equation, a forced wave equation and a case relating to the linearised ideal MHD equations. Section 4 contains a discussion, including some observations, possible objections, and resolutions. The paper closes with a conclusion.

3. Method

We will here present a brief review of the GWRM. For a full and detailed presentation the reader is directed to (Scheffel, Citation2012).

3.1. Weighted residual formulation

We wish to solve a set of partial differential equations,

(1) ut=Du+f.(1)

where D is an arbitrary linear or non-linear operator and f(t,x;p) is a known forcing term. The solution to equation (1) is approximated with multivariate Chebyshev expansion series in time, space, and parameter space. For a single spatial dimension and one parameter we have

(2) u(t,x;p) U(τ,ξ;P)=k=0Kl=0Lm=0MaklmTk(τ)Tl(ξ)Tm(P).(2)

Here () denotes that the first term in each summation is divided by two. Since Chebyshev polynomials are defined in the range [1,1], a change of variables is performed; σ=(zAz)/Bz, Az=(z1+z0)/2, and Bz=(z1z0)/2. Here σ signifies either of the transformed variables, thus τ, ξ, or P, and z is the physical variable, with indices 0 and 1 denoting domain limits.

A weighted residual formulation is obtained by substituting (2) into (1), multiplying the residual with weight functions, and integrating over the entire domain;

(3) p0p1x0x1t0t1RTq(τ)Tr(ξ)Ts(P)wtwxwpdtdxdp=0.(3)

The residual has the form

(4) R=u(t,x;p)[u(t0,x;p)+t0t(Du+f)dt],(4)

with the weight function

(5) wz=(1σ2)1/2.(5)

Equation (1) hereby is transformed into the following set of algebraic equations for the coefficients of the solution ansatz (2):

(6) aqrs=2δq0brs+Aqrs+Fqrs(6)

Here brs are the coefficients of the Chebyshev polynomial approximation of the initial condition. The linear/non-linear operator term Aqrs and the force term Fqrs are functions of aqrs. Boundary equations take the place of the highermost spatial modes of aqrs after inserting Eq. (2) into the given external boundary conditions; internal boundary conditions are produced by coupling the spatial subdomains. In the GWRM equation (6) plus boundary condition equations are solved with a semi-implicit root solver (SIR) (Scheffel & Håkansson, Citation2009). This may entail solving a global matrix equation for all the (K+1)(L+1)(M+1) coefficients. The number of numerical operations, and the CPU time, would then scale as ((K+1)(L+1)(M+1))3 and the memory requirements as ((K+1)(L+1)(M+1))2. From a viewpoint of efficiency, these scalings become problematic for advanced problems.

3.2. Subdomain scheme

Subdomains, both in space and time, have the potential to remedy the efficiency problem. Concentrating here on the spatial dimension, it may be noted that a mere division of the spatial domain into subdomains does not have a radical influence on efficiency. Clearly, the possibility to adjust the subdomain length according to the physical terrain would optimize the solution procedure, but essentially the same global number of coefficient equations would need to be solved simultaneously. The Common Boundary-Condition method (CBC-GWRM) described in the following does, however, reduce the number of simultaneous global equations to be solved. The entire computational domain D=(t,x):[0,T],[0,L] is discretized into s overlapping spatial elements, see Figure . For example s=3 would give a discretized domain Ω=Ω1=[0,x1+ε],Ω2=[x1ε,x2+ε],Ω3=[x2ε,L], where ε is a small overlapping distance. This procedure allows us to use only a few Chebyshev modes in our ansatz for each subdomain. By overlapping the subdomains, point-wise and gradient continuity is ensured.

Figure 1. GWRM subdomains with overlapping region, distance exaggerated (red dots), Chebyshev roots xk=cos((2k1)π/2K),k=1K (blue dots), and the subdomain boundaries (solid black lines).

Figure 1. GWRM subdomains with overlapping region, distance exaggerated (red dots), Chebyshev roots xk=cos((2k−1)π/2K),k=1…K (blue dots), and the subdomain boundaries (solid black lines).

The system of equations we wish to solve now include Ns spatial subdomains, Ne number of physical equations, K temporal modes, and L spatial modes (we here let M=0). This results in N=NsNe(K+1)(L+1) equations to be solved for the coefficients of the ansatz (2). A question arises: can the global amount of equations be reduced in some way?

Equations (6) can be written in fixed point form formally as xs=Φs, where s refers to the respective subdomain; for details see (Scheffel, Citation2012). We now note that only the subset xBCs=ΦBCs representing the boundary equations need to be solved globally. The reason for this is that the physics equations (6) in each individual subdomain xPs=ΦPs, representing the systems of PDEs, are only dependent on xBCs. These “private” equations can be solved locally in each spatial subdomain in each iteration level. This process can be fully parallellized. Furthermore, we have the dependence xBCs=ΦBCs(s1,s,s+1), depicted graphically in Figure . Thus the internal boundary condition equations only contain Chebyshev coefficients (variables) of the immediately neighbouring spatial subdomains.

Figure 2. CBC subdomain schematic with algebraic equations indicated. The private variables (index “p”) are explicitly dependent on the boundary variables (index “BC”) of the given subdomain and implicitly on those of the neighbouring subdomains.

Figure 2. CBC subdomain schematic with algebraic equations indicated. The private variables (index “p”) are explicitly dependent on the boundary variables (index “BC”) of the given subdomain and implicitly on those of the neighbouring subdomains.

A numerical example may be elucidating. Let us assume that a system of five PDEs, representing second order in space, is solved in 1D. Employing K=9 and 10 spatial subdomains with L=9, a total of 5000 global equations result for the Chebyshev coefficients of Eq. (2). The CBC-GWRM algorithm reduces these to 1000. For 2D and 3D problems the reduction is even more profound.

The set of private equations xPs=ΦPs is efficiently solved in parallel. Both these and the global equations xBCs=ΦBCs are solved by SIR (Citation2009). SIR solves the algebraic set of equations by iterating the following equation,

(7) xBCi+1=[I+(RiI)(JBCi)1](xBCiφBCi)+φBCi  ΦBCi(xBCi),(7)

where φ denotes the right hand side of Eq. (6) plus the boundary equations. The matrix R with elements Rmn=Φm/xn controls convergence in SIR and I is the identity matrix. It should be noted that Eq. (7) is a formal representation; for efficiency matrix inversion is generally avoided and a matrix equation is solved instead. Thus the Jacobian JBCi needs to be computed,

(8) JBCpq=(xBCφBC)pxBCq=δpqTpq,(8)

where δpq is the Kronecker delta and Tpq includes the explicit and implicit derivatives;

(9) Tpq=φBCpxBCq+ν=s1ν=s+1i=1NeNpφBCpxPiνxPiνxBCqν.(9)

The indices p and q refer to common BC variables and the index i refers to the Np private variables. The first term is the explicit derivative. The second term shows that the common BC variables are indirectly dependent on the private variables in the neighbouring subdomains, hence the implicit derivatives. The index ν is introduced in the sum to neglect subdomains that are not directly influencing the current common BC variables.

The xP/xBC coefficients in the sum require some attention. The first step is to create a vector of all private equations fi=ziφi(z), i=1NeNp, where z and φ(z) only contain the private variables and equations from x and φ(x). Since the private z variables possess an implicit dependence on the common BC variables, the partial derivatives can be computed and saved in the matrix Fij=fi/zj, i=1NeNp and j=1NeNBC. The implicit derivatives in Fij are evaluated with current private values from the current scheme iteration and the xPi/xBCj variables are obtained by solving the linear algebraic system of equations Fij.

An alternative method for obtaining the Δ=xP/xBC coefficients in Eq. (9) is to approximate the derivative numerically with forward difference xP/xBC[xP(xBC+ϵ)xP(xBC)]/ϵ. The set of private equations numbering (L1)(K+1) have to be solved for every BC variable, that is 2NsNe(K+1) times. The amount of operations can be further reduced since the calculated Jacobian from the regular solution xP(xBC) can be used for the perturbed solution xP(xBC+ϵ) as well.

Another interesting development, with regards to the Δ coefficients in (9), is that if the set of ODEs or PDEs are linear, then the Δ coefficients are equal in all subdomains s between 1<s<Ns. Also, if the boundary conditions are the same on both sides of the computational domain, then only the first and second subdomain, for corresponding Δ coefficients, need be solved.

A work flow of the Common Boundary Condition subdomain scheme, employing the latter numerical scheme for the Jacobian, applied to the 1D case, omitting physical parameter dependence, is given in the box below.

4. Test problems

We have chosen to solve the linearised Burger equation, a forced linear wave equation, and a problem modelled with the linearised ideal MHD equations. Non-linear problems will be addressed in a forthcoming paper. All CBC-GWRM simulations are carried out on one global temporal interval, that is we here omit the use of time intervals. Also, since the following equations are linear with no-flow boundary conditions, the implicit derivatives are only calculated for the first and second subdomains.

4.1. Linearised 1D burger equation

The performance of the CBC-GWRM with regards to accuracy is here compared to that of the explicit Lax-Wendroff method, the implicit Crank-Nicolson method, and the “standard” GWRM with a global spatial subdomain scheme. The purpose of employing the Crank-Nicolson and Lax-Wendroff methods is to include two well known implicit and explicit finite difference methods that require little justification. The performance of other, more or less sophisticated, finite difference methods can easily be compared to these methods.

The parameters that determine the accuracy and efficiency of the GWRM are the order of temporal Chebyshev modes K, spatial Chebyshev modes L, and the number of spatial subdomains Ns. Similarly, the grid values determine the performance of the FD methods, namely M temporal steps and N spatial steps. The CPU time and memory consumption of all the methods are documented throughout.

The linearised 1D Burger equation is stated as follows:

(10) ut+bux=κ2ux2.(10)

where κ and b are constants. The initial condition and boundary conditions chosen here are

(11) u(0,x)=sin(πx)ebx/2κ,(11)
(12) u(t,0)=u(t,1)=0.(12)

This enables an exact solution that can be used for accurate benchmarking (see Figure -) for an example),

(13) u(t,x)=sin(πx)ebx/2κ(b2/4κ+κπ2)t(13)

Figure 3. CBC-GWRM solution and error with κ=0.01 and b=0.06; K=7, L=6 and Ns=7.

Figure 3. CBC-GWRM solution and error with κ=0.01 and b=0.06; K=7, L=6 and Ns=7.

The CPU time and memory consumption of the CBC-GWRM have been compared with two finite difference methods; the explicit Lax-Wendroff and the implicit Crank-Nicolson methods. For a minimum accuracy of ε103 the CBC-GWRM features a CPU runtime of 0.16 s and a memory consumption of 20Megabytes (MB), using a Maple implementation on a desktop PC. This was achieved with the parameters Ns=2, K=4, and L=5. The Lax-Wendroff method with M=340 time steps and N=45 spatial steps featured a runtime of 0.94 s and memory 54MB. The Crank-Nicolson method required 0.09 s and 20MB with parameters M=60 and N=80. Thus we see that for moderate accuracies the C-N method is approximately two times faster than CBC-GWRM and 10 times faster than L-W, all methods requiring comparable memory consumption.

However, when the accuracy is increased to ε105, the CBC-GWRM with Ns=3, K=6, and L=6 features a CPU time of 0.50 s and memory of 22MB. The C-N method gave a CPU time of 0.77 s and memory of 43MB for M=120 and N=400, whilst the L-W method was unable to reach a comparable accuracy. Thus the CBC-GWRM is here faster and more memory efficient for higher accuracies than both FD-methods. With the same parameters and accuracy ε105 the standard GWRM (without the CBC-scheme) achieves a CPU time t=0.27 s and memory 23MB. We show in Discussion, however, that the CPU time of the GWRM using the CBC scheme is strongly advantageous when a large number of spatial subdomains is employed.

The three methods have been analysed with optimal parameters so as to obtain the best accuracy for a given computational time. The data is displayed in Figure , thus showing how all three methods scale in this regard. A simple curve-fit of the data shows that the L-W method scales as εLW  tCPU0.6, and the C-N method scales slightly better at εCN  tCPU0.9. The spectral convergence properties of the CBC-GWRM allows a much stronger scaling than the FD methods; εGWRM  tCPU3.5. It is also found that the CPU time scales linearly as tCPU  Ns1.1 with regards to the number of subdomains used, see Figure ), in Discussion. This feature of the CBC-GWRM becomes advantageous when modelling physical systems that require high local spatial accuracy.

Figure 4. Error plot vs CPU time [s].

Figure 4. Error plot vs CPU time [s].

Figure 5. Temporal plot for interval [0,80] at x=0.2 showing how the CBC-GWRM (blue line) resolves the slower time scale of the exact solution (red line). The parameters used are Ns=4, K=14, and L=5.

Figure 5. Temporal plot for interval [0,80] at x=0.2 showing how the CBC-GWRM (blue line) resolves the slower time scale of the exact solution (red line). The parameters used are Ns=4, K=14, and L=5.

Figure 6. Comparison between the standard (global) GWRM and the CBC-scheme with analytical derivatives for the wave equation. (a) The subdomain scaling and (b) memory consumption is plotted for parameters A=10, n=3, T=30, α=2π/T, β=3π and c=1 with time interval t[0,30].

Figure 6. Comparison between the standard (global) GWRM and the CBC-scheme with analytical derivatives for the wave equation. (a) The subdomain scaling and (b) memory consumption is plotted for parameters A=10, n=3, T=30, α=2π/T, β=3π and c=1 with time interval t∈[0,30].

Figure 7. Perturbed screw-pinch, CBC-GWRM K=7, L=5 and Ns=3.

Figure 7. Perturbed screw-pinch, CBC-GWRM K=7, L=5 and Ns=3.

Figure 8. Eigenfunction ξ(r) of perturbation m=1, k=5. CBC-GWRM (line) mode growth rate ωCBC=0.839, K=7, L=5 and Ns=3; Bateman ωB=0.840 (point-line).

Figure 8. Eigenfunction ξ(r) of perturbation m=1, k=5. CBC-GWRM (line) mode growth rate ωCBC=0.839, K=7, L=5 and Ns=3; Bateman ωB=0.840 (point-line).

Figure 9. Total CPU time [s] vs number of subdomains for solving all corresponding algebraic equations (see Eq. (6)) for 1D linearised Burger computation; CBC-GWRM (blue) and standard GWRM (red), with the same parameters K=5 and L=5.

Figure 9. Total CPU time [s] vs number of subdomains for solving all corresponding algebraic equations (see Eq. (6)) for 1D linearised Burger computation; CBC-GWRM (blue) and standard GWRM (red), with the same parameters K=5 and L=5.

Figure 10. CPU time [s] with increasing subdomains for a 1D linearised Burger computation; GWRM parameters K=5 and L=5.

Figure 10. CPU time [s] with increasing subdomains for a 1D linearised Burger computation; GWRM parameters K=5 and L=5.

Figure 11. (a) CPU time [s] and (b) Memory consumption [MB] with increasing subdomains for 1D linearised Burger computation; CBC-GWRM (blue), Reduced CBC-GWRM (purple), standard GWRM (red), and an approximated parallelized time that follows Amdahl’s law for Reduced CBC-GWRM (green). All methods use parameters K=5 and L=5.

Figure 11. (a) CPU time [s] and (b) Memory consumption [MB] with increasing subdomains for 1D linearised Burger computation; CBC-GWRM (blue), Reduced CBC-GWRM (purple), standard GWRM (red), and an approximated parallelized time that follows Amdahl’s law for Reduced CBC-GWRM (green). All methods use parameters K=5 and L=5.

4.2. Forced wave equation

The forced wave equation in this next example is a second order hyperbolic differential equation that features two time scales. This equation is used to test efficiency, in the sense that in some cases accuracy at small scales may be ignored in favour of efficiently resolving large scale dynamics. The wave equation has the form

(14) 2ut2=c22ux2+f(t,x).(14)

It is here worth noting that the GWRM can solve the wave equation in its single equation form (14). However, in order to accurately compare with the finite difference methods the wave equation is posed as two, first order in time, partial differential equations:

vt=c22ux2+f(t,x),
ut=v.

The initial and boundary conditions are

u(0,x)=sin(πx),
v(0,x)=αAsin(βx),
u(t,0)=u(t,1)=0,
v(t,0)=v(t,1)=0.

Here A, n, α, β and c are free parameters. The forcing term chosen is

f(t,x)=A(c2β2α2)sin(αt)sin(βx).

This leads to the exact solution

(15) u(t,x)=cos(ncπt)sin(nπx)+Asin(αt)sin(βx).(15)

We set the free parameters to to A=10, n=3, T=80, α=6π/T, β=3π and c=1. For the time interval t[0,80] the CBC-GWRM requires a high number of temporal Chebyshev modes K12 to achieve a reasonable average (within 92% percent of the second, slowly evolving part of the solution (15)) of the fast time scale dynamics. The solution at x=0.2 can be seen in Figure .

Since it is inefficient to solve for more than one wavelength with high order temporal modes, a more efficient approach would be to solve the wave equation with parameters A=10, n=3, T=30, α=2π/T, β=3π and c=1 in a time interval t[0,30]. This allows a temporal mode K=5 to accurately average the fast time scale (within 95% percent of the slow manifold). The CBC-GWRM with parameters K=5, L=5, and Ns=4 achieves a CPU time of 0.69 s, which is comparable to the standard GWRM subdomain scheme with the same parameters, requiring 0.83 s. In Figure -) the standard GWRM and the CBC-scheme, employing analytical derivatives, shows the memory consumption and CPU time with increasing subdomains.

Turning to the finite difference methods, the L-W method is able to accurately resolve the slow time scale with parameters M=1200 and N=40 in 1.5 s. The L-W method initially follows the fast time scale until the solution advances further away from the initial condition, in which case it transforms to the slow time scale.

The parameters used for the C-N solution is M=50 and N=50, which gives a run time of 1.4 s. The C-N method fails to average correctly as it is slightly out of phase. Explicit methods, unlike implicit methods, are conditionally stable because they must obey the CFL condition γΔt/Δx1, where γ is the wave speed, Δt is the temporal step length, and Δx is the spatial step length. However, since the forced wave equation is a hyperbolic equation, the FD methods need to resolve the phase of the wave in order to be accurate. Furthermore, the phase can only be resolved by following the strong stability criterion, in which case the implicit method shows no favourable performance over explicit schemes (Appadu, Citation2013).

To conclude, in this example the CBC-scheme is approximately 2.1 times faster than the finite difference methods when one wavelength is simulated with a K=5 temporal Chebyshev mode. Similar, and even higher, accuracy and efficiency levels can be attained using lower order temporal modes and multiple time intervals rather than high order temporal modes with few time intervals (Scheffel, Lindvall, Yik, & Time-Spectral, Citation2018). The memory consumption of the CBC-GWRM is also superior compared to the GWRM global subdomain scheme. This can be seen in Figure ); a curve fit of the data reveals that the memory consumption of the CBC-scheme scales linearly, whilst the global GWRM scheme memory scaling is quadratic. These are substantial increases in performance which allows the CBC-GWRM to be highly competitive when solving physical systems with high degrees of freedom.

4.3. Ideal MHD

The ideal MHD equations are useful to investigate whether the CBC-GWRM is capable of accurately modelling complex physical systems. The ideal MHD model is a set of coupled partial differential equations that describe the dynamics of a perfectly conductive fluid or plasma. The equations may be stated as

(16) ρt+(ρv)=0,(16)
(17) ρt+vv+pJ×B=0,(17)
(18) pt+(pv)+(Γ1)pv=0,(18)
(19) Bt+×E=0(19)
(20) ×Bμ0J=0,(20)
(21) E+v×B=0.(21)

The first three equations model the fluid; the continuity Eq. (16) models the conservation of mass density ρ; the equation of motion (17) solves for the fluid velocity v; and the energy equation (18) models the adiabatic evolution of the pressure profile p;

(22) t+vpρΓ=0,(22)

where Γ=5/3 is the ratio of specific heats. The second set of equations involves the electromagnetic equations that describe the evolution of the magnetic field B, electric field E, and the current density J; Faraday’s law (19), Ampere’s law (20), where μ0 is the permeability in vacuum, and Ohm’s law (21).

The goal here is to model ideal MHD instabilities that occur in a magnetically confined cylindrical plasma with coordinates (r,θ,z). The CBC-GWRM is applied to the ideal MHD equations when linearized about an equilibrium, which consequently consist of 14 (7 real and 7 imaginary) coupled partial differential equations. A perturbation exp[i(mθ+kz)] is introduced, where m and k are the azimuthal and axial mode numbers, respectively.

The inner boundary conditions need to be handled with some care to avoid singularities at r=0 (Lundin, Citation2006). The outer boundary r=1 condition is that of a perfectly conducting wall, hence the radial components are set to zero at the wall.

The equilibrium chosen is a simple screw-pinch equilibrium (in normalized variables),

Br=0, Bt=r, Bz=0.05,
p0=1r2, Jt=0, Jz=2.

The equilibrium was then perturbed using m=1 and k=5. The time evolution of the perturbed radial velocity and pressure is shown in Figure -). Initially the perturbed variables are dominated by a host of different waves, which is why the simulation has to advance far enough for the dominating unstable mode to become distinguishable.

The growth rate obtained from the CBC-GWRM is compared to that of a shooting code developed in (Bateman, Citation1978), see Figure . The CBC-GWRM calculates a growth rate ωCBC=0.839 whilst the shooting code obtains a growth rate ωB=0.840. For higher accuracy it is advisable to use multiple time intervals with fewer temporal modes. This application of the CBC-GWRM to the linearized ideal MHD equations shows the advantage of using a Chebyshev spectral ansatz because of its ability to average over small scale dynamics. The initial waves that propagate are of no interest, and are averaged out, leaving the dominating unstable mode.

5. Discussion

The CBC-GWRM has several favourable properties; 1) rapid spectral convergence and high accuracy in both time and space, 2) real-valued Chebyshev polynomials having the useful mini-max property, 3) sparse matrix methods for solving the coefficient equations, 4) reduced global coefficient matrix equations where only the internal and external boundary condition equations need be solved, and 5) parallellized solution of the subdomain private equations. The first three points are common properties of time-spectral methods, while this work is focused on points 4) and 5). Regarding 4), in the example problems of this paper the number of operations is reduced by a factor (2/L)3 and the memory usage by (2/L)2 since only the internal and external boundary condition equations are solved globally. The “2” comes from the fact that only the two highest spatial Chebyshev modes are allocated for the two boundary conditions employed.

We can find a scaling law estimate for the efficiency of the CBC-GWRM. The number of private equations for one physical equation in each subdomain of, for example the Burger equation is (L1)(K+1). In order to produce the partial derivatives of equation (9), the private set of equations need to be solved twice for each common boundary condition and temporal mode. The total number of operations is then 2Ns(K+1)(L1)3(K+1)3 when a single PDE is solved. The number of global common boundary condition equations are 2Ns(K+1). The CPU time of the standard GWRM scheme with sparse band matrix algorithms scales approximately as Ns1.4; the same procedures are used to solve the condensed common boundary condition matrix. Thus the ratio of the total number of operations for the CBC-GWRM and the standard GWRM is

(23) 2Ns(L1)3(K+1)4+Ns1.423(K+1)3Ns1.4(L+1)3(K+1)3=2(K+1)Ns0.4L1L+13+23(L+1)3.(23)

From Eq. (23) it can be seen that the CBC-GWRM is more efficient than the standard GWRM when Ns is large. For example; L=5 and K=5 gives the criterion that Ns x>;27 for the CBC-GWRM to be more efficient. This is an important result since many fluid dynamics applications suggest Ns>100. The scaling law Eq. (23) only takes into account the amount of operations it takes to solve the total amount of algebraic equations (6) for both the CBC-GWRM and the standard GWRM, that is excluding all overhead operations, such as calculating the Jacobian matrices etcetera; see Figure for actual CPU times consistent with the scaling argument in Eq. (23).

The effect of the first term in Eq. (23), representing private domain computations, can be reduced substantially by employing parallellization. Thus, the limiting dependence (2/(L+1))3 can be approached. The estimation of the parallelizable time was made from the speed-up gains ascertained from Amdahl’s Law (Amdahl, Citation1967). Amdahl’s law is formulated as S=1/[(1p)+p/s], where S is the speed-up gain, s is the proportion of the code that can be computed in parallel, and p is the unoptimized computation time. Here s has been calculated by the CPU times corresponding to the proportion of the code that can be parallelized. In Figure the CBC-GWRM, with overhead operations, shows that the CPU times are still comparable to the standard GWRM. There are, however, further means to improve efficiency.

For linear PDEs with constant coefficients it has been found that due to the constant implicit derivatives, the implicit variable dependencies xP/xBC in Eq. (9) need not be solved for in more than three subdomains, which includes the first, second and last subdomain. If the two boundary conditions are the same then the minimum amount of subdomains that need to be solved are two, i.e. the first and second subdomain. Thus, the minimum amount of operations required to solve the private equations corresponding to a linear PDE with no-flow, or equal-flow, boundary conditions is 4(K+1)(L1)3(K+1)3. This gives a more favourable scaling law than (23):

(24) 4(L1)3(K+1)4+Ns1.423(K+1)3Ns1.4(L+1)3(K+1)3=4(K+1)Ns1.4L1L+13+23(L+1)3.(24)

Figure ) shows how the CPU time, including overhead operations, for the linearised Burger equation, scales with the number of subdomains Ns[10,100] for the reduced CBC-GWRM, the standard GWRM with all equations solved globally, and the reduced CBC-GWRM adjusted for approximate parallelizable speedup gains. Here reduced refers to the reduction in implicit derivative calculations discussed above. The standard GWRM and reduced CBC-GWRM show comparable CPU times when few subdomains are used. However, the advantage of the CBC scheme, in both CPU times and memory consumption (see Figure )), is evident when more subdomains are used. The substantial reduction of the memory consumption that can be attained with the CBC-GWRM is of considerable importance for many applications, such as when employing more degrees of freedom in the physical domain.

The avenue of parallelizable subdomains grows even more advantageous when studying the ideal MHD equations. For the ideal MHD case approximately 95% of the code can be parallelized, which according to Almdahl’s Law gives a speedup >12 if more than 32 processors are used and it saturates at speedup=20 for cores numbering 2048 and higher (Amdahl, Citation1967).

To close, it has been widely held that time-spectral methods are not as efficient as their finite difference counterparts. While spectral methods do feature higher accuracies, the idea of lacking efficiency has now been challenged by such methods as the GWRM and the spectral deferred correction method. The spectral deferred correction method still, most commonly, relies on implicit and explicit finite difference methods to create a crude initial approximation, which is then corrected. This is achieved by using spectral integration in-between the finite time steps which is included to correct the crude approximation. This makes the spectral deferred correction method a high order method, requiring longer computation times (Gustafsson & Hemmingsson, Citation2002; Gustafsson & Kress, Citation2001; Speck et al., Citation2015).

6. Conclusion

The CBC-GWRM solves a set of initial-value ordinary or partial differential equations in the temporal and spatial domains with a time-spectral weighted residual method, using a novel algorithm for increasing efficiency and reducing memory consumption. This allows the method to obtain high accuracy and to efficiently average over small scale dynamics, as seen in the modelling of the linearised Burger and forced wave equations. Before this work the “standard” GWRM solved all subdomains simultaneously from the global set of algebraic equations. Our goal was to break down the problem into smaller pieces for enhancing efficiency. The CBC-method provides a solution to this problem.

For the 1D linearised Burger equation the CBC-GWRM was compared to finite difference methods. At low accuracy the implicit finite difference scheme outperformed both the explicit and the time-spectral methods. The maximum error, however, of the CBC-GWRM solution scales as εGWRM  tCPU3.47, compared to εLW  tCPU0.6 and εCN  tCPU0.9. This allows CBC-GWRM to be 30% faster than Crank-Nicolson for accuracies ε105. The CBC-GWRM CPU time also approaches a scaling of Ns1.1, with increasing number of subdomains, which is an improvement from the standard GWRM Ns1.4 scaling.

An optimal scaling law for the total amount of operations of linear PDEs was found (see Eq. (23)). With the technique of only calculating the implicit derivatives in the first and second subdomain, applied to solution of the 1D linearised Burger equation, it was found for the CBC-GWRM that with Ns=50 there was a 53% and 33% reduction in CPU time and memory consumption, respectively. Thus the CBC-GWRM outperforms the standard GWRM (global subdomain scheme) in both CPU times and memory consumption.

The linearized ideal MHD equations were solved within 0.1% error for the instability growth in a screw-pinch, in agreement with previous simulations (Scheffel, Citation2011). This accuracy was reached using a single time interval, making the CBC-GWRM highly competitive when solving for slow unstable mode growth rates. This shows that the CBC-GWRM is capable of solving complex physical systems that are relevant for fusion plasma physics, whilst efficiently resolving the temporal domain. The CBC-GWRM is also shown to substantially reduce memory requirements as compared to the earlier “standard” GWRM.

Additional information

Funding

The authors received no direct funding for this research.

Notes on contributors

Kristoffer Lindvall

Kristoffer Lindvall is a Ph.D. student in the Fusion Plasma Physics department at KTH Royal Institute of Technology, Stockholm, Sweden. He received his Master of Science (M.Sc.) degree from Luleå University of Technology of Sweden in Aerospace Engineering. He specialises in numerical methods and their applications in fusion plasma physics.

References

  • Amdahl, G. M., Validity of the single processor approach to achieving large scale computing capabilities, in: AFIPS ‘67 (Spring) Proceedings of the April 18-20, 1967, spring joint computer conference, ACM, 1967, pp. 483–485. New Jersey, NJ.
  • Appadu, A. R. (2013). Numerical solution of the 1D advection-diffusion equation using standard and nonstandard finite difference schemes. Journal Applications Mathematical, (2013), 1–14.
  • Bar-Yoseph, P., Moses, E., Zrahia, U., & Yarin, A. (1995). Space-time spectral element methods for one-dimensional nonlinear advection-diffusion problems. Journal of Computation Physical, 119, 62. doi:10.1006/jcph.1995.1116
  • Bateman, G. (1978). MHD Instabilities. Cambridge, Mass: The MIT Press.
  • Bateman, G., Schneider, W., & Grossmann, W. (1974). MHD instabilities as an initial boundary-value problem. Nuclear Fusion, 14, 669–683. doi:10.1088/0029-5515/14/5/009
  • Boyd, J. P. (2000). Chebyshev and fourier spectral methods. New York, NY: Dover.
  • Canuto, C., Hussaini, M. Y., Quarteroni, A., & Tang, T. A. (2006). Spectral methods, fundamentals in single domains. Verlag Berlin Heidelberg: Springer.
  • Cao, J., & Cai, H. (2018). Resistive magnetohydrodynamics with toroidal rotation in toroidal plasmas. Physical Plasmas, 25, 1–8. doi:10.1063/1.5006715
  • Dutt, P. (1990). Spectral methods for initial boundary value problems - an alternative approach. SIAM Journal of Numerical Analysis, 27, 885. doi:10.1137/0727051
  • Fakhar-Izadi, F., & Dehghan, M. (2014). Space-time spectral method for a weakly singular parabolic partial integro-differential equation on irregular domains. Computation Mathematical Application, 67, 1884–1904.
  • Fakhar-Izadi, F., & Dehghan, M. (2018). Fully spectral collocation method for nonlinear parabolic partial integro-differential equations. Applications Numercial Mathematical, 123, 88–120. doi:10.1016/j.apnum.2017.08.007
  • Furth, H. P., Killeen, J., & Rosenbluth, M. N. (1963). Finite-resistivity instabilities of a sheet pinch. Physical Fluids, 6, 459–484. doi:10.1063/1.1706761
  • Giraldo, F. X., & Restelli, M. (2007). A study of spectral element and discontinuous Galerkin methods for the Navier-Stokes equations in nonhydrostatic mesoscale atmosphere modelling: Equation sets and test cases. Journal of Computational Physics, 227, 3849–3877. doi:10.1016/j.jcp.2007.12.009
  • Glasser, A. H., Greene, J. M., & Johnson, J. L. (1976). Resistive instabilities in a tokamak. Physical Fluids, 19, 567–574. doi:10.1063/1.861490
  • Gustafsson, B., & Hemmingsson, L. (2002). Deferred correction in space and time. Journal of Scientific Computing, 17, 541. doi:10.1023/A:1015114412222
  • Gustafsson, B., & Kress, W. (2001). Deferred correction methods for initial value problems. Bit Numerical Mathematics, 41, 986. doi:10.1023/A:1021937227950
  • Guyan, R. J. (1964). Reduction of stiffness and mass matrices. AIAA Journal, 3, 380. doi:10.2514/3.2874
  • Hanert, E., & Piret, C. (2014). A Chebyshev pseudospectral method to solve the space-time tempered fractional diffusion equation. SIAM Journal of Sciences Computation, 36(2), A1797–A1812. doi:10.1137/130927292
  • Heath, M. T. (2005). Scientific computing: An introductory survery (2nd ed.). New York, NY: McGraw-Hill.
  • Kopriva, D. A. (2009). Implementing spectral methods for partial differential equations. Netherlands: Springer.
  • Lundin, D., Semi-analytical solution of initial-value problems, Report XR-EE-ALF-2006:001, KTH Royal Insitute of Technology, 2006.
  • Maerschalck, B. D., & Gerritsma, M. I. (2005). The use of Chebyshev polynomials in the space-time least-squares spectral element method. Numerical Algorithms, 38, 173.
  • Mittal, R. C., & Al-Kurdi, A. (2002). LU-decomposition and numerical structure for solving large sparse nonsymmetric linear systems. Computers & Mathematics with Applications, 43, 131–155. doi:10.1016/S0898-1221(01)00279-6
  • Morchoisne, Y. (1979). Solution of Navier-Stokes equations by a space-time pseudospectral method. Rech Aerospace, 5, 11-31.
  • Peraire, J., & Persson, P. (2010). High-order discontinuous galerkin methods for CFD. Computation Fluid Dynamics, 2, 119–152.
  • Peyret, R., & Taylor, T. D. (1983). Computational methods for fluid flow. New York, NY: Springer.
  • Qu, Z. (2004). Static condensation. In Model order reduction techniques. London: Springer.
  • Respondek, J. (2010). Numerical simulation in the partial differential equation controllability analysis with physically meaningful constraints. Mathematical Computation Simulation, 81, 120–132. doi:10.1016/j.matcom.2010.07.016
  • Scheffel, J. (2011). Time-spectral solution of initial-value problems. In Jang, C. L. (Eds.), Partial differential equations: Theory, analysis and applications (pp. 1–49). New York, NY: Nova Science Publishers, Inc.
  • Scheffel, J. (2012). A spectral method in time for initial-value problems. Amercian Journal of Computation Mathematical, 2, 173–193. doi:10.4236/ajcm.2012.23023
  • Scheffel, J., & Håkansson, C. (2009). Solution of systems of nonlinear equations, a semi-implicit approach. Applications Numercial Mathematical, 59. doi:10.1016/j.apnum.2009.05.002
  • Scheffel, J., Lindvall, K., & Yik, H. F. (2018). Time-Spectral Approach to numerical weather prediction. Computer Physics Communications, 226, 127–135. doi:10.1016/j.cpc.2018.01.010
  • Scheffel, J., & Mirza, A. A. (2012). Time-spectral solution of initial-value problems - Subdomain approach. Amercian Journal of Computation Mathematical, 02, 72–81. doi:10.4236/ajcm.2012.22010
  • Schiesser, W. (1991). The numerical method of lines: Integration of partial differential equations. San Diego: Academic Press.
  • Spagnoli, K. E., Humphrey, J. R., Price, D. K., & Kelmelis, E. J. (2011). Accelerating sparse linear algebra using graphics processing units. SPIE Defense, Security and Sensing Symposium, 8060, 1–9.
  • Speck, R., Ruprecht, D., Emmett, M., Minion, M., Bolten, M., Krause &, R. (2015). A multi-level spectral deferred correction method. BIT Num Mathematical, 55, 843–867. doi:10.1007/s10543-014-0517-x
  • Strauss, H. R. (1976). Nonlinear, three-dimensional magnetohydrodynamics of noncircular tokamaks. Physical Fluids, 19, 134–140. doi:10.1063/1.861310
  • Tal-Ezer, H. (1986). Spectral methods in time for hyperbolic equations. SIAM Journal of Numerical Analysis, 23, 11–26. doi:10.1137/0723002
  • Tal-Ezer, H. (1989). Spectral methods in time for parabolic problems. SIAM Journal of Numerical Analysis, 26, 1–11. doi:10.1137/0726001
  • Yang, S. X., Liu, Y. Q., Hao, G. Z., Wang, Z. X., He, Y. L., He, H. D., … Xu, M. (2018). Multiple branches of resistive wall mode instability in a resistive plasma. Physical Plasmas, 25, 1–10. doi:10.1063/1.5007819