Basic Aspects of Discritization
Taylor Series in Computational Fluid Dynamics
Definition and Purpose
The Taylor Series provides a way to represent a continuous function (such as \(f(x + \Delta x)\)) as an infinite sum of terms. This series is crucial for deriving finite-difference expressions, which are discrete approximations of continuous derivatives.
How it Works
The series expands a function around a specific point by using its derivatives at that point. For a function \(f(x + \Delta x)\), the expansion is given by:
- The first term, \(f(x)\), represents an initial "first guess" for the function's value at \(x + \Delta x\) .
- The second term, \((\partial f/\partial x)\Delta x\), adds a component that captures the slope of the function .
- Subsequent higher-order terms (e.g., \((\partial^2 f/\partial x^2) (\Delta x)^2/2!\)) are included to account for the curvature and other higher-order behaviours of the function .
Finite-Difference Approximations for a function \(u\) at a grid point \((i, j)\)
For a function \(u\) at a grid point \((i, j)\) with spatial step sizes \(\Delta x\) and \(\Delta y\), the following approximations are derived from Taylor series
- First-Order Forward Difference with respect to \(x\) :
\[ \left(\frac{\partial u}{\partial x}\right)_{i,j} \approx \frac{u_{i+1,j} - u_{i,j}}{\Delta x} + O(\Delta x) \]This is a first-order accurate approximation, meaning the truncation error is proportional to \(\Delta x\) .
- First-Order Rearward Difference with respect to
\(x\):
\[ \left(\frac{\partial u}{\partial x}\right)_{i,j} \approx \frac{u_{i,j} - u_{i-1,j}}{\Delta x} + O(\Delta x) \]Like the forward difference, this is also first-order accurate.
- Second-Order Central Difference with respect to
\(x\):
\[ \left(\frac{\partial u}{\partial x}\right)_{i,j} \approx \frac{u_{i+1,j} - u_{i-1,j}}{2\Delta x} + O(\Delta x)^2 \]This approximation offers second-order accuracy, with the truncation error being proportional to \((\Delta x)^2\) . This higher accuracy often makes central differences preferable when applicable.
- Second-Order Central Second Difference with respect to
\(x\) (for the second derivative) :
\[ \left(\frac{\partial^2 u}{\partial x^2}\right)_{i,j} \approx \frac{u_{i+1,j} - 2u_{i,j} + u_{i-1,j}}{(\Delta x)^2} + O(\Delta x)^2 \]This formula is used for approximating the second derivative and is second-order accurate .
- First-Order Forward Difference with respect to \(y\) :
\[ \left(\frac{\partial u}{\partial y}\right)_{i,j} \approx \frac{u_{i,j+1} - u_{i,j}}{\Delta y} + O(\Delta y) \]
- First-Order Rearward Difference with respect to
\(y\) :
\[ \left(\frac{\partial u}{\partial y}\right)_{i,j} \approx \frac{u_{i,j} - u_{i,j-1}}{\Delta y} + O(\Delta y) \]
- Second-Order Central Difference with respect to
\(y\) :
\[ \left(\frac{\partial u}{\partial y}\right)_{i,j} \approx \frac{u_{i,j+1} - u_{i,j-1}}{2\Delta y} + O(\Delta y)^2 \]
- Second-Order Central Second Difference with respect to
\(y\) (for the second derivative) :
\[ \left(\frac{\partial^2 u}{\partial y^2}\right)_{i,j} \approx \frac{u_{i,j+1} - 2u_{i,j} + u_{i,j-1}}{(\Delta y)^2} + O(\Delta y)^2 \]
- Second-Order Central Mixed Difference with respect to
\(x\) and \(y\) (for mixed partial derivatives) :
\[ \left(\frac{\partial^2 u}{\partial x \partial y}\right)_{i,j} \approx \frac{u_{i+1,j+1} - u_{i-1,j+1} - u_{i+1,j-1} + u_{i-1,j-1}}{4\Delta x \Delta y} + O(\Delta x)^2 \]This mixed derivative approximation is also second-order accurate .
Exact vs. Approximate Representation
If the Taylor Series includes an infinite number of terms and converges, it provides an exact representation of the function \(f(x + \Delta x)\). However, in practical numerical computations, only a finite number of terms can be retained .
Truncation Error and Accuracy
The omission of the higher-order terms in a finite Taylor Series expansion leads to what is known as truncation error. The lowest-order term within this truncation error is used to define the accuracy of the finite-difference expression . For instance, if a finite-difference expression has a truncation error where the lowest-order term is proportional to \((\Delta x)^n\), then the approximation is considered "n-th order accurate".
