Flow Lab

Syllabus / Module 9: Classical PDEs: Heat, Waves & Potentials

Lesson 9.10

First-Order PDEs: Advection & Characteristics

The transport equation, method of characteristics, variable-speed advection, and the advection–diffusion equation.

Written byClaude Sonnet

🌊
Why this matters for simulation: Advection is the first step of Stam's solver: trace backward along characteristics and sample.

By the end of this lesson you can…

  • Solve $u_t + c\,u_x = 0$ by showing $u$ is constant along the characteristics $dx/dt = c$.
  • Trace characteristics for a variable speed $c(x,t)$ with your own ODE integrators and read $u$ off the foot.
  • Read $u_t + c\,u_x$ as the material derivative, the rate of change riding the characteristic.
  • Tell the non-conservative form from the conservative one for variable $c$ and predict the amplitude change.
  • Add diffusion and use the Peclet number $\mathrm{Pe} = cL/D$ to say how much a profile smears.
  • Build a 1D semi-Lagrangian step, and explain why it is stable at any CFL number and what it costs.
On this page
·
  1. The transport equation
  2. The material derivative
  3. Variable speed: characteristics are ODE solutions
  4. Conservative or non-conservative?
  5. Adding diffusion: the Peclet number
  6. The semi-Lagrangian idea
  7. The lab
  8. Computing it
  9. Concept checks
  10. Problems
  11. What comes next
  12. Key Takeaways

10.3 Von Neumann Stability Analysis pushed an advection equation through three finite-difference schemes and found that two of them failed above a Courant number of one. It never asked what the true solution does. This lesson solves the equation exactly, for a constant wind and then a varying one, with a tool you already own: the equation hides a family of ODEs, and your ODE solvers integrate them. The reward is the advection step of Jos Stam’s solver, which traces backward along the ODE for one step and reads the value it finds there.

▶ Video A profile carried along straight and curved characteristics in the x-t plane, the same pulse in conservative and non-conservative form, diffusion smearing it at different Peclet numbers, and the semi-Lagrangian backtracecaptions only
Transcript
  1. Last lesson pushed u t plus c u x equals 0 through three schemes, and two failed above a Courant number of 1. Today we solve it exactly, because the equation hides a family of ODEs.
  2. Walk along a path x of t and read u. By the chain rule it changes at u t plus d x d t times u x. Choose d x d t equal to c and this is the left side of the PDE, which is zero. So u is constant along every curve d x d t equals c: the characteristics.
  3. For constant c they are straight lines and the solution is u 0 of x minus c t: the profile translates. To know u at x and t, walk backward along the characteristic to time zero and look. The landing point is the foot.
  4. The combination u t plus c u x is the material derivative, D u over D t: the rate of change riding the characteristic. A fixed station sees u change; a balloon in the wind sees it constant.
  5. Let the wind vary. The characteristics now solve d x d t equals c of x and t, and u is still constant on each. In the lab c is 1 plus b sine 2 pi x, with b equal to 0.5. One lap takes 1.1547, and a pulse starting at 0.25 is at 0.553, 0.711 and 0.841 at times 0.25, 0.5 and 0.75, then 0.040 at t equals 1.
  6. Characteristics lean over where c is large, so pulses stretch in fast zones and squeeze in slow ones. The lab pulse is 0.17 wide at half height at t equals 0 and 0.06 wide at t equals 0.5, on a grid of 0.005: about the speed ratio 0.514 over 1.5, or 0.34.
  7. For a variable wind there are two different equations. The conservative form keeps the integral of u: u is a density. Expanding it gives d u d t equals minus c sub x times u, so u decays where the wind speeds up. The exact result: c times u is constant along each characteristic.
  8. In the lab, with b equal to 0.5, 200 cells and a Gaussian at 0.25, look at t equals 0.5. The non-conservative pulse has peak 0.9979, unchanged. The conservative pulse has peak 2.9129 and mass 0.1772, while the non-conservative mass has dropped to 0.0638.
  9. Real dye diffuses, so add D u x x. Ride with the wind and it is just the heat equation: advection moves, diffusion smears. A pulse is carried one width in time L over c, and smears over its width in L squared over D. Their ratio is the Peclet number.
  10. With L equal to w equal to 0.1 and t equal to 1, ten widths of travel, the exact peak is 1 over the square root of 1 plus 40 over Pe: 0.4472 at Pe 10, 0.7071 at 40, 0.9129 at 200, 0.9806 at 1000. The lab, at CFL 1, gives 0.4471, 0.7068, 0.9124 and 0.9800.
  11. Now do the backward walk one step at a time: the advection step of Jos Stam's solver. The new value at x j is the old value at the foot X j of a one-step backtrace. The foot falls between nodes, so interpolate: 1 minus f times one neighbour plus f times the other.
  12. The new value is a weighted average of old values, so no step creates a new extreme, whatever the CFL number. With constant wind and CFL 4, upwind passes 10 to the 6 by step 23, while semi-Lagrangian reaches t equals 1 with L 2 error 2 times 10 to the minus 14.
  13. The price is smoothing: variance f times 1 minus f cells squared per step. At an integer CFL, f is 0 and the peak stays 0.9994 at CFL 1 through 5. The Gaussian has variance 200 cells squared. At CFL 2.5, 80 steps add 20, so the peak falls by the square root of 200 over 220: 0.953.
  14. On a constant wind at t equals 1, CFL 2.5 gives peak 0.9529, CFL 0.5 gives 0.8161, and CFL 0.25 gives 0.7557. More steps, more smoothing, so large steps are cheaper and, here, more accurate.
  15. For a variable wind f is almost never zero, so backtrace accuracy matters. At b equal to 0.5 and CFL 4, the L 2 error is 0.0182 with an RK4 backtrace and 0.0234 with Euler. And mass is only approximately conserved: 0.17669 against 0.17725 at CFL 0.5.
  16. To recap: u is constant along characteristics, so the PDE is a family of ODEs; the forms differ by c sub x times u; Peclet measures smearing; semi-Lagrangian trades smoothing and exact conservation for stability at any CFL.
  17. Next, let the speed depend on u itself. Characteristics cross and the smooth solution fails. In Burgers' equation, lesson 9.11, that becomes a shock.

The transport equation

The simplest PDE for motion says that a quantity u(x,t)u(x,t) is carried at constant speed cc:

ut+c ux=0.u_t + c\,u_x = 0 .

Suppose someone walks along the line x(t)x(t) and reads uu at the walker’s position. By the chain rule (2.2 Linearization, the Chain Rule & the Jacobian) the reading changes at the rate

ddt u(x(t),t)=ut+dxdt ux.\frac{d}{dt}\,u\big(x(t),t\big) = u_t + \frac{dx}{dt}\,u_x .

Choose the walker’s speed to be dx/dt=cdx/dt = c. The right side is then exactly the left side of the PDE, which is zero. So uu is constant along every curve dx/dt=cdx/dt = c. These curves are the characteristics, and they replace a PDE with a family of trivial ODEs: along each, du/dt=0du/dt = 0.

For constant cc the characteristics are the straight lines x=x0+ctx = x_0 + ct. The value on the line through x0x_0 is the starting value u0(x0)u_0(x_0). To find u(x,t)u(x,t), ask which line passes through (x,t)(x,t): it started at x0=x−ctx_0 = x - ct, so

 u(x,t)=u0(x−ct) \boxed{\,u(x,t) = u_0(x - ct)\,}

Check: ut=−c u0′u_t = -c\,u_0' and ux=u0′u_x = u_0'. The profile translates intact. Read the formula as a recipe: to know uu at (x,t)(x,t), walk backward along the characteristic to time zero and look. The landing point is the foot of the characteristic, and the numerical method at the end performs this recipe one step at a time.

Information travels only along these curves, which is why upwind schemes look upstream.

The material derivative

The combination ut+c uxu_t + c\,u_x has a name in fluid mechanics. If cc is the fluid velocity and uu some property of the fluid, then ∂u/∂t\partial u/\partial t is the change seen at a fixed point and c uxc\,u_x is the change due to the fluid arriving from a place where uu was different. Their sum is the material derivative,

DuDt=ut+c ux,\frac{Du}{Dt} = u_t + c\,u_x ,

the rate of change riding the characteristic: seen by a particle drifting with the flow. This is the 1D version of the formula derived in 11.1 Continuum Hypothesis & Flow Kinematics. The transport equation is simply Du/Dt=0Du/Dt = 0: a property that nothing creates or destroys is constant on each particle. A balloon drifting with the air sees a constant value while a fixed station sees it change, and both statements are one equation. If something does create it, the equation becomes Du/Dt=sDu/Dt = s and along the characteristic you integrate du/dt=sdu/dt = s, an ODE again.

Variable speed: characteristics are ODE solutions

Now let the wind vary, c=c(x,t)c = c(x,t). The argument above never used constancy: the characteristics are the solutions of

dxdt=c(x,t),x(0)=x0,\frac{dx}{dt} = c(x,t), \qquad x(0) = x_0,

and uu is still constant on each. These curves are no longer straight, but they are exactly the integral curves of 2.6 Vector Fields, Flow Lines & Streamlines, the paths of particles, and you can compute them with the integrators of 4.3 Runge–Kutta Methods & Butcher Tableaux. With cc smooth, existence and uniqueness (3.7 Existence & Uniqueness) say characteristics never cross, so every (x,t)(x,t) has exactly one foot.

A case with a closed form. Take c=xc = x. Then dx/dt=xdx/dt = x gives x=x0etx = x_0e^t, so the foot of the characteristic through (x,t)(x,t) is x0=xe−tx_0 = xe^{-t} and

u(x,t)=u0 ⁣(xe−t).u(x,t) = u_0\!\left(xe^{-t}\right).

A pulse centred at x=1x = 1 with width ww moves to x=etx = e^t with width wetwe^t and the same height: the front outruns the back, so the pulse stretches.

A case that needs the computer. In the lab the wind is c(x)=1+bsin⁡2πxc(x) = 1 + b\sin 2\pi x on a periodic unit interval. The time for one lap is a clean integral, ∫01dx/c=1/1−b2\int_0^1 dx/c = 1/\sqrt{1-b^2} (a standard integral, quoted from memory, not derived here), which is 1.15471.1547 for b=0.5b = 0.5 (the playground cell below integrates the ODE with RK4 and gets it). A Gaussian pulse starting at x=0.25x = 0.25 with b=0.5b = 0.5 has its centre at 0.5530.553 at t=0.25t = 0.25, 0.7110.711 at t=0.5t = 0.5, 0.8410.841 at t=0.75t = 0.75 and has lapped to x=0.040x = 0.040 at t=1t = 1. It crawls through the slow zone near x=0.75x = 0.75, where cc falls to 0.50.5.

In the x-t plane (tt pointing up) characteristics lean over where cc is large and stand up steeply where it is small. Pulses stretch in a fast zone and squeeze in a slow one: the lab’s pulse is 0.170.17 wide at half height at t=0t = 0 and 0.060.06 wide at t=0.5t = 0.5 (grid resolution 0.0050.005), about the speed ratio 0.514/1.5=0.340.514/1.5 = 0.34.

If cc also depends on tt the ODE is merely non-autonomous; the exercise below uses such a c(x,t)c(x,t).

Conservative or non-conservative?

For a variable wind there are two natural equations, and they are different:

ut+c ux=0versusut+(c u)x=0.u_t + c\,u_x = 0 \qquad\text{versus}\qquad u_t + (c\,u)_x = 0 .

The first is Du/Dt=0Du/Dt = 0 and was just solved. The second is a conservation law. Integrate it over a periodic domain and the flux term integrates to zero, so ∫u dx\int u\,dx never changes: uu is a density, like mass per length, moved around without being created. Expanding the derivative shows the difference:

ut+(c u)x=ut+c ux+cx u=0⟹dudt=−cx u  along the characteristic.u_t + (c\,u)_x = u_t + c\,u_x + c_x\,u = 0 \quad\Longrightarrow\quad \frac{du}{dt} = -c_x\,u \ \text{ along the characteristic}.

The characteristics are the same curves, but uu decays where the wind speeds up (cx>0c_x \gt 0, the density thins out) and grows where it slows (cx<0c_x \lt 0, a pile-up). The exact result is neat. Along a characteristic dc/dt=cx cdc/dt = c_x\,c by the chain rule, so d(ln⁡c)/dt=cxd(\ln c)/dt = c_x and d(ln⁡u)/dt=−d(ln⁡c)/dtd(\ln u)/dt = -d(\ln c)/dt. Hence

c u=constant along each characteristic,u(x,t)=u0(x0) c(x0)c(x).c\,u = \text{constant along each characteristic},\qquad u(x,t) = u_0(x_0)\,\frac{c(x_0)}{c(x)} .

In a steady traffic stream the flux c uc\,u is the same everywhere: cars crawl where the road is crowded.

The lab shows it with c=1+0.5sin⁡2πxc = 1 + 0.5\sin 2\pi x. The same Gaussian starts at x=0.25x = 0.25, where c=1.5c = 1.5. At t=0.5t = 0.5 it has reached x=0.713x = 0.713 where c=0.514c = 0.514. The non-conservative pulse has peak 0.99790.9979 (unchanged, to the grid’s resolution), but the conservative pulse has peak 2.91292.9129 (versus the centre’s estimate c(x0)/c(x)=1.5/0.514=2.92c(x_0)/c(x) = 1.5/0.514 = 2.92), and its mass ∫u dx\int u\,dx is 0.17720.1772, equal to wπw\sqrt\pi at the start. The non-conservative mass is not conserved at all: 0.06380.0638 at t=0.5t = 0.5 and 0.13780.1378 at t=1t = 1. Which equation is right depends on what uu is: a carried property such as temperature is Du/Dt=0Du/Dt = 0; a mass density is the conservative form.

Adding diffusion: the Peclet number

Real dye diffuses. The advection-diffusion equation adds the physics of 9.2 The Heat (Diffusion) Equation:

ut+c ux=D uxx.u_t + c\,u_x = D\,u_{xx}.

For constant cc, change to a frame riding with the wind, ξ=x−ct\xi = x - ct, and write v(ξ,t)=u(x,t)v(\xi,t) = u(x,t). The chain rule gives ut=vt−c vξu_t = v_t - c\,v_\xi and ux=vξu_x = v_\xi, so the equation becomes vt=D vξξv_t = D\,v_{\xi\xi}: the plain heat equation. Advection moves, diffusion smears, and in the moving frame they do not interact. A Gaussian of width ww (meaning e−(x/w)2e^{-(x/w)^2}) obeys the heat equation by keeping its shape and growing as w2→w2+4Dtw^2 \to w^2 + 4Dt, with the peak falling to keep the mass:

peak(t)=ww2+4Dt.\text{peak}(t) = \frac{w}{\sqrt{w^2 + 4Dt}} .

What decides whether this matters? A pulse of width LL is carried one width in the advective time L/cL/c and smears over its own width in the diffusive time L2/DL^2/D. Their ratio is the Peclet number

Pe=cLD=L2/DL/c.\mathrm{Pe} = \frac{cL}{D} = \frac{L^2/D}{L/c} .

Like the Reynolds number (11.5 Non-dimensionalization & the Reynolds Number), it compares two rates. Large Pe means many widths of travel before blurring: after travelling NN widths (t=NL/ct = NL/c), 4Dt/w2=4N/Pe4Dt/w^2 = 4N/\mathrm{Pe} with L=wL = w, and the peak is 1/1+4N/Pe1/\sqrt{1 + 4N/\mathrm{Pe}}. Even Pe=1000\mathrm{Pe} = 1000 costs a quarter of the peak after N=200N = 200 widths (0.7450.745).

The lab defines L=w=0.1L = w = 0.1, c0=1c_0 = 1, D=c0w/PeD = c_0w/\mathrm{Pe} and runs to t=1t = 1, which is N=10N = 10 widths. The exact peak is then 1/1+40/Pe1/\sqrt{1 + 40/\mathrm{Pe}}: 0.44720.4472 at Pe=10\mathrm{Pe} = 10, 0.70710.7071 at 4040, 0.91290.9129 at 200200, 0.98060.9806 at 10001000. With b=0b = 0 and diffusion on, the lab (dotted curve: the exact Gaussian) gives 0.44710.4471, 0.70680.7068, 0.91240.9124 and 0.98000.9800 at CFL 11; the small shortfall is discretisation error whose sources (grid, explicit sub-steps, splitting) I did not separate.

The semi-Lagrangian idea

Back to the recipe: walk backward along the characteristic and read the old value. Numerically, do it one time step at a time. Given the profile unu^n on a grid, the new value at xjx_j is the old value at the point where the characteristic through (xj,tn+1)(x_j, t_{n+1}) stood at time tnt_n:

ujn+1=un(Xj),Xj=foot of the one-step backward trace from xj.u^{n+1}_j = u^n(X_j), \qquad X_j = \text{foot of the one-step backward trace from } x_j .

Computing XjX_j is the ODE dx/dt=c(x,t)dx/dt = c(x,t) stepped backward: one Euler step, one RK4 step, or several. The foot falls between nodes, so interpolate: if XjX_j is a fraction ff of the way from xix_i to xi+1x_{i+1}, then ujn+1=(1−f) uin+f ui+1nu^{n+1}_j = (1-f)\,u^n_i + f\,u^n_{i+1}. That is the whole method.

Stable for any step. The new value is a weighted average of two old values with weights 1−f1-f and ff in [0,1][0,1], so min⁡un≤un+1≤max⁡un\min u^n \le u^{n+1} \le \max u^n: no step creates a new extreme, whatever cc and Δt\Delta t. In von Neumann language (10.3 Von Neumann Stability Analysis) ∣G∣≤1\lvert G\rvert \le 1 for every wavenumber and every CFL number. Upwind was stable only if the foot lay within one cell; this step follows the characteristic however far it goes. In the lab at constant wind and CFL 44 (four cells per step) upwind passes 10610^6 by step 2323, while semi-Lagrangian reaches t=1t = 1 with L2L_2 error 2×10−142\times10^{-14}.

The price: interpolation smooths. Weights 1−f1-f and ff on points one cell apart have variance f(1−f)f(1-f) cells2^2, and that variance is added to the pulse every step (the stable-fluids lesson writes it as numerical viscosity f(1−f)h2/2Δtf(1-f)h^2/2\Delta t). Two checks:

  • Integer CFL is exact. At constant wind f=0f = 0 whenever the CFL number is whole, so nothing is interpolated: the peak stays 0.99940.9994 at CFL 1,2,3,4,51, 2, 3, 4, 5.
  • More steps, more smoothing. The Gaussian with w=0.1w = 0.1 is 2020 cells wide, variance w2/2=200w^2/2 = 200 cells2^2. At CFL 2.52.5 (f=1/2f = 1/2) the 8080 steps add 80(0.25)=2080(0.25) = 20, so the peak falls by 200/220=0.953\sqrt{200/220} = 0.953; the lab shows 0.95290.9529. At CFL 0.50.5 the 400400 steps add 100100: predicted 200/300=0.816\sqrt{200/300} = 0.816, measured 0.81610.8161, identical to upwind since for c<1c \lt 1 the weights are those of (1−c)uj+c uj−1(1-c)u_j + c\,u_{j-1}. Large steps are cheaper and, here, more accurate, the opposite of explicit time stepping.

For a variable wind the fraction is nonzero almost everywhere, so smoothing never vanishes, and backtrace accuracy matters. At b=0.5b = 0.5, CFL 44 (the largest foot is 66 cells back) the L2L_2 error at t=1t = 1 is 0.01820.0182 with an RK4 backtrace and 0.02340.0234 with Euler. For the conservative form interpolate q=c uq = c\,u, which is constant on characteristics, and divide by c(xj)c(x_j); the mass is then conserved only approximately: 0.176690.17669 against 0.177250.17725 at CFL 0.50.5, where flux-form upwind conserves it to rounding.

The lab

◆ Interactive Variable-speed advection: exact solution, semi-Lagrangian and upwind side by side, characteristics in the x-t plane, an optional diffusion term

Loading simulation…

The wind is c=1+bsin⁡2πxc = 1 + b\sin 2\pi x on [0,1)[0,1) with 200200 cells, run to t=1t = 1. Top: profile against exact (dashed). Middle: the x-t plane, characteristics coloured by the value they carry, with four bold backtraces from now to t=0t = 0. Bottom: log⁡10\log_{10} of the L2L_2 error. All numbers are at t=1t = 1 unless stated:

  1. CFL 4, constant wind (first button): parallel straight characteristics; the numbers above. At CFL 2.52.5 the peak is 0.95290.9529; at 0.50.5, 0.81610.8161; at 0.250.25, 0.75570.7557.
  2. Diffusion on, CFL 11, sweep Pe: the peaks above, against the dotted curve.
  3. Non-conservative, b=0.5b = 0.5, CFL 0.50.5: the pulse narrows near x=0.71x = 0.71 at t≈0.5t \approx 0.5 and its peak stays 0.9980.998. Switch to conservative: the dashed exact peak is 2.912.91. The numerical curves stay lower (0.7740.774 against the exact 1.3471.347 at t=1t = 1): smoothing eats a 2020-cell pulse, so judge amplitude by the dashed curve.
  4. b=0.5b = 0.5, CFL 1: the local CFL reaches 1.51.5. Upwind passes 10610^6 at step 8989; semi-Lagrangian finishes with error 0.08580.0858. The threshold is not sharp: at CFL 0.70.7 the local CFL exceeds 11 only by 0.050.05 near the fastest point and upwind survives the run.
  5. SL backtrace: Euler against RK4 at b=0.5b = 0.5, CFL 44: the errors quoted above.

Computing it

🐍 PythonLab: one lap of a characteristic, integrated with RK4
⌘/Ctrl + Enter
🧪 Coding exerciseExercise: semi-Lagrangian advection with a time-dependent wind
⌘/Ctrl + Enter

The exact solution keeps height 11 and stretches the pulse by eG(2)=3.87e^{G(2)} = 3.87, centre 0.80.8 to 3.13.1. Maximum error and peak: 88 steps 0.05960.0596 and 0.9420.942; 44 steps 0.04100.0410 and 0.9660.966; 1616 steps 0.09980.0998 and 0.9000.900. RK4 over Δt=0.25\Delta t = 0.25 lands within 5×10−65\times10^{-6} of the exact foot (2.4946262.494626 against 2.4946222.494622); an Euler backtrace gives maximum error 0.6870.687 over the same 88 steps.

Concept checks

✅ Concept check

For $u_t + 2u_x = 0$ with $u_0(x) = x^2$, what is $u(5, 1.5)$?

✅ Concept check

The wind slows down along the path of a pulse, with $c_x \lt 0$. What happens to the pulse height?

✅ Concept check

A Gaussian travels $25$ of its own widths in a flow with $\mathrm{Pe} = cL/D = 100$ ($L$ equal to the width $w$). By what factor does its peak fall? (Use peak $= w/\sqrt{w^2 + 4Dt}$.)

✅ Concept check

Constant wind, semi-Lagrangian with linear interpolation, and a time step chosen so the CFL number is exactly $3$. What does the solution look like after $10$ steps?

Problems

✏️ Pen & paperReading the characteristic●○○

Solve ut+3ux=0u_t + 3u_x = 0, u0(x)=1/(1+x2)u_0(x) = 1/(1 + x^2). Find u(4,1.5)u(4, 1.5) and the peak’s position at t=1.5t = 1.5.

Show worked solution

u=u0(x−3t)u = u_0(x - 3t). The foot of (4,1.5)(4, 1.5) is 4−4.5=−0.54 - 4.5 = -0.5, so u=1/1.25=0.8u = 1/1.25 = 0.8. The peak of u0u_0 is at 00, so at t=1.5t = 1.5 it is at 4.54.5.

✏️ Pen & paperA stretching wind: both forms●●○

Let c=xc = x. (a) Solve ut+x ux=0u_t + x\,u_x = 0 for a pulse centred at x=1x = 1 of width ww: how wide and tall is it at x=3x = 3? (b) Solve ut+(x u)x=0u_t + (x\,u)_x = 0 and show ∫u dx\int u\,dx is constant.

Show worked solution

(a) u=u0(xe−t)u = u_0(xe^{-t}). The centre reaches 33 at t=ln⁡3t = \ln 3 with width 3w3w and the same height.

(b) c uc\,u is constant on characteristics, so u=u0(x0) x0/x=e−tu0(xe−t)u = u_0(x_0)\,x_0/x = e^{-t}u_0(xe^{-t}). Check with u=e−tg(xe−t)u = e^{-t}g(xe^{-t}): ut=−u−xe−2tg′u_t = -u - xe^{-2t}g', x ux=xe−2tg′x\,u_x = xe^{-2t}g', so ut+x ux=−uu_t + x\,u_x = -u and (xu)x=x ux+u(xu)_x = x\,u_x + u gives 00. With s=xe−ts = xe^{-t}, ∫e−tu0(xe−t) dx=∫u0(s) ds\int e^{-t}u_0(xe^{-t})\,dx = \int u_0(s)\,ds. At t=ln⁡3t = \ln 3 the pulse is three times wider and a third as tall.

✏️ Pen & paperHow much does a dye pulse smear?●●○

A dye pulse of width w=5w = 5 cm travels at 0.20.2 m/s in a pipe with D=10−5D = 10^{-5} m2^2/s. Find Pe (with L=wL = w) and the factor by which the peak has fallen after 1010 m.

Show worked solution

Pe=0.2(0.05)/10−5=1000\mathrm{Pe} = 0.2(0.05)/10^{-5} = 1000. The time is 5050 s, so 4Dt=2×10−34Dt = 2\times10^{-3} m2^2 against w2=2.5×10−3w^2 = 2.5\times10^{-3} m2^2, and the peak is 2.5/4.5=0.745\sqrt{2.5/4.5} = 0.745. Pe =1000= 1000 still costs a quarter of the peak, since 1010 m is 200200 widths and 4N/Pe=0.84N/\mathrm{Pe} = 0.8.

✏️ Pen & paperVariance added by interpolation●●●

A constant wind moves a profile 2.52.5 cells per step. Find the interpolation weights and the variance added per step; then the factor by which a Gaussian e−(x/w)2e^{-(x/w)^2} with w=20w = 20 cells loses peak in 8080 steps.

Show worked solution

The foot is 22 cells plus f=0.5f = 0.5 back: ujn+1=0.5 uj−2+0.5 uj−3u^{n+1}_j = 0.5\,u_{j-2} + 0.5\,u_{j-3}, variance f(1−f)=0.25f(1-f) = 0.25 cells2^2 per step (the whole-cell shift adds none). The Gaussian has variance w2/2=200w^2/2 = 200; after 8080 steps 220220. The peak goes as 1/V1/\sqrt{V}, so the factor is 200/220=0.953\sqrt{200/220} = 0.953; the lab shows 0.95290.9529.

What comes next

Let the speed depend on uu itself, c=uc = u. Characteristics are still straight lines, each with its own slope, so taller parts move faster, catch the parts ahead and the lines cross. Where they cross uu would be multi-valued and the smooth solution fails. In 9.11 Nonlinear Waves: Burgers' Equation & Shocks (9.11, Burgers’ equation) this becomes a shock: the characteristic picture says when and where, and the conservative form says how to continue past it. Later, the wave equation (9.4) factors into two transport equations, and the advection-schemes lesson of Module 10 returns to the grid with the trade you measured here between stability, smoothing and conservation.

Key Takeaways

  • ut+c ux=0u_t + c\,u_x = 0 means uu is constant along the characteristics dx/dt=cdx/dt = c; for constant cc the solution is u0(x−ct)u_0(x - ct).
  • For variable c(x,t)c(x,t) the characteristics solve an ODE (your RK4), and u(x,t)=u0(foot)u(x,t) = u_0(\text{foot}).
  • ut+c uxu_t + c\,u_x is the material derivative Du/DtDu/Dt. The conservative form ut+(c u)x=0u_t + (c\,u)_x = 0 differs by cxuc_x u: c uc\,u is constant on characteristics. In the lab (b=0.5b = 0.5, t=0.5t = 0.5) the conservative peak is 2.912.91, the non-conservative one 0.9980.998.
  • Advection-diffusion in the moving frame is the heat equation; Pe=cL/D\mathrm{Pe} = cL/D, and after NN widths the peak is 1/1+4N/Pe1/\sqrt{1 + 4N/\mathrm{Pe}}.
  • Semi-Lagrangian: trace back one step and interpolate. An average of old values, so stable at any CFL; it costs f(1−f)f(1-f) cells2^2 of smoothing per step (zero at integer CFL) and exact mass conservation.
  • Let cc depend on uu and characteristics collide: Burgers’ equation and shocks.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.

Where this leads

These later lessons build directly on this one: