# Chapter 23 notebook: Partial Differential Equations: Discretize, Resolve, and Verify

**Goal:** Compute scheme-specific stability limits and design a refinement check that separates space and time errors.

**Start with:** Rules 23.2.1, 23.2.2, 23.3.2. Use a calculator or the optional Python lab. Programming is optional for the workbook; the Jupyter version requires a Python 3 kernel. All lab numbers are constructed practice inputs, not observed data.

**Source:** [Finished Chapter 23](../skills/math-thumb-pde/references/chapter.md) from *Mathematical Rules of Thumb*. Numbered rules, classifications, and the decision path come from the book. The lab, exercises, answer key, and worksheet prompts are companion additions.

## 1. Frame your decision

Write a question in which an answer would change something you do. Gather: PDE, coefficients and units; domain and boundary/initial data; spatial and temporal schemes; grid spacing; conservation and error targets.

- My question and intended decision:
- Known inputs and units:
- Required accuracy or threshold:
- What I expect before calculating:
- What I still need to find out:

Use the lab as a worked starting point if you do not yet have your own problem. For notation or prerequisites, ask the chapter skill to explain only the concept blocking the next step.

## 2. Choose a route

- **Is the PDE transport-dominated?** Follow characteristic direction, inspect cell Peclet numbers, and use limiting near discontinuities.
- **Must a quantity balance cell by cell?** Form one shared numerical flux per face and audit the telescoping global balance.
- **Is nominal high order missing?** Check solution regularity, geometry, quadrature, and solver tolerance before increasing polynomial degree.
- **Is time integration explicit?** Evaluate every applicable advection, diffusion, reaction, and source stability restriction.
- **Are waves or thin layers important?** Set the mesh from wavelength and layer thickness, then refine the output that depends on their derivatives or phase.
- **Do space and time errors interact?** Isolate each with separate studies before choosing a coupled refinement path.
- **Has the code been verified?** Run manufactured solutions and recover predicted order in relevant norms.
- **Could the domain or linear solve contaminate the answer?** Move artificial boundaries and tighten multigrid-preconditioned solves independently.

**Chapter-specific stop check:** CFL constants depend on dimension and scheme. Numerical stability is not a resolution certificate; verify boundaries, conservation, and order separately.

## 3. Work the lab

For separate one-dimensional examples on a uniform grid dx=0.01 m: forward Euler with first-order upwind advection at speed 2 m/s needs dt<=dx/|a|=0.005 s; forward Euler with centered diffusion and alpha=1e-4 m^2/s needs dt<=dx^2/(2alpha)=0.5 s. Halving dx halves the advection limit and quarters the diffusion limit. A combined advection-diffusion update can require a joint restriction; taking the smaller of separate limits is not a general proof of its stability.

Predict the sign and scale before running the code. Then change one input and explain why the result moves. The code checks the constructed example; it does not prove the rule for every possible input. Code assertions may describe the example's chosen regime, so inspect them before changing that regime.

```python
spacing, speed, diffusivity = 0.01, 2.0, 1e-4
assert spacing > 0 and speed != 0 and diffusivity > 0
for dx in (spacing, spacing/2):
    advection_limit = dx/abs(speed)
    diffusion_limit = dx*dx/(2*diffusivity)
    print(f"dx={dx:.5f} m; separate advection dt<={advection_limit:.6f} s; separate diffusion dt<={diffusion_limit:.6f} s")
```

**My prediction, observed result, and explanation:**

_Record your work here._

## 4. Practise without the answers

### Exercise 1

A relevant wavelength is 0.5 m. What grid spacing corresponds to ten cells per wavelength?

**My approach, assumptions, calculation, and check:**

_Write your attempt here._

### Exercise 2

For u_t=alpha × u_xx on 0<x<1 with zero endpoint values, verify u=exp(-alpha × pi^2 × t) × sin(pi × x).

**My approach, assumptions, calculation, and check:**

_Write your attempt here._

### Exercise 3

Spatial refinement stops improving the answer when the time step is fixed. Does that prove the spatial scheme is broken?

**My approach, assumptions, calculation, and check:**

_Write your attempt here._

**Coaching prompt:** “Use the Chapter 23 skill to help me with Exercise 2. Ask for my attempt, give one useful hint if I need it, and help me check the assumptions before showing the answer.”

## 5. Answer key and reasoning

Read this after attempting the exercises, or use it immediately if you prefer a complete walkthrough. An answer is complete only when its assumptions and stopping point are clear.

### Answer 1

dx=0.5/10=0.05 m. Verify phase and amplitude errors for the actual scheme; ten cells is an initial screen.

### Answer 2

u_t=-alpha × pi^2 × u and u_xx=-pi^2 × u, so the PDE holds. Boundary values vanish and the initial condition is sin(pi × x); this is a useful exact verification problem.

### Answer 3

No. Time discretization, linear-solver error, boundary effects, or roundoff may dominate. Tighten them independently before estimating spatial order.

## 6. Build the complete chapter toolkit

The new lab samples the chapter; the following checklist covers all 15 rules. Study one thematic group at a time. A large group can take several sessions.

- **Choose a Spatial Discretization That Respects the Physics:** work with rules 23.1.1, 23.1.2, 23.1.3, 23.1.4, 23.1.5.
- **Respect Time-Step and Resolution Scales:** work with rules 23.2.1, 23.2.2, 23.2.3, 23.2.4, 23.2.5.
- **Prove That the Computation Solves the Intended PDE:** work with rules 23.3.1, 23.3.2, 23.3.3, 23.3.4, 23.3.5.

For each selected rule, read its equation, explanation, and worked use in the source. Reproduce that example; change one input; then change one assumption so the rule is no longer justified. Record the result and what check catches the failure. Historical examples remain labeled and qualified as in the source.

Read each complete numbered profile in the [chapter reference](../skills/math-thumb-pde/references/chapter.md) before applying it. The cues below abbreviate the graph metadata; they are not complete conditions. Change the status only after doing the practice described below.

| Rule | Book role | First assumptions to inspect | Practice status |
|---|---|---|---|
| 23.1.1: Bias transport discretization upwind | Workflow | well posed boundary value problem;  consistent discretization | new |
| 23.1.2: Use cell Peclet number to judge centered convection-diffusion | Workflow | well posed boundary value problem;  consistent discretization | new |
| 23.1.3: Prefer finite volume when local conservation is nonnegotiable | Workflow | well posed boundary value problem;  consistent discretization | new |
| 23.1.4: Limit high-order reconstructions near discontinuities | Specialized | well posed boundary value problem;  consistent discretization | new |
| 23.1.5: Do not expect finite-element order beyond solution regularity | Workflow | well posed boundary value problem;  consistent discretization | new |
| 23.2.1: Keep explicit advection CFL near or below one | Workflow | well posed boundary value problem;  consistent discretization | new |
| 23.2.2: Remember that explicit diffusion steps scale with mesh size squared | Independent | explicit time integration;  diffusive operator | new |
| 23.2.3: Resolve waves with at least about ten cells per wavelength | Independent | well posed boundary value problem;  consistent discretization | new |
| 23.2.4: Place several cells across every boundary layer | Workflow | well posed boundary value problem;  consistent discretization | new |
| 23.2.5: Balance temporal and spatial discretization errors | Workflow | separable leading error terms;  known temporal and spatial orders | new |
| 23.3.1: Require every Fourier amplification factor to stay bounded | Workflow | well posed boundary value problem;  consistent discretization | new |
| 23.3.2: Verify PDE codes with a manufactured solution | Workflow | smooth manufactured field;  consistent forcing and boundary data | new |
| 23.3.3: Estimate PDE order from normed errors on successive meshes | Workflow | well posed boundary value problem;  consistent discretization | new |
| 23.3.4: Move artificial boundaries until the answer stops moving | Workflow | well posed boundary value problem;  consistent discretization | new |
| 23.3.5: Use multigrid when elliptic solves dominate | Workflow | well posed boundary value problem;  consistent discretization | new |

For a completed row, record: **rule number / my new input / mathematical claim type / verified assumptions / calculation / check / valid use / rejected use / next step**. “Practised” means you worked an example. “Demonstrated” means you can explain a valid use, transfer it, and reject a misuse without the answer key.

## 7. Apply it to your own problem

Return to your opening question. Choose the smallest rule set that can settle it. Use the book's independent/workflow/specialized classification separately from the claim type (exact, approximate, bound, diagnostic, or heuristic).

- Selected rule number(s) and reason:
- Assumptions that hold, fail, or remain uncertain:
- Substitution with units:
- Result and error, uncertainty, or bound:
- Independent check or limiting case:
- Decision this supports:
- Stop here, do a named next calculation, or gather missing information:

## 8. Transfer and continue

Useful nearby chapters: Chapter 18: applied mathematics; Chapter 20: numerical methods; Chapter 22: ode. Bring the question, units, assumptions, result type, and uncertainty to the next chapter. Choose a bridge only when it supplies an operation you actually need.

**Completion check:** Explain this chapter's lab in your own words; solve one changed-input exercise; reject one invalid use; and produce a decision record for your own problem. If one check fails, revisit that part of the chapter rather than marking every rule complete.
