The governing equations of fluid mechanics contain derivatives — rates of change like $\partial u / \partial x$. Computers can't handle continuous derivatives directly. They need numbers, not infinitesimals. Finite differences bridge this gap by approximating derivatives using values at discrete points.
This lesson builds the mathematical foundation for numerical discretization. Every CFD solver, whether it uses finite differences, finite volumes, or finite elements, relies on these fundamental concepts.
From Continuous to Discrete
The Basic Idea
A derivative is defined as a limit:
Sponsored
Harshal got placed at Fiat Chrysler as Design Engineer
Watch his video testimonial on how the program helped him
Compare forward, backward, and central difference approximations. Adjust grid spacing to see how errors change.
First-Order vs Second-Order Accuracy
Scheme
Formula
Order
Error
Forward
$\frac{f_{i+1} - f_i}{h}$
$O(h)$
First-order
Backward
$\frac{f_i - f_{i-1}}{h}$
$O(h)$
First-order
Central
$\frac{f_{i+1} - f_{i-1}}{2h}$
$O(h^2)$
Second-order
Order of accuracy tells us how error scales with grid spacing:
First-order $O(h)$: Halving $h$ halves the error
Second-order $O(h^2)$: Halving $h$ reduces error by factor of 4
Fourth-order $O(h^4)$: Halving $h$ reduces error by factor of 16
Why Central Difference is Better
Central difference uses information from both sides of the point, achieving symmetry. This symmetry cancels the even-order error terms, leaving only odd-order terms:
This is fourth-order accurate but requires solving a tridiagonal system.
Stencils and Computational Molecules
A stencil (or computational molecule) shows which points are used in a finite difference:
Central 1st derivative:
[-1] [ 0 ] [+1]
o ----x---- o
i-1 i i+1
Coefficients: -1/(2h), 0, +1/(2h)
5-point Laplacian:
[ 1]
o
|
[1]--o---x---o--[1] Coefficients:
i-1 i i+1 1/h² for neighbors
| -4/h² for center
o
[1]
This is still second-order accurate but uses only forward points.
Ghost points: Extrapolate fictitious points outside the domain using boundary conditions.
Special treatment: Apply boundary conditions directly in the discretized equations.
Stability Considerations
The CFL Condition
For time-dependent problems, finite differences must satisfy the Courant-Friedrichs-Lewy (CFL) condition:
Taylor series is the foundation for deriving all finite difference formulas
Central differences are more accurate than forward/backward ($O(h^2)$ vs $O(h)$)
Order of accuracy determines how fast error decreases with grid refinement
Truncation error is the difference between exact derivative and FD approximation
Higher-order schemes use more points but converge faster
Boundary treatment requires special one-sided or extrapolation formulas
Stability (CFL) limits time step for explicit time integration
What's Next
While finite differences approximate derivatives, CFD typically needs to conserve mass, momentum, and energy. The next lesson introduces the Finite Volume Method — the dominant discretization approach in commercial CFD that naturally enforces conservation laws.
Career Growth
3,000+ Engineers Placed in Top Companies
Join the ranks of successful engineers at Bosch, Tata, L&T, and 500+ hiring partners.