Expand description
The native solve: bounded execution of a Case, its state, and the
result contract cfd-craft.result/0.1.
run is the entry point. It validates the case, builds the grid and the
source and receptor weights, starts from the initial state or a restart
State, and advances transactional steps until the steady checks pass,
the transient interval is complete, or a budget, cancellation or failed
step stops it. A Control supplies the wall-time allowance,
cancellation, an optional external poll and optional profiling. The
returned RunResult holds the Summary (the JSON result), the final
state and the geometry evidence.
Keep the questions of the result separate:
Summary::terminationsays why execution stopped:completed,iteration_limit,wall_time_limit,cancelledordiverged.Summary::assessmentsays what the recomputedChecks support:steady_discrete_solution,transient_interval_completed,failed_checksorincomplete.Summary::experimental_validationis alwaysnot_validated: a numerically accepted run is not a validated urban flow.
A failed step never commits its candidate: the returned state is the last
accepted one, and Summary::error records the failure. The result types
derive JsonSchema; their doc comments are the description entries of
the result_schema that cfd-craft describe prints. See the
result contract.
The lower-level functions (step, assess, timestep,
monitor) are research interfaces; they expect a grid built from the
same case and state vectors of its dimensions.
Structs§
- Budget
- Cumulative mass budget of one constituent, in kg. At any accepted state
the mass in the domain should equal
initial_kg + emitted_kg + inflow_kg - outflow_kg; themass_budgetcheck bounds the relative defect. Every entry is finite and nonnegative. - Check
- One numerical check, recomputed by the solver from the current fields. A
check passes when its value is finite and at most its threshold.
Continuity and residual values are normalized with the case’s velocity and
length scales (
neutral_rans:speed_m_sandreference_height_m; otherwise the reference speed, at least 1 m/s, and the shortest domain side). - Control
- Cooperative execution control of one solve: a wall-time allowance, a cancellation flag, an optional external poll and optional phase profiling.
- Particulate
Evidence - Sum over particle bins passing an aerodynamic-size cutoff.
- Path
Evidence - A path receptor sampled from one constituent’s returned concentration field.
- RunResult
- Everything a solve returns: the JSON summary, the final accepted state
and the geometry evidence.
output::write_runpublishes it as a run archive. - Scalar
Evidence - Evidence for one constituent at the returned state: mass budget, extrema, the steady residual, instantaneous rates and receptor values. Cumulative quantities are in kg, rates in kg/s, concentrations in kg/m3.
- State
- The complete solver state: what fields.json archives and a checkpoint
restores. Vectors follow the grid layout of
Grid: one value per face (inGrid::facesorder) or per cell (x fastest), with solid cells included. Counters are cumulative from the cold start, across restarts. - Summary
- The result of one native run (schema
cfd-craft.result/0.1), written as summary.json: identities, the stopping reason and numerical verdict, work counters, geometry, the recomputed checks and per-constituent evidence.terminationsays why execution stopped;assessmentsays what the checks support; experimental validation is a separate question. Null means unavailable in the stated context, not zero.
Constants§
- SCALAR_
SUBSTEPS_ MAX - Cap on explicit scalar sub-steps per implicit outer iteration (P5d). The constituents then advance by at most this many explicit stable steps per outer iteration; their steady state does not depend on the step sizes.
Functions§
- assess
- Recomputes the numerical checks of a state from its fields.
- initial_
state - The cold-start state of a case: face velocities from
Flow::vector, zero pressure, theneutral_ransequilibrium k and epsilon in fluid cells, the initial concentrations and their initial masses, and zero counters. - monitor
- One monitor row of the state: the RMS face velocity, then for each
constituent its mass (kg) followed by its receptor values (kg/m3, in
receptor order), then with
neutral_ransthe mean k and the mean epsilon over all cells.weightsare the receptor weights oftransport::receptor_weights, in receptor order. - monitor_
change - Largest relative change between the column means of three successive
windows of
numerics.monitor_windowrows, each change relative to the largest absolute mean of its column (at least 1e-30). The windows are the first three of the monitor history, whichrunkeeps at the last three windows.Noneuntil the history holds three full windows. - run
- Solves a case within the limits of
control, from the cold-start state or from arestartstate, and returns the inspectable outcome. - scalar_
substeps - Sub-step count and size for a pseudo-time step
dtwith explicit stable stepstable: the fewest equal sub-steps of at moststable, capped atSCALAR_SUBSTEPS_MAXsteps of sizestable. - step
- Advances
sby one step (one outer iteration with an implicit steady algorithm) of sizedt, transactionally. - timestep
- The next stable time step in seconds for the case’s steady algorithm,
capped by
numerics.max_time_step_s.explicitlimits advection and diffusion together withnumerics.advective_cfl_max(at most 0.45),implicit_viscouslimits advection only, andimplicit_projectionfollows the CFL ramp ofmomentum_solve::ramp_cfl.nutis the eddy viscosity per cell (flow::eddy_viscosity).runclips the step to the end time of a transient run. - validate_
state - Checks that a state fits the case and grid before it is used, for example
a restart: vector dimensions (
CFD-E050), finite values, nonnegative k, epsilon and budgets, ascalar_time_swithintime_s, a finite monitor history, and zero concentration in solid cells (allCFD-E051). It does not check the physics identity;output::read_checkpointdoes that.