**3.1 Obtaining discrete compact schemes for the convective-diffusion problem of MNN**

Of great interest is the construction and analysis of the discretization of a singularly perturbed ordinary differential equation of the second order. The equation of convection-diffusion is basic in modeling fluid flow at high Reynolds numbers and in convective mass exchange at high Peclet numbers. Many works are devoted to this subject [25, 40–45].

Numerical solutions of the convection-diffusion equation often show numerical fluctuations. In practical calculations, many authors have observed parasitic oscillations at high Peclet numbers when the central approximation for the convective term is used. On the other hand, the upwind scheme usually leads to unpleasant artificial numerical diffusion.

This dilemma is central to the numerical solutions of convection-diffusion problems.

In order to compute approximate solutions to a partial differential equation, some form of local approximation must be used. This means that the decision values at each node are used to generate an approximate decision value. With finite differences, one usually tries to make the local area as compact as possible, for example, using only neighboring nodes when updating on a node.

If we consider the approximation of the convection-diffusion problem on a uniform grid, we can observe that most of the literature deals with the choice between schemes in a three-point pattern: (W,P,E). To obtain an approximation of a high order of accuracy, it is necessary to increase the number of points of the computational pattern.

Here we use the structure described in the first chapter to derive a new finite difference scheme [14]. Although such a procedure cannot be easily generalized to partial differential equations with variable coefficients.

Consider the DE of convection-diffusion

*Moving Node Method for Differential Equations DOI: http://dx.doi.org/10.5772/intechopen.107340*

$$\frac{d\Phi}{d\mathbf{x}} = \frac{1}{Pe} \frac{d^2\Phi}{d\mathbf{x}^2} + \mathcal{S}(\mathbf{x}),\tag{73}$$

with boundary conditions.

$$
\Phi(\mathbf{0}) = \Phi\_0, \Phi(\mathbf{1}) = \Phi\_1 \tag{74}
$$

where Pe is the Peclet number ð Þ *Pe* ¼ *ρvL=Г* , (*v* is the velocity, *ρ* � density, L is the length scale, Г is the diffusion coefficient, *x* is the dimensionless coordinate, S(х) is the source.

On [0,1] we introduce a non-uniform grid

$$\mathfrak{Q} = \{ \mathfrak{x}\_i, i = 0, 1, 2, \dots, N, 0 = \mathfrak{x}\_0 < \mathfrak{x}\_1 < \dots < \mathfrak{x}\_{i-1} < \mathfrak{x}\_i < \mathfrak{x}\_{i+1} < \dots < \mathfrak{x}\_N = 1 \}. $$

In the first chapter, with the help of moving nodes, an analytical solution to problem (73), (74) was constructed. When constructing compact circuits, we rely on a circuit against the flow, which is monotonic for any Peclet numbers.

Let us rewrite the scheme against the flow (21) for the segment (W,E)

$$\operatorname{Pe}\frac{U^1 - U\_W^1}{\varkappa - W} = \frac{2}{(E - W)} \left( \frac{U\_E^1 - U^1}{E - \varkappa} - \frac{U^1 - U\_W^1}{\varkappa - W} \right) + \operatorname{Pe} \cdot \operatorname{S}(\infty). \tag{75}$$

In (75), the equation relates the unknown function at three points: *W*, *x*, *E*, i.e. Eq. (75) is written in a three-point pattern. Now let us write Eq. (75) for an arbitrary internal node *xi*, which is connected with neighboring nodes *xi*�1, *xi*þ1. Then

$$\operatorname{Pe}\frac{U\_i^1 - U\_{i-1}^1}{\mathbf{x}\_i - \mathbf{x}\_{i-1}} = \frac{2}{(\mathbf{x}\_{i+1} - \mathbf{x}\_{i-1})} \left( \frac{U\_{i+1}^1 - U\_i^1}{\mathbf{x}\_{i+1} - \mathbf{x}\_i} - \frac{U\_i^1 - U\_{i-1}^1}{\mathbf{x}\_i - \mathbf{x}\_{i-1}} \right) + \operatorname{Pe} \cdot \operatorname{S}(\mathbf{x}\_i). \tag{76}$$

Here, *<sup>i</sup>* <sup>¼</sup> 1, 2, … , *<sup>i</sup>*, … , *<sup>N</sup>* � 1 and *<sup>U</sup>*<sup>1</sup> *<sup>i</sup>* means the approximate value of the unknown function at the node *xi*.

This schema can be rewritten like this:

$$
\mathfrak{a}\_P^1 U\_P^1 = \mathfrak{a}\_E^1 U\_E^1 + \mathfrak{a}\_W^1 U\_W^1 + F\_i^1,\tag{77}
$$

But now

$$\begin{aligned} a\_E^1 &= \frac{2}{(\mathbf{x}\_{i+1} - \mathbf{x}\_{i-1})(\mathbf{x}\_{i+1} - \mathbf{x}\_i)}, a\_W^1 = \frac{Pe}{(\mathbf{x}\_i - \mathbf{x}\_{i-1})} + \frac{2}{(\mathbf{x}\_{i+1} - \mathbf{x}\_{i-1})(\mathbf{x}\_{i+1} - \mathbf{x}\_i)}, \\ a\_P^1 &= a\_E^1 + a\_W^1, F\_i^1 = Pe \cdot \mathbb{S}(\mathbf{x}\_i) \end{aligned} \tag{78}$$

To increase accuracy, based on three moving nodes (28),

$$a\_P^3 U\_P^3 = a\_E^3 U\_E^3 + a\_W^3 U\_W^3 + F\_i^3,\tag{79}$$

$$\begin{aligned} \text{here } a\_E^3 &= \frac{8}{(\mathbf{x}\_{i+1} - \mathbf{x}\_{i-1})(\mathbf{x}\_{i+1} - \mathbf{x}\_i)(\mathbf{1} + \mathbf{y}\_1)}, a\_W^3 = \frac{2p\_\mathbf{e}}{(\mathbf{x}\_i - \mathbf{x}\_{i-1})(\mathbf{1} + \mathbf{r}\_1)} + \frac{8}{(\mathbf{x}\_{i+1} - \mathbf{x}\_{i-1})(\mathbf{x}\_i - \mathbf{x}\_{i-1})(\mathbf{1} + \mathbf{r}\_1)}, \\ a\_P^3 &= a\_W^3 + a\_E^3, \ \theta = Pe\left(\mathbf{x}\_{i+1} - \mathbf{x}\_i\right), \sigma = Pe\left(\mathbf{x}\_i - \mathbf{x}\_{i-1}\right), \tau\_1 = 2/(2 + \sigma), \tau\_1 = (2 + \theta)/2 \\ F\_i^3 &= Pe \cdot \mathcal{S}(\mathbf{x}\_i) + \frac{4 + Pe \cdot (\mathbf{x}\_{i+1} - \mathbf{x}\_{i-1})}{\mathbf{x}\_{i+1} - \mathbf{x}\_{i-1}} \cdot \frac{1 - \tau\_1}{1 + \tau\_1} \cdot \mathcal{S}\left(\mathbf{x}\_{i-1/2}\right) + \frac{4}{\mathbf{x}\_{i+1} - \mathbf{x}\_{i-1}} \cdot \frac{\gamma\_1 - 1}{\gamma\_1 + 1} \cdot \mathcal{S}\left(\mathbf{x}\_{i+1/2}\right) \\ &\qquad \cdot \tau\_1 \overset{\pi}{\to} \mathcal{S}\left(\mathbf{x}\_i - \mathbf{x}\_{i-1}\right) \end{aligned}$$

$$
\mathfrak{x}\_{i-1/2} = \mathbf{0}, \mathfrak{z}(\mathfrak{x}\_{i-1} + \mathfrak{x}\_i), \mathfrak{x}\_{i+1/2} = \mathbf{0}, \mathfrak{z}(\mathfrak{x}\_i + \mathfrak{x}\_{i+1}).
$$

Based on with 2*<sup>k</sup>* � 1 moving nodes (31), we have

$$a\_P^{\left(2^k - 1\right)} U\_P^{\left(2^k - 1\right)} = a\_E^{\left(2^k - 1\right)} U\_E^{\left(2^k - 1\right)} + a\_W^{\left(2^k - 1\right)} U\_W^{\left(2^k - 1\right)} + F\_i^{\left(2^k - 1\right)},\tag{80}$$

where

*a* <sup>2</sup>*<sup>k</sup>* ð Þ �<sup>1</sup> *<sup>E</sup>* <sup>¼</sup> <sup>22</sup>*<sup>k</sup>*þ<sup>1</sup> <sup>1</sup> � *<sup>γ</sup><sup>k</sup>* ð Þ ð Þ *xi*þ<sup>1</sup> � *xi*�<sup>1</sup> ð Þ *xi*þ<sup>1</sup> � *xi* <sup>1</sup> � *<sup>γ</sup>*<sup>2</sup>*<sup>k</sup> k* � � , *<sup>a</sup>* <sup>2</sup>*<sup>k</sup>* ð Þ �<sup>1</sup> *<sup>W</sup>* <sup>¼</sup> <sup>22</sup>*<sup>k</sup>*þ<sup>1</sup> *Pe*ð Þ 1 � *τ<sup>k</sup>* ð Þ *xi* � *xi*�<sup>1</sup> <sup>1</sup> � *<sup>τ</sup>*<sup>2</sup>*<sup>k</sup> k* � � þ 22*<sup>k</sup>*þ<sup>1</sup> ð Þ 1 � *τ<sup>k</sup>* ð Þ *xi*þ<sup>1</sup> � *xi*�<sup>1</sup> ð Þ *xi* � *xi*�<sup>1</sup> <sup>1</sup> � *<sup>τ</sup>*<sup>2</sup>*<sup>k</sup> k* � � , *a* <sup>2</sup>*<sup>k</sup>* ð Þ �<sup>1</sup> *<sup>P</sup>* ¼ *a* <sup>2</sup>*<sup>k</sup>* ð Þ �<sup>1</sup> *<sup>W</sup>* þ *a* <sup>2</sup>*<sup>k</sup>* ð Þ �<sup>1</sup> *<sup>E</sup> :τ<sup>k</sup>* <sup>¼</sup> <sup>2</sup>*<sup>k</sup> <sup>=</sup>* <sup>2</sup>*<sup>k</sup>* <sup>þ</sup> *<sup>σ</sup>* � �, *<sup>γ</sup><sup>k</sup>* <sup>¼</sup> <sup>2</sup>*<sup>k</sup>* <sup>þ</sup> *<sup>θ</sup>* � �*=*2*<sup>k</sup>* , *Fi* <sup>2</sup>*<sup>k</sup>* ð Þ �<sup>1</sup> <sup>¼</sup> *Pe* � *S x*ð Þþ*<sup>i</sup>* <sup>2</sup>*<sup>k</sup>*þ<sup>1</sup> <sup>þ</sup> *Pe* � ð Þ *xi*þ<sup>1</sup> � *xi*�<sup>1</sup> *xi*þ<sup>1</sup> � *xi*�<sup>1</sup> ð Þ <sup>1</sup> � *<sup>τ</sup><sup>k</sup>* <sup>2</sup> <sup>1</sup> � *<sup>τ</sup>*<sup>2</sup>*<sup>k</sup> k* 2 X*k*�1 *j*¼1 X *j i*¼1 *<sup>τ</sup><sup>i</sup>*�<sup>1</sup> *<sup>k</sup>* � *S xi* <sup>þ</sup> *<sup>j</sup> xi* � *xi*�<sup>1</sup> 2*k* � �� 2*<sup>k</sup>*þ<sup>1</sup> *xi*þ<sup>1</sup> � *xi*�<sup>1</sup> <sup>1</sup> � *<sup>γ</sup><sup>k</sup>* ð Þ<sup>2</sup> <sup>1</sup> � *<sup>γ</sup>*<sup>2</sup>*<sup>k</sup> k* 2 X*k*�1 *j*¼1 X *j i*¼1 *γ<sup>i</sup>*�<sup>1</sup> *<sup>k</sup>* � *S xi* <sup>þ</sup> <sup>2</sup>*<sup>k</sup>* � *<sup>j</sup>* � � *xi*þ<sup>1</sup> � *xi* 2*k* � �*:*

Let us consider numerical experiments.

**Figures 39** and **40** show graphs for solving problem (73), (74) for *Pe* ¼ 50 on segments 0; 1 ½ � with boundary conditions *Ф*<sup>0</sup> ¼ 0, *Ф*<sup>1</sup> ¼ 1*:* **Figure 39** corresponds to *S x*ð Þ¼ 5 cos 4*x*, and the graphs in **Figure 40** are obtained with

**Figure 39.** *Comparison of various schemes with source term S x*ð Þ¼ 5 cos 4*x:*

*Moving Node Method for Differential Equations DOI: http://dx.doi.org/10.5772/intechopen.107340*

**Figure 40.** *Comparison of various schemes with source term (81).*

$$S(\mathbf{x}) = \begin{cases} 10 - 50\mathbf{x} & \text{if } \mathbf{x} \le \mathbf{0}, \mathbf{3} \\ 50\mathbf{x} - 20 & \text{if } \mathbf{0}, \mathbf{3} < \mathbf{x} < \mathbf{0}, \mathbf{4} \\ & \mathbf{0} \text{ if } \mathbf{0}, \mathbf{4} < \mathbf{x} \end{cases} \tag{81}$$

The numerical results are obtained for *h* ¼ 0, 1 and the grid Peclet number is equal to 5. The solid lines are plots of the exact solutions of the problem. Circle symbols are obtained for the upwind scheme, rectangles according to the Patankar scheme, asterisks according to (79), diamonds according to (80) at *k* ¼ 2, and circles according to (80) at *k* ¼ 7.

**Table 1** shows the root-mean-square errors *σ* ¼ ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi P*<sup>N</sup>* <sup>1</sup> ð Þ *Ф*ð Þ� *xi Ui* 2 *=N* q for the considered schemes. *Фi* is exact solution at nodal points, *Ui* is numerical solution obtained by the considered schemes, *N* number of nodes.

From **Figures 39** and **40**, and from the **Table 1**, it is clear that the proposed schemes give good results.
