cfd_external_flow_submit
Submit external-flow CFD cases asynchronously: simulate drag and lift on a solid, solve a flat-plate validation, or run a prepared OpenFOAM/SU2 case directory.
Instructions
External-flow CFD (drag/lift) 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 two case-BUILDING modes below need
OpenFOAM specifically — they emit OpenFOAM dictionaries; SU2 only ever runs a
case_dir you prepared yourself, which is why solve_capabilities does not count
it toward the cfd family's any_available (issue #237). Three modes:
Put a real solid in the virtual wind tunnel (issue #223): pass a
model(orbody) handle +velocity_m_s. The solid's faces tessellate into an STL, a farfield box is auto-sized around it by standard practice (5L upstream / 10L downstream / 5L lateral, overridable viaupstream_factor/downstream_factor/lateral_factor; the reportedblockage_ratiowarns past 5 %), snappyHexMesh carves the body out, and theforcesfunction object integrates pressure + viscous traction over it. Cd/Cl/Cm come back on the MEASURED frontal silhouette alongflow_direction(default +x; exact for a convex body — override withfrontal_area_mm2for a re-entrant one) andreference_length_mm(default: the largest bbox dimension). Mesh knobs:base_cell_mm(default L/2 — a coarser cell is REJECTED, since snappy would then mesh an empty tunnel and report ~0 drag),surface_refine[min,max] levels,wake_refine,stl_tolerance_mm,end_time. Trust: the laminar path is gated live against the sphere drag curve at Re=1 and Re=100 (within ~2 %);turbulence='kOmegaSST'runs but has no verified oracle for arbitrary bodies and comes backgated:false. Past Re≈1000 a laminar request is flagged inwarningsrather than silently answered.Build the flat-plate validation case (no
model): passvelocity_m_s, with optionalplate_length_mm(default 100), afluidname ('air-20c','water-20c',…) or explicitmu_pa_s+rho_kg_m3, and mesh knobsnx_plate/n_y/end_time. THIS MODE SOLVES A FLAT PLATE, never the caller's geometry: a 2-D laminar plate with a clean leading edge (slip→plate→slip, far-field top), whose wall-shear drag is integrated from the converged U field and returned next to the Blasius reference Cf=1.328/√Re_L (blasius_ratio≈1, ~15 %).turbulence='kOmegaSST'upgrades it to RANS (default plate_length 1000 mm so Re_L > transition), gated BANDED against the mixed-transition Cf = 0.074·Re^(−1/5) − A/Re.Run a prepared
case_dir(optionally anapplication); OpenFOAM runs with its environment sourced, 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. Body mode: {ok, returncode, cd, cl, cm, drag_force_n, drag_pressure_n, drag_viscous_n, lift_force_n, force_total_n, moment_total_nm, force_drift_pct, n_force_samples, reynolds, reference_length_m, frontal_area_m2, frontal_area_source, moment_reference_m (the bbox centre moments are taken about, not the global origin), blockage_ratio, base_cell_m, converged, gated, warnings, case_dir}. Flat plate: {ok, returncode, reynolds_l, cd, cf_solved, cf_blasius, blasius_ratio, drag_force_n, drag_momentum_n, drag_blasius_n, n_cells, case_dir}; RANS plate swaps the gate fields for {cf_solved (momentum), cf_mixed_ref, cf_mixed_ratio, cf_turbulent_ref, cf_wall_corrected, y_plus_estimate, band_pct}. Prepared case: {ok, returncode, solver, application, case_dir, kind, stdout_tail}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n_y | No | ||
| body | No | ||
| fluid | No | air-20c | |
| model | No | ||
| mu_pa_s | No | ||
| case_dir | No | ||
| end_time | No | ||
| nx_plate | No | ||
| rho_kg_m3 | No | ||
| turbulence | No | laminar | |
| application | No | ||
| wake_refine | No | ||
| base_cell_mm | No | ||
| velocity_m_s | No | ||
| flow_direction | No | ||
| lateral_factor | No | ||
| surface_refine | No | ||
| plate_length_mm | No | ||
| upstream_factor | No | ||
| frontal_area_mm2 | No | ||
| stl_tolerance_mm | No | ||
| downstream_factor | No | ||
| reference_length_mm | No |