# Solving Advection Equations by Applying the Crank-Nicolson Scheme Combined with the Richardson Extrapolation

Authors: Zahari Zlatev; Ivan Dimov; István Faragó; Krassimir Georgiev; Ágnes Havasi; Tzvetan Ostromsky
Journal: International Journal of Differential Equations
 (2011)

---

## Abstract

Advection equations appear often in large-scale mathematical models arising in many fields of science and engineering. The Crank-Nicolson scheme can successfully be used in the numerical treatment of such equations. The accuracy of the numerical solution can sometimes be increased substantially by applying the Richardson Extrapolation. Two theorems related to the accuracy of the calculations will be formulated and proved in this paper. The usefulness of the combination consisting of the Crank-Nicolson scheme and the Richardson Extrapolation will be illustrated by numerical examples.


---

## Body

## 1. Statement of the Problem

Consider  the following advection equation:(1.1)∂c∂t=-u∂c∂x,x∈[a1,b1]⊂(-∞,∞),t∈[a,b]⊂(-∞,∞).
It will be assumed that u=u(x,t) is a given function. The physical meaning of this function depends on the area in which (1.1) arises. For example, in fluid dynamics applications it can be interpreted as fluid velocity, while in atmospheric modelling u(x,t) represents the wind velocity.Equation (1.1) must always be considered together with appropriate initial and boundary conditions.The well-known Crank-Nicolson scheme (see, e.g., [1, page 63]) can be used in the numerical treatment of (1.1). The computations are carried out by the following formula:(1.2)σi,n+0.5ci+1,n+1+ci,n+1-σi,n+0.5ci-1,n+1+σi,n+0.5ci+1,n-ci,n-σi,n+0.5ci-1,n=0,
when the Crank-Nicolson scheme is used. The quantity σi,n+0.5 is defined by(1.3)σi,n+0.5=k4hu(xi,tn+0.5),
where tn+0.5k=tn+0.5k and the increments h and k of the spatial and time variables are introduced by using two equidistant grids:(1.4)Gx={xi,i=0,1,…,Nx∣x0=a1,xi=xi-1+h,i=1,2,…,Nx,h=b1-a1Nx,xNx=b1},(1.5)Gt={tn,n=0,1,…,Nt∣t0=a,tn=tn-1+k,n=1,2,…,Nt,k=b-aNt,tNt=b}.
It should be possible to vary the increments h and k (e.g., h→0 and k→0 must be allowed when the convergent rates are to be studied). It will be assumed that the ratio h/k remains constant when the increments are varied. This implies a requirement that if, for example, h is halved then k is also halved. More precisely, it will be assumed that if an arbitrary pair of increments (h1,k1) is replaced with another pair (h2,k2), then the following relationship holds:(1.6)k1h1=k2h2=γ,
where γ is a constant which does not depend on increments. The requirement to keep h/k constant is very reasonable.Assume thatc(xi,tn) is the exact solution of (1.1) at an arbitrary grid-point belonging to the set defined by the two grids (1.4) and (1.5). Then the values ci,n (i=0,1,…,Nx and n=1,2,…,Nt) calculated by (1.2) are approximations of the exact solution at the grid-points (xi,tn). Our major task in the following part of this paper will be to show how the accuracy of the approximations ci,n can be improved by using additionally the Richardson Extrapolation.The application of the Richardson Extrapolation, when an arbitrary advection equation (not only the particular equation which was introduced in the beginning of this section) is treated by any numerical method, will be described in Section2. The error constants in the leading terms of the numerical error for the Crank-Nicolson scheme will be calculated in Section 3. The order of accuracy of the combination of the Crank-Nicolson scheme and the Richardson Extrapolation will be established in Section 4. Numerical results will be presented in Section 5 to demonstrate the applicability of the theorems proved in Sections 3 and 4. Several concluding remarks will be given and discussed in Section 6.


## 2. Application of the Richardson Extrapolation

Assume that a one-dimensional hyperbolic equation similar to (1.1) is treated by an arbitrary numerical method, which is of order p≥1 with regard to the two independent variables x and t. Let {zi,n+1}i=0Nx be the set of approximations of the solution of (1.1) calculated for t=tn+1∈Gt at all grid-points xi, i=0,1,…,Nx, of (1.4) by using the numerical method chosen and consider the corresponding approximations {zi,n}i=0Nx calculated at the previous time-step, that is, for t=tn∈Gt. Introduce vectors c̅(tn+1), z̅n, and z̅n+1, the components of which are {c(xi,tn+1)}i=0Nx, {zi,n}i=0Nx, and {zi,n+1}i=0Nx, respectively. Since the order of the numerical method is assumed to be p with regard both to x and to t, we can write(2.1)c̅(tn+1)=z̅n+1+hpK1+kpK2+O(kp+1),
where K1 and K2 are some quantities, which do not depend on h and on k. It is convenient to rewrite the last equality in the following form:(2.2)c̅(tn+1)=z̅n+1+kpK+O(kp+1),
where(2.3)K=(hk)pK1+K2.
If h and k are sufficiently small, then the sum hpK1+kpK2 will be a good approximation of the errors in the calculated values of the numerical solution {zi,n+1}i=0Nx. If the relationship (1.6) is satisfied and if h and k are sufficiently small, then kpK will also be a good approximation of the error of the numerical solution z̅n+1. This means that if we succeed to eliminate the term kpK in (2.2), then we shall obtain approximations of order p+1. The Richardson Extrapolation can be applied in the attempt to achieve such an improvement of the accuracy. In order to apply the Richardson Extrapolation, it is necessary to introduce an additional grid:
(2.4)Gx2={xi,i=0,1,…,2Nx∣x0=a1,xi=xi-1+h2,i=1,2,…,2Nx,h=b1-a1Nx,x2Nx=b1}.
Assume that approximations {wi,n}i=02Nx (calculated at the grid-points of Gx2 for t=tn∈Gt) are available and perform two small steps with a stepsize k/2 to compute {wi,n+1}i=02Nx. Use only the components with even indices i,i=0,2,4,…,2Nx, to form vector w̃n+1. The following equality holds for this vector:
(2.5)c̅(tn+1)=w̃n+1+(k2)pK+O(kp+1),
where the quantity K is defined as in (2.3).Now, it is possible to eliminate the quantityK from (2.2) and (2.5). This can successfully be done in the following way:(a)
remove the last two terms in (2.2) and (2.5),(b)
multiply (2.5) by 2p,(c)
subtract (2.2) from the modified equality (2.5).The result is(2.6)c̅(tn+1)=2pw̃n+1-z̅n+12p-1+O(kp+1).
Denote(2.7)c̅n+1=2pw̃n+1-z̅n+12p-1.
It is clear that the approximation c̅n+1, being of order p+1, will in general be more accurate than both z̅n+1 and w̃m+1 when h and k are sufficiently small. The device used to construct the approximation c̅n+1 is often called Richardson Extrapolation (it was introduced in [2]; see also [3–7]). Assume that the partial derivatives of the unknown function c(x,t) up to order p+1 exist and are continuous. Then one should expect (2.7) to produce more accurate results than those obtained by the underlying numerical method.Remark 2.1.
The rest terms in the formulae given in this section will in general depend on bothh and k. However, the application of the relationship (1.6) gives h=k/γ, and this justifies the use only of k in all rest terms in this section. This approach will also be used in the remaining part of this paper.Remark 2.2.
No specific assumptions about the particular partial differential equation or about the numerical method used to solve it were made in this section. This was done in order to demonstrate how general the idea, on which the Richardson Extrapolation is based, is. It must be emphasized, however, that in the following part of this paper it will be assumed that (a) equation (1.1) is solved under the assumptions made in the previous section and (b) the underlying numerical algorithm applied to handle it numerically will always be the second-order Crank-Nicolson scheme.


## 3. Error Constants of the Leading Terms of the Numerical Error for the  Crank-Nicolson Scheme

Consider formula (1.2). Following [8], we shall replace the approximations ci,n with the corresponding exact values c(xi,tn) of the solution of (1.1). The result is(3.1)L[c(xi,tn+0.5);h,k]=σi,n+0.5c(xi+1,tn+1)+c(xi,tn+1)-σi,n+0.5c(xi-1,tn+1)+σi,n+0.5c(xi+1,tn)-c(xi,tn)-σi,n+0.5c(xi-1,tn)=σi,n+0.5(c(xi+1,tn+1)-c(xi-1,tn+1))+(c(xi,tn+1)-c(xi,tn))+σi,n+0.5(c(xi+1,tn)-c(xi-1,tn)).
The following theorem can be proved by using this notation in the following theorem.Theorem 3.1.
The quantityL[c(xi,tn+0.5);h,k] can be written (assuming that all involved derivatives exist and are continuous) as
(3.2)L[c(xi,tn+0.5);h,k]=γh36u(xi,tn+0.5)∂3c(xi,tn+0.5)∂x3+k324∂3c(xi,tn+0.5)∂t3+k38u(xi,tn+0.5)∂3c(xi,tn+0.5)∂x∂t2+O(k5).Proof.
Use Taylor expansions around the point(xi,tn+0.5), where tn+0.5=tn+0.5k as in Section 1, of the functions in two variables involved in (3.1) and keep the terms containing ks,s=0,1,2,3,4. After some rather long but quite straight-forward transformations, (3.2) will be obtained.Theorem3.1 ensures that the Crank-Nicolson scheme is a second-order numerical method, which is, of course, well known. It is much more important that (a) it provides the leading terms of the error of this method (which are needed in the proof of Theorem 4.1) and (b) it shows that there are no fourth-order terms in the expression for the numerical error.


## 4. Order of Accuracy of the Combination Consisting of the  Crank-Nicolson Scheme and the Richardson Extrapolation

After presenting some preliminary results connected to (a) the problem solved, (b) the Crank-Nicolson scheme, and (c) the Richardson Extrapolation, everything is now prepared for the proof that the use of the combination of the Crank-Nicolson scheme and the Richardson Extrapolation leads to a fourth-order numerical method when the problem (1.1) is solved. More precisely, the following theorem holds.Theorem 4.1.
The combination of the Crank-Nicolson scheme and the Richardson Extrapolation is a fourth-order numerical method when all derivatives of the solution up to order four exist and are continuous.Proof.
Assume that all approximations{ci,n}i=0Nx at time-step n have already been found. Then the Richardson Extrapolation is carried out by using the Crank-Nicolson scheme to perform one large time-step with stepsize k and two small time-steps with stepsize 0.5k. The major part of the computations during the large time-step is carried out by using the formula:
(4.1)σi,n+0.5zi+1,n+1+zi,n+1-σi,n+0.5zi-1,n+1+σi,n+0.5ci+1,n-ci,n-σi,n+0.5ci-1,n=0.
The major part of the computations during the two small time-steps is based on the use of the following two formulas:
(4.2)σi,n+0.25wi+0.5,n+0.5+wi,n+0.5-σi,n+0.25wi-0.5,n+0.5+σi,n+0.25ci+0.5,n-ci,n-σi,n+0.25ci-0.5,n=0,σi,n+0.75wi+0.5,n+1+wi,n+1-σi,n+0.75wi-0.5,n+1+σi,n+0.75wi+0.5,n+0.5-wi,n+0.5-σi,n+0.75wi-0.5,n+0.5=0.
Let us start with (4.1). Equality (3.1) will be obtained when all approximate values in (4.1) are replaced with the corresponding values of the exact solution. This means that the assertion of Theorem 3.1, equality (3.2), holds for the large time-step.
The treatment of the two small time-steps is more complicated. Combining (4.2) leads to the formula:
(4.3)(σi,n+0.75wi+0.5,n+1+wi,n+1-σi,n+0.75wi-0.5,n+1+σi,n+0.75wi+0.5,n+0.5-wi,n+0.5-σi,n+0.75wi-0.5,n+0.5)+(σi,n+0.25wi+0.5,n+0.5+wi,n+0.5-σi,n+0.25wi-0.5,n+0.5+σi,n+0.25ci+0.5,n-ci,n-σi,n+0.25ci-0.5,n)=0.
Replace all approximate values participating in (4.3) with the corresponding exact values of the solution to obtain an expression for the local approximation error L̂ in the form:
(4.4)L̂=L̂1+L̂2,
where
(4.5)L̂1=σi,n+0.75[c(xi+0.5,tn+1)-c(xi-0.5,tn+1)+c(xi+0.5,tn+0.5)-c(xi-0.5,tn+0.5)]+c(xi,tn+1)-c(xi,tn+0.5),L̂2=σi,n+0.25[c(xi+0.5,tn+0.5)-c(xi-0.5,tn+0.5)+c(xi+0.5,tn)-c(xi-0.5,tn)]+c(xi,tn+0.5)-c(xi,tn).
Our aim is to derive an expression for L̂.
First, we consider the terms participating inL̂1. We use Taylor expansions of the involved functions around the point (xi,tn+0.75) and apply a similar transformation as in the proof of Theorem 3.1. In this way, we can obtain the following relation:
(4.6)L̂1=γh348u(xi,tn+0.75)∂3c(xi,tn+0.75)∂x3+k3192∂3c(xi,tn+0.75)∂t3+k364u(xi,tn+0.75)∂3c(xi,tn+0.75)∂x∂t2+O(k5).
We repeat the same kind of transformations also when L̂2 is considered. Now we apply Taylor expansions around the point (xi,tn+0.25) of the involved functions. Then we obtain
(4.7)L̂2=γh348u(xi,tn+0.25)∂3c(xi,tn+0.25)∂x3+k3192∂3c(xi,tn+0.25)∂t3+k364u(xi,tn+0.25)∂3c(xi,tn+0.25)∂x∂t2+O(k5).
The following result can be found by combining (4.6) and (4.7):
(4.8)L̂=γh348[u(xi,tn+0.75)∂3c(xi,tn+0.75)∂x3+u(xi,tn+0.25)∂3c(xi,tn+0.25)∂x3]+k3192[∂3c(xi,tn+0.75)∂t3+∂3c(xi,tn+0.25)∂t3]+k364[u(xi,tn+0.75)∂3c(xi,tn+0.75)∂x∂t2+u(xi,tn+0.25)∂3c(xi,tn+0.25)∂x∂t2]+O(k5).
Now, by expanding all terms in the right-hand side of (4.8) around the point (xi,tn+0.5k) and after some very long but straight-forward transformations, we obtain
(4.9)L̂=γh324u(xi,tn+0.5)∂3c(xi,tn+0.5)∂x3+k396∂3c(xi,tn+0.5)∂t3+k332u(xi,tn+0.5)∂3c(xi,tn+0.5)∂x∂t3+O(k5).
It should be noted here that a detailed derivation of the important relationship (4.9) can be found in [9].Since the order of the  Crank-Nicolson scheme is p=2, it is clear that the improved approximate solution by the Richardson Extrapolation at time-step n+1 is obtained by(a)
multiplying the result obtained at the end of the second small time-step by4/3,(b)
multiplying the result obtained at the end of the large time-step by1/3,(c)
subtracting the two results obtained in (a) and (b).Performing operations (a)–(c) will give
(4.10)43L̂-13L[c(xi,tn+0.5);h,k]=γh318u(xi,tn+0.5)∂3c(xi,tn+0.5)∂x3+k372∂3c(xi,tn+0.5)∂t3+k324u(xi,tn+0.5)∂3c(xi,tn+0.5)∂x∂t3-γh318u(xi,tn+0.5)∂3c(xi,tn+0.5)∂x3-k372∂3c(xi,tn+0.5)∂t3-k324u(xi,tn+0.5)∂3c(xi,tn+0.5)∂x∂t2+O(k5).
It is immediately seen that the first six terms in the right-hand side of (4.10) vanish. Therefore, the order of accuracy of the combined numerical method (the Crank-Nicolson scheme + the Richardson Extrapolation) is four, which completes the proof of the theorem.It should once again be emphasized that a full proof of Theorem4.1, containing all needed details, can be found in [9].


## 5. Numerical Experiments

In this section, it will be shown that the following two statements are true:(a)
if the solution is continuously differentiable up to order two, then the direct application of the Crank-Nicolson scheme gives second-order accuracy;(b)
if the solution is continuously differentiable up to order four, then the combined method consisting of the Crank-Nicolson scheme and the Richardson Extrapolation behaves as a fourth-order numerical algorithm.Furthermore, we shall also demonstrate the fact that if the above requirements are not satisfied, then neither the direct use of the Crank-Nicolson scheme leads to second-order accuracy nor the combined method based on the combination of the Crank-Nicolson scheme with the Richardson Extrapolation behaves as a fourth-order numerical algorithm.


### 5.1. Organization of the Computations

It is convenient for the purposes in this paper, but not necessary, to divide the time-interval [a,b] into 24 equal subintervals and to call each of these subintervals “hour”. By this convention, the length of the time-interval becomes 24 hours in all three examples given in this section; and we shall study the size of the numerical errors at the end of every hour.In each experiment, the first run is performed by usingNt=168 and Nx=160. Ten additional runs are performed after the first one. When a run is finished, both k and h are halved (this means that Nt and Nx are doubled) and a new run is started. Thus, in the eleventh run we have Nt=172032 and Nx=163840 which means that 172032 systems of linear algebraic equations, each of them containing 163840 equations, are to be solved.Note too, that the ratioh/k is kept constant, that is, the requirement (1.6) is satisfied, when the two increments k and h are varied in this way.We are mainly interested in the behavior of the numerical error. As mentioned above, this error is evaluated at the end of every hour (i.e., 24 times in each run) and at the grid-points of the coarsest spatial grid, in the following way. Assume that run numberr,r=1,2,…,11, is to be carried out and let R=2r-1. Then the error made at the end of hour m is calculated by using the following formula:(5.1)ERRm=max⁡j=0,1,…,160(|cĩ,ñ-cĩ,ñexact|max⁡(|cĩ,ñexact|,1.0)),m=1,2,…,24,ĩ=jR,ñ=7mR,
where cĩ,ñ and cĩ,ñexact are the calculated value and the exact solution at the end of hour m and at the grid-points of the coarsest grid (i.e., for Nx=160). In the three experiments presented in this section, the exact solution is known.The global error made during the computations is estimated by using the following formula:(5.2)ERR=max⁡m=1,2,…,24(ERRm).
It is necessary to point out here that the numerical values of the unknown function, which are improved by the Richardson Extrapolation, that is, by applying (2.7) with p=2, are available only on the coarser spatial grid (1.4). It is necessary to get appropriate approximations for all values on the finer spatial grid (2.4). Several devices for obtaining such approximations have been suggested and tested in [10]. It was shown there that the application of third-order interpolation polynomials gives best results. This device has been used also in the present work.


### 5.2. Construction of a Test Problem with Steep Gradients of the Unknown Function

Assume that the spatial and the time intervals are given by(5.3)x∈[0,50000000],t∈[43200,129600],
and consider a function u(x,t) defined by(5.4)u(x,t)=320.
Let the initial condition be given by(5.5)f(x)=ξ[1+99.0e-ω(x-10000000)2],ξ=1.4679⋅1012,ω=10-12.
The exact solution of the Test Problem, which is defined as above, is(5.6)c(x,t)=f(x-320(t-43200)).
The Test Problem  introduced in this subsection was run both by using the Crank-Nicolson scheme directly and by applying the combination of this scheme and the Richardson Extrapolation. Numerical results are presented in Table 1.Table 1
Results obtained when the test problem defined by (5.3)–(5.5) is handled directly by the Crank-Nicolson scheme and by using the combination of the Crank-Nicolson scheme and the Richardson Extrapolation. The numerical errors calculated by (5.1) and (5.2) are given in the columns under “Error”. In row s,s=2,3,…,11, the ratios of the errors in this row and in the previous row are given in the columns under “Ratio”.
Direct solutionRichardson ExtrapolationNo.NtNxErrorRatioErrorRatio11681607.373E-01—1.454E-01—23363204.003E-011.8421.741E-028.35036726401.254E-013.1421.224E-0314.2204134412803.080E-024.1357.730E-0515.8375268825607.765E-033.9674.841E-0615.9706537651201.954E-033.9743.026E-0715.999710752102404.892E-043.9941.891E-0816.004821504204801.224E-043.9991.181E-0916.011943008409603.059E-054.0007.609E-1115.5191086016819207.648E-064.0009.848E-127.726111720321638401.912E-064.0004.966E-121.983The following conclusions can be drawn by studying the results presented in Table1.(i)
The direct application of the Crank-Nicolson scheme leads to quadratic convergence of the accuracy of the numerical results (i.e., halving the incrementsk and h leads to a decrease of the error by a factor of four). This behaviour should be expected according to Theorem 3.1.(ii)
The combination of the Crank-Nicolson scheme and the Richardson Extrapolation behaves in general as a numerical method of order four (or, in other words, halving the incrementsh and k leads to a decrease of the error by a factor of sixteen). This behaviour should also be expected (according to Theorem 4.1).(iii)
At the end of the computations with the combined numerical method (the Crank-Nicolson scheme + the Richardson Extrapolation), the convergence rate deteriorates. Two facts are very important when this happens: (a) the computed solution is already very accurate and (b) the rounding errors start to affect the calculated results.In Figure1, plots are given showing (a) the initial values, (b) the solution in the middle of the time interval (i.e., after 12 hours), and (c) the solution at the end of the time interval for the test problem defined by (5.3)–(5.5).The solution of the one-dimensional advection equation defined in Section5.2: (a) at the beginning of the interval (the upper plot), (b) at the end of the twelfth hour (the plot in the middle), and (c) at the end of the time-interval (the lower plot).
(a)(b)(c)Remark 5.1.
A similar test-example was used in [11]. It should also be noted that a very similar advection module is a part of the large-scale air pollution model UNI-DEM ([12–14]) and the quantities used in (5.3)–(5.5) are either the same or very similar to the corresponding quantities in this model. Note too that the values of the unknown function are of the same order of magnitude as the ozone concentrations in the atmosphere when these are measured in (number of molecules)/(cubic centimetre).


### 5.3. Construction of an Oscillatory Test Problem

Define the spatial and time intervals by(5.7)a=a1=0,b=b1=2π.
Consider a function u(x,t) defined by (5.8)u(x,t)=0.5.
Let the initial values be defined by (5.9)f(x)=[100+99sin⁡(10x)]*1.4679*1012.
The exact solution of the test problem defined by (5.7)–(5.9) is: (5.10)c(x,t)=f(x-0.5t).
As in Section 5.2, the test problem introduced above was run both by using the Crank-Nicolson scheme directly and by applying the combination of this scheme and the Richardson Extrapolation. Numerical results are presented in Table 2.Table 2
Results obtained when the test problem defined by (5.7)–(5.9) is handled directly by the Crank-Nicolson scheme and by using the combination of the Crank-Nicolson scheme and the Richardson Extrapolation. The numerical errors calculated by (5.1) and (5.2) are given in the columns under “Error”. In row s,s=2,3,…,11, the ratios of the errors in this row and in the previous row are given in the columns under “Ratio”.
Direct solutionRichardson ExtrapolationNo.NtNxErrorRatioErrorRatio11681607.851E-01—1.560E-02—23363202.160E-013.6351.227E-0312.71336726405.317E-024.0621.072E-0411.4324134412801.327E-024.0071.150E-059.3335268825603.319E-033.9971.193E-069.6416537651208.299E-044.0001.478E-078.071710752102402.075E-044.0001.618E-089.136821504204805.187E-054.0001.965E-098.233943008409601.297E-054.0002.387E-108.2331086016819203.242E-064.0003.241E-117.365111720321638408.104E-074.0001.267E-112.557The conclusions, which can be drawn from the results presented in Table2, are quite similar to those given in Section 5.2. However, for the oscillatory test problem, the actual convergence rate achieved in the runs is less than four (greater than three in the beginning and after that equal to or less than three). It is not very clear what the reason for this behaviour is. Perhaps, the interpolation rule used to improve the precision of the values on the finer spatial grid (see Section 5.1 and [10]) is not sufficiently accurate for this example when grid-points near the boundary are treated. Nevertheless, it is clearly seen that the achieved accuracy is nearly the same as the accuracy achieved in the solution of the previous test problem (compare Table 1 with Table 2).In Figure2, plots are given showing (a) the initial values, (b) the solution in the middle of the time interval (i.e., after 12 hours), and (c) the solution at the end of the time interval for the test problem studied in this subsection.The solution of the one-dimensional advection equation defined in Section5.3 is drawn (a) at the beginning of the interval (the upper plot), (b) at the end of the twelfth hour (the plot in the middle), and (c) at the end of the time interval (the lower plot).
(a)(b)(c)


### 5.4. Construction of a Test Problem with Discontinuities

Assume that the spatial interval, the time-interval, and functionu(x,t) are defined as in Section 5.2, that is, by (5.3) and (5.4), and introduce initial values by  (5.11)f(x)=1.4679*1012,x≤5000000orx≥15000000,f(x)=[1+99*x-50000005000000]*1.4679*1012,5000000≤x≤10000000,f(x)=[1+99*15000000-x5000000]*1.4679*1012,10000000≤x≤15000000.
The exact solution of the test problem defined as above is given by (5.6).As in the previous two sub-sections, the test problem introduced above was run both by using the Crank-Nicolson scheme directly and by applying the combination of this scheme and the Richardson Extrapolation. Numerical results are presented in Table3.Table 3
Results obtained when the test problem defined in Section5.4 is handled directly by the Crank-Nicolson scheme and by using the combination of the Crank-Nicolson scheme and the Richardson Extrapolation. The numerical errors calculated by (5.1) and (5.2) are given in the columns under “Error”. In row s,s=2,3,…,11, the ratios of the errors in this row and in the previous row are given in the columns under “Ratio”.
Direct solutionRichardson ExtrapolationNo.NtNxErrorRatioErrorRatio11681601.353E-01—4.978E-02—23363207.687E-021.7602.761E-021.80336726404.424E-021.7371.551E-021.7804134412802.555E-021.7328.570E-031.8105268825601.636E-021.5614.590E-031.8676537651201.051E-021.5522.318E-031.980710752102405.551E-031.8991.188E-031.951821504204802.921E-031.9006.575E-041.807943008409602.644E-031.1052.379E-042.7461086016819201.619E-031.6331.501E-041.585111720321638401.145E-031.4142.787E-054.941Two major conclusions can be drawn from the results presented in Table3: (a) neither the direct Crank-Nicolson scheme nor the combination of the Crank-Nicolson scheme with the Richardson Extrapolation gives the prescribed by the theory accuracy (orders two and four, resp.) and (b) also in this case, that is, in the presence of discontinuities, the combination of the Crank-Nicolson scheme and the Richardson Extrapolation is considerably more accurate than the direct application of the Crank-Nicolson scheme.In Figure3, plots are given showing (a) the initial values, (b) the solution in the middle of the time interval (i.e., after 12 hours), and (c) the solution at the end of the time interval for the test problem studied in this subsection.The solution of the one-dimensional advection equation defined in Section5.4 is drawn (a) at the beginning of the interval (the upper plot), (b) at the end of the twelfth hour (the plot in the middle), and (c) at the end of the time interval (the lower plot).
(a)(b)(c)


## 5.1. Organization of the Computations

It is convenient for the purposes in this paper, but not necessary, to divide the time-interval [a,b] into 24 equal subintervals and to call each of these subintervals “hour”. By this convention, the length of the time-interval becomes 24 hours in all three examples given in this section; and we shall study the size of the numerical errors at the end of every hour.In each experiment, the first run is performed by usingNt=168 and Nx=160. Ten additional runs are performed after the first one. When a run is finished, both k and h are halved (this means that Nt and Nx are doubled) and a new run is started. Thus, in the eleventh run we have Nt=172032 and Nx=163840 which means that 172032 systems of linear algebraic equations, each of them containing 163840 equations, are to be solved.Note too, that the ratioh/k is kept constant, that is, the requirement (1.6) is satisfied, when the two increments k and h are varied in this way.We are mainly interested in the behavior of the numerical error. As mentioned above, this error is evaluated at the end of every hour (i.e., 24 times in each run) and at the grid-points of the coarsest spatial grid, in the following way. Assume that run numberr,r=1,2,…,11, is to be carried out and let R=2r-1. Then the error made at the end of hour m is calculated by using the following formula:(5.1)ERRm=max⁡j=0,1,…,160(|cĩ,ñ-cĩ,ñexact|max⁡(|cĩ,ñexact|,1.0)),m=1,2,…,24,ĩ=jR,ñ=7mR,
where cĩ,ñ and cĩ,ñexact are the calculated value and the exact solution at the end of hour m and at the grid-points of the coarsest grid (i.e., for Nx=160). In the three experiments presented in this section, the exact solution is known.The global error made during the computations is estimated by using the following formula:(5.2)ERR=max⁡m=1,2,…,24(ERRm).
It is necessary to point out here that the numerical values of the unknown function, which are improved by the Richardson Extrapolation, that is, by applying (2.7) with p=2, are available only on the coarser spatial grid (1.4). It is necessary to get appropriate approximations for all values on the finer spatial grid (2.4). Several devices for obtaining such approximations have been suggested and tested in [10]. It was shown there that the application of third-order interpolation polynomials gives best results. This device has been used also in the present work.


## 5.2. Construction of a Test Problem with Steep Gradients of the Unknown Function

Assume that the spatial and the time intervals are given by(5.3)x∈[0,50000000],t∈[43200,129600],
and consider a function u(x,t) defined by(5.4)u(x,t)=320.
Let the initial condition be given by(5.5)f(x)=ξ[1+99.0e-ω(x-10000000)2],ξ=1.4679⋅1012,ω=10-12.
The exact solution of the Test Problem, which is defined as above, is(5.6)c(x,t)=f(x-320(t-43200)).
The Test Problem  introduced in this subsection was run both by using the Crank-Nicolson scheme directly and by applying the combination of this scheme and the Richardson Extrapolation. Numerical results are presented in Table 1.Table 1
Results obtained when the test problem defined by (5.3)–(5.5) is handled directly by the Crank-Nicolson scheme and by using the combination of the Crank-Nicolson scheme and the Richardson Extrapolation. The numerical errors calculated by (5.1) and (5.2) are given in the columns under “Error”. In row s,s=2,3,…,11, the ratios of the errors in this row and in the previous row are given in the columns under “Ratio”.
Direct solutionRichardson ExtrapolationNo.NtNxErrorRatioErrorRatio11681607.373E-01—1.454E-01—23363204.003E-011.8421.741E-028.35036726401.254E-013.1421.224E-0314.2204134412803.080E-024.1357.730E-0515.8375268825607.765E-033.9674.841E-0615.9706537651201.954E-033.9743.026E-0715.999710752102404.892E-043.9941.891E-0816.004821504204801.224E-043.9991.181E-0916.011943008409603.059E-054.0007.609E-1115.5191086016819207.648E-064.0009.848E-127.726111720321638401.912E-064.0004.966E-121.983The following conclusions can be drawn by studying the results presented in Table1.(i)
The direct application of the Crank-Nicolson scheme leads to quadratic convergence of the accuracy of the numerical results (i.e., halving the incrementsk and h leads to a decrease of the error by a factor of four). This behaviour should be expected according to Theorem 3.1.(ii)
The combination of the Crank-Nicolson scheme and the Richardson Extrapolation behaves in general as a numerical method of order four (or, in other words, halving the incrementsh and k leads to a decrease of the error by a factor of sixteen). This behaviour should also be expected (according to Theorem 4.1).(iii)
At the end of the computations with the combined numerical method (the Crank-Nicolson scheme + the Richardson Extrapolation), the convergence rate deteriorates. Two facts are very important when this happens: (a) the computed solution is already very accurate and (b) the rounding errors start to affect the calculated results.In Figure1, plots are given showing (a) the initial values, (b) the solution in the middle of the time interval (i.e., after 12 hours), and (c) the solution at the end of the time interval for the test problem defined by (5.3)–(5.5).The solution of the one-dimensional advection equation defined in Section5.2: (a) at the beginning of the interval (the upper plot), (b) at the end of the twelfth hour (the plot in the middle), and (c) at the end of the time-interval (the lower plot).
(a)(b)(c)Remark 5.1.
A similar test-example was used in [11]. It should also be noted that a very similar advection module is a part of the large-scale air pollution model UNI-DEM ([12–14]) and the quantities used in (5.3)–(5.5) are either the same or very similar to the corresponding quantities in this model. Note too that the values of the unknown function are of the same order of magnitude as the ozone concentrations in the atmosphere when these are measured in (number of molecules)/(cubic centimetre).


## 5.3. Construction of an Oscillatory Test Problem

Define the spatial and time intervals by(5.7)a=a1=0,b=b1=2π.
Consider a function u(x,t) defined by (5.8)u(x,t)=0.5.
Let the initial values be defined by (5.9)f(x)=[100+99sin⁡(10x)]*1.4679*1012.
The exact solution of the test problem defined by (5.7)–(5.9) is: (5.10)c(x,t)=f(x-0.5t).
As in Section 5.2, the test problem introduced above was run both by using the Crank-Nicolson scheme directly and by applying the combination of this scheme and the Richardson Extrapolation. Numerical results are presented in Table 2.Table 2
Results obtained when the test problem defined by (5.7)–(5.9) is handled directly by the Crank-Nicolson scheme and by using the combination of the Crank-Nicolson scheme and the Richardson Extrapolation. The numerical errors calculated by (5.1) and (5.2) are given in the columns under “Error”. In row s,s=2,3,…,11, the ratios of the errors in this row and in the previous row are given in the columns under “Ratio”.
Direct solutionRichardson ExtrapolationNo.NtNxErrorRatioErrorRatio11681607.851E-01—1.560E-02—23363202.160E-013.6351.227E-0312.71336726405.317E-024.0621.072E-0411.4324134412801.327E-024.0071.150E-059.3335268825603.319E-033.9971.193E-069.6416537651208.299E-044.0001.478E-078.071710752102402.075E-044.0001.618E-089.136821504204805.187E-054.0001.965E-098.233943008409601.297E-054.0002.387E-108.2331086016819203.242E-064.0003.241E-117.365111720321638408.104E-074.0001.267E-112.557The conclusions, which can be drawn from the results presented in Table2, are quite similar to those given in Section 5.2. However, for the oscillatory test problem, the actual convergence rate achieved in the runs is less than four (greater than three in the beginning and after that equal to or less than three). It is not very clear what the reason for this behaviour is. Perhaps, the interpolation rule used to improve the precision of the values on the finer spatial grid (see Section 5.1 and [10]) is not sufficiently accurate for this example when grid-points near the boundary are treated. Nevertheless, it is clearly seen that the achieved accuracy is nearly the same as the accuracy achieved in the solution of the previous test problem (compare Table 1 with Table 2).In Figure2, plots are given showing (a) the initial values, (b) the solution in the middle of the time interval (i.e., after 12 hours), and (c) the solution at the end of the time interval for the test problem studied in this subsection.The solution of the one-dimensional advection equation defined in Section5.3 is drawn (a) at the beginning of the interval (the upper plot), (b) at the end of the twelfth hour (the plot in the middle), and (c) at the end of the time interval (the lower plot).
(a)(b)(c)


## 5.4. Construction of a Test Problem with Discontinuities

Assume that the spatial interval, the time-interval, and functionu(x,t) are defined as in Section 5.2, that is, by (5.3) and (5.4), and introduce initial values by  (5.11)f(x)=1.4679*1012,x≤5000000orx≥15000000,f(x)=[1+99*x-50000005000000]*1.4679*1012,5000000≤x≤10000000,f(x)=[1+99*15000000-x5000000]*1.4679*1012,10000000≤x≤15000000.
The exact solution of the test problem defined as above is given by (5.6).As in the previous two sub-sections, the test problem introduced above was run both by using the Crank-Nicolson scheme directly and by applying the combination of this scheme and the Richardson Extrapolation. Numerical results are presented in Table3.Table 3
Results obtained when the test problem defined in Section5.4 is handled directly by the Crank-Nicolson scheme and by using the combination of the Crank-Nicolson scheme and the Richardson Extrapolation. The numerical errors calculated by (5.1) and (5.2) are given in the columns under “Error”. In row s,s=2,3,…,11, the ratios of the errors in this row and in the previous row are given in the columns under “Ratio”.
Direct solutionRichardson ExtrapolationNo.NtNxErrorRatioErrorRatio11681601.353E-01—4.978E-02—23363207.687E-021.7602.761E-021.80336726404.424E-021.7371.551E-021.7804134412802.555E-021.7328.570E-031.8105268825601.636E-021.5614.590E-031.8676537651201.051E-021.5522.318E-031.980710752102405.551E-031.8991.188E-031.951821504204802.921E-031.9006.575E-041.807943008409602.644E-031.1052.379E-042.7461086016819201.619E-031.6331.501E-041.585111720321638401.145E-031.4142.787E-054.941Two major conclusions can be drawn from the results presented in Table3: (a) neither the direct Crank-Nicolson scheme nor the combination of the Crank-Nicolson scheme with the Richardson Extrapolation gives the prescribed by the theory accuracy (orders two and four, resp.) and (b) also in this case, that is, in the presence of discontinuities, the combination of the Crank-Nicolson scheme and the Richardson Extrapolation is considerably more accurate than the direct application of the Crank-Nicolson scheme.In Figure3, plots are given showing (a) the initial values, (b) the solution in the middle of the time interval (i.e., after 12 hours), and (c) the solution at the end of the time interval for the test problem studied in this subsection.The solution of the one-dimensional advection equation defined in Section5.4 is drawn (a) at the beginning of the interval (the upper plot), (b) at the end of the twelfth hour (the plot in the middle), and (c) at the end of the time interval (the lower plot).
(a)(b)(c)


## 6. Concluding Remarks

Several conclusions can be drawn by using the theorems proved in Sections3 and 4 as well as the numerical results presented in Section 6.The most important conclusion is related to the accuracy of the computed results. The accuracy can be improved considerably if the Crank-Nicolson scheme is combined with the Richardson Extrapolation. However, this effect will be achieved only when the solution is continuously differentiable up to order four and when the boundary conditions needed in the actual computations are sufficiently accurate.It is highly desirable to investigate carefully the performance of the combined method in the cases where(a)
some derivatives of the solution are discontinuous,(b)
the solution is highly oscillatory,(c)
the problem is stiff (which will normally cause stability problems).These important topics will be studied in the near future.Some assumptions were made in order to prove the two theorems. It is worthwhile to investigate carefully the possibilities for removing these assumptions or for relaxing them.



---

*Source: 520840-2011-12-20.xml*