Crank-Nicolson Finite Difference Scheme for the 3D Allen-Cahn Equation with PINN Comparison ()
Keywords:
1. Introduction
The Allen-Cahn equation is an important phase-field model, proposed by Allen and Cahn in 1979 [1], for describing phase separation and phase transition processes in alloy materials. This equation has wide applications in fields such as materials science, biology, and image processing, particularly playing a key role in simulating interface evolution. In this paper, we investigate the numerical approximation of the three-dimensional Allen-Cahn equation using a Crank-Nicolson scheme.
(1)
(2)
(3)
where,
is a cubic region in
,
is the boundary of
, the perturbation factor
represents the width of the interface, and the non-linear term
represents the polynomial double-well potential.
Extensive research has been conducted on finite difference schemes for the Allen-Cahn equation [2]-[6]. Evans et al. [7] demonstrated that the exact solution of the Allen-Cahn equation satisfies the maximum principle and energy stability. Tang et al. [8] proposed a first-order linear explicit-implicit scheme and proved
that it adheres to the discrete maximum principle when
, while also
analyzing its discrete energy stability. Li et al. [9] proposed a stabilized second-order CN/AB finite difference scheme for the Riesz space-fractional Allen-Cahn equation with logarithmic free energy. Under suitable constraints on the time step and stabilization parameter, they proved that the scheme preserves the discrete maximum bound principle, maximum-norm stability, discrete energy stability, and
error estimates, verified by numerical experiments. Chu et al. [10] constructed a second-order Crank-Nicolson difference scheme for the one-dimensional Allen-Cahn equation, proving the existence of the difference solution and its adherence to the discrete maximum principle, and further demonstrating the unconditional convergence of the numerical solution in the infinity norm.
In this paper, we develop a second-order Crank-Nicolson finite difference scheme for the three-dimensional Allen-Cahn equation and provide an analysis of its truncation error. We prove the existence, uniqueness, and convergence of the discrete solution under this scheme, and further establish its adherence to the discrete maximum principle. In the numerical experiments, the first two test cases validate the discrete maximum principle, while the third test case involves fitting the equation using both the Crank-Nicolson scheme and the Physics-Informed Neural Network (PINN) algorithm. Using the Crank-Nicolson solution as a benchmark, we compare the
and
errors of the PINN algorithm under various network architectures and visualize the isosurface plots at identical time slices. The results demonstrate a high degree of consistency between the two methods. All three test cases confirm the feasibility and effectiveness of the proposed approach.
2. Construction of the Difference Scheme
Let
and
be positive integers. Partition the interval
into
equal subintervals and the interval
into
equal subintervals. Set
,
, and
,
,
, for
, and
. Here
and
denote the spatial and temporal step sizes, respectively. Let
,
, and
, A point
is called a grid node. For any grid function
defined on
, we introduce the following notations:
Denote
Evaluating the Allen-Cahn equation at the grid point
yields:
To ensure the validity of the Taylor expansions used below, we assume that the exact solution
is sufficiently smooth, in particular that all mixed time derivatives up to third order and spatial derivatives up to fourth order exist and are continuous in
.
where
denotes the truncation remainder term.
Neglecting the truncation error
and replacing
by
in the Taylor expansion, we obtain the following difference scheme
(4)
(5)
(6)
Denote
Set
Then the local truncation error satisfies
3. Main Results
We begin by introducing some notations. For grid functions
and
defined on
, define the discrete inner product and norms by:
Lemma 1 (Browder fixed point theorem). Let
be a finite dimensional inner product space,
the associated norm,
be continuous. Assume that
,
,
, there is
,
such that
, and
.
Theorem 2. The difference scheme (4)-(6) admits at least one solution.
Proof. Clearly, the Crank-Nicolson discretization of the Allen-Cahn equation leads to a two-level nonlinear difference scheme. Assume that the grid values
at time level
are given. Then the discrete system can be regarded as a nonlinear algebraic system for the midpoint values
. Once the midpoint values
are determined, the solution at the next time level is recovered by
.
Denote
, the difference scheme can be written as
Let
.
(7)
Hence, under the conditions
, and
, it follows that
. By Lemma 1, a solution to the difference scheme exists.
Theorem 3. Given the current time level
is known, if the time step size satisfies
, then the solution at the next time level
is unique.
Proof. Assume that there exist two solutions
and
.Hence,
Subtracting the above two equations and letting
, we can obtain,
(8)
Taking the discrete
inner product with
,
(9)
Expand
.
Thus
(10)
Substituting (8), (9) and (10), we obtain
Hence
In Theorem 2, we proved that when
, the solution of the difference scheme exists. Therefore,
and
.
Lemma 4. [10] Define
is bounded continuous functions on R.
,
.
satisfies the Lipschitz condition, for any
,
with
.
Lemma 5. Let
. Let
, we have the following relationship among the norms:
In order to consider the convergence of difference schemes (4)-(6), we discuss the following difference scheme:
(11)
(12)
(13)
Theorem 6. Assume that
is the exact solution of Equations (1)-(3).
is the solution of (11)-(13). Denote
as the error,
There exists a constant
independent of
and
such that
Proof. Subtracting Equation (1) from (11), we obtain the following error equation
(14)
(15)
(16)
Now, we aim to estimate
. Taking the product of (14) with
, summing over
from 1 to
, and simplifying the resulting expression yields, we have
(17)
On the left-hand side, we have
(18)
The first term on the right-hand side,
(19)
For the second term on the right-hand side, by Young’s inequality to obtain
(20)
The third term on the right-hand side,
(21)
The fourth term on the right-hand side,
(22)
Substituting Equations (18)-(22) into Equation (17), we obtain
(23)
Hence,
Define
We can obtain
(24)
By the above inequality (24), we obtain
When
,
, and
, thus,
Now we focus on the estimates of
.
Adding the above three terms, we obtain
Thus,
Theorem 7. The numerical of the fully discrete scheme (4)-(6) converges to the solution of the problem (1)-(3), provided that the step size satisfies
.
Proof. We need to prove that the difference scheme (11)-(13) is equivalent to the difference scheme (4)-(6). Since the solution of the difference scheme (11)-(13) converges to that of the scheme (1)-(3), it follows that when
, we have
Since
we obtain
Thus #Math_177#, and the difference scheme (4)-(6) converges to (1)-(3).
Theorem 8. If the initial value
is bounded by 1, then for
and for each time level
, it holds that
.
Proof. According to Theorem 8,
We can obtain,
the solution of the Allen-Cahn equation
, hence
.When
and
,
. Therefore,
It holds that
.
4. Numerical Experiment
We performed three numerical experiments to test our hypotheses. Tests 1 - 2 verify the maximum-value theorem: with initial data bounded by 1, the solution remains ≤ 1. Test 3 uses the Crank-Nicolson (CN) scheme from this paper as the reference to compare
and
errors between PINN and CN. Because the problem is high-dimensional, we compare isosurfaces on identical time slices rather than full 3D visualization.
We first provide a brief introduction to the Physics-Informed Neural Network (PINN) algorithm (for detailed discussion, refer to [11]).
Physics-Informed Neural Networks (PINNs) combine deep learning with physical models to solve partial differential equations (PDEs). As depicted in Figure 1, PINNs incorporate PDE residuals, boundary conditions, and initial conditions into the loss function. Through backpropagation, the network minimizes this loss, yielding accurate numerical solutions that satisfy the governing physics.
![]()
Figure 1. Illustration of the PINN framework.
Physics Loss: The residual of the equation is defined as:
All derivatives are computed via automatic differentiation from the neural network’s output. The physics loss is the mean squared error of the residual over
randomly sampled collocation points in the domain:
Boundary Loss: The boundary loss ensures that the neural network satisfies the Dirichlet boundary condition
on the six faces of the domain
for all
. The boundary loss is defined as the mean squared error of the network’s output at
randomly sampled points on the boundary:
where
are boundary points. This loss enforces the physical constraint that the solution remains zero at the domain boundaries, enhancing the solution’s accuracy and physical consistency.
Initial Condition Loss: The initial condition loss ensures that the neural network’s output at
matches the prescribed initial condition. This loss is computed as the mean squared error over
randomly sampled points in the spatial domain at
:
Total Loss Function: The total loss function, which is the objective of the PINN training, is a weighted sum of the three components:
where
and
are weighting coefficients determined through experimentation to balance the contributions of the physics, initial condition, and boundary losses.
Example 4.1. We consider the three-dimensional Allen-Cahn equation subject to an initial condition.
For other relevant parameters, we denote
,
,
. We take
. We consider the second-order Crank-Nicolson scheme with varying time step sizes. The following three figures illustrate the evolution of the infinity norm
of the solution under different time steps. From Figure 2, it can be observed that the scheme satisfies the maximum principle.
Example 4.2. Consider:
The parameter settings are identical to those in Example 4.1. This example also plots the infinity norm of u, denoted as
, for each time step under
. As shown in Figure 3, the results similarly satisfy the maximum principle.
Example 4.3. Consider:
In the Crank-Nicolson finite-difference scheme we set the parameters
,
![]()
Figure 2. Maximum values for scheme (4) with time step
and
.
![]()
Figure 3. Maximum values for scheme (4) with time step
and
.
,
and
. For the PINN algorithm, training was performed
using the Adam optimizer with a learning rate of 10−3 to minimize the loss. The weights of the two loss terms,
and
, were both set to 10. Network parameters were initialized using the Xavier scheme. During training, we randomly sampled 30,000 collocation (physics) points, 12,000 boundary points, and 10,000 initial-condition points for optimization; the training proceeded for a total of 20,000 iterations. We computed the
and
errors for different network architectures. Table 1 shows these results; the 8 × 60 architecture (eight hidden layers with 60 neurons per layer) produced the smallest
and
errors.
![]()
Table 1.
and
errors under different network architectures.
Because the equation is high-dimensional, direct visualization of the full solution is infeasible. To facilitate presentation, we generated isosurface renderings of
at the time slices
using both a Crank-Nicolson finite-difference scheme and a physics-informed neural network (PINN); the results are shown in Figure 4 and Figure 5. In future work, PINNs and their improved variants can be integrated into the Allen-Cahn framework to achieve higher-accuracy computations.
5. Conclusions and Suggestions
In this paper, we establish a Crank-Nicolson finite difference scheme for the three-dimensional Allen-Cahn equation and rigorously prove key properties of its solutions, including existence, uniqueness, and the maximum principle. These theoretical results lay a solid mathematical foundation for numerical simulations.
In the numerical experiments, we first validate the effectiveness of the maximum principle. Subsequently, employing the Crank-Nicolson scheme as the benchmark solution, we utilize the Physics-Informed Neural Network (PINN) algorithm to approximate the equation and compute the
and
errors. The results indicate satisfactory accuracy of the PINN algorithm, highlighting its
![]()
Figure 4. Contour plots of
for difference scheme (4) at
and 0.9.
![]()
![]()
Figure 5. Contour plots of
for PINN at
and 0.9.
potential for solving phase-field equations of this type. Visualization further corroborates these findings: isosurface plots of the Crank-Nicolson scheme and PINN algorithm at identical time slices exhibit high consistency.
In the future, the PINN algorithm can be extended to more complex Allen-Cahn equations and their variants, offering efficient computational tools for phase-field modeling.
Acknowledgements
I would like to thank the ISCAM 2025 Organizing Committee for providing me with the opportunity to submit this paper.