Previous Article in Journal
A Two-Step High-Order Compact Corrected WENO Scheme
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An Efficient Computational Algorithm for the Nonlocal Cahn–Hilliard Equation with a Space-Dependent Parameter

1
Program in Actuarial Science and Financial Engineering, Korea University, Seoul 02841, Republic of Korea
2
Department of Mathematics, Korea University, Seoul 02841, Republic of Korea
*
Author to whom correspondence should be addressed.
Algorithms 2025, 18(6), 365; https://doi.org/10.3390/a18060365
Submission received: 23 May 2025 / Revised: 9 June 2025 / Accepted: 14 June 2025 / Published: 15 June 2025
(This article belongs to the Section Analysis of Algorithms and Complexity Theory)

Abstract

:
In this article, we present a nonlocal Cahn–Hilliard (nCH) equation incorporating a space-dependent parameter to model microphase separation phenomena in diblock copolymers. The proposed model introduces a modified formulation that accounts for spatially varying average volume fractions and thus captures nonlocal interactions between distinct subdomains. Such spatial heterogeneity plays a critical role in determining the morphology of the resulting phase-separated structures. To efficiently solve the resulting partial differential equation, a Fourier spectral method is used in conjunction with a linearly stabilized splitting scheme. This numerical approach not only guarantees stability and efficiency but also enables accurate resolution of spatially complex patterns without excessive computational overhead. The spectral representation effectively handles the nonlocal terms, while the stabilization scheme allows for large time steps. Therefore, this method is suitable for long-time simulations of pattern formation processes. Numerical experiments conducted under various initial conditions demonstrate the ability of the proposed method to resolve intricate phase separation behaviors, including coarsening dynamics and interface evolution. The results show that the space-dependent parameters significantly influence the orientation, size, and regularity of the emergent patterns. This suggests that spatial control of average composition could be used to engineer desirable microstructures in polymeric materials. This study provides a robust computational framework for investigating nonlocal pattern formation in heterogeneous systems, enables simulations in complex spatial domains, and contributes to the theoretical understanding of morphology control in polymer science.

1. Introduction

Over recent decades, nonlinear differential equations have emerged as essential instruments for capturing complex behaviors, and scholars in physics and mathematics have demonstrated their effectiveness in describing diverse nonlinear phenomena across various applied science fields [1,2]. The Cahn–Hilliard (CH) model serves as a core framework for explaining multiple physical phenomena, such as phase separation in alloys [3,4], polymer blends [5,6,7], spinodal decomposition [8,9], biological membrane modelling [10,11], and image processing [12,13]. Unlike the traditional CH equation, the nonlocal Cahn–Hilliard (nCH) equation [14,15,16] can model more global, accurate physical systems of block copolymers. Numerous researchers have proposed various computational methods for the nCH equation. Li et al. [14] implemented a backward differentiation scheme for temporal discretization and used explicit extrapolation for the nonlinear and concave expansive terms. They also conducted numerical experiments to validate the second-order method through convergence tests and long-time coarsening simulations. Li et al. [17] presented a comprehensive convergence analysis based on error consistency and stability estimates for the nCH equation. Liu et al. [18] developed and investigated a second-order linear numerical scheme for the nCH equation with the Fourier spectral collocation method. Zhou et al. [19] proposed two classes of exponential temporal differencing methods for the nCH equation, using Fourier collocation while rigorously proving their energy stability and mass conservation.
In this article, we present computational simulations of the nCH equation with a space-dependent parameter using the Fourier spectral method, which is a powerful computational method used to solve partial differential equations (PDEs), particularly those with periodic boundary conditions. This method is widely used in a variety of fields, such as fluid dynamics [20], phase field models [21], and quantum mechanics [22]. Countless studies [23,24,25,26] have proven the feasibility of this method. In particular, we propose a modified equation of the nonlocal CH equation [27], given as follows:
ϕ ( x , t ) t = Δ F ( ϕ ( x , t ) ) ϵ 2 Δ ϕ ( x , t ) ) σ ϕ ( x , t ) ϕ ¯ , x Ω , t > 0 ,
where F ( ϕ ) = 0.25 ( ϕ 2 1 ) 2 is a double-well potential [28]. The parameter ϵ represents the interfacial transition width and characterizes the thickness of the diffuse interface separating distinct phases; and it plays a crucial role in phase-field models by controlling the sharpness of the interface: smaller values of ϵ lead to sharper interfaces that more closely approximate a classical sharp interface, while larger values produce smoother transitions [29]; σ is a positive parameter, and ϕ ¯ = Ω ϕ ( x , 0 ) d x / | Ω | . If σ = 0 , then Equation (1) becomes the classical CH equation [30]. The CH equation is a nonlinear, fourth-order partial differential equation that models phase separation processes in binary mixtures, such as alloys, polymers, or fluids. It describes how two components in a mixture spontaneously separate and evolve over time to minimize the system’s free energy. A block copolymer refers to a polymer composed of two or more covalently bonded homopolymeric segments arranged in a linear chain. Specifically, a diblock copolymer comprises two chemically distinct monomer units linked sequentially along the polymer backbone. To reflect the spatial heterogeneity of the system, we divide the domain Ω into two disjoint subdomains, Ω = Ω 1 Ω 2 , and define a space-dependent mean field accordingly. In each subdomain, the governing equation is formulated by incorporating the corresponding average value of the phase variable. Specifically, the evolution of ϕ ( x , t ) in Ω 1 is governed by
ϕ ( x , t ) t = Δ F ( ϕ ( x , t ) ) ϵ 2 Δ ϕ ( x , t ) ) σ ϕ ( x , t ) ϕ ¯ 1 , x Ω 1 , t > 0 ,
where ϕ ¯ 1 = Ω 1 ϕ ( x , 0 ) d x / | Ω 1 | represents the spatial average of the initial phase variable over Ω 1 . Similarly, in the subdomain Ω 2 , we consider
ϕ ( x , t ) t = Δ F ( ϕ ( x , t ) ) ϵ 2 Δ ϕ ( x , t ) ) σ ϕ ( x , t ) ϕ ¯ 2 , x Ω 2 , t > 0 ,
where ϕ ¯ 2 = Ω 2 ϕ ( x , 0 ) d x / | Ω 2 | denotes the average over Ω 2 . By introducing a piecewise-defined mean value ϕ ¯ ( x ) , the equations on the two subdomains can be unified into a single equation as follows:
ϕ ( x , t ) t = Δ F ( ϕ ( x , t ) ) ϵ 2 Δ ϕ ( x , t ) ) σ ϕ ( x , t ) ϕ ¯ ( x ) , x Ω , t > 0 ,
where ϕ ¯ ( x ) is given by the piecewise definition
ϕ ¯ ( x ) = ϕ ¯ 1 if x Ω 1 , ϕ ¯ 2 if x Ω 2 .
It is important to emphasize that the proposed method is not restricted to cases with only two subdomains. The underlying framework allows straightforward extension to configurations that consist of multiple subdomains. This extension is achieved by applying the same principles to each additional subdomain without requiring fundamental changes to the overall algorithmic structure, which ensures the method’s applicability to a wide range of problems involving spatial heterogeneity.
This paper is organized as follows. Section 2 describes the computational scheme based on the Fourier spectral method combined with a stabilized splitting approach for solving the nonlocal CH equation with space-dependent parameters. Section 3 presents computational experiments illustrating the coarsening dynamics and phase separation behaviors under various initial conditions. Finally, conclusions and future perspectives are summarized. The corresponding implementation code, which supports the numerical methods and simulations discussed in the main text, is provided in Appendix A for reference and reproducibility.

2. Numerical Method

In this section, the Fourier spectral method is introduced for the proposed model. This method offers an efficient and highly accurate computational method for solving partial differential equations, particularly when the equations are defined on periodic domains. This method expands the solution in terms of trigonometric basis functions, converting spatial derivatives into simple algebraic operations in Fourier space. By using the Fast Fourier Transform (FFT), it significantly reduces computational cost while preserving spectral accuracy. This method is especially effective for problems with smooth solutions and offers exponential convergence. However, its use is limited in some specific domains unless modified with appropriate extensions or combined with other techniques. The Fourier spectral method has seen broad applications in simulating fluid dynamics, phase-field models, and nonlinear pattern formation [31].
Now, we describe a computational scheme for Equation (4) in the domain Ω = ( L x , R x ) × ( L y , R y ) , which is discretized as Ω d = { ( x m , y n ) | x m = L x + ( m 0.5 ) h x , y n = L y + ( n 0.5 ) h y , 1 m N x , 1 n N y } . Let ϕ m n k = ϕ ( x m , y n , t k ) , where t k = k Δ t , and Δ t is the temporal step size. The discrete Fourier transform is defined as
ϕ ^ p q k = m = 1 N x n = 1 N y ϕ m n k e i ( ξ p x m + η q y n ) , N x 2 + 1 p N x 2 , N y 2 + 1 q N y 2 ,
where ξ p = 2 π p / L x , η q = 2 π q / L y and ϕ m n k denotes the numerical approximation of ϕ ( x m , y n , t k ) . The inverse discrete Fourier transform can be expressed as follows:
ϕ m n k = N x N y p = N x 2 + 1 N x 2 q = N y 2 + 1 N y 2 ϕ ^ p q k e i ( ξ p x m + η q y n ) .
Let ϕ ( x , y , t ) be a continuous version of ϕ m n k . Equation (8) represents the Fourier series expansion of the function ϕ ( x , y , t ) :
ϕ ( x , y , t ) = 1 N x N y p = N x 2 + 1 N x 2 q = N y 2 + 1 N y 2 ϕ ^ ( ξ p , η q , t ) e i ( ξ p x + η q y ) .
Based on this spectral representation, both the Laplacian Δ ϕ ( x , y , t ) and the bi-Laplacian Δ 2 ϕ ( x , y , t ) can be conveniently computed in Fourier space through simple multiplicative operations. Accordingly, Equations (9) and (10) express the inverse transforms that yield the Laplacian and bi-Laplacian in the physical space:
Δ ϕ ( x , y , t ) = 1 N x N y p = N x 2 + 1 N x 2 q = N y 2 + 1 N y 2 ( ξ p 2 + η q 2 ) ϕ ^ ( ξ p , η q , t ) e i ( ξ p x + η q y ) ,
Δ 2 ϕ ( x , y , t ) = 1 N x N y p = N x 2 + 1 N x 2 q = N y 2 + 1 N y 2 ( ξ p 2 + η q 2 ) 2 ϕ ^ ( ξ p , η q , t ) e i ( ξ p x + η q y ) .
To efficiently solve Equation (11), we use the linearly stabilized splitting method [32], which is known to improve numerical stability and allow for larger time steps without compromising the stability of the solution. The linearly stabilized splitting method is a semi-implicit time integration scheme designed for stiff or nonlinear PDEs, especially gradient-flow-type models. It adds and subtracts a linear stabilization term to the nonlinear component, which allows the linear part to be treated implicitly and the remaining nonlinear part explicitly. This approach improves stability and permits larger time steps without sacrificing accuracy. The method is particularly effective for phase-field equations such as the Allen–Cahn and Cahn–Hilliard models, and offers unconditional energy stability and computational efficiency by avoiding nonlinear solvers. It is widely used in simulations of pattern formation and long-time morphological evolution.
ϕ m n k + 1 ϕ m n k Δ t = Δ 2 ϕ k + 1 ϵ 2 Δ ϕ k + 1 + f ( ϕ k ) m n σ ϕ m n k + 1 ϕ ¯ m n ,
where Δ t is the temporal step size. We substitute Equations (8), (9), and (10) into Equation (11) to obtain
1 Δ t N x N y p = N x 2 + 1 N x 2 q = N y 2 + 1 N y 2 ( ϕ ^ p q k + 1 ϕ ^ p q k ) e i ( ξ p x m + η q y n ) = 1 N x N y p = N x 2 + 1 N x 2 q = N y 2 + 1 N y 2 ( ξ p 2 + η q 2 ) e i ( ξ p x m + η q y n ) 2 ϕ ^ p q k + 1 + ϵ 2 ( ξ p 2 + η q 2 ) ϕ ^ p q k + 1 + f ^ p q k σ N x N y p = N x 2 + 1 N x 2 q = N y 2 + 1 N y 2 e i ( ξ p x m + η q y n ) ϕ ^ p q k + 1 ϕ ¯ ^ p q ,
where ϕ ¯ ^ p q denotes the Fourier coefficient of the piecewise-defined field ϕ ¯ ( x , y ) , which characterizes the spatial heterogeneity across different subdomains.
Then, Equation (13) can be rearranged into the following form:
ϕ ^ p q k + 1 ϕ ^ p q k Δ t = ξ p 2 + η q 2 2 ϕ ^ p q k + 1 + ϵ 2 ( ξ p 2 + η q 2 ) ϕ ^ p q k + 1 + f ^ p q k σ ϕ ^ p q k + 1 ϕ ¯ ^ p q .
Consequently, the discrete Fourier transform takes the following form:
ϕ ^ p q k + 1 = ϕ ^ p q k / Δ t + σ ϕ ¯ ^ p q ( ξ p 2 + η q 2 ) f ^ p q k 1 / Δ t + σ + 2 ( ξ p 2 + η q 2 ) + ϵ 2 ( ξ p 2 + η q 2 ) 2 .
Finally, ϕ m n k + 1 can be obtained using Equation (7):
ϕ m n k + 1 = N x N y p = N x 2 + 1 N x 2 q = N y 2 + 1 N y 2 ϕ ^ p q k + 1 e i ( ξ p x m + η q y n ) .
For the implementation of homogeneous Neumann boundary conditions, one effective strategy is to employ the discrete cosine transform (DCT), which naturally accommodates zero-flux boundary conditions by enforcing symmetry at the domain boundaries. The DCT allows for efficient diagonalization of the discrete Laplacian operator under Neumann conditions, thereby facilitating fast and accurate computation in numerical schemes. This approach has been widely adopted in the recent literature due to its computational efficiency and compatibility with finite difference discretizations; see, for example, [33].

3. Computational Tests

This section presents a numerical investigation of the coarsening dynamics under various initial conditions and domains. First, let us consider the following initial condition for diblock copolymers:
ϕ ( x , y , 0 ) = 0.25 rand ( x , y ) + ϕ ¯ ( x , y ) ,
where ϕ ¯ ( x , y ) = 0.3 , if ( x 7.5 ) 2 + ( y 7.5 ) 2 > 5 , 0 , otherwise .
Here, rand ( x , y ) denotes a random number between 1 and 1 and ( x , y ) [ 0 , 15 ] × [ 0 , 15 ] . In this experiment, we fix the initial condition and all parameters except for the spatial resolution to investigate its influence on the solution. Specifically, we set h = L x / N x , ϵ = 0.03 , σ = 100 , and Δ t = 0.1 . As shown in Figure 1, we choose three spatial resolutions— N x = N y = 200 , 300, and 400—and examine the solution at time t = 12 , 000 Δ t . The differences are clearly visible: when the spatial resolution is low, as in Figure 1a, the solution appears non-smooth. As the spatial resolution increases, the solution becomes noticeably smoother and more regular.
Then, let us consider another initial condition for diblock copolymers:
ϕ ( x , y , 0 ) = 0.25 rand ( x , y ) + ϕ ¯ ( x , y ) ,
where ϕ ¯ ( x , y ) = 0.3 , if ( x 7.5 ) 2 + ( y 7.5 ) 2 5 , 0 , otherwise .
Figure 2 shows the numerical results at different evolution states. We use N x = N y = 500 , h = 0.03 , ϵ = h , and  Δ t = 0.1 . The computational results show well the coarsening dynamics of the nonlocal CH equation. Figure 2 shows the temporal evolution of the phase field variable ϕ , where the left snapshot corresponds to t = 100 Δ t while the right snapshot to t = 2000 Δ t . Initially, a disordered structure with high-frequency oscillations appears within a circular region as a result of the random perturbation that was applied to the central domain. Over time, as shown at time t = 100 Δ t , small-scale patterns begin to merge and form more coherent stripe-like morphologies. Eventually, at time t = 2000 Δ t , the system exhibits a significant reduction in the number of interfaces and forms well-defined, large-scale labyrinthine structures. The circular boundary remains intact throughout the process, due to the imposed initial configuration ϕ ¯ , which introduces a contrast between the inside and outside regions. These results effectively capture the phase separation and coarsening dynamics of the diblock copolymer system in regions characterized by different average values of the phase variable. We define the discrete total energy as
E h ( ϕ k ) = m = 1 N x n = 1 N y F ( ϕ m n k ) h 2 + h 2 N x N y p = N x / 2 + 1 N x / 2 q = N y / 2 + 1 N y / 2 ϵ 2 2 ( | ξ p ϕ ^ p q k | 2 + | η q ϕ ^ p q k | 2 ) + h 2 N x N y p = N x / 2 + 1 N x / 2 q = N y / 2 + 1 N y / 2 σ 2 ( | ξ p ψ ^ p q k | 2 + | η q ψ ^ p q k | 2 ) ,
where ψ is obtained by solving Δ ψ = ϕ ϕ ¯ . Figure 2 also shows the time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) . The normalized discrete total energy initially decreases over time and gradually stabilizes afterward.
Furthermore, we present the phase separation behavior with another initial condition via a nonlocal CH model for diblock copolymers. The initial condition is given by
ϕ ( x , y , 0 ) = 0.25 rand ( x , y ) + ϕ ¯ ( x , y ) ,
where ϕ ¯ ( x , y ) = 0.3 , if 3 ( x 7.5 ) 2 + ( y 7.5 ) 2 6 , 0 , otherwise .
A computational domain is given as [ 0 , 15 ] × [ 0 , 15 ] . Here, we use N x = N y = 500 , h = 0.03 , σ = 105 , ϵ = h , and Δ t = 0.1 . The final time is T = 800 .
Figure 3 shows the phase separation behaviors during evolution and illustrates the time evolution of the phase field governed by the nonlocal CH equation under a distinct annular initial configuration. The initial condition introduces a negative average phase value only in a ring-shaped region between two concentric circles. At the early stage, the phase field would exhibit a largely homogeneous pattern outside the ring, while fine-grained oscillatory structures emerge within the annular region. These features stem from the imposed random perturbation and the localized nonzero mean in the initial configuration. As time progresses ( t = 100 Δ t , the left snapshot in the Figure 3), the internal structure within the ring undergoes coarsening and results in a hexagonal dot pattern, whereas stripe-like morphologies appear in the surrounding region. This contrast in the evolved patterns reflects the effect of the spatial variation in the initial average phase distribution. Eventually, in the late stage ( t = 2000 Δ t , the right snapshot in the Figure 3), a well-organized pattern with a hexagonal dot structure appears inside the annular region, while elongated lamellae with clearly defined interfaces emerge in the other regions. These results demonstrate that spatially selective initial perturbations can effectively localize phase separation and pattern formation. This localization induces different morphological evolution within diblock copolymer systems that are described by the nonlocal CH equation. Figure 3 also shows the time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) . The normalized discrete total energy initially decreases over time and gradually stabilizes afterward.
Another initial condition is given as the shape of a zebra.
ϕ ( x , y , 0 ) = 0.25 rand ( x , y ) + ϕ ¯ ,
where ϕ ¯ = 0 , if ( x , y ) Ω zebra , 0.25 , otherwise .
Here, Ω z e b r a is defined as the domain of the shape of the zebra in this particular experiment. A computational domain is given as [ 0 , 29 ] × [ 0 , 22 ] . Parameter values are set to N x = 580 , N y = 440 , h = 0.1 , σ = 53 , ϵ = h , and Δ t = 0.001 . The final time is T = 10 .
Figure 4 describes the phase separation behaviors over time and illustrates the temporal evolution of phase separation governed by the nonlocal CH equation with an initial condition shaped like a zebra. In this setup, the phase variable ϕ is initialized to random values with an average ϕ ¯ = 0 within the zebra-shaped domain Ω zebra , while the region outside the shape is set to random values with an average ϕ ¯ = 0.25 . Initially, a disordered mixture of short stripe and dot-like patterns would emerge within the zebra-shaped region. The interfaces are irregular and the pattern has not yet coarsened significantly. As time progresses to t = 1000 Δ t (the left snapshot in the Figure 4), the internal structure becomes more organized, with the appearance of elongated stripe-like morphologies that begin to align spatially. The boundaries of the zebra remain sharply defined, which indicates that the pattern formation is effectively confined to the initial domain. Finally, at t = 10,000Δt (the right snapshot in the Figure 4), the internal morphology reaches a relatively steady configuration, characterized by well-developed and continuous stripe patterns with smooth interfaces. The zebra shape remains intact, and no significant evolution is observed in the outer region, which confirms that the spatially selective initialization effectively localizes the dynamic behavior of the system. These results demonstrate how complex morphological patterns, such as those resembling natural textures, can emerge and stabilize within geometrically constrained domains when driven by nonlocal interactions in the phase-field model. Figure 4 also shows the time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) . The normalized discrete total energy initially decreases over time and gradually stabilizes afterward.
In addition to the standard diblock copolymer case, we conducted experiments on diblock copolymers with local defectiveness. The initial condition is defined using the shape of a tapered trench.
ϕ ( x , y , 0 ) = 0.25 rand ( x , y ) + ϕ ¯ ( x , y ) , if ( x , y ) Ω trench , ϕ ¯ , otherwise . ,
where ϕ ¯ ( x , y ) = 0 , if ( x , y ) Ω trench , 0.7475 , otherwise .
Here, Ω trench is defined as the domain of the shape of the tapered trench in this particular experiment. A computational domain is given as [ 25 , 25 ] × [ 15 , 15 ] . Parameter values are set to N x = 500 , N y = 300 , h = 0.01 , σ = 100 , ϵ = 0.42 h , and Δ t = 1 . The final time is T = 5000 .
Figure 5 describes the phase separation behaviors over time. At the early stage, horizontal and continuous stripe structures would begin to appear along the edge regions inside the tapered trench, while the non-edge regions exhibit disordered short stripe structures. As the system evolves to t = 500 Δ t (the left snapshot in the Figure 5), the number of horizontal and continuous stripe structures increases along the edge regions of the trench interior, and elongated stripe patterns with partial spatial alignment emerge in the non-edge regions. By t = 5000 Δ t (the right snapshot in the Figure 5), the central area of the trench is fully characterized by horizontal and continuous stripe structures, the edge regions inside the trench show a further increase in such patterns, and the non-edge regions exhibit enhanced connectivity and smoother interfaces. Figure 5 also shows the time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) . The normalized discrete total energy initially decreases over time and gradually stabilizes afterward.

4. Conclusions

In this work, we have proposed a mathematical model for simulating the nonlocal CH equation with a space-dependent parameter, motivated by phase separation phenomena in diblock copolymers. The model incorporates spatially varying average values, which enables the simulation of heterogeneous systems through a piecewise-defined mean field formulation. A Fourier spectral method, combined with a linearly stabilized splitting method, has been used to efficiently solve the resulting equation. The numerical results confirm that the proposed method accurately captures the essential features of coarsening dynamics and phase separation patterns under various initial conditions. The influence of space-dependent terms on morphological evolution is clearly illustrated, and this result demonstrates the utility of the model in the description of complex spatial interactions. The approach is not limited to two subdomains and can be naturally extended to multiple subdomains, which offers broad applicability in the modeling of phase-field systems with spatial heterogeneity. Future work will focus on normalized time-fractional derivative [34], three-dimensional extensions, and adaptive mesh refinement strategies to further enhance computational efficiency and spatial resolution.

Author Contributions

All the authors contributed as follows. Conceptualization: J.K., X.W. and Z.L.; Methodology: J.K., X.W. and Z.L.; Validation: J.K., X.W. and Z.L.; Writing—Original Draft Preparation: J.K., X.W. and Z.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The original contribution presented in this study is included in Appendix A. Further inquiries can be directed to the corresponding author.

Acknowledgments

The authors express their gratitude to the reviewers for their valuable and insightful comments, which greatly contributed to improving the quality of this article.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A. MATLAB Program for the Proposed Method

This appendix presents the MATLAB program developed to implement the proposed numerical scheme.
Listing A1. MATLAB program.
clear;  % Clear all variables from the workspace

% Set grid parameters
Nx = 500; Ny = Nx;              % Number of grid points in x and y directions
hx = 0.03; hy = hx;                % Grid spacing in x and y directions
Lx = hx ∗ Nx; Ly = hy ∗ Ny; % Physical domain size in x and y

% Generate spatial grids (cell-centered)
x = linspace (0.5∗hx, Lx − 0.5∗hx, Nx);
y = linspace (0.5∗hy, Ly − 0.5∗hy, Ny)’;

% Define model parameters
epsilon = hx;              % Interfacial width parameter
Cahn = epsilon^2;      % Coefficient for Cahn-Hilliard diffusion
alpha = 100;                % Source term scaling parameter

% Generate 2D spatial mesh
[xx, yy] = meshgrid(x(1:end), y(1:end));

% Initialize average phase field aveM and perturbed field v
for i = 1:Nx
    for j = 1:Ny
        % Define average phase field aveM with circular interface
        if Lx/3 − sqrt((Lx/2 − x(i))^2 + (Ly/2 - y(j))^2) < 0
            aveM(i,j) = −0.3;   % Outside the circle
        else
            aveM(i,j) = 0;      % Inside the circle
        end
        % Add random perturbation to aveM
        v(i,j) = 0.5 ∗ (0.5−rand(1)) + aveM(i,j);
    end
end

% Define Fourier wave numbers for spectral derivatives
kx = 2∗pi/Lx ∗ fftshift(−Nx/2:Nx/2−1);  % Fourier modes in x
ky = 2∗pi/Ly ∗ fftshift(−Ny/2:Ny/2−1)’; % Fourier modes in y

% Compute squared wave numbers for Laplacian and bi-Laplacian operators
k2x = −kx.^2;
k2y = −ky.^2;
[kxxt, kyyt] = meshgrid(k2x, k2y);
kxx = kxxt’;
kyy = kyyt’;

% Set time integration parameters
dt = 0.1;
T = 50;
Nt = round(T/dt);  % Total number of time steps
ns = Nt / 10;          % Interval for visualization

% Time integration loop
for n = 1:Nt
    % Compute FFT of the right-hand side including source term
    v_hat = fft2(v + dt ∗ alpha ∗ aveM);
    vf = fft2(v.^3 - 3∗v);  % Nonlinear term in Fourier space

    % Compute denominator in semi-implicit update formula
    deno = (1.0+dt∗alpha-dt∗2∗(kxx+kyy)+dt∗Cahn∗(kxx+kyy).^2);

    % Semi-implicit update in Fourier space
    vnew = (v_hat + dt ∗ (kxx + kyy) .∗ vf) ./ deno;

    % Transform back to physical space
    v = real(ifft2(vnew));

    % Visualization every ns time steps
    if (mod(n, ns) == 0)
        figure (1);
        vv = v;
      vv(1,1)=−1; vv(end,end)= 1;  % Normalize extrema for visualization
      surf(xx, yy, −vv’);            % Plot the negative of v
      shading interp; colormap gray;
      % Smooth shading and grayscale colormap
      view (0,90); axis image;  % Top-down view, equal axis scaling
      drawnow;          % Update the figure window
      pause (0.01);         % Brief pause for rendering
    end
end

References

  1. Solano-López, P.; Saavedra, J.; Molina, R. Exploratory Study of a Green Function Based Solver for Nonlinear Partial Differential Equations. Algorithms 2024, 17, 564. [Google Scholar] [CrossRef]
  2. Daribayev, B.; Mukhanbet, A.; Azatbekuly, N.; Imankulov, T. A Quantum Approach for Exploring the Numerical Results of the Heat Equation. Algorithms 2024, 17, 327. [Google Scholar] [CrossRef]
  3. Singh, R.; Kumar, S. Lie Symmetry Analysis, Closed-Form Solutions and Dynamics for the Kinetics of Phase Separation in Iron (Fe–Cr–X (X = Mo, Cu)) Based on Ternary Alloys. Nonlinear Dyn. 2024, 112, 20255–20267. [Google Scholar] [CrossRef]
  4. Abazari, R.; Rezazadeh, H.; Akinyemi, L.; Inc, M. Numerical Simulation of a Binary Alloy of 2D CahnHilliard Model for Phase Separation. Comput. Appl. Math. 2022, 41, 389. [Google Scholar] [CrossRef]
  5. Martínez-Agustín, F.; Ruiz-Salgado, S.; Zenteno-Mateo, B.; Rubio, E.; Morales, M.A. 3D Pattern Formation from Coupled Cahn–Hilliard and Swift–Hohenberg Equations: Morphological Phases Transitions of Polymers, Bock and Diblock Copolymers. Comput. Mater. Sci. 2022, 210, 111431. [Google Scholar] [CrossRef]
  6. Garcke, H.; Kovács, B.; Trautwein, D. Viscoelastic Cahn–Hilliard Models for Tumor Growth. Math. Models Methods Appl. Sci. 2022, 32, 2673–2758. [Google Scholar] [CrossRef]
  7. Inguva, P.K.; Walker, P.J.; Yew, H.W.; Zhu, K.; Haslam, A.J.; Matar, O.K. Continuum-Scale Modelling of Polymer Blends Using the Cahn–Hilliard Equation: Transport and Thermodynamics. Soft Matter 2021, 17, 5645–5665. [Google Scholar] [CrossRef]
  8. Zhang, T.; Zhong, J.; Zhang, L. Multi-Objective Optimization Assisting Three-Dimensional Quantitative Cahn–Hilliard Simulations of Microstructure Evolution in Fe–Cr Alloys During Spinodal Decomposition. Comput. Mater. Sci. 2024, 244, 113260. [Google Scholar] [CrossRef]
  9. Mandolesi, B.; Iandiorio, C.; Belardi, V.G.; Vivio, F. Spinodal Decomposition-Inspired Metamaterial: Tailored Homogenized Elastic Properties via the Dimensionless Cahn–Hilliard Equation. Eur. J. Mech. A Solids 2025, 112, 105615. [Google Scholar] [CrossRef]
  10. Frohoff-Hülsmann, T.; Thiele, U. Nonreciprocal Cahn–Hilliard Model Emerges as a Universal Amplitude Equation. Phys. Rev. Lett. 2023, 131, 107201. [Google Scholar] [CrossRef]
  11. Zhiliakov, A.; Wang, Y.; Quaini, A.; Olshanskii, M.; Majd, S. Experimental Validation of a Phase-Field Model to Predict Coarsening Dynamics of Lipid Domains in Multicomponent Membranes. Biochim. Biophys. Acta Biomembr. 2021, 1863, 183446. [Google Scholar] [CrossRef]
  12. Novak, A.; Reinić, N. Shock Filter as the Classifier for Image Inpainting Problem Using the Cahn–Hilliard Equation. Comput. Math. Appl. 2022, 123, 105–114. [Google Scholar] [CrossRef]
  13. Li, L. On a Cahn–Hilliard–Oono Model for Image Segmentation. Asymptot. Anal. 2023, 132, 519–548. [Google Scholar] [CrossRef]
  14. Li, X.; Qiao, Z.; Wang, C. Stabilization Parameter Analysis of a Second-Order Linear Numerical Scheme for the Nonlocal Cahn–Hilliard Equation. IMA J. Numer. Anal. 2023, 43, 1089–1114. [Google Scholar] [CrossRef]
  15. Burkovska, O.; Gunzburger, M. On a Nonlocal Cahn-Hilliard Model Permitting Sharp Interfaces. Math. Models Methods Appl. Sci. 2021, 31, 1749–1786. [Google Scholar] [CrossRef]
  16. Xue, Z.; Zhai, S.; Zhao, X. Energy Dissipation and Evolutions of the Nonlocal Cahn-Hilliard Model and Space Fractional Variants Using Efficient Variable-Step BDF2 Method. J. Comput. Phys. 2024, 510, 113071. [Google Scholar] [CrossRef]
  17. Li, X.; Qiao, Z.; Wang, C. Convergence Analysis for a Stabilized Linear Semi-Implicit Numerical Scheme for the Nonlocal Cahn-Hilliard Equation. Math. Comput. 2021, 90, 171–188. [Google Scholar] [CrossRef]
  18. Liu, Z.; Li, X. The Fast Scalar Auxiliary Variable Approach with Unconditional Energy Stability for Nonlocal Cahn–Hilliard Equation. Numer. Methods Partial Differ. Equ. 2021, 37, 244–261. [Google Scholar] [CrossRef]
  19. Zhou, Q.; Sun, Y. Energy Stability of Exponential Time Differencing Schemes for the Nonlocal Cahn–Hilliard Equation. Numer. Methods Partial Differ. Equ. 2023, 39, 4030–4058. [Google Scholar] [CrossRef]
  20. Starn, J. A Simple Fluid Solver Based on the FFT. J. Graph. Tools 2001, 6, 43–52. [Google Scholar] [CrossRef]
  21. Durdiev, D.; Wendler, F. An Effective Fourier Spectral Phase-Field Approach for Ferroelectric Materials. Comput. Mater. Sci. 2023, 218, 111928. [Google Scholar] [CrossRef]
  22. Zhang, P.; Jia, J.; Jiang, X. Time-Splitting Fourier Spectral Method for Two-Dimensional Space Fractional Schrödinger-Poisson-Xα model. Appl. Math. Lett. 2025, 170, 109610. [Google Scholar] [CrossRef]
  23. Pindza, E.; Owolabi, K.M. Fourier Spectral Method for Higher Order Space Fractional Reaction–Diffusion Equations. Commun. Nonlinear Sci. Numer. Simul. 2016, 40, 112–128. [Google Scholar] [CrossRef]
  24. Pareschi, L.; Perthame, B. A Fourier Spectral Method for Homogeneous Boltzmann Equations. Transp. Theory Stat. Phys. 1996, 25, 369–382. [Google Scholar] [CrossRef]
  25. Zheng, N.; Li, X. Error Analysis of the SAV Fourier-Spectral Method for the Cahn–Hilliard–Hele–Shaw System. Adv. Comput. Math. 2021, 47, 1–27. [Google Scholar] [CrossRef]
  26. Cai, Z.; Lin, B.; Lin, M. A Positive and Moment-Preserving Fourier Spectral Method. SIAM J. Numer. Anal. 2024, 62, 273–294. [Google Scholar] [CrossRef]
  27. Nishiura, Y.; Ohnishi, I. Some Mathematical Aspects of the Micro-Phase Separation in Diblock Copolymers. Phys. D Nonlinear Phenom. 1995, 84, 31–39. [Google Scholar] [CrossRef]
  28. Kim, J. Modified Wave-Front Propagation and Dynamics Coming from Higher-Order Double-Well Potentials in the Allen–Cahn Equations. Mathematics 2024, 12, 3796. [Google Scholar] [CrossRef]
  29. Choi, J.; Ham, S.; Kwak, S.; Hwang, Y.; Kim, J. Stability Analysis of an Explicit Numerical Scheme for the Allen–Cahn Equation with High-Order Polynomial Potentials. AIMS Math. 2024, 9, 19332–19344. [Google Scholar] [CrossRef]
  30. Lee, G.; Lee, S. Study on Decoupled Projection Method for Cahn–Hilliard Equation. J. KSIAM 2023, 27, 272–280. [Google Scholar] [CrossRef]
  31. Ju, L.; Li, X.; Qiao, Z. Fully discrete Fourier spectral schemes for a nonlocal Cahn–Hilliard equation. IMA J. Numer. Anal. 2021, 41, 1246–1275. [Google Scholar] [CrossRef]
  32. Eyre, D.J. An Unconditionally Stable One-Step Scheme for Gradient Systems. Unpubl. Manuscr. 1998, 6. Available online: http://www.math.utah.edu/~eyre/research/methods/ch_numer.ps (accessed on 16 April 2020).
  33. Hwang, Y.; Ham, S.; Lee, H.G.; Kim, H.; Kim, J. Numerical Algorithms for the Phase-Field Models Using Discrete Cosine Transform. Mech. Res. Commun. 2024, 139, 104305. [Google Scholar] [CrossRef]
  34. Kim, J. Influence of Fractional Order on the Behavior of a Normalized Time-Fractional SIR Model. Mathematics 2024, 12, 3081. [Google Scholar] [CrossRef]
Figure 1. (ac) are the snapshots of numerical solutions of the nonlocal CH model (4) with the initial condition (18) using N x = N y = 200 , N x = N y = 300 , and N x = N y = 400 , respectively, at time t = 12,000Δt.
Figure 1. (ac) are the snapshots of numerical solutions of the nonlocal CH model (4) with the initial condition (18) using N x = N y = 200 , N x = N y = 300 , and N x = N y = 400 , respectively, at time t = 12,000Δt.
Algorithms 18 00365 g001
Figure 2. Time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) .
Figure 2. Time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) .
Algorithms 18 00365 g002
Figure 3. Time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) .
Figure 3. Time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) .
Algorithms 18 00365 g003
Figure 4. Time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) .
Figure 4. Time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) .
Algorithms 18 00365 g004
Figure 5. Time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) .
Figure 5. Time evolution of the normalized discrete total energy E h ( ϕ k ) / E h ( ϕ 0 ) .
Algorithms 18 00365 g005
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Li, Z.; Wu, X.; Kim, J. An Efficient Computational Algorithm for the Nonlocal Cahn–Hilliard Equation with a Space-Dependent Parameter. Algorithms 2025, 18, 365. https://doi.org/10.3390/a18060365

AMA Style

Li Z, Wu X, Kim J. An Efficient Computational Algorithm for the Nonlocal Cahn–Hilliard Equation with a Space-Dependent Parameter. Algorithms. 2025; 18(6):365. https://doi.org/10.3390/a18060365

Chicago/Turabian Style

Li, Zhengang, Xinpei Wu, and Junseok Kim. 2025. "An Efficient Computational Algorithm for the Nonlocal Cahn–Hilliard Equation with a Space-Dependent Parameter" Algorithms 18, no. 6: 365. https://doi.org/10.3390/a18060365

APA Style

Li, Z., Wu, X., & Kim, J. (2025). An Efficient Computational Algorithm for the Nonlocal Cahn–Hilliard Equation with a Space-Dependent Parameter. Algorithms, 18(6), 365. https://doi.org/10.3390/a18060365

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop