Computational Physics – Why Are These Equations Equivalent in 2nd Order First Derivative Approximations in Finite Differencing Scheme?

computational physicsdifferential equationsdifferentiationsimulations

In approximating a first derivative term (assuming $\delta z$ is the distance between two spatial grid points) using a finite differencing scheme I came up with these basic equations:

$$\phi \frac{\partial y}{\partial z} = \phi_z \left[ \frac{y_{z+\Delta z} – y_{z-\Delta z}}{2 \Delta z} \right]$$

$$\phi C_p \frac{\partial T}{\partial z} = \phi_z C_{p,z} \left[ \frac{T_{z+\Delta z} – T_{z-\Delta z}}{2 \Delta z} \right]$$

However it was commented to me that these equations are equivalent:

$$\phi \frac{\partial y}{\partial z} = \frac{1}{2} \left[ \phi_{z+\Delta z/2} \left( \frac{y_{z+\Delta z} – y_z}{\Delta z} \right) + \phi_{z-\Delta z/2} \left( \frac{y_z – y_{z-\Delta z}}{\Delta z} \right) \right]$$

$$\phi C_p \frac{\partial T}{\partial z} = \frac{1}{2} \left[ \phi_{z+\Delta z/2} C_{p,z+\Delta z/2} \left( \frac{T_{z+\Delta z} – T_z}{\Delta z} \right) + \phi_{z-\Delta z/2} C_{p,z-\Delta z/2} \left( \frac{T_z – T_{z-\Delta z}}{\Delta z} \right) \right]$$

My question is why are these the same? The algebra does not seem to simplify down easily such that they result in the same equations. How can it be the case that both equations are 2nd order finite difference approximations?

Best Answer

For a general first-order, constant coefficient partial derivative with equal grid spacing, the central finite difference scheme is the same as the average of the forward and backward finite difference scheme, which is provable by simple algebra: $$ \frac{\partial f}{\partial x}\approx\frac{f(x+\delta x)-f(x-\delta x)}{2\delta x}=\frac{1}{2}\left[\frac{f(x+\delta x)-f(x)}{\delta x}+\frac{f(x)-f(x-\delta x)}{\delta x}\right]. \tag{1}$$ As this assumes a constant coefficient (set to 1 in this case), it is different from your system.

For the variable coefficient PDE, you want to consider that the coefficient varies in the flux balance between $[z-\delta z,\,z]$ and $[z,\,z+\delta z]$. Your first pair of equations does not do this; instead, you've effectively assumed a constant coefficient system in deriving your finite difference scheme.

Now the second set of equations can also be derived from an averaging of a forward and backward scheme, but it considers also the flux balance of the coefficients: $$ \kappa(x)\frac{\partial f}{\partial x}\approx\frac{1}{2}\left[g\left(x+\frac{1}{2}\delta x\right)+g\left(x-\frac{1}{2}\delta x\right)\right]\tag{2}$$ where $$ g\left(x+\frac{1}{2}\delta x\right)=\kappa\left(x+\frac{1}{2}\delta x\right)\frac{f\left(x+\delta x\right)-f\left(x\right)}{\delta x}$$ is the forward difference and with a symmetric form for the backward difference, $g(x-\delta x/2$).

Hence, I would not say that the two are the same or are equivalent. The second set is clearly superior because it properly considers the flux balance of the coefficients when deriving the finite difference scheme.