Computational fluid dynamics divides a domain into many locations and approximates how mass, momentum, and energy move between them. It is model-building plus numerical analysis, not only a colorful velocity map.
Change depth and displaced volume. Pressure increases with depth; buoyancy is the weight of displaced fluid.
Depth 2.0 m; pressure 120620 Pa; displaced volume 0.020 m³; buoyant force 196.2 N.
Start with a square grid. A scalar such as density is one value per cell; velocity needs two arrays, one for horizontal speed and one for vertical speed. Treat each cell value as an average over a small control volume, not an exact point measurement. That decision gives every update a useful accounting question: what crossed the cell faces?
For a conserved scalar (q), the finite-volume idea is:
\[\frac{q^{n+1}_{i,j}-q^n_{i,j}}{\Delta t} = -\frac{F_{x,\mathrm{right}}-F_{x,\mathrm{left}}}{\Delta x} -\frac{F_{y,\mathrm{top}}-F_{y,\mathrm{bottom}}}{\Delta y} + S_{i,j}.\]Read this like a state transition. The next cell value equals the old value, plus known sources, minus what leaves through faces. When the same face flux is added to one neighbor and subtracted from the other, the interior exchange cancels in the whole-grid ledger. Only sources and boundary flux can change total mass.
An implementation should name the stages rather than hide them in one giant update:
The small grid helper in this project demonstrates the same discipline with diffusion: a five-point neighborhood computes a Laplacian, then a fresh array receives the explicit update. It rejects a diffusion step larger than its stability limit instead of drawing plausible-looking nonsense. For unit cell spacing, that particular update requires:
\[\nu\Delta t \leq \frac14,\]where (\nu) is the diffusion coefficient. Advection has a related CFL limit: in one update, material should not travel across more than roughly one cell. Record the chosen limit next to the solver configuration, because a stable run is evidence about the algorithm, not merely a slider restriction.
A closed wall often means normal velocity is zero: fluid may slide along the wall but cannot pass through it. A periodic edge instead maps the rightmost neighbor to the leftmost cell. An inlet needs a stated velocity or flow rate; an outlet needs a rule that does not reflect arbitrary pressure waves back into the domain. These are different programs with different physical claims.
Before trusting a visualization, run small deterministic checks: a uniform periodic field should remain uniform, diffusion should reduce an isolated peak without creating extra total quantity under compatible boundaries, a closed box should not leak mass, and halving cell size and time step should preserve the conclusion you plan to teach. Save the input configuration and diagnostics beside an image so a reader can reproduce the frame.
Prediction: Changing a boundary condition can alter the entire flow field.
List the minimum fields for an incompressible 2D solver and name one boundary test for a closed wall.CFD is a structured field solver. Treat cell values as state, face fluxes as messages between cells, boundaries as executable physical assumptions, and conservation/stability diagnostics as tests. Make the grid, boundaries, update rules, and refinement checks visible to the reader.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Introduction to CFD Concepts, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Fluids, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Introduction to CFD Concepts as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Plan a deterministic field solver around grids, boundary conditions, conservation updates, and convergence checks.