1 Introduction

The dynamics of stochastic systems that are second order in time depends on the damping parameter, \(\eta \). As \(\eta \rightarrow 0\), the system exhibits properties similar to those of Hamiltonian systems. As \(\eta \rightarrow \infty \), the system behaves similar to one that is first order in time. With the correct scaling of noise intensity, however, the stationary density is independent of \(\eta \). In the case of scalar second order stochastic differential equations with additive noise and a damping term, it is possible to design numerical methods [8, 37, 38, 43, 45] with some desirable properties, described below, in all ranges of values of \(\eta \) [7]. While the analysis of these methods was given only in the linear case, these properties were shown to hold numerically for nonlinear problems as well. In this paper, we consider how to extend these ideas to second-order-in-time Stochastic Partial Differential Equations (SPDEs) in one space dimension with additive space-time white noise.

In one-degree-of-freedom linear systems, it is possible to devise timestepping methods with one Gaussian random variable per timestep, that have no systematic error in the position variable, and with a simple expression for the error in the velocity variable as a function of \(\varDelta t\) [8]. New methods obtained from the analysis of linear equations were observed to perform well when applied to nonlinear systems [6]; whether they cope better with underdamped or overdamped systems, or equally-well with any value of damping, can be understood from the dependence of the error in linear systems on \(\eta \). We shall follow this methodology here, producing timestepping methods for solution of systems of stochastic differential equations, using one Gaussian random variable per degree of freedom per timestep, from analysis of corresponding linear systems.

We shall consider the following second-order-in-time SPDE, known as \(\phi ^4\) or Allen-Cahn [5, 11, 15, 20, 27, 29], that exhibits coherent structures called kinks:

$$\begin{aligned} \frac{\partial ^2}{\partial t^2}{\phi }_t(x) + \eta \frac{\partial }{\partial t}{\phi }_t(x) = \frac{\partial ^2}{\partial x^2}{\phi }_t(x) + f({\phi }_t(x)) + {\left( 2\eta \varTheta \right) ^{\frac{1}{2}}}\,{\varvec{\xi }}_t(x)\!, \end{aligned}$$
(1)

with periodic boundary conditions on \([0,l]\). The last term in (1) is space-time white noise:

$$\begin{aligned} \mathrm{I}\!\mathrm{E}({\varvec{\xi }}_t(x){\varvec{\xi }}_{t'}(x')) = \delta (x-x')\delta (t-t'). \end{aligned}$$

A configuration is a continuous function of \(x\), \({\phi }_t(x)\), obtained by fixing \(t\) in one realization. At most values of \(x\), \({\phi }_t(x)\) is close to either \(-1\) or \(+1\). A narrow region where the configuration crosses through \(0\) from below is called a kink; one where it crosses from above is called an antikink. In our scaling, the width of a kink is order 1 and the spatial domain is \([0,l]\); it is also possible to scale the width of a kink to \(\epsilon \) on the spatial domain \([0,1]\) [20, 22, 40]. Systematic computational studies of the SPDE require low temperatures in order to unambiguously identify kinks [15, 29]; they are computationally costly because the steady-state density of kinks decreases exponentially with temperature (so that \(l\) must be large) and the equilibration time increases exponentially with temperature.

After a sufficiently long time, in both the continuum SPDEs and the discrete system, a statistically-steady state is attained and maintained by a balance between continual nucleation of new domains and the diffusion and annihilation of existing ones [4, 9, 10, 15, 26, 30]. Many steady-state quantities, such as the mean number of kinks per unit length, can be calculated from the invariant density of the SPDE, by evaluating the partition function [3, 36, 39]. Further insight has recently been obtained by demonstrating the equivalence between the invariant density of paths of the SPDE, on the spatial domain, and the density of paths of a suitable bridge process [35, 41, 46].

2 Numerical solution

Consider the numerical solution of (1) in one space dimension [18, 19, 21, 24, 33, 34, 44]. We are interested in the correlation functions

$$\begin{aligned} c_q(x) = \lim _{t\rightarrow \infty }\mathrm{I}\!\mathrm{E}({\phi }_t(x_0){\phi }_t(x_0+x))\quad \text {and}\quad c_p(x) = \lim _{t\rightarrow \infty }{\mathbb {E}}\left( \frac{\partial {\phi }_t}{\partial t}(x_0)\frac{\partial {\phi }_t}{\partial t}(x_0+x)\right) \!. \end{aligned}$$

Note that \(c_q(x)\) and \(c_p(x)\) are independent of \(x_0\) and symmetric functions of \(x\), taken modulo \([0,l]\). In a numerical solution, \(c_q(x)\) and \(c_p(x)\) are measured by choosing one or more \(x_0\) and recording numerical means over a long realisation.

The numerical solution of the SPDE (1), using the finite-difference approximation, gives, via the Method of Lines applied to the spatial operator and the Brownian sheet, a set of \(N\) coupled stochastic differential equations [5, 13, 14]:

$$\begin{aligned} \mathrm{d }{\mathbf{X}_t}=&\, I_N\mathbf{V}_t\mathrm{d }t \nonumber \\ \mathrm{d }\mathbf{V}_t=&\, {-}\eta I_N\mathbf{V}_t\mathrm{d }t + I_Nf({\mathbf{X}_t})\mathrm{d }t + kC_N{\mathbf{X}_t}\mathrm{d }t + \epsilon \mathrm{d }\mathbf{W}_t, \end{aligned}$$
(2)

where \({\mathbf{X}_t}\) and \(\mathbf{V}_t\) are \(\mathrm{I}\!\mathrm{R}^N\)-valued random variables, written as \(N\times 1\) column vectors, \(I_N\) is the \(N\)-dimensional identity matrix and \({\mathbf{W}}=({\mathbf{W}}{(1)},\ldots ,{\mathbf{W}}{(N)})^\mathrm{T}\), a column vector of \(N\) independent Wiener processes. The parameters \(k\), \(N\), and \(\epsilon \) are related to \(\varDelta x\), \(l\) and \(\varTheta \) by

$$\begin{aligned} k=\varDelta x^{-2},\quad N = \frac{l}{\varDelta x} \quad \text {and}\quad \epsilon ^2 = \frac{2\eta \varTheta }{\varDelta x}. \end{aligned}$$

The \(N\times N\) symmetric matrix \(C_N\) is the discretised Laplacian

$$\begin{aligned} C_N = \begin{pmatrix}-2&{}\quad 1&{}\quad 0&{}\quad \ldots &{}\quad &{}\quad 1\\ 1&{}\quad -2&{}\quad 1&{}\quad 0&{}\quad \ldots \\ 0&{}\quad 1&{}\quad -2&{}\quad 1\\ &{}&{}&{} \ddots &{}&{} \\ 0&{}&{}\quad \ldots &{}\quad 1&{}\quad -2&{}\quad 1\\ 1&{}\quad 0&{}\quad \ldots &{} &{}\quad 1&{}\quad -2\end{pmatrix}. \end{aligned}$$

The limit \(N\rightarrow 0\) corresponds to the SPDE limit \(\varDelta x\rightarrow 0\). We typically use values of \(N\) of order \(10^5\). At finite \(\varDelta x\), the sets of random variables

$$\begin{aligned} {\mathbf{X}_t}= \begin{pmatrix}{\mathbf{X}_t}(1)\\ \vdots \\ {\mathbf{X}_t}(N)\end{pmatrix} \quad \text {and}\quad \mathbf{V}_t= \begin{pmatrix}\mathbf{V}_t(1)\\ \vdots \\ \mathbf{V}_t(N)\end{pmatrix}\!, \end{aligned}$$

representing “position” and “velocity”, provide an approximation to \({\phi }_t(i\varDelta x)\) and \(\frac{\partial {\phi }_t}{\partial t}(i\varDelta x)\), \(i=1,2\ldots ,N\). We shall study timestepping methods that produce approximate solutions of (2), seeking accurate correlation functions for all values of \(\eta \).

This work can be viewed as the extension, to \(N\) degrees of freedom, of recent results for the one-degree-of-freedom case. There, we considered [7, 8] second-order differential equations of the form \( \ddot{x} = f(x) - \eta \dot{x} + \epsilon \xi (t) \), representing the motion of a particle subject to deterministic forces \(f(x)\) and random forcing \(\xi (t)\),where \(\mathrm{I}\!\mathrm{E}(\xi (t)\xi (t')) = \delta (t-t')\). The amplitude of the random forcing, \(\epsilon \), is related to the temperature \(\varTheta \) and damping coefficient \(\eta \) by the fluctuation-dissipation relation \( \epsilon ^2 = 2\eta K\varTheta \), where \(K\) is Boltzman’s constant. The deterministic force defines a potential function \(U(x)\) via \( f(x) = -U'(x) \).

Motivating examples

Our main example will be the case \(f(x)=x-x^3\). The effects of finite difference approximation are most easily explained in the case of the velocity–velocity correlations, \(c_p(x)\). In the exact solution of (2),

$$\begin{aligned} c_p(x)= {\left\{ \begin{array}{ll} \ 0 &{}\quad x\ne 0\\ \displaystyle \frac{\varTheta }{\varDelta x} &{} \quad x=0. \end{array}\right. } \end{aligned}$$
(3)

As long as a stationary density exists, the form (3) does not depend on \(f(x)\) and is exact even when \(\varDelta x\ne 0\).

In Fig. 1, numerically-compiled averages of the velocity correlation function are displayed at three values of \(x\). Each dot is compiled from one numerical realisation, with \(N=4\times 10^5\), by averaging over samples taken once per time interval at times up to \(t=4\times 10^5\). The value of \(c_p(0)\) obtained at finite \(\varDelta t\) differs from the exact value; the Runge–Kutta Leapfrog method shows the best convergence properties (left panel). At finite \(\varDelta t\), similarly, numerical mean values \(c_p(i\varDelta x)\), \(i=1,2,\ldots \) are not, in general, zero. One property of the reverse leapfrog method is that \(c_p(i\varDelta x)\), \(i=2,\ldots \) is zero for linear systems and close to zero for nonlinear systems (right panel). The method also has the best convergence properties in \(c_q(x)\), but we postpone discussion of this to later sections. The goal of the analysis we present in Sect. 3 is to calculate the convergence properties of timestepping methods.

Fig. 1
figure 1

Three numerical velocity–velocity correlations: the mean-square at one point in space, \(c_p(0)\), the product at neighbouring sites, \(c_p(\varDelta x)\), and the product at a separation of two sites, \(c_p(2\varDelta x)\). The SPDE is solved using the leapfrog (leap), reverse leapfrog (RL) and three-stage Runge–Kutta leapfrog (RKL3) methods, with \(\eta =1.0\), \(\varTheta =0.2\) and \(\varDelta x=0.4\). The exact results are shown as dotted lines

3 Partitioned Runge–Kutta methods for systems of SDEs

Exact results can be obtained for linear systems, which serve as a testing ground for general, nonlinear, systems. Accordingly, in this Section we consider \(N\)-degree-of-freedom linear systems described by

$$\begin{aligned} \mathrm{d }{\mathbf{X}_t}=&\, I_N\mathbf{V}_t\mathrm{d }t \nonumber \\ \mathrm{d }\mathbf{V}_t=&\, {-}\eta I_N\mathbf{V}_t\mathrm{d }t -gI_N{\mathbf{X}_t}\mathrm{d }t + kC_N{\mathbf{X}_t}\mathrm{d }t + \epsilon \mathrm{d }\mathbf{W}_t. \end{aligned}$$
(4)

Let

$$\begin{aligned} B_N = gI_N - kC_N, \end{aligned}$$

then the set of SDEs (4) can be written as one matrix equation:

where \(O_N\) is the \(N\times N\) zero matrix.

Our task is to examine how faithfully the stationary density is reproduced by standard and new timestepping methods for SPDEs. These methods produce approximate values for the positions and velocities at discrete times \(t_n, n=0,1,2,\ldots \). We denote these values by \(X_n(i)\) and \(V_n(j)\), \(i,j = 1,\ldots ,N\). Usually \(t_{n+1} - t_n\) is a fixed number \(\varDelta t\). We consider the evolution of \(X_n\) and \(V_n\) and their statistical properties as \(t_n\rightarrow \infty \), and compare with the exact results

$$\begin{aligned} \lim _{t\rightarrow \infty }\mathrm{I}\!\mathrm{E}({\mathbf{X}_t}^{T}{\mathbf{X}_t}) = \frac{\epsilon ^2}{2\eta } L_N, \quad \lim _{t\rightarrow \infty }\mathrm{I}\!\mathrm{E}({\mathbf{X}_t}^{T}\mathbf{V}_t) = O_N \quad \text {and}\quad \lim _{t\rightarrow \infty }\mathrm{I}\!\mathrm{E}(\mathbf{V}_t^{T}\mathbf{V}_t) = \frac{\epsilon ^2}{2\eta } I_N, \end{aligned}$$

where [17]

$$\begin{aligned} L_N = B_N^{-1}. \end{aligned}$$

3.1 Partitioned Runge–Kutta methods

Let

$$\begin{aligned} q_n = \begin{pmatrix}X_n(1)\\ \vdots \\ X_n(N)\end{pmatrix} \quad \text {and}\quad p_n = \begin{pmatrix}V_n(1)\\ \vdots \\ V_n(N)\end{pmatrix}\!. \end{aligned}$$

When solving (2) under a partitioned Runge–Kutta (PRK) method [25] with \(s\) stages, \(q_{n+1}\) and \(p_{n+1}\) are obtained from \(q_n\) and \(p_n\) via \(s\) intermediate vectors \(Y_i\) and \(Z_i\):

$$\begin{aligned} p_{n+1}&=p_n + \sum _{j=1}^s b_j(-\eta Z_j+f(Y_j)+kC_NY_j)\varDelta t+ \epsilon \varDelta W_n, \\ q_{n+1}&= q_n + \sum _{j=1}^s \hat{b}_j Z_j\varDelta t, \end{aligned}$$

where \(\varDelta W_n = (\varDelta W_n(1),\ldots ,\varDelta W_n(N))^\mathrm{T}\), and each \(\varDelta W_n(i)\) is drawn independently from a Gaussian distribution with mean zero and variance \(\varDelta t\). The intermediate vectors satisfy

$$\begin{aligned} Z_i&= p_n + \sum _{j=1}^s a_{ij}(-\eta Z_j+f(Y_j)+kC_NY_j) \varDelta t+ \epsilon c_i \varDelta W_n \nonumber \\ Y_i&= q_n + \sum _{j=1}^s \hat{a}_{ij}Z_j \varDelta t. \end{aligned}$$
(5)

Note that \(N\) Gaussian random variables are required per timestep. We use the notation \(e = (1,1,\ldots ,1)^\mathrm{T}\), \(b = (b_1,b_2,\ldots ,b_s)^\mathrm{T}\), \(\hat{b} = (\hat{b}_1,\hat{b}_2,\ldots ,\hat{b}_s)^\mathrm{T}\), \(c = (c_1,c_2,\ldots ,c_s)^\mathrm{T}\) and let \(A\) and \(\hat{A}\) be the \(s\times s\) matrices whose entries are the \(a_{ij}\) and \(\hat{a}_{ij}\) in (5). We assume \(c=Ae\) and \(b^\mathrm{T}e=1\), and represent PRK methods by pairs of Butcher tableaux [16]:

Let \(Z = (Z_1,Z_2,\ldots ,Z_s)^\mathrm{T}\), \(Y = (Y_1,Y_2,\ldots ,Y_s)^\mathrm{T}\) and \(f(Y) = (f(Y_1),f(Y_2),\ldots ,f(Y_s))^\mathrm{T}\). Then we can write (5) as

$$\begin{aligned} (I_S\otimes I_N+\eta A\otimes I_N\varDelta t)Z&= e\otimes p_n+ (A\otimes I_N) f(Y)\varDelta t+ (A\otimes C_N)Yk\varDelta t\nonumber \\&\quad + \epsilon c\otimes \varDelta W_n \\ Y&= e\otimes q_n + (\hat{A}\otimes I_N) Z\varDelta t. \nonumber \end{aligned}$$
(6)

If a PRK method is applied to the linear system, \(f(Y)=-gY\), then (6) simplifies to

$$\begin{aligned} PZ&= e\otimes p_n - (c\otimes B_N) q_n \varDelta t+ \epsilon c\otimes \varDelta W_n\\ Y&= e\otimes q_n + \hat{A} Z\varDelta t, \end{aligned}$$

where

$$\begin{aligned} P = I_S\otimes I_N + \eta A\otimes I_N\varDelta t+ (A\hat{A})\otimes B_N\varDelta t^2. \end{aligned}$$
(7)

Thus

$$\begin{aligned} p_{n+1} =&p_n - \eta b^\mathrm{T}\otimes I_NZ\varDelta t- b^\mathrm{T}\otimes B_NY\varDelta t+ \epsilon \varDelta W_n\nonumber \\ q_{n+1} =&q_n + \hat{b}^\mathrm{T}\otimes I_N Z\varDelta t \end{aligned}$$
(8)

and we can write

$$\begin{aligned} \begin{pmatrix}q_{n+1}\\ p_{n+1}\end{pmatrix} = R \otimes \begin{pmatrix}q_{n}\\ p_{n}\end{pmatrix} + \epsilon r \otimes \varDelta W_n, \end{aligned}$$
(9)

where

$$\begin{aligned} R = \begin{pmatrix}R_{11}&{}\quad R_{12}\\ R_{21}&{}\quad R_{22}\end{pmatrix} \quad \text {and}\quad r = \begin{pmatrix}R_1\\ R_2\end{pmatrix}. \end{aligned}$$

Comparing (8) with (9), we find

$$\begin{aligned} R_{11}&= I_N-(\hat{b}^\mathrm{T}\otimes I_N)P^{-1}(c\otimes B_N)\varDelta t^2\\ R_{12}&= (\hat{b}^\mathrm{T}\otimes I_N) P^{-1}(e\otimes I_N)\varDelta t\\ R_{21}&{=} -\left( I_N - \eta (b^\mathrm{T}\otimes I_N)P^{-1}(c\otimes I_N) \varDelta t{+} (b^\mathrm{T}\hat{A}\otimes B_N)P^{-1}(c\otimes I_N)\varDelta t^2 \right) B_N\varDelta t\\ R_{22}&= I_N - \eta (b^\mathrm{T}\otimes I_N)P^{-1}(e\otimes I_N) \varDelta t- (b^\mathrm{T}\hat{A}\otimes B_N)P^{-1}(e\otimes I_N)\varDelta t^2\\ R_1&= (\hat{b}^\mathrm{T}\otimes I_N) P^{-1}(c\otimes I_N)\varDelta t\\ R_2&= I_N - \eta (b^\mathrm{T}\otimes I_N)P^{-1}(c\otimes I_N)\varDelta t- (b^\mathrm{T}\hat{A}\otimes B_N)P^{-1}(c\otimes I_N)\varDelta t^2 . \end{aligned}$$

The \(R_{ij}\), as well as \(R_1\) and \(R_2\), are \(N\times N\) symmetric matrices and functions of \(\varDelta t\).

Let

$$\begin{aligned} \varSigma _n = {\mathbb {E}}\left( \begin{pmatrix}q_n^\mathrm{T}\\ p_n^\mathrm{T}\end{pmatrix} \begin{pmatrix}q_n^\mathrm{T}&\quad p_n^\mathrm{T}\end{pmatrix}\right) \!. \end{aligned}$$

The stationary density of the numerical method is characterised by \(\varSigma = \displaystyle \lim _{n\rightarrow \infty }\varSigma _n\). We shall search for methods such that

(10)

Thus, while requiring exact statistics in the discretised positions, we describe the numerical error in the velocities in terms of the difference between \(J_N\) and the \(N\times N\) identity as a function of \(\varDelta t\) and \(\eta \).

With a numerical update of the form (9), \(\varSigma _{n+1}\) is related to \(\varSigma _{n}\) by

$$\begin{aligned} \varSigma _{n+1} = R\varSigma _n R^\mathrm{T} + \epsilon ^2 \begin{pmatrix}R_1^\mathrm{T}\\ R_2^\mathrm{T}\end{pmatrix} \begin{pmatrix}R_1^\mathrm{T}&\quad R_2^\mathrm{T}\end{pmatrix}\varDelta t, \quad \text {where}\quad R^\mathrm{T} = \begin{pmatrix} R_{11}^\mathrm{T}&{}\quad R_{21}^\mathrm{T}\\ R_{12}^\mathrm{T}&{}\quad R_{22}^\mathrm{T}\end{pmatrix}\!. \end{aligned}$$

The required form (10) of the stationary correlation matrix will be found if \(S=0\) where

$$\begin{aligned} S = R\begin{pmatrix}L_N &{}\quad O_N\\ O_N&{}\quad J_N \end{pmatrix}R^\mathrm{T} - \begin{pmatrix} L_N&{}\quad O_N\\ O_N&{}\quad J_N\end{pmatrix} + 2\eta \begin{pmatrix} R_1R_1^\mathrm{T}&{}\quad R_1R_2^\mathrm{T} \\ R_2R_1^\mathrm{T} &{}R_2R_2^\mathrm{T} \end{pmatrix}\!. \end{aligned}$$

The condition \(S=0\) is equivalent to the following three equations:

$$\begin{aligned} R_{11}L_NR_{11} - L_N + R_{12}J_NR_{12} + 2\eta R_1R_1 \varDelta t&= 0\\ R_{11}L_NR_{21} + R_{12}J_NR_{22} + 2\eta R_1R_2 \varDelta t&= 0\\ R_{21}L_NR_{21} + R_{22}J_NR_{22} - J_N + 2\eta R_2R_2\varDelta t&= 0. \end{aligned}$$

Notice that

$$\begin{aligned} R_1B_N\varDelta t=&\, I_N-R_{11}\\ R_2B_N\varDelta t=&\, {-}R_{21}. \end{aligned}$$

3.2 Basic result on systems

It is convenient to define

$$\begin{aligned} T_N&= (\hat{b}^T\otimes I_N)P^{-1}(c\otimes I_N)\nonumber \\ U_N&= (\hat{b}^T\otimes I_N)P^{-1}(e\otimes I_N)\nonumber \\ Z_N&=(\eta b^T\otimes I_N + \varDelta tb\hat{A}\otimes B_N)P^{-1}(c\otimes I_N)\nonumber \\ W_N&= (\eta b^T\otimes I_N + \varDelta tb\hat{A}\otimes B_N)P^{-1}(e\otimes I_N), \end{aligned}$$
(11)

with \(P\) given by (7). Then

$$\begin{aligned} \begin{array}{l@{\quad }l} \displaystyle R_{11} = I_N-T_NB_N\varDelta t^2 &{}R_{12}=U_N\varDelta t\\ \displaystyle R_{21} =-(I_N-Z_N\varDelta t)B_N\varDelta t&{}R_{22}=I_N - W_N\varDelta t\\ \displaystyle R_1 = T_N\varDelta t&{}R_2= I_N-Z_N\varDelta t, \end{array} \end{aligned}$$

and

$$\begin{aligned} -(T_NB_NL_N+L_N^\mathrm{T}B_NT^\mathrm{T}_N) + T^\mathrm{T}_NB_NB^\mathrm{T}_NT_N\varDelta t^2 + U_NJ_NU^\mathrm{T}_N +2\eta \varDelta t^2 TT^\mathrm{T}_N = 0. \end{aligned}$$

Since \(B_N=B_N^\mathrm{T}\), \(T_N=T_N^\mathrm{T}\), \(U_N=U_N^\mathrm{T}\) and \(B_nL_N=I_N\), we find

$$\begin{aligned} J_N = 2U_N^{-2}T_N\left( I_N - (\eta \varDelta t+\frac{1}{2}B_N\varDelta t^2)T_N \right) \!. \end{aligned}$$
(12)

That is, \(J_N = \alpha (\eta I_N\varDelta t,B_N\varDelta t^2)\), where \(\alpha (\eta \varDelta t,g\varDelta t^2)\) is the scalar function (1.19) in [8].

4 Timestepping methods for systems of SDEs

We now consider specific examples of timestepping methods, beginning with two-stage methods.

4.1 The implicit midpoint method

For reference, we give the Butcher tableaux and corresponding matrix \(P\) for the implicit midpoint method. The tableaux are

and

$$\begin{aligned} P = \begin{pmatrix}I_N &{} O_N \\ O_N &{} I_N(1+\frac{1}{2}\eta \varDelta t) +\frac{1}{4}B_N\varDelta t^2\end{pmatrix}\!. \end{aligned}$$

Thus

$$\begin{aligned} R_{11}&= \left( I_N+\frac{1}{2}\eta \varDelta tI_N +\frac{1}{4}B_N\varDelta t^2\right) ^{-1}\left( I_N+\frac{1}{2}\eta \varDelta tI_N -\frac{1}{4} B_N\varDelta t^2\right) \\ R_{12}&= \left( I_N+\frac{1}{2}\eta \varDelta tI_N +\frac{1}{4}B_N\varDelta t^2\right) ^{-1}\varDelta t\\ R_{21}&= \left( I_N+\frac{1}{2}\eta \varDelta tI_N +\frac{1}{4}B_N\varDelta t^2\right) ^{-1}B_N\varDelta t\\ R_{22}&= \left( I_N+\frac{1}{2}\eta \varDelta tI_N +\frac{1}{4}B_N\varDelta t^2\right) ^{-1}\left( I_N-\frac{1}{2}\eta \varDelta tI_N -\frac{1}{4}B_N\varDelta t^2\right) \!. \end{aligned}$$

and there is no error in the velocity–velocity correlations [7, 37, 38]:

$$\begin{aligned} J_N = I_N. \end{aligned}$$

However, this method is implicit and therefore not convenient for use on nonlinear systems.

4.2 The leapfrog method

The leapfrog method is represented in Butcher tableaux as:

which gives, after some simplification, \( J_N = (I_N(1-\frac{1}{2}\eta \varDelta t)-\frac{1}{4}B_N\varDelta t^2)^{-1} \), thus generalising the result of [7].

4.3 Mannella’s method

Mannella’s modification of the leapfrog method [31, 32] is represented as:

it has \( J_N = (I_N-\frac{1}{4} B_N\varDelta t^2)^{-1}. \) This is an improvement on the standard leapfrog method because \(J_N-I_N\), the error in the velocity–velocity correlation function, is proportional to \(\varDelta t^2\) and independent of \(\eta \).

4.4 The reverse leapfrog method

This is represented as

As \(A\hat{A}=0\), we can show

$$\begin{aligned} P = \begin{pmatrix}(1+\frac{1}{2}\eta \varDelta t)I_N&{}\quad O_N\\ \frac{1}{2}\eta \varDelta tI_N&{}\quad I_N\end{pmatrix} \end{aligned}$$

and

$$\begin{aligned} R_{11}&=I_N - \frac{1}{2}\frac{1}{1+\frac{1}{2}\eta \varDelta t}B_N\varDelta t^2\\ R_{12}&= \left( 1 + \frac{1}{1+\frac{1}{2}\eta \varDelta t}\right) I_N\varDelta t\\ R_{21}&= \left( I_N-\frac{1}{2}\frac{\eta \varDelta t}{1+\frac{1}{2}\eta \varDelta t}I_N +\frac{1}{2}\frac{\varDelta t^2}{1-\frac{1}{2}\eta \varDelta t}B_N\right) B_N\varDelta t^2\\ R_{22}&= \frac{1-\frac{1}{2}\eta \varDelta t}{1+\frac{1}{2}\eta \varDelta t}I_N + \frac{1}{2}B_N\frac{\varDelta t^2}{1+\frac{1}{2}\eta \varDelta t}. \end{aligned}$$

This yields

$$\begin{aligned} J_N = I_N - \frac{1}{4} B_N\varDelta t^2. \end{aligned}$$

As with the Mannella method, the reverse leapfrog method is efficient and easily implemented and has the virtues of giving the exact correlation function in the positions variable, and an error in the velocity variables independent of \(\eta \). In addition, the form of \(J_N-I_N\) means that the correlations introduced in the velocity variable are only one \(\varDelta x\) step on either side, since \(B_N=gI_N-kC_N\).

The correlation introduced in the velocity variable is independent of \(\eta \) and only occurs between neighbouring grid points:

$$\begin{aligned} c_p(0) = 1 - \frac{1}{4}(2k+g)\varDelta t^2, \qquad c_p(\varDelta x) = \frac{1}{4}k\varDelta t^2 \quad \text {and} \quad c_p(i\varDelta x)= 0,\text { for }i>1, \end{aligned}$$

consistent with the results shown in Fig. 1.

4.5 Runge–Kutta leapfrog methods

In this section we give a more detailed analysis of the class of Runge–Kutta leapfrog methods introduced in [8]. We first introduce the simplifying assumptions that were made in that paper.

Theorem 1

If the following conditions, known as property A, hold [8]:

$$\begin{aligned} b^\mathrm{T}=\hat{b}^\mathrm{T} \quad b^\mathrm{T}A = \frac{1}{2}b^\mathrm{T}\quad A\hat{A} e = \frac{1}{2} c \quad b^\mathrm{T}e = 1. \end{aligned}$$

Then

$$\begin{aligned} U_N&= I_N - (\eta \varDelta tI_N + \frac{1}{2} \varDelta t^2B_N)T_N \end{aligned}$$

and

$$\begin{aligned} J_N&= 2T_NU_N^{-1}. \end{aligned}$$

Proof

The formula for \(J_N\) is given by (11) and (12) with

$$\begin{aligned} J_N = 2U_N^{-2}T_N\left( I_N - (\eta \varDelta t+\frac{1}{2}B_N\varDelta t^2)T_N \right) \!, \end{aligned}$$

where

$$\begin{aligned} T_N&= (\hat{b}^\mathrm{T}\otimes I_N)P^{-1}(c\otimes I_N)\\ U_N&= (\hat{b}^\mathrm{T}\otimes I_N)P^{-1}(e\otimes I_N)\\ P&= I_S\otimes I_N + A\otimes I_N\eta \varDelta t+ (A\hat{A})\otimes B_N\varDelta t^2. \end{aligned}$$

Expanding \(P^{-1}\) and repeatedly using Property A and \(Ae=c\) gives

$$\begin{aligned} U_N&= I_N + \sum _{j=1}^{\infty }(-1)^j (b^\mathrm{T}\otimes I_N) (A\otimes I_N\eta \varDelta t+ A\hat{A}\otimes B_N\varDelta t^2)^{j-1} (c\otimes I_N\eta \varDelta t\\&\quad + \frac{1}{2}c\otimes B_N\varDelta t^2) = I_N - (\eta \varDelta tI_N + \frac{1}{2}\varDelta t^2 B_N)T_N. \end{aligned}$$

Hence \(J_N = 2T_NU_N^{-1}\). \(\square \)

This is the generalisation, to \(N\)-degree-of-freedom systems, of Lemma 3.2 in [8]. There, the strategy was to construct classes of PRK methods with high order.

Runge–Kutta leapfrog methods with \(s\ge 3\) stages and increasingly high order [8] are constructed as follows. In addition to property A, let

$$\begin{aligned} \hat{A} = \frac{1}{2}I-e_sv^\mathrm{T}, \end{aligned}$$
(13)

where \(v\) is chosen so that \(v^\mathrm{T}e=0\) and \(v^\mathrm{T}=(v_1,v_2, \cdots ,\frac{1}{2})\) and with a value \(k=s-2\) such that

$$\begin{aligned} v^\mathrm{T}A^{j-1}c=0, \qquad j=1,\ldots ,k. \end{aligned}$$
(14)

Let

$$\begin{aligned} X_N = \eta \varDelta tI_N+\frac{1}{2}\varDelta t^2B_N \end{aligned}$$

then (13) and (14) give

$$\begin{aligned} (b^\mathrm{T}\otimes I_N) (A\otimes I_N\eta \varDelta t+ A\hat{A}\otimes B_N\varDelta t^2)^j (c\otimes I_N) = b^\mathrm{T}A^jcX_N^j \qquad j =1,\ldots ,k, \end{aligned}$$

and

$$\begin{aligned}&(b^\mathrm{T}\otimes I_N) (A\otimes I_N\eta \varDelta t+ A\hat{A}\otimes B_N\varDelta t^2)^{k+1} (c\otimes I_N)\\&\quad = b^\mathrm{T}A^{k+1}cX_N^{k+1}- ( b^\mathrm{T}Ae_s)( v^\mathrm{T}A^kc)\varDelta t^2 B_N X_N^k \end{aligned}$$

so that

$$\begin{aligned} T_N = b^\mathrm{T}c I_N + \sum _{j=1}^{k+1}(-1)^j(b^\mathrm{T}A^jc)X_N^j+ M_N +O(\varDelta t^{k+3}), \end{aligned}$$

where

$$\begin{aligned} M_N = (-1)^{k+2}( b^\mathrm{T}Ae_s)( v^\mathrm{T}A^kc) \varDelta t^2 B_N X_N^k. \end{aligned}$$

Now, with property A,

$$\begin{aligned} b^\mathrm{T}A^jc = \left( \frac{1}{2}\right) ^{j+1}, \quad \forall j, \end{aligned}$$

so

$$\begin{aligned} 2T_N = I_N + \sum _{j=1}^{k+1}(-1)^j(\frac{1}{2} X_N)^j + 2M_N +O(\varDelta t^{k+3}). \end{aligned}$$

Thus from Theorem 4.1

$$\begin{aligned} 2T_N = U_N + 2M_N + O(\varDelta t^{k+3}). \end{aligned}$$

Hence

$$\begin{aligned} J_N&= 2T_NU_N^{-1}\\&= I_N+ 2M_NU_N^{-1} + O(\varDelta t^{k+3}), \end{aligned}$$

and so the error in \(J_N\) is

$$\begin{aligned} J_N-I_N = 2(-1)^{k+2}( b^\mathrm{T}Ae_s)( v^\mathrm{T}A^kc)\varDelta t^{k+2}\eta ^kB_N. \end{aligned}$$

and this is consistent with the scalar result first given in [8] where \(k+2=s\). Thus the lowest-order correlations introduced into the velocity variable, proportional to \(B_N\), are only one spatial step on either side.

4.6 s = 3

Example: The three-step Runge–Kutta leapfrog method, satisfying Property A, was first given in [6] and takes the form

$$\begin{aligned} Y_1&= q_n + \frac{1}{2}\varDelta tp_n\\ Z_2&=(1-\frac{1}{2}\eta \varDelta t)p_n + \frac{1}{2}\left( (f(Y_1) + C_NY_1)\varDelta t+ \epsilon \varDelta W\right) \\ Y_2&= q_n + \frac{1}{2}\varDelta tZ_2\\ Y_3&= 2Y_2-Y_1\\ p_{n+1}&=\frac{1}{1+\frac{1}{2}\eta \varDelta t}\\&\quad \left( (1-\frac{1}{2}\eta \varDelta t)p_n-\frac{1}{4} \left( f(Y_1)+2f(Y_2)+f(Y_3)+C_NY_2\right) \varDelta t+\epsilon \varDelta W\right) \\ q_{n+1}&= q_n + \frac{1}{2}(p_n+p_{n+1}). \end{aligned}$$

We find

$$\begin{aligned} P&= \begin{pmatrix} I_N &{} O_N &{} O_N\\ \frac{1}{2}\eta \varDelta tI_N+\frac{1}{4} \varDelta t^2 B_N&{}I_N&{}O_N\\ -\frac{1}{2}\eta \varDelta tI_N-\frac{1}{2}B_N\varDelta t^2&{}\quad \eta \varDelta tI_N+B_N\varDelta t^2 &{}\quad (1+\frac{1}{2}\eta )I_N \end{pmatrix}\!\!,\\ T_N&= \frac{1}{2}I_N-\frac{1}{4}\left( \eta \varDelta tI_N + \frac{1}{2} B_N\varDelta t^2\right) +\frac{1}{8}\left( \eta \varDelta tI_N + \frac{1}{2} B_N\varDelta t^2\right) \eta \varDelta tI_N+\cdots \\ U_N&= I_N-\frac{1}{2}\left( \eta \varDelta tI_N + \frac{1}{2} B_N\varDelta t^2\right) +\frac{1}{4}\left( \eta \varDelta tI_N + \frac{1}{2} B_N\varDelta t^2\right) ^2+\cdots \\ J_N&= I_N - \frac{1}{8}\left( \eta \varDelta tI_N + \frac{1}{2} B_N\varDelta t^2\right) ^{\!2} +\frac{1}{4}\left( \eta \varDelta tI_N + \frac{1}{2} B_N\varDelta t^2\right) \eta \varDelta tI_N+\cdots \\&= I_N-\frac{1}{8}\eta \varDelta t^3B_N + \cdots . \end{aligned}$$

The error is proportional to \(\eta \varDelta t^3\), consistent with the one-degree-of-freedom case [8].

5 Timestepping methods for the \(\phi ^4\) SPDE

We now return to our nonlinear example, the kink-bearing SPDE with \(f(x)=-U'(x)\) where \(U(x) = -\frac{1}{2}x^2 + \frac{1}{4}x^4\). Let us consider the functions \(c_q(x)\) and \(c_p(x)\) in the limit \(\varDelta x\rightarrow 0\). The nonlinearity of the SPDE does not affect the exact velocity correlation function, \(c_p(x)\), which is still zero if \(x\ne 0\). The steady state density of the field at a point is non-Gaussian with mean-square, \(c_q(0)\), calculated as \(\varDelta x\rightarrow 0\) as follows. Let \(\epsilon _n\) and \(\psi _n(u)\) be the eigenvalues, and corresponding normalised eigenfunctions, of the equation [5, 12, 28]

$$\begin{aligned} \left( -\frac{1}{2\beta ^2}\frac{\partial ^2}{\partial u^2} +U(u)\right) \psi _n(u) = \epsilon _n\psi _n(u), \end{aligned}$$

where \(\beta =\varTheta ^{-1}\) and \(n=0\) corresponds to the eigenfunction with the smallest eigenvalue. Then

$$\begin{aligned} c_q(x) = \sum _ns_n^2\exp (-\beta x(\epsilon _n-\epsilon _0)), \end{aligned}$$

where \(s_n = \int _{-\infty }^{\infty } u\psi _n(u)\psi _0(u)\mathrm{d }u\). The most important feature of the correlation function is the exponential term with exponent \(\beta (\epsilon _1-\epsilon _0)\), where \(\epsilon _1\) is the next-to-smallest eigenvalue: as \(x\rightarrow \infty \), \(c_q(x)\propto \exp (-x/\lambda )\), where \(\lambda ^{-1} = \beta (\epsilon _1-\epsilon _0)\). To estimate \(\lambda \) from a numerical solution we plot the following function of \(x\):

$$\begin{aligned} b(x) = \varDelta x\left( \log \left( \frac{c_q(x)}{c_q(x+\varDelta x)} \right) \right) ^{-1}, \end{aligned}$$

so that \(\displaystyle \lim _{x\rightarrow \infty }b(x)=\lambda \). The numerical \(b(x)\) plateaus at the value \(\lambda \) (Figure 2). In our numerical runs, we used \(N=10^5\) grid points and averaged over samples taken every 10 time units up to time \(t=10^6\).

Fig. 2
figure 2

The correlation function \(c_q(x)\) and the corresponding \(b(x)\) constructed from a numerical solution with \(\beta =5\), \(k=4\), \(\eta =1\)

In Fig. 3, we compare the accuracy of \(c_q(x)\), \(c_p(x)\) and \(\lambda \), measured numerically. In the quantity that is the most challenging to measure numerically, \(\lambda \), the reverse leapfrog method performs remarkably well. The Runge–Kutta leapfrog method, however, is most accurate in \(c_p(\varDelta x)\). Timestepping methods included in Fig. 3 are the standard leapfrog and Mannella’s modification [31, 32], the Heun method, and the reverse leapfrog method, all of which are two-stage methods using one Gaussian random variable per timestep. Also shown is the the three-stage Runge–Kutta leapfrog method [8]. The code used to produce these results is given as supplementary material, along with a code that produces an animated illustration of the dynamics and measurement of the density.

Fig. 3
figure 3

Performance of different algorithms as a function of \(\varDelta t\). The values of \(\beta =5\), \(\eta =1.0\) and \(\varDelta x=0.25\) are fixed. In the upper graph, the correlation length \(\lambda \) is shown as a function of \(\varDelta t\); the reverse leapfrog method is most accurate. In the lower left panel, \(|c_p(\varDelta x)|\) is plotted; the most accurate algorithm is the third-order Runge–Kutta leapfrog method. In the lower right panel, \(|c_p(2\varDelta x)|\) is plotted; the error in this quantity with the reverse leapfrog method is smaller than the statistical error

In Fig. 4, we compare the accuracy of \(c_q(0)\) (the mean-square of \(\phi \), where there is still error associated with finite \(\varDelta x\) even as \(\varDelta t\rightarrow 0\)) and of \(c_p(x)\) at three values of \(x\) and two values of \(\eta \). The reverse leapfrog method performs best in the position variable (upper panel) and the velocity correlation function at a separation of two grid points (lower panel). However, the three-stage and four-stage Runge–Kutta leapfrog methods [8] are most accurate in the velocity correlation function at zero and one grid point separation. Methods with five or more stages can be implemented similarly.

Fig. 4
figure 4

Numerical means, as a function of \(\varDelta t\), with \(\varDelta x=0.2\). Left column \(c_q(0)\). Central column \(c_p(0)\). Right column \(c_p(\varDelta x)\). Top row \(\eta =0.5\). Bottom row \(\eta =2.0\). The timestepping methods used are the standard leapfrog (leap), reverse leapfrog (RL), three-stage and four-stage Runge–Kutta leapfrog (RKL3 and RKL4). Exact continuum results are shown as dotted lines

6 Discussion

In this paper we have constructed classes of Runge–Kutta methods for solving second-order-in-time SPDEs in one space dimension based on the finite difference approximation. Two-stage methods are available that improve on the standard leapfrog method in important ways. A series of multistage methods, with increasing accuracy in the stationary density, have also been devised and implemented. These methods are essentially those described in [8]; here we show how they behave in multidimensional systems, yielding good accuracy in the stationary variances and the correlations in the position and velocity variables while using only one Wiener increment per step irrespective of the number of stages.

Numerical methods satisfying weak convergence criteria have been constructed recently [1, 23, 42]. The focus, usually on constructing higher order methods and methods with good linear stability properties, is also shifting towards consideration of methods that preserve the stationary density function [2]. However, our approach is still novel in its focus on second-order-in-time, or Langevin, dynamics.

A recent paper [6] considered the behaviour of Runge–Kutta methods applied to nonlinear Hamiltonian problems with additive noise, with an independent Wiener increment added per stage rather than per step. This approach is more expensive but it can be shown that it allows for better dynamic properties associated with the method and, in particular, for the midpoint rule this preserves the mean of the problem exactly at each step - this is not the case if just one Wiener process is used per step. We will consider the extension of this idea to examples considered in this paper in future work.