APL321: Lab Assignment 1
Error Analysis of 1D Convection-Diffusion Equation
Pratham Chugh
January 25, 2026
1 Introduction
This report analyzes the numerical solution of the non-dimensional 1-D convection-diffusion
equation for a scalar ϕ(x):
dϕ d2 ϕ
Pe = 2 (1)
dx dx
The Peclet number is chosen as P e = 50, with boundary conditions ϕ(0) = 0 and ϕ(1) = 1.
The analytical solution used for comparison is:
exp(xP e) − 1
ϕexact (x) = (2)
exp(P e) − 1
2 Question 1: Numerical Solution and Comparison
2.1 Discretization Schemes
The domain is discretized into N points with uniform spacing h = 1/(N − 1). We express the
discrete form as AP ϕi + AW ϕi−1 + AE ϕi+1 = 0.
2.1.1 Part (a): First-Order Upwind Differencing Scheme (UDS)
For P e > 0, information is taken from the upwind node (i − 1):
• AW = 1
∆x2
+ Pe
∆x
• AE = 1
∆x2
• AP = − ∆x2 2 − Pe
∆x
2.1.2 Part (b): Second-Order Central Differencing Scheme (CDS)
Both convective and diffusive terms utilize central differences:
• AW = 1
∆x2
+ Pe
2∆x
• AE = 1
∆x2
− Pe
2∆x
• AP = − ∆x2 2
1
2.2 Results and Observations
Numerical solutions were generated for N = 11, 21, 41, 81.
• Stability: UDS remained stable across all N , though it exhibited numerical diffusion.
• Oscillations: CDS produced non-physical oscillations at N = 11 and N = 21 because
the cell Peclet number exceeded the stability limit (P e · ∆x > 2).
3 Question 2: Discretization Error Analysis
3.1 Error Definition
Discretization error ϵh is defined using a standard deviation norm:
v
u N
uX (ϕh (xi ) − ϕexact (xi ))2
ϵh = ||ϕh − ϕexact || = t (3)
i=1
N
where ϕh is the discrete solution and ϕexact is the analytical solution.
3.2 Convergence Results (Log-Log Plot)
The error ϵh was plotted against h on a log-log scale for N = 11, 21, 41, 81. Reference lines
y1 = c1 h and y2 = c2 h2 were included to visualize the order of accuracy.
3.3 Commentary on Order of Accuracy
• UDS (Part a): The error curve aligns with the O(h) slope, confirming first-order accu-
racy.
• CDS (Part b): The error curve aligns with the O(h2 ) slope, confirming second-order
accuracy.
4 Question 3: Local Order of Accuracy
Without the exact solution, the order mh is calculated using three grid levels:
1 ||ϕ2h − ϕ4h ||
mh = ln (4)
ln 2 ||ϕh − ϕ2h ||
As h → 0, mh for UDS approaches 1 and CDS approaches 2.