This study aims to present a numerical method for solving the one-dimensional heat equation with temperature-dependent thermal conductivity. General nonlinear boundary conditions that can depend on time explicitly are considered.
First, using an implicit scheme, the heat equation is discretized in time, whereby, at each time level, a nonlinear two-point boundary value problem (TPBVP) is obtained. To solve the nonlinear TPBVPs, the quasilinearization method is applied. The obtained linear sub-problems are solved by the finite difference method.
The whole method is unconditionally stable. Its computational efficiency is high. The time complexity of the algorithm is O(MN), where M is the number of time levels and N is the number of space mesh points. Examples with exponential and power law dependence of the thermal diffusivity on temperature and different boundary conditions, including fixed temperature, fixed flux, convection, relaxing and oscillating conditions, are presented. The results confirm the unconditional stability of the method and its high computational efficiency.
In addition to being unconditionally stable and computationally very efficient, the proposed method is quite easy to implement. This is demonstrated by the provided four MATLAB codes. They treat different types of boundary conditions and different dependences of the thermal conductivity on the temperature.
The novelty of the method lies in converting the heat equation, which is a partial differential equation, into a sequence of ordinary differential equations (ODEs) with boundary conditions. This allows using methods for ODEs.
1. Introduction
The one-dimensional heat equation (Cannon, 1984; Carslow et al., 1986; Bergman, 2011) with temperature-dependent thermal conductivity is a nonlinear partial differential equation (PDE) (Polyanin and Zaitsev, 2012). The exact solution to this equation has been found only for a limited number of specific cases (Polyanin et al., 2000; Sadighi and Ganji, 2007; Wazwaz, 2001, 2003; Kosov and Semenov, 2019). For this reason, some approximate analytical techniques (Mustafa et al., 2014; Hristov, 2015, 2016; Yu et al., 2024, and the references therein) and a variety of numerical methods (Bartish and Shakhno, 1993; Gürarslan, 2010; Filipov and Faragó, 2018; Zheng et al., 2020; Lienemann et al., 2005; Gürarslan and Sari, 2011; Zhuang et al., 2021; Zen et al., 2024; Feng et al., 2020) have been developed. A typical numerical approach is to fully discretize the heat equation, or a linearized version of it, using the finite difference method (FDM) (Smith, 1985; LeVeque, 2007) or the finite element method (Taler and Ocłoń, 2014), whereby a system of algebraic equations is obtained. Then, numerical methods for algebraic systems such as Gauss–Seidel (Burden et al., 2016) or Newton’s method (Quarteroni et al., 2010) can be used. Efficient solution of systems resulting from discretizing PDEs is provided by the multigrid methods (Brabazon et al., 2014; Brandt, 1977; Briggs et al., 2000; Trottenberg et al., 2001) such as the full approximation scheme (Brabazon et al., 2014; Brandt, 1977) or the Newton-Multigrid (Brabazon et al., 2014; Briggs et al., 2000; Trottenberg et al., 2001). Note that, because the original problem is nonlinear, an iterative method has to be involved at some stage of the numerical solution. Along with other possibilities, Newton and Picard iterations are often used (Zen et al., 2022). An alternative to full discretization of the PDE is a semi-discretization approach, whereby the PDE is discretized only with respect to one independent variable. This converts the PDE into a system, or sequence, of ordinary differential equations (ODEs). Then, one can use numerical methods for ODEs (Ascher and Petzold, 1998).
An important numerical method that relies on semi-discretization is the method of lines (Liskovets, 1965; Zafarullah, 1970; Schiesser, 2012; Marucho and Campo, 2016). It was originally introduced by Liskovets (1965) for PDEs of elliptic, parabolic, and hyperbolic type. Since then, it has been applied in many different contexts and is still actively used today (Marucho and Campo, 2016). The method discretizes the equation in space, whereby a system of first-order ODEs is obtained. The system, together with the initial condition, constitutes an initial value problem (IVP). It can be solved using various numerical approaches for IVP (Ascher and Petzold, 1998), which, of course, may involve further discretization.
Recently, another approach based on semi-discretization has been proposed (Filipov and Faragó, 2018). Initially, using an implicit scheme, the method discretizes the nonlinear heat equation in time only, whereby, adding the boundary conditions, a sequence of nonlinear two-point boundary value problems (TPBVPs) is obtained. Starting from the initial condition, the TPBVPs can be solved successively using a numerical method for nonlinear boundary value problems for ODEs (e.g. Cuomo and Marasco, 2008, and the references therein). In Filipov and Faragó (2018), to solve the nonlinear TPBVPs, the FDM with Newton’s method has been applied. The original work considers only Dirichlet boundary conditions, but the method has also been applied successfully to relaxing boundary conditions (Filipov et al., 2022) and PDE–ODE systems (Filipov et al., 2023).
The work presented in this article generalizes the original method (Filipov and Faragó, 2018) to nonlinear boundary conditions that can depend on time explicitly. Moreover, contrary to the original approach, which applies the FDM directly to the nonlinear TPBVP and then uses the Newton method, we first apply the quasilinearization method (Bellman and Kalaba, 1965; Lakshmikantham et al., 1995; Mohapatra et al., 1997; Ahmad et al., 2001; Khan, 2006) and just then the FDM. As proven in Filipov et al. (2019), these two approaches formally lead to the same result; however, the latter approach has an advantage. Because the quasilinearization method replaces the nonlinear TPBVP by a sequence of linear TPBVPs, one can take advantage of the many available methods for numerical solution of linear problems such as the FDM, the collocation method, and others (Ascher et al., 1995). The proposed method is computationally very efficient. The time complexity of the algorithm is O(MN), where M is the number of time levels and N is the number of space mesh points. Moreover, the method is unconditionally stable, i.e. it remains numerically stable regardless of the chosen values for M and N.
2. Converting the nonlinear heat equation into a time sequence of nonlinear two-point boundary value problems
Let u(x, t) be the temperature at position x and time t, and α be the thermal diffusivity of the media:
where ρ is the density, Cp is the heat capacity at constant pressure, and κ is the thermal conductivity. The density and the heat capacity are considered constant, but the thermal conductivity is assumed to depend on the temperature (e.g Yu et al., 2024; Ivanova et al., 2020); hence, α = α(u). Then, the heat equation is:
We assume that α is positive and two times continuously differentiable. Obviously, unless α is constant, the PDE (1) is nonlinear. The equation is considered on the domain D ={(x, t)|a < x < b, t > 0}, i.e. in the space region between x = a and x = b, and for t > 0 (Figure 1).
At the boundaries, we impose boundary conditions of the form:
where ga and gb are given – not necessarily linear – functions that have continuous partial derivatives with respect to the first and second argument. The initial condition is:
where u0 (x) is the given initial temperature profile. Performing the differentiation on the right-hand side of equation (1), we obtain:
where Duα = dα/du. We introduce the time mesh tn = nτ, n = 1,2,… Let us consider equation (5) at the time level t = tn. Using the Taylor expansion u(x, tn−1) = u(x, tn) − τ∂t u(x, tn) + O(τ2), we replace the time derivative in (5) by the backward finite difference approximation plus O(τ) term:
Therefore, dropping the O(τ) term, we get the following semi-discretization in time of the PDE (1):
where ' denotes differentiation with respect to x. If un−1 (x) is a given (known) function, then equation (6) is a second-order nonlinear ODE for the function un (x). The time-discretization scheme used in equation (6) leads to the backward Euler method. We choose this method because it is the simplest implicit method, and implicit methods, e.g. backward Euler (Filipov and Faragó, 2018) and Crank–Nicolson (Zen et al., 2024), typically lead to unconditional stability of the whole numerical procedure. In a more compact form, equation (6) can be written as:
where:
Equation (7) and the boundary conditions:
constitute a nonlinear TPBVP for the unknown function un (x). In fact, because n = 1,2,…, we have a sequence of nonlinear TPBVPs. Starting from the initial condition u0 (x), we can solve the TPBVP (7)–(10) for n = 1, i.e. at time level t1, and get u1 (x), which is an approximation of u(x, t1). Then, using u1 (x), we can solve the TPBVP for n = 2 and get u2 (x), which is an approximation of u(x, t2), and so on (Figure 2). Thus, successively, we obtain an approximation un (x) of the exact solution at each time level tn.
Time-discretization of the domain D. At time level 0, the function u0 (x) along the solid black line is known from the initial condition. At the black dots, boundary conditions are specified. At each time level n = 1, 2, …the temperature un (x) along the blue line should be found by solving the corresponding nonlinear TPBVP (7)–(10)
Source(s): Figure by authors
Time-discretization of the domain D. At time level 0, the function u0 (x) along the solid black line is known from the initial condition. At the black dots, boundary conditions are specified. At each time level n = 1, 2, …the temperature un (x) along the blue line should be found by solving the corresponding nonlinear TPBVP (7)–(10)
Source(s): Figure by authors
Finally, we note that the time-discretization (6) is consistent with the PDE (5) to first order with respect to τ. Hence, the sequence of nonlinear TPBVPs (7)–(10) is consistent with (5) to first order, too. Because we use an implicit method which is typically stable, our approach results in a convergent algorithm.
3. Converting the nonlinear two-point boundary value problem into a sequence of linear two-point boundary value problems by quasilinearization
In this section, we construct an iterative procedure for solving the nonlinear TPBVP (7)–(10) at each time level tn, n = 1,2,…. The procedure is based on the quasilinearization method. Let be some given (known) function that approximates the exact solution un (x) of the problem (7)–(10). It is called the k-th approximation of the solution. Using , we can expand the right-hand side of equation (7) in Taylor series around the point getting:
where q and p are the partial derivatives of f (8) with respect to un and , respectively:
Dropping in equation (11), the terms higher than linear and replacing the exact solution of (7)–(10)un (x) by its approximation , we get the quasilinearization equation:
Equation (14) is a linear ODE for the unknown function . Together with the boundary conditions:
it constitutes a linear TPBVP for . If the temperature profile at time level n − 1, i.e. un− 1 (x), and are given (known), we can solve the linear TPBVP (14)–(16) and get the next (k + 1)-th approximation . In general, is a better approximation of un (x) than . Starting from some zeroth approximation , we can solve the TPBVP (14)–(16) for k = 1,2,… and get a sequence of functions If the sequence is convergent, then the limiting function is the sought solution of (7)–(10). At each time level n as a zeroth approximation , we can take the numerical solution of the nonlinear problem at the previous time level, i.e. un− 1 (x). For time level n = 1, it is just the initial condition u0 (x). In Figure 3, we have shown an example with time discretization step τ = 1. The conductive media is in the region 0 < x < 1 and is initially at temperature u = 0. At time t = 0, the temperature at x = 0 is suddenly raised to u = 1 and kept fixed at this value for t > 0.
Four time levels are shown. At each time level n, the quasilinearization method is applied. The functions shown with dashed lines are the consecutive approximations of the solution un (x) shown with solid line. It is used as a zeroth approximation at the next time level, i.e. (see the arrows)
Source(s): Figure by authors
Four time levels are shown. At each time level n, the quasilinearization method is applied. The functions shown with dashed lines are the consecutive approximations of the solution un (x) shown with solid line. It is used as a zeroth approximation at the next time level, i.e. (see the arrows)
Source(s): Figure by authors
The quasilinearization method is, in fact, a Newton–Raphson method on operator level (Filipov et al., 2019). Its convergence is quadratic. When the zeroth approximation is “sufficiently good,” as in our case, the method converges rapidly (Cuomo and Marasco, 2008). Note that the smaller the time step τ gets, the closer the zeroth approximation gets to the solution (see Figure 3) and the more efficient the quasilinearization method becomes. For the examples considered in Section 7, when the time step is τ = 0.01, it takes only about two to three iterations at each time level to reach the solution with precision 10−6.
4. Solving the linear two-point boundary value problem by finite difference method
To solve the linear TPBVP (14)–(16), we are going to use the FDM. We introduce the space-mesh:
Let and denote approximations of and , respectively. For the inner mesh points, the first derivatives of and at x = xi are approximated by the central difference approximation:
The error that we make by replacing the derivatives with their approximations (17) is O(h2), i.e. second order in h.
At the left boundary x = a, the first derivatives of and are approximated by the forward difference approximation with second-order error:
At the right boundary x = b, the first derivatives of and are approximated by the backward difference approximation with second-order error:
Using the central difference approximation for the second derivative of at x = xi, i = 2, 3,…, n − 1, equation (14) is discretized on the mesh, yielding:
The boundary conditions are:
Equations (20)–(22) constitute a system of algebraic equations for the unknown . They replace the TPBVP (14)–(16). To solve (20), subject to (21)–(22) in linearized form, we introduce the vectors:
where:
Then, according to Theorem 1 in Filipov et al. (2019), the solution of the system is:
where:
and:
is the Jacobian of with respect to . The solution is the next, in general better, approximation of un. Starting from the 0-th approximation , i.e. the solution un−1 obtained at the previous time level, we can find each next approximation , k = 0,1,… using (26). If the sequence is convergent, then the limiting vector is the approximate solution to the nonlinear TPBVP (7), (9)–(10). In practice, the iteration process is terminated when , where ‖·‖ is some suitably chosen norm, e.g. the maximum norm, and ϵ is some small number. This inequality is called stopping criteria. The vector is taken as approximate solution to the nonlinear TPBVP. As shown in the next section, the Jacobian matrix (28) is tridiagonal or close to tridiagonal for the most common types of boundary conditions. Hence, using the Thomas method and, if necessary, the Sherman–Morrison algorithm, (27) can be computed in only O(N) operations, where N is the number of space mesh points (Filipov et al., 2019). Hence, the time complexity of the whole method is O(MN), where M is the number of time mesh points.
5. Calculating the elements of the Jacobian
To be able to use iteration (26), we need to have the elements of the Jacobian matrix (28). In this section, we calculate explicitly these elements. The Jacobian matrix is an n × n matrix, where n is the number of space mesh-points. Rows 2 through n – 1 relate to the discretized differential equation, while rows 1 and n relate to the left and right boundary conditions, respectively.
According to equations (23) and (17), the nonzero elements of rows i = 2, 3,…, n − 1 of the Jacobian are:
The first row of the Jacobian concerns the first boundary condition. According to (24) and (18), the nonzero elements of the first row are:
The last row of the Jacobian concerns the second boundary condition. According to equations (25) and (19), the nonzero elements of the last row are:
6. Imposing different types of boundary conditions
This section considers several types of boundary conditions that are likely to occur in practice. First, we consider the case where the temperature u at the boundary is specified. This means that the temperature at the boundary is a given function of time. When this function is just a constant, we get the usual Dirichlet boundary condition. If the temperature at the boundary increases or decreases in a monotonic way approaching a certain value as time goes to infinity, we have a relaxing boundary condition (Filipov et al., 2022; Hristov, 2022). If the temperature at the boundary oscillates without approaching a limit, we get an oscillating boundary condition. Examples for these three cases are presented in Section 7.
Let the temperature at the first boundary x = a and the second boundary x = b be ua (t) and ub (t), respectively, i.e.:
Moving all terms in (29) and (30) to the left-hand side of the equations and comparing with the boundary conditions (2) and (3), we see that:
Obviously, in the case of specified temperature, the functions ga and gb do not depend on the temperate gradient ∂u/∂x and are linear with respect to the temperature u. Hence, in this case, we deal with linear boundary conditions. The derivatives of ga and gb with respect to u are:
The derivatives of ga and gb with respect to ∂u/∂x are:
According to equations (31) and (32), equations (24) and (25) become:
To calculate the elements of the first and the last row of the Jacobian, we apply the formulas derived in the previous section. Taking into account equation (33) and equation (35), we conclude that the only nonzero element of row 1 is:
Equations (34) and (36) tell us that the only nonzero element of row n is:
Next, we consider the case whereby the heat flux − α∂u/∂t at the boundary is specified. This means that the flux is a given function of time.
Let the heat flux at the first boundary x = a and the second boundary x = b be ϕa (t) and ϕb (t), respectively, i.e.:
Taking all terms in (41) and (42) to the left-hand side of the equations and comparing with (2) and (3), we see that:
If the thermal diffusivity α depends on the temperature u, then the functions ga and gb depend on the temperature and the temperature gradient ∂u/∂x, and are nonlinear. Hence, in this case, we deal with nonlinear boundary conditions. The derivatives of ga and gb with respect to u are:
The derivatives of ga and gb with respect to ∂u/∂x are:
Taking into account (43) and (44) and using (18) and (19) for the temperature gradient at the boundaries, equations (24) and (25) become:
To calculate the elements of the first and the last rows of the Jacobian, we apply the formulas derived in the previous section. Taking into account (45) and (47) and approximating the gradient of the temperature by (18) and (19), for the nonzero elements of row 1 of the Jacobian, we get:
Using equations (46) and (48), for the nonzero elements of row n, we get:
Finally, we consider the convection boundary condition. It occurs when at the boundary the solid body is in contact with a fluid passing over the surface. Then, the heat flux through the surface is proportional to the temperature difference between the temperature in the bulk of the fluid and the temperature at the boundary, i.e. at the surface of the body. In our case, the body occupies the region a ≤ x ≤ b.
Let the regions x < a and x > b be occupied by a fluid. Then the boundary conditions are:
where H is the mean convective heat transfer coefficient; Ta (t) is the temperature inside the liquid occupying x < a; and Tb (t) is the temperature inside the liquid occupying x < b. Both Ta and Tb are measured away enough from the respective boundaries where the temperature inside the fluid can be considered uniform, i.e. no temperature gradient exists.
Taking all terms in (57) and (58) to the left-hand side of the equations and comparing with (2) and (3), we see that:
Similarly to the specified heat flux case, if the thermal diffusivity α depends on the temperature u, the functions ga, gb are nonlinear and depend on both the temperature u and temperature gradient ∂u/∂x. In this case, the convection boundary condition is nonlinear. The derivatives of ga and gb with respect to u are:
The derivatives of ga and gb with respect to ∂u/∂x are:
Taking into account equations (59) and (60) and using (18) and (19) for the temperature gradient at the boundaries, equations (24) and (25) become:
In the derivations provided in this chapter, we considered boundary conditions of the same type at both boundaries. Of course, we might want to impose one type of boundary condition at one of the boundaries and another type at the other boundary, e.g. convection boundary condition at the left boundary and Dirichlet boundary condition at right boundary. To do this, we should just choose, from the formulas above, the appropriate formula for each boundary. Examples are provided in Section 7.
The formulas derived in this section cover the most common types of boundary conditions encountered in science and engineering. Of course, the proposed method is not restricted to these boundary conditions only. To derive the respective formulas for other types of conditions, one can follow the procedure used in this section.
7. Numerical results
In this section, several examples are presented and solved numerically using the proposed method. Different dependencies of the thermal conductivity on the temperature and different types of boundary conditions are considered. In the third example, the stability, the convergence and the computational efficiency of the method are tested. The fourth example investigates transient nonlinear heat conduction in a slab exposed to a fluid. The considered problems are solved on a time interval t ∈ [t0, tf], where t0 = 0 is the initial time and tf is the final time. The number of time levels, including the time level 0, is denoted by M, hence, the time step is:
The time levels are n = 0,1,…, M − 1. In the MATLAB programs presented in the Appendix, these time levels are denoted by m = 1,2,…, M, respectively.
7.1 Example 1
In this example, we consider the heat equation:
with thermal diffusivity:
Exponential temperature dependence of the thermal conductivity has been investigated in several works (Filipov and Faragó, 2018; ; Kumar et al., 2022).
Initially, the temperature along the body is zero; hence, the initial condition is:
At the right boundary, x = 1, the temperature is kept fixed at zero throughout the process:
This is a Dirichlet boundary condition.
At the left boundary, x = 0, eight types of boundary conditions are considered. First, the heat equation is solved for the case when the temperature at the left boundary is specified, i.e. the temperature is a given function of time (29). Two cases are considered. First, the temperature is kept fixed at 1:
Then, the case when the temperature approaches the value 1 gradually as time approaches infinity is considered:
This boundary condition is a typical example of a relaxing boundary condition. The condition was first introduced and motivated in Hristov (2022) for the diffusion equation. Nonlinear heat conduction with relaxing boundary conditions is investigated in Zen et al. (2024) and Filipov et al. (2022).
The transient conduction for thermal diffusivity (73) with α0 = 0.01, c = 1.5, and boundary condition at the left boundary (74) and (75) is shown in Figure 4. The final time reached in the experiment is tf = 12. The heat equation is solved using the proposed numerical method with N = 51 discretization points in space and M = 41 discretization points in time. The method was implemented in MATLAB. The code used to solve the considered problem for boundary condition (75) is presented in the Appendix, Algorithm (1).
Temperature profiles at time t = 0, 0.3, 0.6,…,12 for fixed temperature at x = 0, BC (74) (left figure) and relaxing temperature at x = 0, BC (75) (right figure)
Source(s): Figure by authors
Temperature profiles at time t = 0, 0.3, 0.6,…,12 for fixed temperature at x = 0, BC (74) (left figure) and relaxing temperature at x = 0, BC (75) (right figure)
Source(s): Figure by authors
Another important boundary condition is when the heat flux through the boundary is specified. This means that the heat flux at the boundary is a given function of time. For the left boundary this condition is given by (41). First we consider the case when the heat flux through the surface x = 0 is kept fixed at value 1:
Then, a case when the heat flux approaches 1 gradually as time goes by is considered, namely:
This condition is a relaxing boundary condition for the flux.
Using the proposed numerical method, the heat equation is solved for boundary condition (76) and then boundary condition (77), and thermal diffusivity (73) with α0 = 0.01, c = 1.5. The final time is tf = 6, while the number of space and time discretization points (mesh points) is N = 51 and M = 21, respectively. The result is shown in Figure 5. The MATLAB program is presented in the Appendix, Algorithm 3.
Temperature profiles at time t = 0,0.3,0.6,…,6 for fixed heat flux at x = 0, BC (76) (left figure) and relaxing heat flux at x = 0, BC (77) (right figure)
Source(s): Figure by authors
Temperature profiles at time t = 0,0.3,0.6,…,6 for fixed heat flux at x = 0, BC (76) (left figure) and relaxing heat flux at x = 0, BC (77) (right figure)
Source(s): Figure by authors
Next we consider convection boundary condition at the left boundary x = 0. The region x < 0 is occupied by fluid; hence, the heat flux through the boundary is proportional to the difference between the temperature inside the liquid and the temperature at the surface (57). The mean convective heat transfer coefficient is H = 1. The temperature inside the liquid is kept constant at a value Ta = 1; hence, the boundary condition is:
Then, the case when the temperature Ta inside the liquid occupying x < 0 increases gradually toward a value 1 as Ta = 1− e−t is considered. We say that the liquid temperature in the bulk is relaxing. In this case, the boundary condition is:
The problem is solved on the time interval [0, tf], where tf = 12. The number of space mesh points is N = 51 and number of time mesh points is M = 41.The result is shown in Figure 6. The MATLAB program used to solve the problem is presented in the Appendix, Algorithm 3.
Convection boundary condition at x = 0. Temperature profiles at time t = 0,0.3,0.6,…,12 are shown for fixed temperature in the bulk of x < 0, BC (78) (left figure) and relaxing temperature in the bulk, BC (79) (right figure)
Source(s): Figure by authors
Convection boundary condition at x = 0. Temperature profiles at time t = 0,0.3,0.6,…,12 are shown for fixed temperature in the bulk of x < 0, BC (78) (left figure) and relaxing temperature in the bulk, BC (79) (right figure)
Source(s): Figure by authors
Finally, we consider the case when the temperature or the heat flux at the boundary is a specified oscillating function of time. Let the temperature at the left boundary x = 0 oscillate as:
The considered transient heat problem with boundary condition (80) is solved numerically on the time interval t ∈ [0,6]. The solution is shown in Figure 7.
Temperature as a function of position and time for the case of specified oscillating temperature at the left boundary x = 0 (80) and fixed at zero temperature at the right boundary x = 1
Source(s): Figure by authors
Temperature as a function of position and time for the case of specified oscillating temperature at the left boundary x = 0 (80) and fixed at zero temperature at the right boundary x = 1
Source(s): Figure by authors
Let the flux at the left boundary oscillate in the following way:
Temperature as a function of position and time for the case of specified oscillating flux at the left boundary x = 0 (81) and fixed at zero temperature at the right boundary x = 1
Source(s): Figure by authors
Temperature as a function of position and time for the case of specified oscillating flux at the left boundary x = 0 (81) and fixed at zero temperature at the right boundary x = 1
Source(s): Figure by authors
7.2 Example 2
This example considers the heat equation:
with power thermal diffusivity (Hristov, 2016):
The initial condition is:
The two boundary conditions are:
Note that the body occupying x ∈ [0,1] is initially at high temperature, but from time t = 0 on, because of the lower temperature at the two boundaries, the body should start cooling down. The heat equation is solved numerically on the time interval t ∈ [0,1]. Results for the transient heat conduction with μ = 0, 0.5,…, 2.5 are shown in Figure 9. The results indicate that the higher the value of μ is, the slower the cooling of the body is. Transient processes with power low diffusivity of the form (82) and μ > 0 are called slow diffusion.
The cooling of an initially uniformly heated body with power law thermal diffusivity α(u) = uμ
Source(s): Figure by authors
The cooling of an initially uniformly heated body with power law thermal diffusivity α(u) = uμ
Source(s): Figure by authors
7.3 Example 3
In this example, we consider a problem based on the problem presented in Example 4 in Gürarslan (2010). The considered equation is:
with thermal diffusivity:
The equation is considered on the space interval x ∈ (−5, 5). The initial condition is:
The boundary conditions are:
The exact solution to the problem is:
It is worth noting that, in terms of mass transport, the diffusion equation with diffusivity (83) describes the so-called fast diffusion. We are going to use this problem to investigate the stability, convergence and computational efficiency of the proposed numerical method.
It is well known that some discretization schemes may lead to numerical instability. For example, the forward time center space scheme (Tannehill et al., 1997) is numerically stable only for r ≤ 0.5, where:
To investigate the stability of the proposed method, the problem is solved on the time interval t ∈ [0,5] for different number of time levels M and different number of space mash-points n. The length of the time step is:
The length of the space step is:
The three different sets of discretization parameters M and N that we used and the corresponding values of τ, h and r (84) are shown in Table 1.
Three different sets of the discretization parameters M and N
| Experiment | M | N | τ | h | r |
|---|---|---|---|---|---|
| 1 | 5,001 | 101 | 0.001 | 0.1 | 0.1 |
| 2 | 51 | 101 | 0.1 | 0.1 | 10 |
| 3 | 51 | 1,001 | 0.1 | 0.01 | 1,000 |
| Experiment | M | N | τ | h | r |
|---|---|---|---|---|---|
| 1 | 5,001 | 101 | 0.001 | 0.1 | 0.1 |
| 2 | 51 | 101 | 0.1 | 0.1 | 10 |
| 3 | 51 | 1,001 | 0.1 | 0.01 | 1,000 |
Source(s): Table by the authors
The numerical solutions are shown in Figure 10. They confirm the unconditional stability of the method.
Numerical solution of the problem in Example 3 for three different values of r (Table 1)
Source(s): Figure by authors
Numerical solution of the problem in Example 3 for three different values of r (Table 1)
Source(s): Figure by authors
Next, we consider the problem on the time interval t ∈ [0,1], i.e. tf = 1. Let M be the number of time levels, including the initial time level at t = 0. Then the last time level is M − 1. Let the numerical solution at the last time level, i.e. at time t = 1, be unum (x) = uM−1 (x). Let the exact solution at time t = 1 be uexact (x) = u(x, 1).
To compare the numerical solution with the exact solution at t = 1, we introduce the error:
where ‖·‖ is the maximum norm. To investigate the convergence of the method, the error e is computed for different values of M and N. First, we have fixed the value of the space discretization at N = 1001 and compared the exact and numerical solutions for increasing number of time levels M =10 · 2l−1 + 1, l = 1,2,3,4. The values of M are taken in such a way that the length of the time step τ in each next experiment is half the length of the time step in the previous experiment. Results are shown in Table 2. Clearly, because doubling the time levels decreases the error twice, the method is first order with respect to M. Then, we fix the time levels at M = 10001 and conduct experiments with an increasing number of space mesh points N = 10 · 2l−1 + 1, l = 1,2,3,4. In each next experiment, the length of the space step h is half the value of h in the previous. Results are shown in Table 3. Because refining the mesh twice leads to decreasing the error about four times, we can conclude that, as predicted theoretically, the method is second-order accurate with respect to h.
The error el at time t = 1 for different number of time mesh points M
| l | M | el | el-1/el |
|---|---|---|---|
| 1 | 11 | 0.005897 | |
| 2 | 21 | 0.002965 | 1.99 |
| 3 | 41 | 0.001487 | 1.99 |
| 4 | 81 | 0.000746 | 1.99 |
| l | M | el | el-1/el |
|---|---|---|---|
| 1 | 11 | 0.005897 | |
| 2 | 21 | 0.002965 | 1.99 |
| 3 | 41 | 0.001487 | 1.99 |
| 4 | 81 | 0.000746 | 1.99 |
Source(s): Table by the authors
The error el at time t = 1 for different number of space mesh points N
| l | N | el | el-1/el |
|---|---|---|---|
| 1 | 11 | 0.038490 | |
| 2 | 21 | 0.008648 | 4.45 |
| 3 | 41 | 0.002185 | 3.96 |
| 4 | 81 | 0.000585 | 3.74 |
| l | N | el | el-1/el |
|---|---|---|---|
| 1 | 11 | 0.038490 | |
| 2 | 21 | 0.008648 | 4.45 |
| 3 | 41 | 0.002185 | 3.96 |
| 4 | 81 | 0.000585 | 3.74 |
Source(s): Table by the authors
Finally, we have conducted an experiment to investigate the time complexity of the algorithm. Two versions of the MATLAB code have been created. The first one uses the left matrix division operation as the codes shown in the Appendix, while the second one uses the Thomas method for tridiagonal matrices (Filipov et al., 2019). Results are presented in Table 4 and Table 5. As should be expected, for both cases the time to execute the code increases linearly with the number of time levels M. One can see that increasing M twice, for fixed n, leads to no more than a two-times increase in the run-time. On the other hand, Table 5 tells us that increasing n twice, for fixed M, leads to a three to five times increase in the run-time for the left matrix division case, while the same increase leads to only two-times increase for the tridiagonal solution. Hence, the time complexity of the proposed method, when the tridiagonal solver is applied, is indeed O(MN) as expected. Therefore, the method is very efficient computationally.
Execution time (run-time) in seconds for increasing number of time mesh points M
| l | M | Run-time (s) – left division | Run-time (s) – tridiagonal |
|---|---|---|---|
| 1 | 101 | 0.031 | 0.028 |
| 2 | 201 | 0.058 | 0.044 |
| 3 | 401 | 0.106 | 0.090 |
| 4 | 801 | 0.184 | 0.155 |
| 5 | 1601 | 0.344 | 0.287 |
| 6 | 3201 | 0.635 | 0.524 |
| 7 | 6401 | 1.163 | 0.963 |
| 8 | 12801 | 2.182 | 1.753 |
| 9 | 25601 | 3.681 | 3.070 |
| 10 | 51201 | 5.993 | 4.943 |
| l | M | Run-time (s) – left division | Run-time (s) – tridiagonal |
|---|---|---|---|
| 1 | 101 | 0.031 | 0.028 |
| 2 | 201 | 0.058 | 0.044 |
| 3 | 401 | 0.106 | 0.090 |
| 4 | 801 | 0.184 | 0.155 |
| 5 | 1601 | 0.344 | 0.287 |
| 6 | 3201 | 0.635 | 0.524 |
| 7 | 6401 | 1.163 | 0.963 |
| 8 | 12801 | 2.182 | 1.753 |
| 9 | 25601 | 3.681 | 3.070 |
| 10 | 51201 | 5.993 | 4.943 |
Note(s): The number of space mesh points is n = 101. Two cases are investigated: left matrix division operation and tridiagonal solver
Execution time (run-time) in seconds for increasing number of space mesh points n
| l | n | Run-time (s) – left division | Run-time (s) – tridiagonal |
|---|---|---|---|
| 1 | 101 | 0.031 | 0.028 |
| 2 | 201 | 0.078 | 0.045 |
| 3 | 401 | 0.432 | 0.086 |
| 4 | 801 | 1.373 | 0.157 |
| 5 | 1601 | 5.035 | 0.299 |
| 6 | 3201 | 20.230 | 0.733 |
| 7 | 6401 | 81.609 | 1.392 |
| 8 | 12801 | 379.520 | 2.772 |
| 9 | 25601 | >400 | 5.512 |
| 10 | 51201 | >400 | 10.098 |
| l | n | Run-time (s) – left division | Run-time (s) – tridiagonal |
|---|---|---|---|
| 1 | 101 | 0.031 | 0.028 |
| 2 | 201 | 0.078 | 0.045 |
| 3 | 401 | 0.432 | 0.086 |
| 4 | 801 | 1.373 | 0.157 |
| 5 | 1601 | 5.035 | 0.299 |
| 6 | 3201 | 20.230 | 0.733 |
| 7 | 6401 | 81.609 | 1.392 |
| 8 | 12801 | 379.520 | 2.772 |
| 9 | 25601 | >400 | 5.512 |
| 10 | 51201 | >400 | 10.098 |
Note(s): The number of time mesh points is M = 101. Two cases are investigated: left matrix division operation and tridiagonal solver
7.4 Example 4
In this example, we solve the problem studied in Yu et al. (2024). A slab of thickness L, initial temperature T0 and linearly temperature-dependent thermal conductivity is exposed to an ambient fluid of constant temperature T∞. The heat transfer coefficients on each side of the slab could be different. We consider the case where no internal heat source is present. The heat equation is:
On each side of the slab, a convective boundary condition is applied:
The initial condition is:
The thermal conductivity is:
where κ0 is the thermal conductivity at a reference temperature Tref, which, for convenience, the authors take to be T∞.
We solve the problem for the following numerical values of the parameters: H1 = 1, H2 = 10, Tref = T∞ = 0, T0 = 1, L = 1, and κ(u)/ρCp = α(u) = 1 + βu, where β = 1. The MATLAB program used to solve the problem is presented in Appendix, Algorithm 4. Results are shown in Figure 11. Because there is no heat source present, the temperature distribution approaches a steady state u(x) ≡ 0, and, compared to the similar cases investigated in Yu et al. (2024), the cooling of the slab occurs faster.
Solution to Example 4. The temperature as a function of position and time is shown in the left figure. The temperature profiles at t = 0, 0.02, 0.04,…, 2 (from top to bottom) are shown in the middle figure. The right figure shows how temperature at different positions decreases with time
Source(s): Figure by authors
Solution to Example 4. The temperature as a function of position and time is shown in the left figure. The temperature profiles at t = 0, 0.02, 0.04,…, 2 (from top to bottom) are shown in the middle figure. The right figure shows how temperature at different positions decreases with time
Source(s): Figure by authors
8. Conclusion
This article presented a new numerical approach for solving the one-dimensional heat equation with temperature-dependent thermal conductivity. The method semi-discretizes the equation in time and then converts the obtained nonlinear TPBVPs to a sequence of linear TPBVPs by the quasilinearization method. The obtained linear problems are solved by the FDM, but other methods can also be applied. General nonlinear boundary conditions are considered. As shown in the work, the Jacobian matrix for the most common types of boundary conditions is tridiagonal or close to tridiagonal. Hence, applying the Thomas method and, if necessary, the Sherman–Morrison algorithm, the time complexity of the whole method becomes O(MN), where M is the number of time levels and N is the number of space mesh points. That is, the method is computationally very efficient. The theoretically predicted time complexity is confirmed by computer experiments. Because the time-discretization scheme that we use is implicit, the proposed method is unconditionally stable. This fact is also confirmed experimentally.
This research was supported by the National Research, Development and Innovation Office – NKFIH, grant no. K137699 and also by HUNREN – ELTE Numerical Analysis and Large Networks Research Group.
References
Appendix. MATLAB codes
This appendix presents four MATLAB codes. The first three codes were used to solve the problem considered in Example 1 with left boundary condition (75) (Code 1, Algorithm 1), (77) (Code 2, Algorithm 2), and (79) (Code 3, Algorithm 3), respectively. Code 4, shown in Algorithm 4, solves the problem considered in Example 4. The mathematical symbols used in the article and the corresponding MATLAB variables are given in Table A1.
Mathematical symbols and the corresponding symbols used in the MATLAB codes
| Article | MATLAB |
|---|---|
| α0 | A0 |
| c | c |
| β | beta |
| H | H |
| M | M |
| N | N |
| tf | tf |
| a | a |
| b | b |
| τ | tau |
| h | h |
| n + 1 | m |
| tn | t(m) |
| ua (tn) | ua(m) |
| ub (tn) | ub(m) |
| ϕa (tn) | phia(m) |
| ϕb (tn) | phib(m) |
| Ta (tn) | Ta(m) |
| Tb (tn) | Tb(m) |
| i | i |
| xi | x(i) |
| un,i | U(I,m) |
| un | U(:,m) |
| un-1 | U(:,m-1) |
| u0 | u0 |
| u | |
| du | |
| F | |
| J | |
| delta | |
| u(i) | |
| A | |
| Au | |
| Auu | |
| Du | |
| f | |
| q | |
| p |
| Article | MATLAB |
|---|---|
| α0 | A0 |
| c | c |
| β | beta |
| H | H |
| M | M |
| N | N |
| tf | tf |
| a | a |
| b | b |
| τ | tau |
| h | h |
| n + 1 | m |
| tn | t(m) |
| ua (tn) | ua(m) |
| ub (tn) | ub(m) |
| ϕa (tn) | phia(m) |
| ϕb (tn) | phib(m) |
| Ta (tn) | Ta(m) |
| Tb (tn) | Tb(m) |
| i | i |
| xi | x(i) |
| un,i | U(I,m) |
| un | U(:,m) |
| un-1 | U(:,m-1) |
| u0 | u0 |
| u | |
| du | |
| F | |
| J | |
| delta | |
| u(i) | |
| A | |
| Au | |
| Auu | |
| Du | |
| f | |
| q | |
| p |
Source(s): Table by the authors
Algorithm 1. Example 1 – specified temperature at the left boundary, equation (75)
% MATLAB code 1:
function main
A0 = 0.01; c = 1.5;
M = 41; tf = 12; tau=tf/(M-1);
N = 51; a = 0; b = 1; h=(b-a)/(N-1);
t=zeros(M,1); ua=zeros(M,1); ub=zeros(M,1);
for m = 1:M
t(m)=(m-1)*tau;
ua(m)=1-exp(-t(m)); % temperature at x = 0
ub(m)=0; % temperature at x = 1
end
x=zeros(N,1); u0=zeros(N,1);
for i = 1:N
x(i)=a+(i-1)*h;
u0(i)=0; % temperature at t = 0
end
U=zeros(N,M); U(:,1)=u0;
F=zeros(N,1);
J=zeros(N,N);J(1,1)=1; J(N,N)=1;
for m = 2:M % time level
u = U(:,m-1);
delta = 1;
while(delta > 0.000001) % QL with FDM
F(1)=u(1)-ua(m);
F(N)=u(N)-ub(m);
for i = 2:N-1
A=A0*exp(c*u(i));
Au=c*A;
Auu=c*Au;
Du=(u(i + 1)-u(i-1))/(2*h);
f=((u(i)-U(i,m-1))/tau-Au*Du*Du)/A;
q=(1/tau-Auu*Du*Du-f*Au)/A;
p=−2*Au*Du/A;
F(i)=u(i + 1)–2*u(i)+u(i-1)-h*h*f;
J(i,i-1)=1+h*p/2;
J(i,i)=−2-h*h*q;
J(i,i + 1)=1-h*p/2;
end
du=-J\F;
u = u+du;
delta=norm(du,Inf);
end
U(:,m)=u;
end
mesh(x,t,U’,'EdgeColor’,'interp’);
end
%
Code and Algorithm by authors.
Algorithm 2. Example 1 – specified flux at the left boundary, equation (77)
%MATLAB code 2:
function main
A0 = 0.01; c = 1.5;
M = 21; tf = 6; tau=tf/(M-1);
N = 51; a = 0; b = 1; h=(b-a)/(N-1);
t=zeros(M,1);
phia=zeros(M,1); ub=zeros(M,1);
for m = 1:M
t(m)=(m-1)*tau;
phia(m)=1-exp(-t(m)); % flux at x = 0
ub(m)=0; % temperature at x = 1
end
x=zeros(N,1);
u0=zeros(N,1);
for i = 1:N
x(i)=a+(i-1)*h;
u0(i)=0; % temperature at t = 0
end
U=zeros(N,M); U(:,1)=u0;
F=zeros(N,1);
J=zeros(N,N); J(N,N)=1;
for m = 2:M % time level
u = U(:,m-1);
delta = 1;
while(delta > 0.000001) % QL + FDM
A=A0*exp(c*u(1)); Au=c*A;
Du=(-u(3)+4*u(2)–3*u(1))/(2*h);
F(1)=A*Du+phia(m);
J(1,1)=Au*Du-1.5*A/h;
J(1,2)=2*A/h;
J(1,3)=-A/(2*h);
F(N)=u(N)-ub(m);
for i = 2:N-1
A=A0*exp(c*u(i)); Au=c*A; Auu=c*Au;
Du=(u(i + 1)-u(i-1))/(2*h);
f=((u(i)-U(i,m-1))/tau-Au*Du*Du)/A;
q=(1/tau-Auu*Du*Du-f*Au)/A;
p=−2*Au*Du/A;
F(i)=u(i + 1)–2*u(i)+u(i-1)-h*h*f;
J(i,i-1)=1+h*p/2;
J(i,i)=−2-h*h*q;
J(i,i + 1)=1-h*p/2;
end
du=-J\F;
u = u+du;
delta=norm(du,Inf);
end
U(:,m)=u;
end
mesh(x,t,U’,'EdgeColor’,'interp’);
end
%
Code and Algorithm by authors.
Algorithm 3. Example 1 – convection boundary condition at the left boundary, equation (79)
%MATLAB code 3:
function main
A0 = 0.01; c = 1.5; H = 1;
M = 41; tf = 12; tau=tf/(M-1);
N = 51; a = 0; b = 1; h=(b-a)/(N-1);
t=zeros(M,1);
Ta=zeros(M,1); ub=zeros(M,1);
for m = 1:M
t(m)=(m-1)*tau;
Ta(m)=1-exp(-t(m)); % temperature, x < 0
ub(m)=0; % temperature at x = 1
end
x=zeros(N,1);
u0=zeros(N,1);
for i = 1:N
x(i)=a+(i-1)*h;
u0(i)=0; % temperature at t = 0
end
U=zeros(N,M); U(:,1)=u0;
F=zeros(N,1);
J=zeros(N,N); J(N,N)=1;
for m = 2:M % time level
u = U(:,m-1);
delta = 1;
while(delta > 0.000001) % QL + FDM
A=A0*exp(c*u(1)); Au=c*A;
Du=(-u(3)+4*u(2)–3*u(1))/(2*h);
F(1)=A*Du-H*u(1)+H*Ta(m);
J(1,1)=Au*Du-H-1.5*A/h;
J(1,2)=2*A/h;
J(1,3)=-A/(2*h);
F(N)=u(N)-ub(m);
for i = 2:N-1
A=A0*exp(c*u(i));
Au=c*A;
Auu=c*Au;
Du=(u(i + 1)-u(i-1))/(2*h);
f=((u(i)-U(i,m-1))/tau-Au*Du*Du)/A;
q=(1/tau-Auu*Du*Du-f*Au)/A;
p=−2*Au*Du/A;
F(i)=u(i + 1)–2*u(i)+u(i-1)-h*h*f;
J(i,i-1)=1+h*p/2;
J(i,i)=−2-h*h*q;
J(i,i + 1)=1-h*p/2;
end
du=-J\F;
u = u+du;
delta=norm(du,Inf);
end
U(:,m)=u;
end
mesh(x,t,U’,'EdgeColor’,'interp’);
end
%
Code and Algorithm by authors.
Algorithm 4. Example 4 – convection boundary conditions at both boundaries
%MATLAB code 4:
function main
beta = 1;
Au=beta; Auu = 0;
H1 = 1; H2 = 10;
M = 101; tf = 2; tau=tf/(M-1);
N = 51; a = 0; b = 1; h=(b-a)/(N-1);
t=zeros(M,1);
Ta=zeros(M,1); Tb=zeros(M,1);
for m = 1:M
t(m)=(m-1)*tau;
Ta(m)=0; % left liquid temperature
Tb(m)=0; % right liquid temperature
end
x=zeros(N,1);
u0=zeros(N,1);
for i = 1:N
x(i)=a+(i-1)*h;
u0(i)=1; % initial slab temperature
end
U=zeros(N,M); U(:,1)=u0;
F=zeros(N,1);
J=zeros(N,N);
for m = 2:M % time level
u = U(:,m-1);
delta = 1;
while(delta > 0.000001) % QL + FDM
% at left boundary, x = 0:
A = 1+beta*u(1);
Du=(-u(3)+4*u(2)–3*u(1))/(2*h);
F(1)=A*Du-H1*u(1)+H1*Ta(m);
J(1,1)=Au*Du-H1-1.5*A/h;
J(1,2)=2*A/h;
J(1,3)=-A/(2*h);
% at right boundary, x = 1:
A = 1+beta*u(N);
Du=(3*u(N)-4*u(N-1)+u(N-2))/(2*h);
F(N)=A*Du+H2*u(N)-H2*Tb(m);
J(N,N)=Au*Du+H2 + 1.5*A/h;
J(N,N-1)=−2*A/h;
J(N,N-2)=A/(2*h);
% inner points, 0<x < 1:
for i = 2:N-1
A = 1+beta*u(i);
Du=(u(i + 1)-u(i-1))/(2*h);
f=((u(i)-U(i,m-1))/tau-Au*Du*Du)/A;
q=(1/tau-Auu*Du*Du-f*Au)/A;
p=−2*Au*Du/A;
F(i)=u(i + 1)–2*u(i)+u(i-1)-h*h*f;
J(i,i-1)=1+h*p/2;
J(i,i)=−2-h*h*q;
J(i,i + 1)=1-h*p/2;
end
du=-J\F;
u = u+du;
delta=norm(du,Inf);
end
U(:,m)=u;
end
figure;
mesh(x,t,U’,'EdgeColor’,'interp’);
end
%
Code and algorithm by authors.











