User:Subik31kumar/sandbox

Hybrid difference scheme is a method used in the numerical solution for convection-diffusion problems.

Introduction
Hybrid difference scheme is a method used in the numerical solution for convection-diffusion problems. These problems play important roles in computational fluid dynamics. It can be described by the general partial equation as follows:


 * $$\frac{\partial}{\partial t}(\rho\phi)+\nabla (\rho \mathbf{u} \phi)\,= \nabla (\Gamma \cdot \text{grad} \phi)+S_{\phi} $$$$\;$$  ($$)

Where, $$\rho$$ is density, $$\mathbf{u}$$ is the velocity vector, $$\Gamma$$ is the diffusion coefficient and $$S_{\phi}$$ is the source term. In this equation property, $$\phi$$ can be temperature, internal energy or component of velocity vector $$\mathbf{u}$$ in x, y and z directions.

For one-dimensional analysis of convection-diffusion problem in steady state and without the source the equation reduces to,


 * $$\frac{\partial}{\partial x}(\rho u \phi)\,= \frac{\partial}{\partial x}\left(\Gamma\frac{\partial \phi}{\partial x}\right),\quad      0<x<L\; $$       $$\;$$   ($$)

With boundary conditions, $$\phi (0)\,= \phi_0$$ and $$\phi (L)\, = \phi_{L}$$, where L is the length, $$\phi_0$$ and $$\phi_{L}$$ are the given values.

Grid Generation
Integrating equation (2) over the control volume containing node N, and using the Gauss’ theorem i.e.,


 * $$\int_{CV} \nabla (\rho\mathbf{u}\phi)dV \,= \int_{A} \mathbf{n} \cdot (\rho\mathbf{u}\phi)dA$$ $$\;$$   ($$)

Yields the following result,


 * $$\left(\rho u A \phi \right)_{r}$$ - $$\left(\rho u A \phi \right)_{l}$$ = $$\left(\Gamma A \frac{\partial \phi}{\partial x}\right)_{r}$$ - $$\left(\Gamma A \frac{\partial \phi}{\partial x}\right)_{l}$$ $$\;$$($$)

Where, A is the cross-sectional area of the control volume. The equation must also satisfy the continuity equation, i.e.,


 * $$\left(\rho u A \right)_{r}$$ - $$\left(\rho u A \right)_{l}$$ = 0 $$\;$$  ($$)

Now let us define variables F and D to represent the convection mass flux and diffusion conductance at cell faces,


 * $$F\,= \rho u A$$$$\;$$ and $$\;$$$$D\,= \frac{\Gamma A}{\delta x}$$ $$\;$$   ($$)

Hence, equations (1) and (2) transform into the following equations:


 * $$ F_{r} \phi_{r}-F_{l} \phi_{l}\,= D_{r}(\phi_{R}-\phi_{N})-D_{l}(\phi_{N}-\phi_{L})$$ $$\;$$  ($$)


 * $$ F_{r}-F_{l}\,=0$$ $$\;$$  ($$)

Where, the lower case letters denote the values at the faces and the upper case letters denote that at the nodes. We also define a non-dimensional parameter Peclet number (Pe) as a measure of the relative strengths of convection and diffusion,


 * $$ Pe \,= \frac{F}{D} \,= \frac{\rho u}{\Gamma \text{/} \delta x}$$ $$\;$$  ($$)

For a low Peclet number (|Pe|<2) the flow is characterized as dominated by diffusion. For large Peclet number the flow is dominated by convection.

Central and Upwind difference scheme
In the above equations (7) and (8), we observe that the values require are at the faces, instead of the nodes. Hence approximations are required to fulfill this.

In Central Difference scheme we replace the value at the face with the average of the values at the adjacent nodes,
 * $$\phi_{r}\,= \frac{\phi_{R} + \phi_{N}}{2}$$ $$\;$$ and $$\;$$ $$\phi_{l}\,= \frac{\phi_{N} + \phi_{L}}{2}$$ $$\;$$   ($$)



By putting these values in equation (7) and rearranging we get the following result,


 * $$ a_{N} \phi_{N} \,= a_{R} \phi_{R} + a_{L} \phi_{L}$$ $$\;$$  ($$)


 * {| class="wikitable"

! scope="col" style="width:200px;"| $$ a_{L} $$ ! scope="col" style="width:200px;"| $$ a_{R} $$ ! scope="col" style="width:200px;"| $$ a_{N} $$
 * $$ D_{l} + \frac{F_{l}}{2} $$
 * $$ D_{l} + \frac{F_{l}}{2} $$
 * $$ D_{l} + \frac{F_{l}}{2} $$


 * $$D_{r} + \frac{F_{r}}{2} $$
 * $$D_{r} + \frac{F_{r}}{2} $$


 * $$ a_{r} + a_{l} + (F_{r} - F_{l})$$
 * $$ a_{r} + a_{l} + (F_{r} - F_{l})$$


 * }

In the Upwind scheme we replace the value at the face with the value at the adjacent upstream node. For example for the flow to the right (Pe>0)as shown in the diagram, we replace the values as follows;


 * $$ \phi_{l}\,= \phi_{L} $$$$\;$$ and $$\;$$$$ \phi_{r}\,= \phi_{N} $$ $$\;$$  ($$)

And for Pe<0, we put the values as shown in the figure 3,


 * $$ \phi_{r}\,= \phi_{R} $$$$\;$$ and $$\;$$$$ \phi_{l}\,= \phi_{N} $$ $$\;$$  ($$)

By putting these values in equation (7) and rearranging we get the same equation as equation (11), but the following values of the coefficients:


 * {| class="wikitable"

! scope="col" style="width:200px;"| $$ a_{L} $$ ! scope="col" style="width:200px;"| $$ a_{R} $$ ! scope="col" style="width:200px;"| $$ a_{N} $$
 * $$ D_{l} + \text{max}( F_{l}, 0) $$
 * $$ D_{l} + \text{max}( F_{l}, 0) $$
 * $$ D_{l} + \text{max}( F_{l}, 0) $$


 * $$D_{r} + \text{max}( F_{r}, 0)$$
 * $$D_{r} + \text{max}( F_{r}, 0)$$


 * $$ a_{r} + a_{l} + (F_{r} - F_{l})$$
 * $$ a_{r} + a_{l} + (F_{r} - F_{l})$$


 * }

Hybrid Difference Scheme
Hybrid difference scheme of Spalding (1970) is a combination of the central difference scheme and upwind difference scheme. It makes use of the central difference scheme, which is second order accurate, for small Peclet numbers (|Pe|<2). For large Peclet numbers (|Pe|>2) it uses the Upwind difference scheme, which first order accurate but takes into account the convection of the fluid.

As it can be seen in figure 4 that for Pe=0, it is a linear distribution and for high Pe it takes the upstream value depending on the flow direction. For example the value at the left face, in different circumstances is,

$$ \phi_{l}\,= \left [\left (1 + \frac{2}{ Pe_{l} }\right) \frac{\phi_{l}}{2} + \left (1 + \frac{2}{ Pe_{l} }\right) \frac{\phi_{l}}{2}\right ] \,$$ $$\;$$ for $$\;$$ $$ -2< Pe_{l} <2$$$$\;$$  ($$)

$$ \phi_{l}\,= \phi_{L}$$ $$\;$$ for $$\;$$ $$ Pe_{l} >=2$$ $$\;$$  ($$)

$$ \phi_{l}\,= \phi_{N}$$ $$\;$$ for $$\;$$ $$ Pe_{l} <=-2$$ $$\;$$  ($$)

Substituting these values in equation (7) we get the same equation (11) with the values of the coefficients as follows,


 * {| class="wikitable"

! scope="col" style="width:200px;"| $$ a_{L} $$ ! scope="col" style="width:200px;"| $$ a_{R} $$ ! scope="col" style="width:200px;"| $$ a_{N} $$
 * $$ \text{max} \left [ F_{l}, \left ( D_{l} + \frac{ F_{l}}{2} \right ), 0 \right ] $$
 * $$ \text{max} \left [ F_{l}, \left ( D_{l} + \frac{ F_{l}}{2} \right ), 0 \right ] $$
 * $$ \text{max} \left [ F_{l}, \left ( D_{l} + \frac{ F_{l}}{2} \right ), 0 \right ] $$


 * $$ \text{max} \left [ F_{r}, \left ( D_{r} + \frac{ F_{r}}{2} \right ), 0 \right ] $$
 * $$ \text{max} \left [ F_{r}, \left ( D_{r} + \frac{ F_{r}}{2} \right ), 0 \right ] $$


 * $$ a_{r} + a_{l} + (F_{r} - F_{l})$$
 * $$ a_{r} + a_{l} + (F_{r} - F_{l})$$


 * }

Advantages and Disadvantages of Hybrid Difference Scheme
It exploits the favourable properties of the central difference and upwind scheme. It switches to upwind difference scheme when central difference scheme produces inaccurate results for high Peclet numbers. It produces physically realistic solution and has proved to be helpful in the prediction of practical flows.

The only disadvantage associated with hybrid difference scheme is that the accuracy in terms of Taylor series truncation error is only first order.