One of the greatest challenges in the area of applied mathematics continues to be the design of numerical methods capable of approximating the solution of partial differential equations quickly and accurately. One of the most important equations, due to the hydraulic and transport applications it has, and the large number of difficulties that it usually presents when solving it numerically is the Diffusion Equation.
In the present work, a Method of Lines applied to the numerical solution of the said equation in irregular regions is presented using a scheme of Generalized Finite Differences. A series of tests and numerical results are presented, which show the accuracy of the proposed method.
keywords Generalized Finite Differences, Method of Lines, Diffusion Equation, Irregular Regions
When a substance is been transported with a speed equal to zero, i.e. no flow moves it, then, according to the transport equation [1], the initial profile of the substance should remain the same as time goes by, maintaining the substance concentration at each point in the fluid.
However, in practice, this does not happen due to molecular diffusion; this is due to the molecules are in constant motion, causing collisions and rebounds in different directions. The molecules will tend to separate, or diffuse, within the flow. In general, this movement moves from areas with a higher density of molecules to areas with a lower density.
Taking into account that the diffusive flux of a substance, in any part of a system is proportional to the gradient of its density, then it can be written as:
|
(1) |
where represents the diffusion coefficient, which tells how easy a substance diffuses in a medium.
Since the change in total mass in a given interval is due to the flux at the extreme points, then
|
Assuming enough smoothness for the functions and , the expression can be written as
|
Since this integral must be equal to zero for any and values, then the integrand must be identically zero. This is,
|
(2) |
which is a formula know as a conservation law.
Replacing the flow equation (1) in the conservation law (2) it is possible to obtain,
|
which, making some pertinent derivations, takes the form
|
(3) |
which is known as the diffusion equation in a spatial dimension. This equation is also known as the heat equation, since heat diffuses in a similar way.
This same idea can be extended [2], following a similar process to the previous one, to define the diffusion equation in a plane as
|
(4) |
For the case of interest of this work, it is important to obtain an approximation in generalized finite differences, for the spatial part, to the solution of the problem
|
Where is a simply connected planar domain, and its boundary, , is a positively oriented Jordan polygon, as the domain shown in Figure 1.
In this case, for the temporal discretization, a Method of Lines is proposed [3].
Figure 1: Example of an domain. |
For the case of diffusion equation
|
it is possible to discretize the spatial derivatives applying a generalized finite differences method, for that it is convenient to considerate the approximation to the second order linear operator
|
(5) |
where , , , , , and are given functions. Within an arbitrary distribution of nodes, as the one presented on Figure 2, it is possible to approximate its value at a node using values of at some neighbor nodes , [4]. For this work, a finite difference scheme is applied at the node , which can be written as a linear combination as
|
(6) |
where are adequate weighs.
Figure 2: Arbitrary distribution of and its neghbors. |
According to [5,6], a finite difference scheme is consistent with the linear operator if the local truncation error satisfies that
|
(7) |
as , , , .
Using the six first terms of Taylor's series expansion, up to second order, of the consistency condition (7), it is possible to obtain the system
|
(8) |
where and . In order to solve this linear system, it is possible to separate the first equation of the system (8)
|
(9) |
and then, the problem defined by
|
(10) |
can be solved using the reduced Cholesky factorization of its normal equations, as in [7], namely
|
where
|
The value of is then obtained from (9) assuming, for the case of the diffusion equation, .
Now, the scheme defined by (10) can be used to approximate the linear operator
|
taking , and . The resulting coefficients, define the Finite-Difference Scheme
|
(11) |
for diffusion equation, where represent the time level and is the approximation to the solution in the point at time .
An important issue to be taken into account is the number of neighbors, , to use in the scheme. In this paper, 8 neighbor points were taken into account following the stencil shown in Figure 3.
Figure 3: Centered stencil used in the scheme. |
Once a discretization of the spatial operator is obtained, the problem of finding an approximation to the solution of the diffusion equation
|
can be solved as a linear system of ordinary differential equations in time; which can be solved through a Runge-Kutta method. In the present work it is proposed to use Runge-Kutta [8] of order 2, 3, and 4 as follows:
|
where
|
|
|
where
|
|
|
|
where
|
|
|
|
in all the cases, represents the time level.
To show the performance of the proposed scheme, the problem of obtaining a numerical solution to diffusion equation on three different regions was proposed. The three regions, denoted as CAB, MID and UP, are non-rectangular planar domains and are shown on Figures 4a to 5.
(a) CAB region. | (b) MID region. |
Figure 4 |
Figure 5: UP region. |
All the regions were scaled to fit on , and meshed with nodes, following a variational procedure implemented in UNAMalla [9], then they were subdivided to obtain meshes with nodes.
For all the regions, the initial and boundary conditions were taken from the closed form solution:
|
The time interval was subdivided with different discretizations, the number of time steps was chosen to satisfy the classical Courant condition [10]:
|
where and are the spatial steps on each grid, taken from the meshes with nodes, and .
The norm of the quadratic error, at a th time level, can be computed as
|
where and are the approximated and theoretical solutions, respectively, at the -th grid node, and is the area of the polygon defined by the points , , and .
The set of Figures 6 to 9 presents a comparison of the numerical results obtained, for some time levels, with the proposed scheme using the fourth order Runge-Kutta approximation and the exact solution for CAB region. The approximation is presenten on the left, and the exact solution on the right.
Figure 6: Comparison between numerical results (left) and exact solution (right) for CAB region at s. |
Figure 7: Comparison between numerical results (left) and exact solution (right) for CAB region at s. |
Figure 8: Comparison between numerical results (left) and exact solution (right) for CAB region at s. |
Figure 9: Comparison between numerical results (left) and exact solution (right) for CAB region at s. |
In a similar way, the sets of Figures 10 to 13, and 14 to 17 present the respective comparisons for the MID and the UP regions.
Figure 10: Comparison between numerical results (left) and exact solution (right) for MID region at s. |
Figure 11: Comparison between numerical results (left) and exact solution (right) for MID region at s. |
Figure 12: Comparison between numerical results (left) and exact solution (right) for MID region at s. |
Figure 13: Comparison between numerical results (left) and exact solution (right) for MID region at s. |
Figure 14: Comparison between numerical results (left) and exact solution (right) for UP region at s. |
Figure 15: Comparison between numerical results (left) and exact solution (right) for UP region at s. |
Figure 16: Comparison between numerical results (left) and exact solution (right) for UP region at s. |
Figure 17: Comparison between numerical results (left) and exact solution (right) for UP region at s. |
Table 1 shows the results of the computed quadratic errores computed for all the test on CAB region. All the methods are reported with the following names: RKN, where N represents the Runge-Kutta order. Analogously, Tables 2 and 3 present the results for MID and UP regions respectively.
CAB region | |||
Method | time | nodes | |
RK2 | s | ||
s | |||
s | |||
s | |||
RK3 | s | ||
s | |||
s | |||
s | |||
RK4 | s | ||
s | |||
s | |||
s |
MID region | |||
Method | time | nodes | |
RK2 | s | ||
s | |||
s | |||
s | |||
RK3 | s | ||
s | |||
s | |||
s | |||
RK4 | s | ||
s | |||
s | |||
s |
UP region | |||
Method | time | nodes | |
RK2 | s | ||
s | |||
s | |||
s | |||
RK3 | s | ||
s | |||
s | |||
s | |||
RK4 | s | ||
s | |||
s | |||
s |
It can be observed in the results presented in this work that the Line Method proposed for the solution of the diffusion equation produces satisfactory numerical solutions of the equation. In the tests carried out, no spurious oscillations or instabilities were perceived; Furthermore, it is shown that the approximations are more precise when using a fourth-order Runge-Kutta method.
It is possible to appreciate that with the presented discretizations, even with the second-order Runge-Kutta method, acceptable numerical results can be obtained. Additionally, the numerical results in Tables 1 to 3 show that a refinement of the spatial mesh can improve the approximations carried out with the method; as expected in this kind of methods. It is worth mentioning that, for all the tests, a minimum number of time steps was used, taking into account the classical theory for the diffusion equation, which makes the computational cost of this method low, since it does not require making very small temporary discretizations, as in other cases.
We want to thank AULA CIMNE-Morelia and CIC-UMSNH for the financial support for this work.
Special thanks to the ``Laboratorio de Matemáticas Aplicadas of the ``Facultad de Ciencias Físico-Matemáticas at ``Universidad Michoacana de San Nicolás de Hidalgo for lending their computational infrastructure.
[1] Gerardo Tinoco-Guerrero and Francisco Javier Domínguez-Mota and José Gerardo Tinoco-Ruiz and Juan Salvador Lucas-Martínez. (2018) "Aproximación de la Ecuación de Advección en Regiones Irregulares Utilizando un Método de Líneas y Diferencias Finitas Generalizadas", Volume 2. Revista Mexicana de Métodos Numéricos 2
[2] Victorita Dolean and Pierre Jolivet and Frédéric Nataf. (2015) "An Introduction to Domain Decomposition Methods: Algorithms, Theory, and Parallel Implementation". Society for Industrial and Applied Mathematics
[3] William Schiesser. (1991) "The Numerical Method of Lines". San Diego : Academic Press
[4] Gerardo Tinoco-Guerrero and Francisco Javier Domínguez-Mota and José Gerardo Tinoco-Ruiz. (2015) "Numerical Solution of Advection Equations Using Structured Grids on Plane Irregular Regions With a Finite Differences Scheme", Volume 1. Boletón de la Sociedad Mexicana de Computación Científica y Sus Aplicaciones 3 29 - 32
[5] John C. Strikwerda. (2004) "Finite Difference Schemes and Partial Differential Equations". Society for Industrial and Applied Mathematics
[6] J. W. Thomas. (1995) "Numerical Partial Differential Equations: Finite Difference Methods", Volume 2. Springer
[7] Gerardo Tinoco-Guerrero and Francisco Javier Domínguez-Mota and José Gerardo Tinoco-Ruiz. (2020) "A Study of the Stability for a Generalized Finite-Difference Scheme Applied to the Advection-Diffusion Equation", Volume 176. Mathematics and Computer in Simulations 301 - 311
[8] J. C. Butcher. (1969) "Conference on the Numerical Solution of Differential Equations", Volume 109. Springer 133 - 139
[9] UNAMalla. (2011) "An Automatic Package for Numerical Grid Generation"
[10] Michael B. Abbott and Andrew D. McCowan and Ian R. Warren. (1984) "Accuracy of Short-Wave Numerical Models", Volume 110. Journal of Hydraulic Engineering 10 1287 - 1301
Published on 14/06/22
Accepted on 07/06/22
Submitted on 19/09/21
Volume 38, Issue 2, 2022
DOI: 10.23967/j.rimni.2022.06.003
Licence: CC BY-NC-SA license