# Analytical and Numerical Results for the Transient Diffusion Equation with Diffusion Coefficient Depending on Both Space and Time

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Analytical Solution

## 3. The Procedure of the Numerical Solution

#### 3.1. The Spatial and Temporal Discretization

#### 3.2. The Applied 18 Numerical Algorithms

_{i}. This assures stability and, at the same time, quite quick convergence. At the next points, we give the concrete formulas with which the structures can be filled. In the case of the theta-formula, we just give the value of the parameter θ.

## 4. Numerical Results with Fixed Time-Step Sizes

#### 4.1. Experiment 1 with Small Value of Parameter m

#### 4.2. Experiment 2 with Large Value of Parameter m

## 5. Numerical Results with Adaptive Time-Step Sizes

**The LNe3 method**

**The CLL method**

**Runge–Kutta Cash–Karp Method RKCK**

**Runge–Kutta–Fehlberg Method**

#### 5.1. Experiment 1 with Adaptive Solvers

#### 5.2. Experiment 2 with Adaptive Solvers

## 6. Discussion and Summary

## Author Contributions

## Funding

## Data Availability Statement

## Conflicts of Interest

## References

- Lienhard, J.H.L., IV.; Lienhard, J.H. A Heat Transfer Textbook, 4th ed.; Phlogiston Press: Cambridge, MA, USA, 2017; ISBN 9780971383524. [Google Scholar]
- Jacobs, M.H. Diffusion Processes; Springer: Berlin/Heidelberg, Germany, 1935; ISBN 978-3-642-86414-8. [Google Scholar]
- Yu, H.; Yao, L.; Ma, Y.; Hou, Z.; Tang, J.; Wang, Y.; Ni, Y. The Moisture Diffusion Equation for Moisture Absorption of Multiphase Symmetrical Sandwich Structures. Mathematics
**2022**, 10, 2669. [Google Scholar] [CrossRef] - Reguera, D.; Rubí, J.M. Kinetic equations for diffusion in the presence of entropic barriers. Phys. Rev. E
**2001**, 64, 061106. [Google Scholar] [CrossRef][Green Version] - Zwanzig, R. Diffusion past an entropy barrier. J. Phys. Chem.
**1992**, 96, 3926–3930. [Google Scholar] [CrossRef] - Wolfson, M.; Liepold, C.; Lin, B.; Rice, S.A. A comment on the position dependent diffusion coefficient representation of structural heterogeneity. J. Chem. Phys.
**2018**, 148, 194901. [Google Scholar] [CrossRef][Green Version] - Berezhkovskii, A.; Hummer, G. Single-File Transport of Water Molecules through a Carbon Nanotube. Phys. Rev. Lett.
**2002**, 89, 064503. [Google Scholar] [CrossRef] [PubMed] - Kärger, J.; Ruthven, D.M. Diffusion in Zeolites and other Microporous Solids; Wiley: New York, NY, USA, 1992; ISBN 0-471-50907-8. [Google Scholar]
- Hille, B. Ion Channels of Excitable Membranes, 3rd ed.; Oxford University Press Inc.: New York, NY, USA, 2001; ISBN 9780878933211. [Google Scholar]
- Amiri, S.; Mazaheri, M.; Gilan, N.B. Introducing a new method for calculating the spatial and temporal distribution of pollutants in rivers. Int. J. Environ. Sci. Technol.
**2021**, 18, 3777–3794. [Google Scholar] [CrossRef] - Hefny, M.M.; Tawfik, A.M. The Fate of Molecular Species in Water Layers in the Light of Power-Law Time-Dependent Diffusion Coefficient. Symmetry
**2022**, 14, 1146. [Google Scholar] [CrossRef] - Mátyás, L.; Barna, I.F. General Self-Similar Solutions of Diffusion Equation and Related Constructions. Rom. J. Phys.
**2022**, 67, 101. [Google Scholar] - Barna, I.F.; Mátyás, L. Advanced Analytic Self-Similar Solutions of Regular and Irregular Diffusion Equations. Mathematics
**2022**, 10, 3281. [Google Scholar] [CrossRef] - Savović, S.; Djordjevich, A. Numerical solution of the diffusion equation describing the flow of radon through concrete SEQ CHAPTER. Appl. Radiat. Isot.
**2008**, 66, 552–555. [Google Scholar] [CrossRef] [PubMed] - Jejeniwa, O.A.; Gidey, H.H.; Appadu, A.R. Numerical Modeling of Pollutant Transport: Results and Optimal Parameters. Symmetry
**2022**, 14, 2616. [Google Scholar] [CrossRef] - Kumar, V.; Chandan, K.; Nagaraja, K.V.; Reddy, M.V. Heat Conduction with Krylov Subspace Method Using FEniCSx. Energies
**2022**, 15, 8077. [Google Scholar] [CrossRef] - Mbroh, N.A.; Munyakazi, J.B. A robust numerical scheme for singularly perturbed parabolic reaction-diffusion problems via the method of lines. Int. J. Comput. Math.
**2021**, 99, 1139–1158. [Google Scholar] [CrossRef] - Fteiti, M.; Ghalambaz, M.; Sheremet, M.; Ghalambaz, M. The impact of random porosity distribution on the composite metal foam-phase change heat transfer for thermal energy storage. J. Energy Storage
**2023**, 60, 106586. [Google Scholar] [CrossRef] - Essongue, S.; Ledoux, Y.; Ballu, A. Speeding up mesoscale thermal simulations of powder bed additive manufacturing thanks to the forward Euler time-integration scheme: A critical assessment. Finite Elements Anal. Des.
**2022**, 211, 103825. [Google Scholar] [CrossRef] - Beuken, L.; Cheffert, O.; Tutueva, A.; Butusov, D.; Legat, V. Numerical Stability and Performance of Semi-Explicit and Semi-Implicit Predictor–Corrector Methods. Mathematics
**2022**, 10, 2015. [Google Scholar] [CrossRef] - Ji, Y.; Xing, Y. Highly Accurate and Efficient Time Integration Methods with Unconditional Stability and Flexible Numerical Dissipation. Mathematics
**2023**, 11, 593. [Google Scholar] [CrossRef] - Fedoseev, P.; Pesterev, D.; Karimov, A.; Butusov, D. New Step Size Control Algorithm for Semi-Implicit Composition ODE Solvers. Algorithms
**2022**, 15, 275. [Google Scholar] [CrossRef] - Ndou, N.; Dlamini, P.; Jacobs, B.A. Enhanced Unconditionally Positive Finite Difference Method for Advection–Diffusion–Reaction Equations. Mathematics
**2022**, 10, 2639. [Google Scholar] [CrossRef] - Appadu, A.R. Performance of UPFD scheme under some different regimes of advection, diffusion and reaction. Int. J. Numer. Methods Heat Fluid Flow
**2017**, 27, 1412–1429. [Google Scholar] [CrossRef][Green Version] - Karahan, H. Unconditional stable explicit finite difference technique for the advection-diffusion equation using spreadsheets. Adv. Eng. Softw.
**2007**, 38, 80–86. [Google Scholar] [CrossRef] - Sanjaya, F.; Mungkasi, S. A simple but accurate explicit finite difference method for the advection-diffusion equation. J. Phys. Conf. Ser.
**2017**, 909, 012038. [Google Scholar] [CrossRef] - Pourghanbar, S.; Manafian, J.; Ranjbar, M.; Aliyeva, A.; Gasimov, Y.S. An Efficient Alternating Direction Explicit Method for Solving a Nonlinear Partial Differential Equation. Math. Probl. Eng.
**2020**, 2020, 9647416. [Google Scholar] [CrossRef] - Harley, C. Hopscotch method: The numerical solution of the Frank-Kamenetskii partial differential equation. Appl. Math. Comput.
**2010**, 217, 4065–4075. [Google Scholar] [CrossRef] - Al-Bayati, A.Y.; Manaa, S.A.; Al-Rozbayani, A.M. Comparison of Finite Difference Solution Methods for Reaction Diffusion System in Two Dimensions. AL-Rafidain J. Comput. Sci. Math.
**2011**, 8, 21–36. [Google Scholar] [CrossRef][Green Version] - Nwaigwe, C. An Unconditionally Stable Scheme for Two-Dimensional Convection-Diffusion-Reaction Equations. Available online: https://www.researchgate.net/publication/357606287_An_Unconditionally_Stable_Scheme_for_Two-Dimensional_Convection-Diffusion-Reaction_Equations (accessed on 27 February 2023).
- Savović, S.; Drljača, B.; Djordjevich, A. A comparative study of two different finite difference methods for solving advection–diffusion reaction equation for modeling exponential traveling wave in heat and mass transfer processes. Ric. Mat.
**2021**, 71, 245–252. [Google Scholar] [CrossRef] - Kovács, E. A class of new stable, explicit methods to solve the non-stationary heat equation. Numer. Methods Partial. Differ. Equations
**2020**, 37, 2469–2489. [Google Scholar] [CrossRef] - Nagy, A.; Saleh, M.; Omle, I.; Kareem, H.; Kovács, E. New Stable, Explicit, Shifted-Hopscotch Algorithms for the Heat Equation. Math. Comput. Appl.
**2021**, 26, 61. [Google Scholar] [CrossRef] - Saleh, M.; Kovács, E.; Nagy, Á. New stable, explicit, second order hopscotch methods for diffusion-type problems. Math. Comput. Simul.
**2023**, 208, 301–325. [Google Scholar] [CrossRef] - Saleh, M.; Kovács, E.; Barna, I.F.; Mátyás, L. New Analytical Results and Comparison of 14 Numerical Schemes for the Diffusion Equation with Space-Dependent Diffusion Coefficient. Mathematics
**2022**, 10, 2813. [Google Scholar] [CrossRef] - Olver, F.W.J.; Lozier, D.W.; Boisvert, R.F.; Clark, C.W. NIST Handbook of Mathematical Functions; Cambridge University Press: New York, NY, USA, 2011; ISBN 978-0-521-14063-8. Volume 66. [Google Scholar]
- Wikipedia. Whittaker Function. Available online: https://en.wikipedia.org/wiki/Whittaker_function (accessed on 27 February 2023).
- Jalghaf, H.K.; Kovács, E.; Majár, J.; Nagy, Á.; Askar, A.H. Explicit Stable Finite Difference Methods for Diffusion-Reaction Type Equations. Mathematics
**2021**, 9, 3308. [Google Scholar] [CrossRef] - Chen-Charpentier, B.M.; Kojouharov, H.V. An unconditionally positivity preserving scheme for advection–diffusion reaction equations. Math. Comput. Model.
**2013**, 57, 2177–2185. [Google Scholar] [CrossRef] - Kovács, E.; Nagy, Á.; Saleh, M. A Set of New Stable, Explicit, Second Order Schemes for the Non-Stationary Heat Conduction Equation. Mathematics
**2021**, 9, 2284. [Google Scholar] [CrossRef] - Kovács, E.; Nagy, Á.; Saleh, M. A New Stable, Explicit, Third-Order Method for Diffusion-Type Problems. Adv. Theory Simulations
**2022**, 5, 2100600. [Google Scholar] [CrossRef] - Kovács, E.; Nagy, Á. A new stable, explicit, and generic third-order method for simulating conductive heat transfer. Numer. Methods Partial. Differ. Equations
**2022**, 39, 1504–1528. [Google Scholar] [CrossRef] - Gourlay, A.R.; Mcguire, G.R. General Hopscotch Algorithm for the Numerical Solution of Partial Differential Equations. IMA J. Appl. Math.
**1971**, 7, 216–227. [Google Scholar] [CrossRef] - Saleh, M.; Kovács, E. New Explicit Asymmetric Hopscotch Methods for the Heat Conduction Equation. Comput. Sci. Math. Forum
**2021**, 2, 22. [Google Scholar] - Nagy, Á.; Omle, I.; Kareem, H.; Kovács, E.; Barna, I.F.; Bognar, G. Stable, Explicit, Leapfrog-Hopscotch Algorithms for the Diffusion Equation. Computation
**2021**, 9, 92. [Google Scholar] [CrossRef] - Hirsch, C. Numerical Computation of Internal and External Flows, Volume 1: Fundamentals of Numerical Discretization; Wiley: Hoboken, NJ, USA, 1988. [Google Scholar]
- Chapra, S.C.; Canale, R.P. Numerical Methods for Engineers, 7th ed.; McGraw-Hill Science/Engineering/Math: New York, NY, USA, 2015. [Google Scholar]
- Nagy, Á.; Majár, J.; Kovács, E. Consistency and Convergence Properties of 20 Recent and Old Numerical Schemes for the Diffusion Equation. Algorithms
**2022**, 15, 425. [Google Scholar] [CrossRef] - Holmes, M.H. Introduction to Numerical Methods in Differential Equations; Springer: New York, NY, USA, 2007; ISBN 978-0387-30891-3. [Google Scholar]
- Iserles, A. A First Course in the Numerical Analysis of Differential Equations; Cambridge University Press: Cambridge, MA, USA, 2009; ISBN 9788490225370. [Google Scholar]
- Shampine, L.F.; Watts, H.A. Comparing Error Estimators for Runge-Kutta Methods. Math. Comput.
**1971**, 25, 445–455. [Google Scholar] [CrossRef] - Ritschel, T. Numerical Methods of Solution of Differential Equations; Technical University of Denmark: Kongens Lyngby, Denmark, 2013. [Google Scholar]
- Fekete, I.; Conde, S.; Shadid, J.N. Embedded pairs for optimal explicit strong stability preserving Runge–Kutta methods. J. Comput. Appl. Math.
**2022**, 412, 114325. [Google Scholar] [CrossRef] - Hairer, E.; Nørsett, S.P.; Wanner, G. Solving Ordinary Difference Equations 1—Nonstiff Problems; Springer: Berlin/Heidelberg, Germany, 1993; ISBN 978-3-540-56670-0. [Google Scholar]
- Press, W.H.; Teukolsky, S.A.; Vetterling, W.T.; Flannery, B.P. Numerical Recipes 3rd Edition: The Art of Scientific Computing, 3rd ed.; Cambridge University Press: Cambridge, MA, USA, 2007; Volume 1, ISBN 0521880688. [Google Scholar]
- Atkinson, K.E.; Han, W.; Stewart, D. Numerical Solution of Ordinary Differential Equations; Wiley: Hoboken, New Jersey, USA, 2011; ISBN 9781118164495. [Google Scholar]
- Söderlind, G.; Wang, L. Adaptive time-stepping and computational stability. J. Comput. Appl. Math.
**2006**, 185, 225–243. [Google Scholar] [CrossRef][Green Version] - Gustafsson, K. Control Theoretic Techniques for Stepsize Selection in Explicit Runge-Kutta Methods. ACM Trans. Math. Softw.
**1991**, 17, 533–554. [Google Scholar] [CrossRef]

**Figure 1.**The solution of Equation (3) with D = 1; $\alpha =1/2$; c

_{1}= 1; c

_{2}= 0: the black, red, blue, and green lines are for (m = 0; 1/2; 1; 5/2).

**Figure 2.**The solution $u\left(x,t\right)$ of Equation (2) with the shape function Equation (4) for $D=1,m=2.4,\alpha =3.1,{c}_{1}=0,{c}_{2}=5.96\times {10}^{-13},x\in \left[0.055,0.355\right],t\in \left[0.5,1.5\right]$.

**Figure 3.**The solution $u\left(x,t\right)$ of Equation (2) with the shape function Equation (4) for $D=1,m=7.2,\alpha =11.4,{c}_{1}=0,{c}_{2}=0.0042,x\in \left[0.48,0.73\right],t\in \left[0.9,1.5\right]$.

**Figure 4.**Hopscotch-type space-time structures. The time elapses from the top (t = 0) to the bottom.

**Figure 5.**Maximum errors as a function of the time-step size for Experiment 1. The numerical order of convergence of the algorithms are the slopes of the error curves.

**Figure 6.**The variable u as a function of x in the case of the initial function u

^{0}, the analytical solution at the final time, the CCL algorithm for $h={10}^{-5}$, and the LH algorithm for $h=0.0013$ in the case of small value of m (Experiment 1). It is worth emphasizing again that for these time-step sizes, explicit Runge–Kutta algorithms are unstable.

**Figure 7.**The time development of the errors, i.e., the absolute difference between the analytical solution and that of the stable numerical methods, for $h=2\times {10}^{-4}$ as a function of time.

**Figure 9.**The variable u as a function of x in the case of the initial function u

^{0}, the analytical solution at the final time, the CCL algorithm for $h=1.2\times {10}^{-5}$, and the LH algorithm for $h=0.0016$ in the case of large value of m (Experiment 2).

**Figure 10.**The time development of the errors, i.e., the absolute difference between the analytical solution and that of the stable numerical methods, for $h={10}^{-3}$ as a function of time.

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. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Saleh, M.; Kovács, E.; Barna, I.F. Analytical and Numerical Results for the Transient Diffusion Equation with Diffusion Coefficient Depending on Both Space and Time. *Algorithms* **2023**, *16*, 184.
https://doi.org/10.3390/a16040184

**AMA Style**

Saleh M, Kovács E, Barna IF. Analytical and Numerical Results for the Transient Diffusion Equation with Diffusion Coefficient Depending on Both Space and Time. *Algorithms*. 2023; 16(4):184.
https://doi.org/10.3390/a16040184

**Chicago/Turabian Style**

Saleh, Mahmoud, Endre Kovács, and Imre Ferenc Barna. 2023. "Analytical and Numerical Results for the Transient Diffusion Equation with Diffusion Coefficient Depending on Both Space and Time" *Algorithms* 16, no. 4: 184.
https://doi.org/10.3390/a16040184