Condensation and frost¶
How a pipe's water vapour condenses, freezes and evaporates: where the block
is read and refused, which driver applies the step, and what the step decides
per cell. Written 2026-10-20 with closures/condensation.py; the physics, the
energy bookkeeping and the validation are in
Closures: Condensation and frost, the
standard in Function contracts and flow charts.
What enters. A pipe with [pipe.condensation] kind = "water", its water
vapour as an H2O species column (the primary or an extra), an ideal gas with
one gamma. Per cell the step reads the conservative state (rho, rho u, rho E),
the H2O mass fraction and the condensate rho_cond [kg/m^3], e_cond [J/m^3].
What comes out. Per cell, the condensed (or evaporated) mass moved between the gas density and the H2O column and the condensate, the condensate's energy change moved out of (or into) the gas total energy, every other species' mass and the gas velocity kept. Water and energy, gas plus condensate, are conserved to round-off.
flowchart TD
A["[pipe.condensation] in the TOML"] --> P["_parse_condensation"]
P -- "kind not none / water" --> XP["ValueError"]
P --> V{"_validate_condensation"}
V -- "no H2O column, quasi_steady solver, per_cell_gamma, real gas, tau < 0 or NaN" --> XV["CaseValidationError at pipe[i].condensation"]
V --> B{"_attach_condensation"}
B -- "kind none" --> N0["pipe.condensation = None: no step, bit-identical"]
B -- "no H2O column, real gas, per-cell gamma, bad tau" --> XB["ValueError naming the pipe"]
B --> S["CondensationState: h2o_col, tau, rho_cond = e_cond = 0"]
S --> D{"driver"}
D -- "explicit: post_rk, once per step" --> OP["apply_condensation_to_pipe"]
D -- "strang: each transport half-step is the explicit driver" --> OP
D -- "implicit: after the post-Newton operators, before the BDF2 carry" --> OP
D -- "quasi-steady transient, advance_single_pipe" --> XR["refuse_condensation: NotImplementedError naming the driver"]
OP -- "real gas, per-cell or mixture gamma, bad tau, a state that does not fit the pipe" --> XO["ValueError naming the pipe"]
OP --> K["condensation_kernel, per cell"]
K -- "rho <= 0 or all-vapour T <= 0" --> SK["cell left for the dt check"]
K -- "no condensate and vapour at or below saturation" --> UN["cell untouched, bit for bit"]
K --> EQ{"equilibrium_state"}
EQ -- "all water fits as vapour at the all-vapour T" --> DRY["condensate 0: evaporate it all"]
EQ --> BR["_bracket from the all-vapour T"]
BR --> TP{"bracket across 273.16 K?"}
TP -- "no" --> RT["_root_on_branch on ice or water"]
TP -- "yes, ice residual >= 0" --> RT
TP -- "yes, water residual <= 0" --> RT
TP -- "yes, between" --> MIX["melting mix at 273.16 K"]
RT --> CA["_condensate_at: W - rho_sat(T), times e_c(T)"]
DRY --> R["move frac = 1 or 1 - exp(-dt/tau) of the way"]
CA --> R
MIX --> R
R --> OUT["gas: rho, H2O column, rho E, velocity kept; condensate updated"]
The result file's final state carries condensation/rho_cond and
condensation/e_cond (pipe_state_dict), and a resume restores them
(_pipe_state_pairs); ice_fraction reads the frozen share from the
condensate's energy.
Functions¶
src/aeolus1d/io/parsers.py::_parse_condensationsrc/aeolus1d/io/validate.py::_validate_condensationsrc/aeolus1d/io/validate.py::_condensation_problemssrc/aeolus1d/io/build.py::_attach_condensationsrc/aeolus1d/solver/network_timeloop.py::_ExplicitNetwork.post_rksrc/aeolus1d/solver/implicit_network.py::advance_network_implicitsrc/aeolus1d/solver/quasi_steady_network.py::advance_network_quasi_steady_transientsrc/aeolus1d/solver/timeloop.py::advance_single_pipesrc/aeolus1d/solver/solver_ops.py::condensation_pipessrc/aeolus1d/solver/solver_ops.py::apply_condensation_to_pipesrc/aeolus1d/solver/solver_ops.py::refuse_condensationsrc/aeolus1d/closures/condensation.py::condensation_kernelsrc/aeolus1d/closures/condensation.py::equilibrium_statesrc/aeolus1d/closures/condensation.py::_bracketsrc/aeolus1d/closures/condensation.py::_root_on_branchsrc/aeolus1d/closures/condensation.py::_equilibrium_residualsrc/aeolus1d/closures/condensation.py::_condensate_atsrc/aeolus1d/closures/condensation.py::saturation_vapour_densitysrc/aeolus1d/closures/condensation.py::condensate_energysrc/aeolus1d/closures/condensation.py::p_sat_watersrc/aeolus1d/closures/condensation.py::p_sat_icesrc/aeolus1d/closures/condensation.py::latent_heat_vaporisationsrc/aeolus1d/closures/condensation.py::latent_heat_sublimationsrc/aeolus1d/closures/condensation.py::ice_fractionsrc/aeolus1d/io/snapshot.py::pipe_state_dictsrc/aeolus1d/io/resume.py::_pipe_state_pairs