---
title: Sources and changing boundaries
heading: Heat sources, forced vibrations and boundaries that move with time
eyebrow: A12 · Lesson 35 · Sources and changing boundaries
xp: 40
---

::: hook
Separation of variables, as you've used it so far, needs a homogeneous equation with fixed boundary values. Real problems rarely cooperate. A resistor heats itself from inside, a string is driven by a periodic force, and a chip's case temperature ramps up while it warms. Two ideas handle all of these. Subtract a part that absorbs the source or the boundary values, and expand what's left in the same eigenfunctions as before; each mode then obeys its own ordinary differential equation, a first-order low-pass filter for heat and a resonator for waves, driven by its share of the source.
:::

::: play
- A strip with both ends held at 0 has uniform heating switched on at time 0. The curve is its temperature profile, as a fraction of the final midpoint temperature, after a time s measured in units of the slowest mode's time constant $\tau_1$.
- Slide s from 0 upward. The profile rises toward the parabola $4x(1 - x)$ (dashed), and the higher modes settle almost at once.
- The readout shows the midpoint's progress. It reaches 95% at about $s = 3$.
:::

```sim plot
view: graph
x: x = 0..1
y: u = 0..1.1
slider: s = 0..4 step 0.02 = 0.5
plot: (32/pi^3)*(sin(pi*x)*(1 - exp(-s)) + sin(3*pi*x)/27*(1 - exp(-9*s)) + sin(5*pi*x)/125*(1 - exp(-25*s)) + sin(7*pi*x)/343*(1 - exp(-49*s))) | label: profile at time s | samples: 300
plot: 4*x*(1 - x) | label: final profile | dashed
readout: midpoint as a fraction of final = (32/pi^3)*((1 - exp(-s)) - (1 - exp(-9*s))/27 + (1 - exp(-25*s))/125 - (1 - exp(-49*s))/343) | digits: 4
```

::: predict
## A string fixed at both ends is driven by a small vibrating force applied at its midpoint. Which modes can the drive excite?

- [ ] All of them
- [x] Only the odd-numbered modes
- [ ] Only the even-numbered modes
- [ ] Only the fundamental

::: reveal
Only the odd ones. A force at x pushes mode n in proportion to the mode's shape there, $\sin(n\pi x/L)$. At the midpoint that's $\sin(n\pi/2)$, which is zero for every even n: the midpoint is a node of every even mode, so a force there can't do work on them, even at their resonant frequencies.
:::
:::

::: nameit
## Subtracting a steady part

For $u_t = \alpha u_{xx} + q(x)$ with $u(0) = A$ and $u(L) = B$, first solve the steady problem $\alpha v'' = -q(x)$ with the same boundary values. Then $w = u - v$ satisfies the homogeneous equation with zero ends and starts at $u(x, 0) - v(x)$, which separation of variables handles.

## Expanding the source

When the source changes in time, expand everything in the eigenfunctions $\phi_n = \sin\frac{n\pi x}{L}$ with $\lambda_n = \left(\frac{n\pi}{L}\right)^2$: $u = \sum a_n(t)\phi_n$ and $q = \sum q_n(t)\phi_n$, with $q_n = \frac2L\int_0^Lq\phi_n\,dx$. Substituting gives one ODE per mode:

$$a_n' + \alpha\lambda_na_n = q_n(t) \quad\text{(heat)}, \qquad a_n'' + \omega_n^2a_n = q_n(t) \quad\text{(waves, } \omega_n = c\sqrt{\lambda_n}\text{)}.$$

Each heat mode is a first-order low-pass filter with time constant $\tau_n = \frac{1}{\alpha\lambda_n}$. Each wave mode is an undamped resonator, which responds without limit to a drive at $\omega_n$ unless $q_n = 0$.

## Boundaries that change with time

If $u(0, t) = g(t)$ and $u(L, t) = 0$, put $u = g(t)\left(1 - \frac xL\right) + w$. Then w has zero ends and obeys $w_t = \alpha w_{xx} - g'(t)\left(1 - \frac xL\right)$: the moving boundary has become a source.

## Duhamel's principle

If $U(x, t)$ is the response to a unit step in the boundary value or the source, the response to a general input g is the superposition of steps, $u = g(0)U(x, t) + \int_0^tg'(s)U(x, t - s)\,ds$. This is convolution, as in circuits, applied to a PDE.
:::

::: example
## A 2 cm copper strip ($\alpha = 1.1 \times 10^{-4}$ m²/s) with its ends held at ambient has uniform heating switched on at t = 0. When does its midpoint reach 95% of its final rise?

::: solution
1. **Source coefficients.** The source is uniform, so $q_n = \frac{4q}{n\pi}$ for odd n and 0 for even n (with q in kelvins per second).
2. **The final midpoint temperature.** Each mode settles to $q_n\tau_n$, so it is
   $$\sum\frac{4q\tau_1}{\pi n^3}\sin\frac{n\pi}{2}$$
3. **The first mode's share.** That sum is the parabola's peak, and the first mode alone carries $\frac{32}{\pi^3} = 1.032$ of it, while the higher modes subtract the extra 3%.
4. **Time to 95%.** The higher modes settle 9, 25, … times faster, so the midpoint follows $1 - 1.032e^{-t/\tau_1}$ closely. Setting that to 0.95 gives
   $$\begin{aligned} t &= \tau_1\ln\frac{1.032}{0.05} \\ &= 3.03\tau_1 \end{aligned}$$
5. **The time constant.**
   $$\begin{aligned} \tau_1 &= \frac{L^2}{\pi^2\alpha} \\ &= \frac{4 \times 10^{-4}}{\pi^2 \times 1.1 \times 10^{-4}}\ \text{s} \\ &= 0.37\ \text{s} \end{aligned}$$
   so t = 1.1 s.

**Answer:** the midpoint reaches 95% of its final rise after about 1.1 s.
:::
:::

::: example
## One end of a steel rod ($\alpha = 10^{-5}$ m²/s, L = 10 cm) is heated at a steady 1 K/s, and the other end is held at 0. Once the start-up transient has passed, how far does the midpoint lag behind a straight-line profile?

::: solution
1. **Split off the ramp.** With $g = Rt$, write
   $$u = Rt(1 - x/L) + w$$
2. **The source for w.** It is $-R(1 - x/L)$, which doesn't change in time, so w settles to the steady solution of
   $$\alpha w'' = R(1 - x/L)$$
   with zero ends.
3. **Solve.**
   $$w = \frac R\alpha\left(\frac{x^2}{2} - \frac{x^3}{6L} - \frac{Lx}{3}\right)$$
4. **At the midpoint.**
   $$\begin{aligned} w &= \frac R\alpha L^2\left(\frac18 - \frac1{48} - \frac16\right) \\ &= -\frac{RL^2}{16\alpha} \end{aligned}$$
5. **Put in the numbers.**
   $$\frac{1 \times 0.01}{16 \times 10^{-5}}\ \text{K} = 62.5\ \text{K}$$
   Steel conducts too slowly to keep up with a 1 K/s ramp along 10 cm, so its middle trails far behind.

**Answer:** the midpoint lags 62.5 K behind the straight-line profile.
:::
:::

::: example
## A string fixed at both ends is driven by a small force concentrated at one third of its length. Which modes stay silent, whatever the drive frequency?

::: solution
1. **Mode coefficients.** A point force $F(t)\delta(x - L/3)$ has mode coefficients $q_n \propto \sin\frac{n\pi}{3}$.
2. **The silent modes.** That's zero for n = 3, 6, 9, …, the modes with a node at one third. Those modes get no drive at all, so even a drive at their resonant frequency leaves them still.
3. **The other modes.** Each responds like a resonator: a drive at frequency ω gives mode n an amplitude proportional to
   $$\frac{q_n}{\omega_n^2 - \omega^2}$$
   large near $\omega_n$.
4. **In instruments.** This is why a guitar's pickup position and a piano's hammer position (about one seventh or one eighth of the string) shape the tone.

**Answer:** modes 3, 6, 9, …, the ones with a node at one third, stay silent at any drive frequency.
:::
:::

::: check
given: q = 1 | 5; L = 1 | 2; k = 100 | 400
answer: q*1e6*(L/100)^2/(8*k)
unit: K
tolerance: 0.5%

## A strip of length {L} cm, with conductivity {k} W/(m·K) and its ends held at ambient, generates heat uniformly at {q} MW/m³. What is its midpoint's final temperature rise?

::: right
Right. $\frac{qL^2}{8k}$, the peak of the steady parabola.
:::

::: misses
- [q*1e6*(L/100)^2/(2*k)] That's at x = L for a strip with one end insulated; with both ends cooled the peak is $\frac{qL^2}{8k}$.
- [any] Solve $-ku'' = q$ with zero ends.
:::
:::

::: check
given: L = 1 | 2; a = 1.1 | 0.23
answer: (L/100)^2/(pi^2*a*1e-4)*ln(32/(0.05*pi^3))
unit: s
tolerance: 0.5%

## A strip {L} cm long with diffusivity {a} × 10⁻⁴ m²/s has uniform heating switched on, with its ends held at ambient. When does its midpoint reach 95% of its final rise?

::: right
Right. $\tau_1\ln\frac{32/\pi^3}{0.05} = 3.03\tau_1$.
:::

::: misses
- [(L/100)^2/(pi^2*a*1e-4)*ln(20)] The first mode starts 3% above the final value, so it must fall further: use $\frac{32}{\pi^3} = 1.032$.
- [any] $\tau_1 = \frac{L^2}{\pi^2\alpha}$; solve $1 - 1.032e^{-t/\tau_1} = 0.95$.
:::
:::

::: check
given: R = 0.1 | 1; L = 5 | 10; a = 1 | 10
answer: R*(L/100)^2/(16*a*1e-5)
unit: K
tolerance: 0.5%

## One end of a rod {L} cm long (α = {a} × 10⁻⁵ m²/s) ramps at {R} K/s; the other is held fixed. How far does the midpoint lag the straight-line profile?

::: right
Right. $\frac{RL^2}{16\alpha}$, once the transient has died away.
:::

::: misses
- [R*(L/100)^2/(8*a*1e-5)] Check the midpoint value of $\frac{x^2}{2} - \frac{x^3}{6L} - \frac{Lx}{3}$: it's $-\frac{L^2}{16}$.
- [any] Solve $\alpha w'' = R(1 - x/L)$ with zero ends and evaluate at L/2.
:::
:::

::: check
given: m = 3 | 4 | 5
answer: m
tolerance: 0

## A string is driven by a point force at 1/{m} of its length from one end. What is the lowest mode the force can't excite?

::: right
Right. Mode {m} has a node at $L/m$, so $\sin(m\pi/m) = 0$.
:::

::: misses
- [2*m] Mode 2m has a node there too, but mode m comes first.
- [any] Find the lowest n with $\sin(n\pi/m) = 0$.
:::
:::

::: check
kind: parts
given: tau = 0.5 | 2; f = 0.1 | 1

## A heat mode with time constant {tau} s is driven by a source varying as $\cos 2\pi ft$ with f = {f} Hz.

::: part
answer: 1/sqrt(1 + (2*pi*f*tau)^2)
tolerance: 0.5%

### What is its amplitude, as a fraction of its response to a steady source of the same size?

::: misses
- [1/(1 + 2*pi*f*tau)] Add in quadrature: $\sqrt{1 + (\omega\tau)^2}$.
- [any] It's a first-order low-pass filter.
:::
:::

::: part
answer: atan(2*pi*f*tau)*180/pi
unit: °
tolerance: 0.5%

### By how many degrees does it lag the source?

::: misses
- [any] $\tan^{-1}\omega\tau$.
:::
:::
:::

::: check
kind: choice

## What does expanding a time-varying source in the eigenfunctions do to the heat equation?

- [ ] It makes the boundary values zero
- [x] It splits it into separate first-order ODEs, one per mode
- [ ] It removes the time dependence
- [ ] It turns it into Laplace's equation

::: right
Right. The eigenfunctions don't mix under $\partial_{xx}$, so each coefficient evolves on its own, driven by its share of the source.
:::

::: misses
- [1] That's what subtracting a part for the boundary values does.
- [3] The modes still evolve in time; each now has an ODE in t.
- [4] Laplace's equation is the steady state, which a time-varying source never reaches.
:::
:::

::: check
kind: derivation
vars: R = 0.1..2, L = 0.5..2, a = 0.5..2, x = 0..0.5

## A rod has $u(0, t) = Rt$ and $u(L, t) = 0$; write $u = Rt(1 - x/L) + w$, with α written as a.

::: step
answer: R*(1 - x/L)/a

### Once settled, w is steady, so $\alpha w'' = R(1 - x/L)$. What is $w''$?
:::

::: step
answer: -R*L^2/(16*a)

### With zero ends, what is w at the midpoint?
:::

::: right
Right. The midpoint lags the straight line by $\frac{RL^2}{16\alpha}$: slower heating or shorter rods keep up better.
:::
:::

::: explain
## Why does each mode of a heated rod behave like a first-order low-pass filter?

::: model
Expanding in eigenfunctions of the rod, each mode's shape is a sine that the second derivative only rescales: $\partial_{xx}\phi_n = -\lambda_n\phi_n$. So the heat equation never moves heat from one mode to another, and each coefficient obeys $a_n' = -\alpha\lambda_na_n + q_n(t)$. That's the equation of an RC circuit driven by a current, with time constant $\frac{1}{\alpha\lambda_n}$: the mode charges up toward its share of the source and forgets fast changes. Short-wavelength modes have large $\lambda_n$, so they settle fast and respond to fast changes, while the slowest mode sets how long the whole rod takes to respond.
:::
:::

::: practice

::: check
given: q = 2 | 10; L = 0.5 | 3; k = 50 | 200
answer: q*1e6*(L/100)^2/(8*k)
unit: K
tolerance: 0.5%

## Midpoint rise: {q} MW/m³, {L} cm, k = {k} W/(m·K)?

::: misses
- [any] $\frac{qL^2}{8k}$.
:::
:::

::: check
given: R = 0.5 | 2; L = 2 | 20; a = 2 | 5
answer: R*(L/100)^2/(16*a*1e-5)
unit: K
tolerance: 0.5%

## Midpoint lag: {R} K/s, {L} cm, α = {a} × 10⁻⁵ m²/s?

::: misses
- [any] $\frac{RL^2}{16\alpha}$.
:::
:::

::: check
given: tau = 1 | 5; f = 0.05 | 0.3
answer: 1/sqrt(1 + (2*pi*f*tau)^2)
tolerance: 0.5%

## Mode amplitude ratio, τ = {tau} s, f = {f} Hz?

::: misses
- [any] $\frac{1}{\sqrt{1 + (\omega\tau)^2}}$.
:::
:::
:::
