Fourier-Spectral Method for the Phase-Field Equations

: In this paper, we review the Fourier-spectral method for some phase-ﬁeld models: Allen–Cahn (AC), Cahn–Hilliard (CH), Swift–Hohenberg (SH), phase-ﬁeld crystal (PFC), and molecular beam epitaxy (MBE) growth. These equations are very important parabolic partial differential equations and are applicable to many interesting scientiﬁc problems. The AC equation is a reaction-diffusion equation modeling anti-phase domain coarsening dynamics. The CH equation models phase segregation of binary mixtures. The SH equation is a popular model for generating patterns in spatially extended dissipative systems. A classical PFC model is originally derived to investigate the dynamics of atomic-scale crystal growth. An isotropic symmetry MBE growth model is originally devised as a method for directly growing high purity epitaxial thin ﬁlm of molecular beams evaporating on a heated substrate. The Fourier-spectral method is highly accurate and simple to implement. We present a detailed description of the method and explain its connection to MATLAB usage so that the interested readers can use the Fourier-spectral method for their research needs without difﬁculties. Several standard computational tests are done to demonstrate the performance of the method. Furthermore, we provide the MATLAB codes implementation in the Appendix A.


Introduction
In this paper, we review the unconditionally gradient stable Fourier-spectral method for several phase-field equations. The phase-field models are derived from the variational approach that minimizes the free energy of the system. Thus, the derived system follows a law of energy dissipation, which configures thermodynamic consistency, and hence leads to a mathematically well-posed model. The spectral methods, which belong to the collection of weighted residual methods, are originally derived to solve the spatial part of partial differential equations. For detailed, rigorous, and numerical aspect information on spectral methods, see [1,2] and the references therein. In spectral methods, one usually takes a finite set of the expansion functions (so called trial or basis functions) to represent the numerical solution as a linear combination of those functions. Choosing the expansion parts is important because they form a basis for entire spectral domain. Furthermore, we implicitly assume that those functions are smooth, therefore the most common choices are orthogonal polynomials and trigonometric functions. Since our focus is the Fourier-spectral method, the trigonometric basis functions are regarded as the trial functions. Moreover, instead of regarding entire continuous space, the representation is imposed only at discrete points; this is why this method is so called pseudo-spectral method. It is enable to one can save the computing resources in evaluating differentiation and employ the efficient algorithm such as the fast Fourier transform when the number of grid points is even. In addition, the error is decreasing exponentially when one employs the Fourier-spectral method while the finite difference methods lead to the algebraically decreasing order in fact. Figure 1 shows the order of spectral accuracy compared with the order of accuracy of finite difference. In this case, we use a simple function u(x) = log(10 + cos x); hence u (x) = − sin x/(10 + cos x). An error is defined as Error = max 1≤i≤N |u (x i ) − Du i | where Du i is an approximation of u (x i ). According to Figure 1, the error is decreasing exponentially via Fourier-spectral method indeed. Furthermore, we verify the efficiency of the Fourier-spectral method employing the following initial-boundary value problem in one-dimensional space with the 2π-periodic boundary condition.
Then, the exact solution of Equation (1) is u(x, t) = e −t sin(x). Define u k i as a numerical approximation to u(x i , k∆t) for 1 ≤ k ≤ N t where ∆t is a time step and N t is the number of iterations. Figure 2 depicts the convergence of second-order central finite difference scheme and Fourier-spectral method. Note that the backward difference method in time is employed to both cases and an error is defined as Error = ∑ N i=1 (u(x i , 1) − u N t i ) 2 /N where N is the number of grid points, hence the number of modes, and it is easily verified that the Fourier-spectral method requires relatively few grid points within similar accuracy indeed. Sometimes, an interpolant cannot apply to less flexible domains since the method employs implicitly periodic or homogeneous boundary conditions though there is an advantage in numerical accuracy. Therefore, a somewhat subtle additional process is required to employ complex or mixed boundary conditions. Moreover, it causes Gibbs phenomenon if there is a point of discontinuity, i.e., when it has a sharp gradient. Figure 3 shows the oscillations near discontinuities when one employs the Fourier interpolant.  Moreover, we set all the mobility terms in phase-field models as constant for convenience, more precisely set to 1 without loss of generality, since it requires further manipulation to handle a variable mobility in spectral methods [3].
The Allen-Cahn (AC) equation is discussed first. It describes the temporal evolution of a non-conserved order field during anti-phase domain coarsening [4]: where φ(x, t) is defined as the difference between the concentrations of the two components in a mixture, which varies on −1 to 1, F(φ) = 0.25(φ 2 − 1) 2 is the free energy potential, and is a small constant related to the interfacial energy. Note that F (φ) = φ 3 − φ. The AC equation has a wide range of applications such as mean curvature flows, two-phase incompressible fluids, complex dynamics of dendritic growth, image inpainting, and image segmentation, see Figure 4 for some of these examples [5][6][7]. Lee and Lee [8] presented unconditionally energy stable first-and second-order semi-analytical Fourier-spectral methods for the AC equation to reduce the errors caused by large time step. Those methods were originated by decomposition of original equation into two parts, linear and nonlinear, that have closed-form solutions; hence operator splitting steps ensure high-order nonlinear solvers.  [5] with permission from MDPI. (b) Image segmentation. Reprinted from [6] with permission from Hindawi. (c) Crystal growth. Reprinted from [7] with permission from KSIAM. The next is a similar type to the previous one, the Cahn-Hilliard (CH) equation, which models the process of spinodal decomposition in conserved binary alloys [9]: The CH equation is widely used in applications such as phase separation, topology optimization, multiphase incompressible fluid flows, image inpainting, surface reconstruction, diblock copolymer, tumor growth simulation, and microstructures with elastic inhomogeneity, see Figure 5 for some of these examples [10].
Recently in [11], the discretization via nonlinear stabilized splitting scheme to the CH equation was reviewed and was solved by using a nonlinear multigrid method. Further in [12], Lee researched energy stability of the second-order strong-stability-preserving implicit-explicit Runge-Kutta methods for the CH equation. Christlieb et al. [13] presented the unconditionally gradient nonlinearly stabilized method for the CH equation, which is originally proposed by Eyre [14], within Fourier method and proposed an iterative scheme which is convergent for large time steps. There are a bunch of research related in AC and CH equations so far, some selected literatures are listed as follows. Montanelli and Bootland [15] proposed several exponential integration formula and compared their performance within stiff partial differential equations including AC and CH models. Such models are rewritten to sum of linear operator part with high-order terms and nonlinear operator part, and then Fourier-spectral method is applied in order to employ exponential integrator to this semilinear ordinary differential equations. Zhang and Liu [16] used several AC or CH type equations to represent the spatial patterns in ecological and biological system. Shen and Yang [17] presented numerical approximations of the AC and CH equations for semi-implicit or implicit schemes which are unconditionally energy stable, with stability analysis and error estimates based on spectral-Galerkin method. The results confirmed that spectral methods are suitable for diffusive interface models. Regarding on this respect especially, we introduce a nonlocal CH equation, which is appropriate to apply the Fourier-spectral method, that can model microphase separation in diblock copolymers, which consist of two different types of monomers [18] and an explicit form is listed as follows: where σ is inversely proportional to the square of the total chain length of the copolymer and φ = Ω φ(x, 0)/|Ω| is the average concentration over the domain Ω. Block copolymer is a linear-chain molecule consists of at least two subchains connected to each other to make a polymer chain. A diblock copolymer exists if the subchain consists of two distinct monomer blocks. Related mathematical models have been developed in order to investigate the behaviors of phase separation of block copolymers and to find an available technique to manufacture nano-structured materials [19][20][21][22]. There is a direct applications of Equation (4) in [23] recently, where the authors employ the spectral method and see the references therein to check more details. The Swift-Hohenberg (SH) equation was originally derived to model patterns from the influence of thermal fluctuations in hydrodynamics [24]: where φ is a density field and is a temperature related positive constant. There are several applications to employ this model such as cellular materials, metallurgy, laser dynamics, electrohydrodynamics, crystallography, etc. See [25][26][27][28] and the references therein for more details. In addition, we introduce a classical phase field crystal (PFC) equation which takes account for atomic-crystallization growth [29]: This model has a variety of applications such as crystallization in liquid-liquid interface with undercooled material, isotropic phase separation, etc. On the atomistic/molecular scale freezing, a theoretical approach to undercooled liquids crystallization has been studied in [30,31], and the efficient numerical methods based on the operator splitting method or spectral method are developed for the phase-field crystal model [32,33]. The operator splitting method with Fourier-spectral method can relax the time step restriction or shorten the computation time depending on which a solver is applied for each stage.
A molecular beam epitaxy (MBE) growth model describes a process in which a thin single crystal layer is deposited on a single crystal substrate using molecular beams [34,35]: The MBE model is a substantially used approach for thin-film deposition of a surface or interface quality determined to single-monolayer precision. This procedure is widely applied in semiconductor heterostructures and persistently studied topic in material science. Consequently, considerable mathematical models have been evolved to study the epitaxy dynamics, covering from continuum models to molecular dynamical simulations. The readers are referred to the following references for more details [36][37][38][39][40][41][42][43].
The main purpose of this paper is to present brief reviews, to describe numerical solution algorithms, and to provide the MATLAB code implementations of the unconditionally gradient stable Fourier-spectral method for the several phase-field equations. In particular, we highlight the caution that needs to be taken when applying the MATLAB based fast Fourier transform to the Fourier-spectral method.
The outline of this paper is as follows. The numerical solutions in two-and three-dimensional cases of the above phase-field models are described in Sections 2 and 4, respectively. In Sections 3 and 5, we present the basic numerical simulations to the stated phase-field models in both two-and three-dimensional cases. We finalize the paper with the conclusion in Section 6. In the Appendix A, we provide the MATLAB codes for the numerical implementation of the presented equations.

Numerical Solutions in 2D
In this section, we present unconditionally stable Fourier-spectral methods for the phase-field models in two-dimensional space Ω = [l x , r x ] × [l y , r y ]. Let N x , N y be positive even integers and L x = r x − l x , L y = r y − l y be the length of each direction, respectively; hence define h x = L x /N x and h y = L y /N y as the spatial step size in each direction, respectively. We denote discretized points as (x m , y n ) = (l x + mh x , l y + nh y ) where 0 ≤ m ≤ N x and 0 ≤ n ≤ N y are integers. Let φ k mn be an approximation of φ(x m , y n , t k ), where t k = k∆t and ∆t is the temporal step size. For the given data {φ k mn |m = 1, . . . , N x and n = 1, . . . , N y }, the discrete Fourier transform is defined aŝ where ξ p = 2π p/L x and η q = 2πq/L y . The inverse discrete Fourier transform is k pq e i(ξ p x m +η q y n ) .
Note that we can obtain spectral derivatives as if we perform analytic differentiations in the Fourier space. We assume that φ(x, y, t) is sufficiently smooth and extended to continuous version of the numerical approximation φ k mn . The following shows step-by-step description of how the differentiation works in the Fourier transform with finite basis.
This process enables one can derive spectral derivatives in the Fourier space easily, not differentiate directly in the physical space. Therefore, we can represent the Laplacian to coefficients in the Fourier space as follows: where the first line is the definition of the inverse Fourier transform and the second line is just applying Equation (10) twice to xand y-direction to φ(x, y, t) and its Fourier transform. Now we present the numerical solutions of phase-field equations. First, we derive the numerical solution of the AC equation. We apply the linearly stabilized splitting scheme [14] to Equation (2).
where f (φ) = φ 3 − 3φ. Thus, Equation (12) can be transformed into the discrete Fourier space as follows:φ Therefore, we obtain the following discrete Fourier transform Then, the updated numerical solution φ k+1 mn can be computed using Equation (9): k+1 pq e i(ξ p x m +η q y n ) . (15) Next, we obtain the numerical solution of the CH equation. We employ the linearly stabilized splitting scheme [14] to Equation (3).
Thus, Equation (16) can be transformed into the discrete Fourier space as follows: Therefore, we obtain the following discrete Fourier transform Then, the updated numerical solution φ k+1 mn can be computed using Equation (9): Now, we present a numerical solution to the SH equation. In a similar manner, we discretize Equation (5) as follows: where g(φ) = φ 3 . Then we transform Equation (20) aŝ Therefore, we have the following result and hence we have a numerical solution φ k+1 mn as follows: Similarly, a numerical solution for the PFC model (6) is obtained by the same procedure Then Equation (24) is transformed aŝ Therefore, we have the following result Subsequently, we have a numerical solution φ k+1 mn as follows: The remaining one is a numerical solution to the MBE growth model (7). Discretize Equation (7) with an expanded divergence term ∆φ and treat this in implicit way, We Note that [·] FT and [·] IFT represent the discrete Fourier transform and the discrete inverse Fourier transform, respectively. Therefore, we have the following result and then we update a numerical solution φ k+1 mn as follows:

Numerical Experiments in 2D
We perform several numerical investigations in this section. Note that we employ the 2π-periodic boundary condition for overall numerical simulations in two-dimensional case. Sometimes, we employ the initial conditions as random perturbations in domain since these are adequate to reaction-diffusion type models. For AC and CH equations, since there are equilibrium solutions in one-dimensional space as hyperbolic tangent profiles on infinite domain, we use those as initial conditions. Furthermore, we take the value of model parameter as an approximate value close to m = hm/[2 √ 2 tanh −1 (0.9)], which is used in finite difference methods [44].

The AC Equation
Numerical simulations are conducted to verify the mean curvature flow of the AC equation at first. Initial conditions are given as follows: where Figure 6 shows the numerical test results at t = 1 to the AC equation using the Fourier-spectral method. Here, we use N x = N y = 128, h = 2π/128, = 0.05, and ∆t = 0.0001. The final time is T = 1. The results reflect the motion by mean curvature characteristic of the AC equation.  Figure 7 shows the zero-level contours over time with the initial conditions used in Figure 6. Moreover, an energy dissipation of the AC model (2) is depicted in Figure 8, where a total free energy E (φ) is defined as Discretize Equation (36) with spectral derivatives, it yields since the following Parseval's identity has been applied,

The CH Equation
Next, we investigate the coarsening dynamics of the CH equation (3) numerically with the following initial conditions, where rand denotes a random number between −1 to 1 and (x, y) ∈ [−0.5, 0.5] × [−0.5, 0.5]. Figure 9 shows the numerical results at t = 0.01. We use N x = N y = 1000, h = 1/1000, = 0.0025, and ∆t = 0.00001. The results represent well the coarsening dynamics of the CH equation.  Furthermore, an energy dissipation of the CH equation is illustrated in Figure 11. We define a total free energy as follows: Identical process represented in Equation (38) is adopted to Equation (41), We adopt the initial condition (39) and ∆t = 0.0001. Further we present the phase separation behavior via nonlocal CH model for diblock copolymers. An initial condition is given by  Figure 12 shows the phase separation behaviors called the hexagonal patterns over time.
Another initial condition is given as follows: φ(x, y, 0) =φ + 0.2rand(x, y) . A computational domain is given as [0, 3.2] × [0, 3.2]. Parameter values are set to N x = N y = 300, h = 3.2/300,φ = 0, σ = 100, = 3h, and ∆t = 0.1. The final time is T = 1000. Figure 13 describes the phase separation behaviors called the lamellar patterns over time. Consequently, we illustrate an energy dissipation of the nonlocal CH model (4). A total free energy is given by where ψ is obtained by solving −∆ψ = φ −φ. Now Equation (45) is discretized as by using Equation (38). Figure 14 shows the energy dissipation of the nonlocal CH equation with the discrete energy (46). We employ the same condition in Figure 12 except for ∆t = 0.0001 and T = 0.1. Figure 14. Energy dissipation over time to the nonlocal CH model (4) with the initial condition (43).
Note that t-axis is on log-scale.

The SH Equation
We present the pattern formation due to the SH equation (5) in the rectangular domain [0, 120] × [0, 120]. The initial condition is given as follows: For the next step, we investigate an energy decay of the following functional Using Equation (38), a discrete version of Equation (48) is defined as   (47). Note that t-axis is on log-scale.

Classical PFC Model
The phase separation behavior of the classical PFC model is described in this section. Numerical simulation is conducted in the rectangular domain [0, 120] × [0, 120]. The initial condition is given as follows: whereφ = 0.07. Parameters used here are N x = N y = 120, h = 120/120, = 0.025, and ∆t = 0.001. The final time is T = 1500. Figure 17 illustrates the isotropic phase transition behaviors. Note that we restrict the range of colors in [φ − 0.2,φ + 0.2]. Furthermore, we present an illustration of energy dissipation to this PFC model. Since both SH and PFC equations derived from the same total free energy, we employ Equation (49). Figure 18

MBE Growth Model
The epitaxial growth of isotropic current MBE growth model is investigated in this section. Numerical simulation is conducted in the rectangular domain [0, 2π] × [0, 2π]. The initial condition is given as follows: φ(x, y, 0) = 0.1(sin 3x sin 2y + sin 5x sin 5y) .
Parameters are used as N x = N y = 200, = 0.1, and ∆t = 0.001. The final time is T = 15. Figure 19 illustrates the epitaxial growth in computational domain. Further, we present an energy decay to the MBE growth model (7). An energy functional is given by Discretize Equation (52) using Equation (38), whereĝ k pq is a coefficient in Fourier space defined Figure 20 depicts the discrete energy decay over time. Here, we employ the same condition used in Figure 19.

Logarithmic Free Energy
In this paper, we have used the polynomial form of double-well potential F(φ). Note that it is not the only choice. Now, we consider the logarithmic Flory-Huggins free energy [45,46] for the AC and CH equations. Here, θ e and θ c is a positive constant, which are taken as 1 and 1.5, respectively, in this paper. Figure 21 illustrates the logarithmic free energy. To solve the AC and CH equations with the logarithmic free energy (55), we also apply Eyre's linearly stabilized splitting scheme [14]. First, we discretize the AC equation (2) with a free energy (55): where f (φ) = θ e ln 1+φ 1−φ − 2(1 + α)θ c φ, and α is an auxiliary constant for the splitting scheme [47]. Then, Equation (56) can be transformed into the discrete Fourier space as follows: Therefore, we obtain the following discrete Fourier transform Then, the updated numerical solution φ k+1 mn can be computed using Equation (9): k+1 pq e i(ξ p x m +η q y n ) . (59) We conduct a numerical test with the following initial condition is where θ = tan −1 (y/x) for (x, y) ∈ [π, π] × [π, π]. We set the parameters as N x = N y = 128, h = h x = h y , = 0.05, α = 2, and ∆t = 0.0001. Figure 22 shows the zero-level contours over time with the initial condition (60) according to motion by mean curvature. Next, we obtain the numerical solution of the CH equation (3) with the logarithmic free energy (55). Applying the linearly stabilized splitting scheme [14] to the governing equation, we get Thus, Equation (61) can be transformed into the discrete Fourier space as follows: Therefore, we obtain the following discrete Fourier transform Then, the updated numerical solution φ k+1 mn can be computed using Equation (9): k+1 pq e i(ξ p x m +η q y n ) . (64) We perform the numerical test to the CH equation with the following initial condition (39) on the computational domain Ω = [−0.5, 0.5] × [−0.5, 0.5]. We use N x = N y = 1000, h = h x = h y , = 0.0025, and ∆t = 0.00001. Figure 23a-c shows the numerical results at t = 100∆t, 300∆t, and 1000∆t, respectively, and represent well the coarsening dynamics of the CH equation. According to the numerical simulation results, the unconditionally stable Fourier-spectral method ensures the fast convergence that error is decaying exponentially since the collocation points in physical space guarantee the exact function values in the Fourier space and the method provides a sufficiently smooth basis function (an exponential basis function in this case), one can obtain high-order approximations of derivatives. Moreover, it has almost linearly increasing calculation speed when a large number of grid points are used; hence one can represent the spatial details of numerical results with sufficient grid points in a short time.

Numerical Solutions in 3D
We extend the Fourier-spectral method on two-dimensional space to three-dimensional space, Ω = [l x , r x ] × [l y , r y ] × [l z , r z ] for the stated phase-field models. Let N x , N y , N z be positive even integers and L x = r x − l x , L y = r y − l y , L z = r z − l z be the length of each direction, respectively. We denote discretized points by (x m , y n , z o ) = (l x + mh x , l y + nh y , l z + oh z ) for 0 ≤ m ≤ N x , 0 ≤ n ≤ N y , 0 ≤ o ≤ N z , where h x = L x /N x , h y = L y /N y , h z = L z /N z is the spatial step size in each direction, respectively. For t k = k∆t, φ(x m , y n , z o , t k ) is denoted by φ k mno , where ∆t is the temporal step. For the given data {φ k mno | m = 1, . . . , N x , n = 1, . . . , N y , o = 1, . . . , N z }, the discrete Fourier transform is defined asφ where ξ p = 2π p/L x , η q = 2πq/L y , ω r = 2πr/L z . The inverse discrete Fourier transform is k pqr e i(ξ p x m +η q y n +ω r z o ) . (66) Similar to the two-dimensional case, we assume that φ(x, y, z, t) is sufficiently smooth and extended to continuous version of the numerical approximation φ k mno . Therefore, we can obtain the following result.
Consequently, we can write Laplacian as coefficients in the Fourier space as follows: where the first line is the definition of the inverse Fourier transform and the second line is just applying Equation (67) twice to x-, y-, and z-direction to φ(x, y, z, t) and its Fourier transform. Now, we present the numerical solutions of three-dimensional phase-field models. Since most of the calculations are redundant, we just briefly list as follows by extending the solvers in two-dimensional space to those of three-dimensional space. Note that the functions f and g which are defined in Section 2 are simply extended to three-dimensional domain. The following is a numerical solution to the AC equation (2).
Then, the renewed numerical solution φ k+1 mno can be computed using Equation (66): k+1 pqr e i(ξ p x m +η q y n +ω r z o ) . (70) Next one is a numerical solution to the CH equation (3).
Then, the renewed numerical solution φ k+1 mno can be calculated using Equation (66): k+1 pqr e i(ξ p x m +η q y n +ω r z o ) . (72) The following is a numerical solution to the SH Equation (5).
and hence we have a numerical solution φ k+1 mno as follows: k+1 pqr e i(ξ p x m +η q y n +ω r z o ) . (74) Subsequently, we have a numerical solution to the classical PFC model (6) as follows.
(80) Figure 26 illustrates the non-increase discrete energy Equation (80) over time. Similar settings are given as above except for T = 0.6.

The CH Equation
Next, we investigated the numerical test to the CH equation (3) with the following initial conditions, φ(x, y, z, 0) = −0.45 + 0.05rand(x, y, z), where rand implies a random number generating function ranged from −1 to 1 and (x, y, z) ∈ Figure 27 shows the numerical investigation results at t = 100∆t, 500∆t, and 1000∆t to the 3D CH equation using the Fourier-spectral method with the initial condition (81). Here, we use N x = N y = N z = 128, h = 1/128, = h, and ∆t = 0.001.
(83) Figure 29 describes the non-increase energy dissipation over time with the initial condition (81). Similarly, we conduct numerical simulations to generate the lamellar patterns. Figure 31 depicts the snapshots of the lamellar pattern formation via nonlocal CH equation with the initial condition (84). We take N x = N y = N z = 80, h = 1.2/80, = 2.5h, σ = 100,φ = 0, and ∆t = 0.1. The final time is T = 1000. We present a result of long time energy decay in a numerical way. Figure 32 shows the energy decay of the nonlocal CH equation, where the discretization is simply extended from Equation (46) as follows: (85) Figure 32. Energy dissipation over time of Equation (85) via nonlocal CH equation with the initial condition (84). Each snapshot depicts the evolution at t = 400∆t, 700∆t, and 10,000∆t, respectively.
Note that t-axis is on log-scale.

The SH Equation
We present numerical simulation results to the SH equation in this section. A computational domain is [0, 100] × [0, 100] × [0, 100]. An initial condition is given as whereφ = 0.1. Figure 33 shows the patterns due to the instability of thermal fluctuations. Here, we use N x = N y = N z = 120, h = 100/120, = 0.25, and ∆t = 0.1. The final time is T = 2400. As in the case of two-dimensional space, the reduction of the following discrete energy Equation (87) is represented in Figure 34. (87)

Classical PFC Model
We present numerical simulation results to the classical PFC model in the three-dimensional domain [0, 80] × [0, 80] × [0, 80]. An initial condition is given as whereφ = 0.07. Figure 35 shows the phase transition behaviors of this PFC model. Here, we use N x = N y = N z = 60, h = 80/60, = 0.025, and ∆t = 0.01. The final time is T = 1500. We present the energy dissipation in three-dimensional case. Figure 36 shows the energy decay over time, Equation (87), via classical PFC model.

Conclusions
In this paper, we briefly investigate the Fourier-spectral method to the phase-field equations in two-and three-dimensional cases, especially focused on AC, CH, SH, PFC, MBE growth models which are very important parabolic partial differential equations and are applicable to a lot of interesting scientific problems. We present detailed descriptions and numerical solutions of the unconditionally gradient stable Fourier-spectral method and explain its connection to MATLAB usage so that the interested readers can simply implement the corresponding Fourier-spectral method for their research needs without difficulties. Numerical simulation results yield the corresponding method represents well the characteristics of each equation. Furthermore, we provide the MATLAB codes for these equations in the Appendix A.  ( 1 ) ; c l f ; s u r f ( x , y , r e a l ( u ' ) ) ; shading i n t e r p ; view ( 0 , 9 0 ) ; a x i s image ; pause ( 0 . 0 1 ) f o r i t e r = 1 : Nt u= r e a l ( u ) ; s _ h a t = f f t 2 ( u/dt ) -f f t 2 ( u .^3 ) + 2 * ( pp2+qq2 ) . * f f t 2 ( u ) ; v_hat= s _ h a t . / ( 1 . 0 / dt + ( 1 -e p s i l o n ) +( pp2+qq2 ) .^2 ) ; u= i f f t 2 ( v_hat ) ; i f (mod( i t e r , ns ) ==0) s u r f ( x , y , r e a l ( u ' ) ) ; shading i n t e r p ; view ( 0 , 9 0 ) ; a x i s image ; pause ( 0 . 0 1 ) end end dt = 0 . 0 1 ; T = 1 5 0 ; Nt=round ( T/dt ) ; ns=Nt / 5 0 ; f i g u r e ( 1 ) ; c l f ; s u r f ( x , y , r e a l ( u ' ) ) ; shading i n t e r p ; a x i s image ; view ( 0 , 9 0 ) ; pause ( 0 . 0 1 ) f o r i t e r = 1 : Nt u= r e a l ( u ) ; s _ h a t = f f t 2 ( u/dt ) -( pp2+qq2 ) . * f f t 2 ( u .^3 ) + 2 * ( pp2+qq2 ) .^2 . * f f t 2 ( u ) ; v_hat= s _ h a t . / ( 1 . 0 / dt + ( 1 -e p s i l o n ) * ( pp2+qq2 ) +( pp2+qq2 ) .^3 ) ; u= i f f t 2 ( v_hat ) ; i f (mod( i t e r , ns ) ==0) s u r f ( x , y , r e a l ( u ' ) ) ; shading i n t e r p ; view ( 0 , 9 0 ) ; a x i s image ; pause ( 0 . 0 1 ) end end f i g u r e ( 1 ) ; c l f ; colormap j e t ; s u r f ( x , y , r e a l ( u ' ) ) ; a x i s image ; view ( 0 , 9 0 ) ; shading i n t e r p ; c o l o r b a r ; c a x i s ( [ -1 1 ] ) ; pause ( 0 . 0 1 ) ; f o r i t e r = 1 : Nt u= r e a l ( u ) ; tu= f f t 2 ( u ) ; f x = r e a l ( i f f t 2 ( pp . * tu ) ) ; f y = r e a l ( i f f t 2 ( qq . * tu ) ) ; f 1 =( f x .^2+ f y .^2 ) . * f x ; f 2 =( f x .^2+ f y .^2 ) . * f y ; s _ h a t = f f t 2 ( u/dt ) +(pp . * f f t 2 ( f 1 ) +qq . * f f t 2 ( f 2 ) ) ; v_hat= s _ h a t . / ( 1 / dt -( pp2+qq2 ) + e p s i l o n * ( pp2+qq2 ) .^2 ) ; u= i f f t 2 ( v_hat ) ; i f (mod( i t e r , ns ) ==0) c l f ; s u r f ( x , y , r e a l ( u ' ) ) ; view ( 0 , 9 0 ) ; shading i n t e r p ; a x i s image ; c o l o r b a r ; c a x i s ( [ -1 1 ] ) ; pause ( 0 . 0 1 ) end end There is a cautious step in the MATLAB for usage of generated grid which is used for the Fourier space. The indices are not sorted in ascending order as described in Section 2 above, one must start with 0 and replace the largest absolute value to be centered, i.e., N x /2 and N y /2, then sort the others with ascending order from −N x /2 + 1, −N y /2 + 1 to −1. Therefore, one must use the following grids [0 1 · · · (N x − 1)/2 N x /2 − N x /2 + 1 − N x /2 + 2 · · · − 2 − 1] and [0 1 · · · (N y − 1)/2 N y /2 − N y /2 + 1 − N y /2 + 2 · · · − 2 − 1]. Extending to the three-dimensional case is straightforward. Furthermore, it is important to make the highest frequency N/2 to zero in odd derivatives due to the symmetry [1,2].