MATHEMATICAL MODELING WORKSHOP / 01
A tank, a boundary, a balance
How do flow, volume and reaction change concentration?
Learning objectives & prerequisites
Derivatives, units and Python functions. Review Notes 2, 9 and 11 as needed.
- Translate a control volume into a differential equation.
- Use residence time and a Damkohler number to compare systems.
- Separate model assumptions from numerical error.
01 / 08 · 10 MIN
Observe
Imagine a well-mixed 20 L tank receiving 2 L/min of solution at 10 g/L. The same volume leaves each minute. A first-order reaction removes solute at 0.05 per minute. Concentration is initially zero. This is an invented teaching system: the numbers describe an experiment, not measured equipment.
Sketch the boundary and label every crossing quantity. Predict whether concentration reaches the inlet value.
02 / 08 · 10 MIN
Ask
An answer needs a quantity and a time horizon. Compare a transient question (concentration after 10 minutes) with a long-run question (steady concentration). Both require a balance, but a steady-state calculation alone cannot answer the first.
Write one quantitative research question and an observable result that would contradict your prediction.
03 / 08 · 15 MIN
Assume
Set M=VC. Equal inflow and outflow keep V constant. Perfect mixing makes outlet concentration equal to tank concentration. Constant temperature justifies holding k fixed. Each assumption changes the equation; none follows merely from choosing an ODE solver.
Complete the model card. For imperfect mixing, identify the first equation term you would revisit.
04 / 08 · 20 MIN
Formulate
Accumulation equals inflow minus outflow minus reaction. Dividing by V gives dC/dt=(Q/V)(Cin−C)−kC. All terms have units g/L/min. With c=C/Cin and τ=tQ/V, the only dynamic parameter is Da=kV/Q. The equilibrium is Cin/(1+Da), approached on time scale 1/(Q/V+k).
Derive the dimensionless equation without copying it; explain how doubling both Q and V affects the curve.
05 / 08 · 15 MIN
Design
Euler replaces an instantaneous rate by a rate held constant over h: Cnext=C+h f(C). The homogeneous error multiplier is 1−h(Q/V+k). Stability requires its magnitude below one; preserving monotone decay is stricter. Compare with the analytic exponential and an adaptive solver.
Write y[i+1]=y[i]+h*rhs(t[i],y[i]) inside student_euler. Hand-check y'=−y with y(0)=1 at h=0.1 for two steps. Then calculate the tank multiplier at h=10.
06 / 08 · 25 MIN
Experiment
Complete student_model and student_euler in the Python panel. Write the time-stepping loop yourself; the two-step hand calculation checks it independently of the balance. The scaffold compares your trajectory with the analytic and SciPy references. First run the default case; then vary one parameter. Use the prediction box before running and record both successful and failed checks.
Run k=0, k=0.05 and k=0.2. Explain the resulting steady levels using Da, then halve the time step.
07 / 08 · 25 MIN
Challenge
A solver matching the analytic solution verifies this equation's implementation. It does not validate perfect mixing in a real tank. A wrong balance can still generate a smooth curve. Keep a ledger separating a physical-model change, parameter uncertainty and a discretization change.
Intentionally omit reaction. Which checks catch the error? Propose a tracer measurement to assess the mixing assumption.
08 / 08 · 15 MIN
Communicate
A useful conclusion identifies the regime, a numerical result, a check and a limitation. Describe how the governing dimensionless ratio explains the observation. Export the notebook and verify that another reader can recover the same numbers with the stated parameters.
Write a 150–250 word conclusion and one follow-up experiment. Link each claim to a plot or numerical check.
Need a little guidance?
1. Concept hint
Track solute mass, not just concentration. Inflow is Q×Cin in g/min.
2. Mathematical / algorithm hint
Divide Q(Cin−C)−kVC by V; the initial value enters the trajectory, not the rate law.
3. Reference implementation guide
Compare your expression with the reference implementation below, then explain each term in your own words.
Compare the reasoning before applying it. Your current code is backed up before replacement.
Experiment protocol: comparison, failure & extension
Required comparison
Compare k=0 with k=0.2, then halve h with all physical parameters fixed.
Failure experiment
Set k=1 and h=10: Euler can oscillate or become negative. Interpret the failed checks.
Research extension
Replace perfect mixing with two exchanging compartments. Identify a tracer experiment that distinguishes the models.
PYTHON WORKBENCH
Predict. Then run.
Parameters & random seed
Edit directly above or open the syntax-highlighting editor. The starter's unfinished student_model should fail relevant checks; use your derivation to complete it.
The runtime downloads only when started. Each experiment uses a fresh namespace and a 30-second limit.
Unable to load? Download the standalone notebook and run it in Python with NumPy, SciPy and Matplotlib. Reference notebook
Connect this lesson to your bookshelf.
Lecture & writing Notes
- The Modeling Process and Scaling
- Differential Equations and Dynamic Models
- Dimensional Analysis and Similitude
- Paper Architecture and Judge Navigation
- The Summary — Claim, Evidence, and Decision
- Building Trust — Assumptions, Validation, and Sensitivity
- Academic Prose — Precision, Flow, and Evidence
- Visual Evidence, LaTeX, and Submission Engineering
Book chapters (PDF and print pages separated)
- Chidambaram — Mathematical Modelling and Simulation in Chemical Engineering
3.1: Isothermal CSTR
PDF 50–51 · Print 31–32 - Segel & Edelstein-Keshet — A Primer on Mathematical Models in Biology
4: Nondimensionalization and scaling
PDF 86–87 · Print 67–68