cfd_internal_flow_submit
Submit asynchronous internal-flow CFD pressure-drop jobs through OpenFOAM or SU2, covering plane-channel, pipe, RANS, and FreeCAD solid geometry cases.
Instructions
Internal-flow CFD (pressure drop) via OpenFOAM or SU2, asynchronous. Requires an
OpenFOAM (apt/conda) or SU2 binary; when none resolves this returns {ok:false,
reason, install} rather than raising. The pipe and geometry-bridge modes need
OpenFOAM specifically — they emit OpenFOAM dictionaries — but channel_height_mm
builds a NATIVE SU2 case, which is why solve_capabilities counts SU2 toward the
cfd family (issue #237). On Apple Silicon that is the difference between needing
a Multipass VM and not. turbulence='kOmegaSST' upgrades the pipe
validation case to RANS (SIMULATION_NEXT B3): wall-function k/ω/ν_t with first-cell
y+ targeted at ~30–100, developed dp/dx fitted over the second half of a ≥40·D pipe,
gated BANDED against Colebrook (colebrook_ratio ≈ 1 ± 10 % — the Moody correlation
is itself a band, never an exact gate). Four modes:
Build the native SU2 plane-channel case (no OpenFOAM, no VM): pass
channel_height_mm, optionallychannel_length_mm(default 10× the height),velocity_m_s(default Re 50), afluidormu_pa_s+rho_kg_m3(default a light oil — holding Re low with water means millimetres per second, where SU2's incompressible pseudo-time is badly scaled),nx/ny,max_iterations. Gated against the EXACT plane-Poiseuille closed form Δp = 12·μ·U·L/h², returningpoiseuille_ratio≈ 1. The inlet is the fully developed parabolic profile, so there is no entrance-length error to drown out with a long domain.Build the straight-pipe validation case (no case prep): pass
diameter_mm,length_mm, andvelocity_m_s(orflow_rate_lpm), with afluidname or explicitmu_pa_s+rho_kg_m3(mesh density vian_axial/n_radial, iterations viaend_time). The handler builds the axisymmetric laminar pipe, runs blockMesh+simpleFoam, and returns the solved Δp next to the Hagen–Poiseuille analytic reference (cfd_pipe_flow) — the kickoff's exact CFD gate,hp_ratio≈1.Solve a real FreeCAD solid — the geometry bridge: pass a
bodyhandle plusinlet_face/outlet_face(1-based indices into the solid's faces; every other face becomes a no-slip wall) andvelocity_m_s(applied along the inlet face's inward normal). The solid tessellates into a multi-region STL and meshes with blockMesh + snappyHexMesh;base_cell_mmsets the background cell size,location_in_mesh_mmthe kept-region seed point (default: bbox centre — set it for non-convex solids),stl_tolerance_mmthe tessellation sag. Use the developed-profilepressure_drop_pa; also passdiameter_mm+length_mmto get anhp_ratioreference for pipe-like bodies.Run a prepared
case_dir(optionally anapplication, e.g. 'simpleFoam'/'foamRun'); for OpenFOAM its environment is sourced before the run, while an SU2 case (*.cfg+*.su2mesh) runs as a direct native subprocess — no bash/WSL needed, including on Windows.
Returns the degradation dict, or {job_id, status, cache_hit}; poll job_result. Pipe/body cases: {ok, returncode, pressure_drop_pa (developed), pressure_drop_inlet_pa, hagen_poiseuille_pa?, hp_ratio?, n_cells, case_dir}; RANS pipe adds {dpdx_pa_m, dpdx_colebrook_pa_m, colebrook_ratio, y_plus_estimate, band_pct}. Prepared case: {ok, returncode, solver, application, case_dir, kind, stdout_tail}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | ||
| fluid | No | water-20c | |
| mu_pa_s | No | ||
| n_axial | No | ||
| case_dir | No | ||
| end_time | No | ||
| n_radial | No | ||
| length_mm | No | ||
| rho_kg_m3 | No | ||
| inlet_face | No | ||
| turbulence | No | laminar | |
| application | No | ||
| diameter_mm | No | ||
| outlet_face | No | ||
| base_cell_mm | No | ||
| velocity_m_s | No | ||
| flow_rate_lpm | No | ||
| max_iterations | No | ||
| stl_tolerance_mm | No | ||
| channel_height_mm | No | ||
| channel_length_mm | No | ||
| location_in_mesh_mm | No |