Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Fluid results

A solved fluid step keeps, in the session, its output frames (velocity, gauge pressure and, with heat, temperature in every cell; with a free surface, each cell’s fill level), the force on every wall and, with heat, the heat into every wall over time; with a free surface, the liquid’s extent and volume over time (Free surface: solve.probe with front and depth). The results commands probe them at points, along lines and on walls, and show them as a coloured slice through the domain, as the obstacles coloured by the fluid beside them, and as streamlines traced through the velocity field.

Commandssolve.fluid (the reply), solve.probe, results.fluid.measure, results.slice, results.surface, results.streamlines, results.contour, results.frame, results.animate
Step procedure"fluid"
Solvercrates/lbm (solve.rs: frames and histories); display in crates/engine/src/flow.rs, crates/render/src/flow.rs
MethodCell-centred fields; trilinear interpolation between cell centres; streamlines by the midpoint rule in half-cell steps
Verified bycrates/render/src/flow.rs and crates/engine/src/flow.rs tests; crates/engine/src/flow/line.rs, flow/wall.rs tests

Synopsis

[
  {"command": "results.slice", "params": {"step": "Run", "field": "pressure", "axis": "z", "position": 0.05}},
  {"command": "results.streamlines", "params": {"step": "Run", "field": "velocity", "count": 100,
    "line": {"from": [0.01, 0.0, 0.05], "to": [0.01, 0.12, 0.05]}}},
  {"command": "results.surface", "params": {"step": "Run", "show": true, "field": "velocity"}},
  {"command": "solve.probe", "params": {"step": "Run", "points": [[0.15, 0.06, 0.05]]}},
  {"command": "solve.probe", "params": {"step": "Run", "line": {"from": [0.1, 0, 0.05],
    "to": [0.1, 0.12, 0.05], "field": "velocity_x"}}},
  {"command": "solve.probe", "params": {"step": "Run", "forces": ["F2:top", "Body1/F3"]}}
]

Parameters

Display

CommandFieldValueDefaultMeaning
results.slicestepstep nameThe fluid step.
fieldvelocity, pressure, temperatureas shownVelocity magnitude, gauge pressure, or temperature when the frames carry heat.
axisx, y, z, noneas shownThe slice’s normal; none hides the slice.
positioncoordinate or "auto"the symmetry plane, else the middleWhere along axis; "auto" is the symmetry plane along axis when the domain has one there, else the middle; must lie inside the domain.
frame0 … lastthe one shown (at first the last)The frame.
results.surfaceshowboolColour the obstacles by the field (false: the part in its own colours).
fieldvelocity, pressure, temperature, wall_heat_fluxas shownRead in the fluid cells beside each obstacle face; wall_heat_flux per face (below).
frame0 … lastas shown
results.streamlinesshowboolfalse hides them.
fieldvelocity, pressure, temperatureas shownColour by speed or temperature; plain for pressure.
seeds[[x, y, z], …]At most 2000 seed points.
line{"from", "to"}count seeds evenly along this line.
count1 to 200064Seeds along line, or on the inlet face when neither seeds nor line is given.
max_steps1 to 100 0004000Steps (half a cell each) per streamline.
frame0 … lastas shown
results.contourfieldvelocity, pressure, temperature, wall_heat_fluxThe banded field and its legend (bands 2 to 24, range) for a fluid step.
results.frameframe or timeindex or flow timethe lastThe frame shown (by index, or the frame nearest a time).
results.animateonboolPlays the recorded frames in order.

What a command leaves out stays as shown. A fluid step is first shown with velocity magnitude on a slice normal to the horizontal axis across the flow (the slice holds the flow direction and the vertical; Z is up), on the symmetry plane of the domain along that axis when it has a symmetry face there (else through the middle), the obstacles coloured, and 64 streamlines seeded on the inlet face. The flow direction is the axis of the largest mean velocity over the fluid cells of the last frame (+x for fluid at rest).

Probing (solve.probe on a fluid step)

FormFieldsReply
Pointspoints: [[x, y, z], …] (at most 10 000), frame (default the last)Per point: its cell, whether it is solid, velocity, pressure and, with heat, temperature of the cell containing it; cell: null outside the grid.
Lineline: {"from", "to", "count", "field", "face"}, frameThe field at count points evenly along the line (default one per cell spacing, at most 10 000), their xyz, and the max and min with their xyz.
Forcesforces: ["x_min", "F2:top", "Body1/F2:top"] (at most 100)times and each wall’s force history.
Heatheat: ["y_min", …] (at most 100)times and each wall’s heat history (power, positive into the wall). Needs heat.

Line fields: velocity_x, velocity_y, velocity_z, speed, pressure, temperature, wall_heat_flux (with face, the box wall the line lies on).

Theory

Cooling and exchanger measurements

results.fluid.measure {"step": "Run", "from": "x_min", "to": "x_max"} reads the last saved frame; frame selects another by its zero-based index. It leaves the displayed frame and model unchanged. The command is available through command search and its form, the CLI, scripts and the control channel. Stale and free-surface results are refused.

The reply’s rows table identifies each measurement by body (null for a box face), face and quantity, with a value and display unit. csv contains the same table as RFC 4180 text, including the step, frame, time and time unit on every row. It can be saved by a script without opening a dialog. These are measurements of one saved frame, not time averages or a validation verdict. Wall heat is linearly interpolated between recorded samples at that frame’s time; there is no extrapolation. Missing heat, material properties or thermal fields give null values (empty CSV cells), not invented zeros.

For each open box face (x_min, x_max, y_min, y_max, z_min, z_max):

  • area excludes obstacle cells. area_mean_pressure, area_mean_temperature and area_mean_velocity_x/y/z include stagnant fluid cells. The mean is sum(value * cell_area) / sum(cell_area); blocked faces have no mean. The ports report of solve.fluid and results.frame carries the same means per face as area_mean.
  • inflow_volume_flow and outflow_volume_flow integrate the normal velocity separately in each direction. Each rate is nonnegative; opposing flow is never cancelled before averaging. The corresponding mass_flow uses the reference density saved at solve time.
  • inflow_mean_temperature and outflow_mean_temperature weight temperature by mass flow (equivalently volume flow for the constant reference density); zero flow has no mixed temperature. inflow_sensible_heat and outflow_sensible_heat use rho * cp * Q * (T - Tref). The heat_reference row gives Tref, the mixed temperature of all incoming flow. Without incoming flow, no sensible heat reference is inferred.

With both from and to, pressure_drop is the first face’s area-mean static gauge pressure minus the second’s, also included in the table. Both must be open faces with fluid area. It measures boundary-layer cell fields, not an extrapolated wall value or total pressure. Every recorded thermal wall contributes a wall_heat_rate, positive into that wall, including named obstacle interfaces. This is the saved thermal exchange, separate from port advection.

This first slice of #837 leaves arbitrary face sets/surfaces, port conduction, time-window averages, exchanger effectiveness and LMTD, and a complete energy balance with sources and storage for follow-up. The existing heated-block check verifies advective heat against the generated power within 2%; the pressure-driven Poiseuille check verifies the area-mean pressure drop within 0.1%. Synthetic fields check nonuniform weighting, backflow, blocked and stagnant faces; command tests check units, history interpolation, frame selection and CSV.

Fields

A frame holds, per cell (index i + nx (j + ny k)), the velocity in the model’s units (with Guo’s half force), the gauge pressure (ρ − 1) c_s² ρ₀ Δx²/Δt², and with heat the temperature, all in single precision; solid cells hold zero. The fluid mass of the frame is kept in double precision. The initial frame and frames more, evenly spaced to the end, are recorded; a run stopped by its steady rule adds a frame at the stop. Force, heat and zone histories are sampled every ⌈steps/10 000⌉ steps. Each wall-force entry is the mean of the last two steps, because a wall’s force alternates step by step near τ⁺ = ½ (A. J. C. Ladd, J. Fluid Mech. 271:285–309, 1994): it is the force at (k − ½)Δt for the step k. The first step of a run has no step before it, so its entry is that step’s force alone.

Interpolation

Values are cell-centred; solid cells have no value. Inside the fluid a point’s value is the trilinear interpolation between the cell centres around it, from the fluid cells among them. Within half a cell of a box face there is no centre beyond the point, so the value is the nearest centre’s: a temperature line run onto a held wall reads the first cell’s temperature; wall_heat_flux reads the wall.

Slices

A slice joins the cell centres of the layers either side of its plane, interpolated linearly between them, into triangles carrying their corners’ values, and bands them with the contour legend. The outermost centres move out to the domain’s faces, so the slice covers the whole domain. A triangle touching cells with no value takes the mean of its other corners there, and one with none is left out (the obstacle is drawn there). A layer larger than 2²⁰ quadrilaterals is sampled every few cells. The automatic slice is placed from the model as it is at that moment: when a step’s results are first shown, when position is "auto" and when the axis changes. After the domain’s faces are edited, "auto" places it on the edited faces’ plane; a step the model no longer has is sliced through the middle.

Ranges

The slice’s contour.range (the legend’s Max and Min) and the solve’s max_speed are taken over interior fluid cells: the layers of inlet and outlet faces are left out, convective outlets too, because a wake reaching a uniform pressure outlet distorts the last layer (Boundary conditions).

Streamlines

Streamlines follow the trilinear interpolation of the cell velocities (solid cells at rest: the no-slip value), integrated downstream along their arc length by the midpoint (second-order Runge–Kutta) rule with a step of half a cell. Each stops where it leaves the domain, enters a solid cell or reaches still fluid (a speed below 10⁻⁶ of the field’s largest), or at max_steps. All of them together stop at 2 000 000 points. Default seeds lie on a lattice across the inlet face (the upstream face of the flow direction), half a cell inside it: over the obstacles’ shadow on the face, grown by half its size on every side and kept on the face, so the streamlines pass over and around the obstacles; over the whole face without obstacles. A seed outside the fluid starts none.

Wall heat flux

results.surface and results.contour with wall_heat_flux colour each obstacle face by the signed power it receives divided by its complete tessellated area, in power per area (positive into the wall). The face’s heat history is interpolated at the shown frame’s time without extrapolation: frame 0, which predates the history, has no value; recorded adiabatic faces are zero; faces without a history stay uncoloured. No slice is drawn for this surface-only field.

Along a line on a box wall, solve.probe gives the heat flux into the wall from its thermal condition: a held temperature T_w gives the one-sided second-order difference through the wall and the two cell-centre layers beside it (at Δx/2 and 3Δx/2), a flux face its flux, an adiabatic face zero:

q = k (9 T₁ − T₂ − 8 T_w) / (3 Δx)

Line extremes

The max and min of a line probe lie between the samples, at the vertex of the parabola through the extreme sample and its two neighbours; at an end of the line, or beside a point without a value, the sample itself.

Algorithm

  1. solve.fluid stores the result and replies with its summary (Lattice Boltzmann flow).
  2. A display command updates the session’s results view (slice, surface, streamlines, field, frame); the desktop viewport and the headless pictures draw the same plot of it.
  3. Streamlines are traced on the chosen frame and kept until the result, the frame or the settings change; the reply’s traced gives the number of streamlines, their points, the seeds, and no_start, the seeds that started none.

Output

CommandReply
results.sliceThe view, with contour.range over interior fluid cells.
results.surfaceThe view.
results.streamlinesThe view and traced: streamlines, points, seeds, no_start.
solve.probeAs in Parameters, in the display units.

The reply of solve.fluid lists every wall’s final and mean force and, with heat, its heat; the probe returns their complete histories.

Worked example

The bundled flow-past sample (Lattice Boltzmann flow) after its 16 s run, read with every results command of this page: a pressure slice, the bracket coloured by the pressure beside it, streamlines from a seed line, point and line probes, and two faces’ force histories.

Modelflow-past: air at 25 mm/s past the L-bracket, box (−60, −40, 0) to (180, 80, 100) mm, 184 320 cells of 2.5 mm, step Flow (16 s, 3200 steps, 11 frames), solved on the CPU
Viewsslice of pressure normal to z at 25 mm (half the upright’s height); results.surface with pressure; 100 streamlines seeded along the line (−50, −20, 5) → (−50, 60, 60) mm, coloured by speed
Probesfour points on y = 20 mm (the bracket’s mid-plane); a velocity_x line across the wake at x = 100 mm; the force histories of the upright’s upstream (F2:side:l6) and downstream (F2:side:l4) faces
Unitsmm, t, s, N, MPa
[
  {"command": "file.sample", "params": {"name": "flow-past"}},
  {"command": "solve.fluid", "params": {"step": "Flow", "backend": "cpu"}},
  {"command": "results.streamlines", "params": {"step": "Flow", "show": false}},
  {"command": "results.slice", "params": {"step": "Flow", "field": "pressure", "axis": "z", "position": 25}},
  {"command": "results.slice", "params": {"step": "Flow", "axis": "none"}},
  {"command": "results.surface", "params": {"step": "Flow", "show": true, "field": "pressure"}},
  {"command": "results.surface", "params": {"step": "Flow", "show": true, "field": "velocity"}},
  {"command": "results.streamlines", "params": {"step": "Flow", "show": true, "field": "velocity",
    "count": 100, "line": {"from": [-50, -20, 5], "to": [-50, 60, 60]}}},
  {"command": "solve.probe", "params": {"step": "Flow", "points": [[-30, 20, 25], [30, 20, 60], [100, 20, 25], [170, 20, 25]]}},
  {"command": "solve.probe", "params": {"step": "Flow", "line": {"from": [100, 20, 0], "to": [100, 20, 100], "field": "velocity_x"}}},
  {"command": "solve.probe", "params": {"step": "Flow", "forces": ["Bracket/F2:side:l6", "Bracket/F2:side:l4"]}}
]

The pictures were taken with the MCP screenshot tool after the slice (top view), the pressure surface (camera yaw 135°, pitch 30°, looking at the upstream face) and the streamlines (iso view). The headless pictures draw no colour legend; the ranges below are the replies’ contour.range (interior fluid cells of the whole domain, the last frame).

CommandWhat it returned
results.slice (pressure)contour.range: max 8.21 × 10⁻¹⁰ MPa at (−56.25, 18.75, 1.25), min −7.68 × 10⁻¹⁰ MPa at (1.25, 11.25, 51.25), just above the upright’s top
results.slice (velocity, first view)max 39.29 mm/s at (18.75, −16.25, 26.25), beside the bracket; min 0.043 mm/s at (103.75, −1.25, 1.25), on the floor in the wake
results.streamlinestraced: 100 streamlines, 18 639 points, 100 seeds, no_start 0
solve.probe points (frame 10, 16 s)(−30, 20, 25), upstream: u = (23.12, 0.26, 4.08) mm/s, p = 2.92 × 10⁻¹⁰ MPa. (30, 20, 60), above the bracket: u = (26.11, 0.02, 1.45) mm/s, p = −4.01 × 10⁻¹⁰ MPa. (100, 20, 25), 40 mm behind the foot: u = (6.33, −0.14, −4.17) mm/s, p = −3.11 × 10⁻¹¹ MPa. (170, 20, 25), 10 mm before the outlet: u = (14.95, −0.03, −6.90) mm/s, p = 1.51 × 10⁻¹⁰ MPa
solve.probe line, velocity_x at x = 100 mmmax 33.39 mm/s at z = 80.73 mm; min −0.876 mm/s at z = 5.23 mm
solve.probe forcestimes: 3200 samples, 0.005 s to 16 s (every step: ⌈3200/10 000⌉ = 1). F2:side:l6 x: 2.238 × 10⁻⁴ N at 0.005 s, 1.941 × 10⁻⁴ N at 16 s; F2:side:l4 x: −1.175 × 10⁻⁴ N to −1.368 × 10⁻⁴ N

Machine: Apple M4 Max; the solve on the CPU, the pictures on the GPU (renderer: Apple M4 Max (Metal), hardware). Each results command replied in under 0.1 s.

What to look at. The slice shows the stagnation pressure ahead of the upright, the low pressure where the flow separates off its two vertical edges, and the recovery downstream. The line probe across the wake finds reversed flow near the floor (−0.88 mm/s at z = 5.2 mm, 40 mm behind the foot) under the faster flow that went over the bracket (33.4 mm/s at z = 81 mm), and the point probes show the flow turning down (w < 0) behind the bracket. results.surface colours each tessellated triangle from the values at its vertices: the upright’s flat upstream face is two triangles, so it shows the pressure at its corners and misses the stagnation in its middle, which the slice shows beside it. The force histories of the two upright faces are each of order 10⁻⁴ N, over a hundred times the bracket’s drag (1.13 × 10⁻⁶ N): each face’s force carries the lattice’s rest pressure c_s² ρ₀ (Δx/Δt)² = 0.1 Pa over its area (Lattice Boltzmann flow), so drag is read from the sum over a closed set of faces.

Verification

CaseReferenceToleranceTest
A uniform flow along xThe streamline runs straight to the outlet in half-cell steps (19 points over 10 cells); a solid cell stops it; seeds outside, in a solid or in still fluid start none10⁻¹² off the linestreamlines_follow_the_flow
A rigid rotation about zStreamlines are circles: the midpoint rule keeps the radius 5 over 2000 steps0.05 (1 %)streamlines_of_a_vortex_close
64³ cells, hostile countsSeeds capped at 2000, points at 2 000 000exactstreamline_work_is_bounded
Default seedsOver the obstacle’s shadow grown by half its sizeseeds_lie_upstream_of_the_obstacle
SlicesCover the domain and interpolate; skip solid cells; a large layer is sampleda_slice_covers_the_domain_and_interpolates, a_slice_skips_solid_cells_and_refuses_bad_input, a_large_slice_is_sampled
First viewSlice across the flow, surfaces and streamlinesa_fluid_result_is_first_shown_across_the_flow
Line extremesVertex of the parabola through three samplesextremes_lie_on_the_parabola_through_three_samples
Wall heat on obstacle facesFace identity, area, sign and frame; no heat before the first samplewall_heat_uses_face_identity_area_sign_and_frame_in_both_views, histories_interpolate_without_fabricating_initial_heat

The local Nusselt numbers of the de Vahl Davis oracle cases are read with solve.probe lines (Oracle results).

Limitations

  • results.export.vtu does not export fluid steps yet: fluid results are per cell (“not supported yet”).
  • results.export.csv writes node probes only: a fluid probe’s reply has no node rows and is refused.
  • Frames are single precision.
  • Transient peaks between frames are not seen; more frames resolve them.
  • The speed ranges leave out every inlet and outlet layer.
  • results.xy refuses a fluid step’s fields: they are per cell (solve.probe reads them).

Implementation

FileContents
crates/lbm/src/solve.rsFrame, ForceHistory, HeatHistory, FluidResult (probe, in_open_layer, temperatures).
crates/engine/src/flow.rsFlowView::for_result, cell_values, interior_range, direction.
crates/engine/src/flow/line.rsLine probes, wall_heat_flux on box walls, line extremes.
crates/engine/src/flow/wall.rsFace-averaged wall heat of obstacle faces.
crates/render/src/flow.rsSlices, surface sampling, streamlines, face_seeds, the caps.
crates/engine/src/cmd/results.rsresults.slice, results.surface, results.streamlines.
crates/engine/src/cmd/solve.rsprobe_fluid.