Skip to main content
Glama

CFD Internal Flow Submit

cfd_internal_flow_submit
Destructive

Submit asynchronous internal-flow CFD jobs to compute pressure drop with OpenFOAM or SU2 for pipes, channels, or FreeCAD solids, validated against analytical solutions.

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, optionally channel_length_mm (default 10× the height), velocity_m_s (default Re 50), a fluid or mu_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², returning poiseuille_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, and velocity_m_s (or flow_rate_lpm), with a fluid name or explicit mu_pa_s+rho_kg_m3 (mesh density via n_axial/n_radial, iterations via end_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 body handle plus inlet_face/outlet_face (1-based indices into the solid's faces; every other face becomes a no-slip wall) and velocity_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_mm sets the background cell size, location_in_mesh_mm the kept-region seed point (default: bbox centre — set it for non-convex solids), stl_tolerance_mm the tessellation sag. Use the developed-profile pressure_drop_pa; also pass diameter_mm+length_mm to get an hp_ratio reference for pipe-like bodies.

  • Run a prepared case_dir (optionally an application, e.g. 'simpleFoam'/'foamRun'); for OpenFOAM its environment is sourced before the run, while an SU2 case (*.cfg + *.su2 mesh) 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}.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "cfd_internal_flow_submit"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyNo
fluidNowater-20c
mu_pa_sNo
n_axialNo
case_dirNo
end_timeNo
n_radialNo
length_mmNo
rho_kg_m3No
workspaceNoRun this call in this named workspace
inlet_faceNo
turbulenceNolaminar
applicationNo
diameter_mmNo
outlet_faceNo
base_cell_mmNo
velocity_m_sNo
flow_rate_lpmNo
max_iterationsNo
stl_tolerance_mmNo
channel_height_mmNo
channel_length_mmNo
location_in_mesh_mmNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.7
    • addedInput schema / properties / workspace
      Added value: +{
      +  "default": "",
      +  "description": "Run this call in this named workspace",
      +  "title": "Workspace",
      +  "type": "string"
      +}
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only say readOnly=false/destructive=true/openWorld=false; the description goes well beyond that by disclosing the solver-binary prerequisite, the non-raising {ok:false, reason, install} degradation path, the async job_id/poll-job_result workflow, the cache_hit flag, Apple Silicon/Multipass constraints, and the exact return shape per mode. That is precisely the operational context the annotations cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loading and bullet structure are good, but the text is a dense wall with low-value asides — issue #237, 'SIMULATION_NEXT B3', 'the kickoff's exact CFD gate', and the Moody-correlation parenthetical — that dilute the operational facts. The mode bullets earn their place; several of the framing sentences do not.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 23-parameter, no-output-schema, asynchronous simulation tool, the description covers prerequisites, mode selection, defaults, failure behavior, and per-mode return payloads (including the RANS additions and prepared-case stdout_tail). An agent has enough to call it and interpret the result without reading source.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 4%, so the description must carry the load, and it largely does — it explains the meaning and defaults of channel_height_mm, channel_length_mm, velocity_m_s, fluid/mu_pa_s/rho_kg_m3, diameter_mm/length_mm/flow_rate_lpm, n_axial/n_radial, end_time, body/inlet_face/outlet_face, base_cell_mm, location_in_mesh_mm, stl_tolerance_mm, case_dir and application. However, it references `nx`/`ny` for the channel mode, parameters that do not exist in the schema, which will leave an agent guessing which actual field controls mesh resolution.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names a specific verb and resource — internal-flow (pressure-drop) CFD via OpenFOAM or SU2 — and immediately marks the tool as asynchronous. The four enumerated modes (native SU2 channel, pipe validation, FreeCAD geometry bridge, prepared case_dir) make it unambiguous which capability this provides relative to siblings such as cfd_external_flow_submit or cfd_pipe_flow.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Each mode is tied to the parameters that select it and the conditions that motivate it (no OpenFOAM/no VM, no case prep, a real FreeCAD solid, a prepared case). What is missing is explicit routing away from alternatives: it never says when to prefer cfd_pipe_flow's analytic result or cfd_external_flow_submit instead, so a sibling-selection decision still requires inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools