Compare steady-state solutions using central differencing, upwind differencing, and the QUICK scheme against the analytical solution. Watch how central differencing develops spurious oscillations as the Peclet number increases — an intuitive introduction to CFD numerical schemes.
Flow & Diffusion Parameters
Presets
Convection velocity u
m/s
Positive value (carries the scalar left → right)
Diffusion coefficient D
m²/s
Smaller D keeps a sharper advected pulse
Advection-dominated — Pe = 10.0
Playback
Domain
Length L = 1.0 m
Initial pulse x₀ = 0.15 L
Convection-Diffusion Animation (transport of a concentration pulse)
Concentration φ(x,t)Peak position = u·tSpread σ = √(2Dt)Initial pulse
Live Readouts
—
Péclet number Pe = uL/D
—
Peak value φmax
—
Peak position x [m]
—
Spread σ [m]
High Pe = a sharp pulse is advected. Low Pe = diffusion wins and the pulse smears out quickly.
Theory Note — Convection-Diffusion & the Moving Gaussian
For a point-source pulse, the exact solution of the 1-D convection-diffusion equation is a Gaussian that is advected by the flow while diffusion broadens it:
$$\phi(x,t) = \frac{1}{\sqrt{4\pi D t}}\exp\!\left(-\frac{(x-ut)^2}{4Dt}\right),\quad Pe = \frac{uL}{D}$$
The pulse centre moves as $x_c = u\,t$, its variance grows as $\sigma^2 = 2Dt$, and the peak decays as $1/\sqrt{4\pi D t}$. A high Péclet number ($Pe \gg 1$) means convection dominates — a sharp pulse is swept across the domain. A low Péclet number ($Pe \ll 1$) means diffusion dominates and the pulse smears almost immediately. The animation renders this analytic solution directly.
1-D convection-diffusion equation: $u$ is the flow velocity (m/s), $D$ the diffusion coefficient (m²/s), and $\phi$ the transported scalar.
$$Pe = \frac{uL}{D}$$
Péclet number: ratio of convection to diffusion. $Pe \gg 1$ is advection-dominated (sharp wave); $Pe \ll 1$ is diffusion-dominated (smooth).
$$\phi(x,t) = \frac{1}{\sqrt{4\pi D t}}\exp\!\left(-\frac{(x - u t)^2}{4 D t}\right)$$
Moving-Gaussian solution: exact response to a point-source pulse, with centre $=u t$, variance $\sigma^2 = 2Dt$, peak $\propto 1/\sqrt{4\pi D t}$.
What is Convection-Diffusion?
🙋
What exactly is a 1D convection-diffusion problem? I see the simulator has "convection velocity" and "diffusion coefficient" as inputs.
🎓
Basically, it's a model for how a quantity, like heat or a pollutant, is transported. "Convection" is the bulk movement (carried by a flow, like wind), and "diffusion" is the spreading out due to random motion. In this 1D simulator, you can see how these two physical processes compete. Try setting the convection velocity to a high value and the diffusion coefficient to a low one to see a sharp front form.
🙋
Wait, really? So the "analytical solution" line is the perfect answer, and the other lines are approximations? Why are there different ones like "upwind" and "QUICK"?
🎓
Exactly! The analytical solution is the exact math. But computers can't solve it directly for complex problems, so we use "numerical schemes" to approximate it on a grid. "Central" is simple but can create wiggly, unrealistic results when convection is strong. "Upwind" is more stable but less accurate. "QUICK" tries to be a smarter compromise. Slide the "Grid Spacing" to a larger value to see how a coarse grid makes all the approximations worse.
🙋
That makes sense. So what's this "Pe" number that shows up in the formula? And how do the boundary values φ(0) and φ(L) work in the simulator?
🎓
Great question! The Péclet number (Pe) is the key. It's the ratio of convection strength to diffusion strength. A high Pe means convection dominates (a sharp front); a low Pe means diffusion dominates (a smooth spread). The formula is $Pe_{total}= \frac{uL}{D}$. In the simulator, φ(0) and φ(L) are the fixed values at the left and right ends of your domain. For instance, you could model a pipe where one end has a concentrated dye (φ=1) and the other end is clear water (φ=0). Change these boundary values and watch the profile shift.
Physical Model & Key Equations
The steady-state 1D convection-diffusion equation governs the transport of a scalar quantity φ (like temperature or concentration). It balances the rate of change due to fluid motion (convection) against spreading due to gradients (diffusion).
$$u \frac{d\phi}{dx}= D \frac{d^2\phi}{dx^2}$$
Where: $u$ is the constant convection velocity [m/s]. $D$ is the constant diffusion coefficient [m²/s]. $\phi$ is the scalar quantity being transported (e.g., temperature, concentration).
The equation says: (Convection) = (Diffusion).
For a domain of length L with fixed boundary values, the analytical solution to this equation is an exponential profile. The shape is entirely controlled by the global Péclet number.
Where: $Pe_{total}$ is the dimensionless Péclet number. It's the single most important parameter. $Pe_{total}\gg 1$: Convection dominates. Solution has a sharp boundary layer. $Pe_{total} \ll 1$: Diffusion dominates. Solution is nearly a straight line.
This is the exact solution the numerical schemes in the simulator are trying to approximate.
Frequently Asked Questions
When the Péclet number is large, the convective term becomes dominant, and the central difference scheme fails to properly reflect upstream information. As a result, numerical oscillations (non-physical wiggles) occur. Using upwind differencing or the QUICK scheme can suppress these oscillations.
The central difference scheme has high accuracy but oscillates when the Péclet number is large. The upwind difference scheme is stable but introduces significant numerical diffusion, making the solution overly smooth. The QUICK scheme strikes a balance between the two, offering higher-order accuracy and stability, making it a practical choice.
The Péclet number may be too large, or the mesh may be too coarse. Reducing the Péclet number or refining the mesh will bring the numerical solution closer to the analytical one. Also, note that due to the nature of the scheme, the upwind difference tends to overestimate the diffusion term.
Dirichlet boundary conditions are applied: φ=1 at x=0 and φ=0 at x=L. The analytical solution is defined under these conditions, and the numerical solution is computed under the same conditions. If you wish to change the boundary conditions, you need to edit the code directly.
Real-World Applications
Pollutant Dispersion in Rivers: Modeling how a chemical spill (diffusion) is carried downstream by the river current (convection). Engineers use this to predict contamination zones and plan response strategies. The Péclet number tells them if the pollutant will spread widely or remain in a concentrated plume.
Heat Transfer in Electronics Cooling: Analyzing heat from a chip carried away by airflow in a heat sink. Convection is the forced airflow, and diffusion is the thermal conduction within the air and solids. Accurate numerical schemes are crucial for predicting hot spots and preventing failure.
Chemical Vapor Deposition (CVD): A key manufacturing process for semiconductors and coatings. Reactive gases flow over a substrate (convection) while chemical species diffuse to the surface to form a thin film. The balance between flow and diffusion rates determines film uniformity.
Blood Oxygen Transport in Capillaries: Oxygen in blood is carried by flow (convection) and moves into tissue by diffusion across capillary walls. The 1D model simplifies the analysis of how oxygen concentration drops along the capillary length, which is vital for understanding tissue oxygenation.
Common Misconceptions and Points of Caution
Model assumptions: The mathematical model used here relies on simplifying assumptions such as linearity, homogeneity, and isotropy. Always verify that your real system satisfies these assumptions before applying results directly to design decisions.
Units and scale: Many calculation errors arise from unit conversion mistakes or order-of-magnitude errors. Pay close attention to the units shown next to each parameter input.
Validating results: Always sanity-check simulator output against physical intuition or hand calculations. If a result seems unexpected, review your input parameters or verify with an independent method.
Set velocity (val-u, range 0.1–2.0 m/s) using the slider or text input. Higher values increase convection dominance.
Set diffusivity (val-D, range 0.001–0.1 m²/s) using sl-D. Lower diffusivity reduces spreading and sharpens gradients.
Adjust grid spacing (val-dx, range 0.01–0.5 m) with sl-dx. Smaller dx improves resolution but increases computational cost.
Select discretization scheme (central difference, upwind, or QUICK) from the dropdown.
Click "Run Simulation" to compute Pe (Péclet number) and compare numerical vs. analytical profiles.
Observe stability warnings if Pe exceeds critical thresholds for your chosen scheme.
Worked Example
Steel pipe coolant flow: u=1.2 m/s, D=0.008 m²/s, dx=0.05 m yields Pe=7.5. Central difference scheme becomes oscillatory (unstable) at Pe>2. Switching to upwind (first-order) eliminates oscillations but introduces 0.3–0.5 m artificial diffusion error. QUICK scheme maintains accuracy within 0.08 m error and remains stable at Pe=7.5, making it optimal for this convection-dominated regime.
Practical Notes
Péclet number Pe=uL/D dictates scheme choice: Pe<2 allows central difference; 210 demands QUICK or flux-limiting schemes.
Upwind adds O(dx) numerical diffusion proportional to u·dx, artificially smoothing sharp temperature/concentration fronts in industrial applications (cooling, pollution transport).
Halving dx quadruples computation time but improves Pe-local stability; monitor CPU usage for domain lengths >10 m.
QUICK requires three-point stencils; avoid near boundaries unless using ghost cells or extrapolation.