fds-mcp-server 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fds_mcp/__init__.py ADDED
@@ -0,0 +1 @@
1
+ """MCP server for Fire Dynamics Simulator (FDS)."""
fds_mcp/config.py ADDED
@@ -0,0 +1,22 @@
1
+ """Server settings shared by the tools, set from the command line or the environment."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+
8
+
9
+ @dataclass(frozen=True)
10
+ class Settings:
11
+ """Runtime settings.
12
+
13
+ ``workspace``: when set, every path received by a tool must resolve inside this
14
+ directory (mandatory for the HTTP transport, optional for stdio).
15
+ """
16
+
17
+ workspace: Path | None = None
18
+
19
+ def __post_init__(self) -> None:
20
+ """Store the workspace as an absolute, symlink-free path."""
21
+ if self.workspace is not None:
22
+ object.__setattr__(self, "workspace", self.workspace.expanduser().resolve())
@@ -0,0 +1,43 @@
1
+ # FDS best practices (checklist)
2
+
3
+ Case set-up
4
+
5
+ - `&HEAD CHID='name'`: letters, digits, underscores; no spaces or periods. All output
6
+ files start with the CHID.
7
+ - `&TIME T_END=...` always: the default is 1 s.
8
+ - One `&MESH` per MPI process; meshes of similar cell counts balance the load.
9
+ - Domain faces default to inert walls: open them with
10
+ `&VENT MB='XMIN', SURF_ID='OPEN' /` (or `DB=`, or an explicit XB plane).
11
+ - Every `SURF_ID`, `MATL_ID`, `PROP_ID`, `CTRL_ID`, `RAMP` used must be defined
12
+ (ID matching is case sensitive).
13
+ - End the file with `&TAIL /`.
14
+
15
+ Geometry
16
+
17
+ - FDS snaps obstructions and vents to the grid: thin walls become one cell thick or
18
+ zero thickness; check dimensions in the result.
19
+ - A VENT must be a plane (one zero dimension) attached to a solid surface or to the
20
+ domain boundary; otherwise FDS stops (ERROR 818/820).
21
+ - Objects outside every mesh are dropped without error.
22
+
23
+ Fire
24
+
25
+ - Specify the fire as a burner: `&SURF ID='FIRE', HRRPUA=... /` on a VENT or on the top
26
+ of an OBST, with a `RAMP_Q` or `TAU_Q` for growth.
27
+ - Take HRRPUA and the burner area from test data for the burning item; squeezing a
28
+ large HRR onto a tiny burner gives unrealistic plume velocities.
29
+ - Check D*/dx (topic `mesh_resolution`).
30
+ - Define one `&REAC` (fuel, yields of soot and CO) consistent with the burning material.
31
+
32
+ Outputs
33
+
34
+ - Put devices (`&DEVC`) inside the domain and away from solid faces for gas-phase
35
+ quantities; set `&DUMP DT_DEVC=...` to a useful interval.
36
+ - Request only the slices (`&SLCF`) needed: they dominate disk usage.
37
+
38
+ Running
39
+
40
+ - Test with a short `T_END` first, then the full run.
41
+ - Monitor `CHID.out` (time step, CFL); a sharply falling time step announces a
42
+ numerical instability.
43
+ - Stop cleanly by creating an empty file `CHID.stop` in the run directory.
@@ -0,0 +1,16 @@
1
+ # Frequent FDS errors and how to fix them
2
+
3
+ | Symptom | Likely cause | Fix |
4
+ |---|---|---|
5
+ | `ERROR(101): Problem with ... line` at start-up | misspelt parameter, parameter on the wrong group, missing `/` at the end of a record, unquoted string, comma inside numbers | run `fds_validate_input`; check the record at the line given |
6
+ | Unknown or undefined ID (SURF, MATL, RAMP, PROP, CTRL, DEVC) | ID referenced but never defined, or different capitalisation | define the record or fix the spelling (IDs are case sensitive) |
7
+ | Run ends after 1 s | no `T_END` on `&TIME` | set `T_END` |
8
+ | Device output constant or missing; "DEVC ... is not within any mesh" | device XYZ outside the meshes or inside a solid | move the device into the gas phase |
9
+ | `ERROR(818)` / `ERROR(820)`: VENT ... is not attached to a solid surface | vent plane floating in the gas | place the vent plane on an obstruction face or on the domain boundary |
10
+ | `ERROR(374): Numerical Instability - FDS stopped` | time step collapsed: cells with aspect ratio above 2, unrealistic HRRPUA, high-velocity jets, badly aligned meshes, many pressure zones created by thin cavities | refine or smooth the grid, reduce HRRPUA by enlarging the burner, check mesh alignment, fill unintended cavities |
11
+ | Very slow run | too many cells, unbalanced meshes, one MPI process for many meshes | coarsen where possible, balance meshes, use one MPI process per mesh |
12
+ | More MPI processes than meshes | each process needs at least one mesh | split the domain into more meshes or start fewer processes |
13
+ | Results look unphysical near the fire | D*/dx too small | refine the mesh near the fire (topic `mesh_resolution`) |
14
+
15
+ Messages starting with `ERROR` in `CHID.out` or on the console end the run;
16
+ `WARNING` messages do not.
@@ -0,0 +1,40 @@
1
+ # Mesh resolution and D*/dx
2
+
3
+ The characteristic fire diameter is
4
+
5
+ D* = ( Q / (rho_inf * cp * T_inf * sqrt(g)) )^(2/5)
6
+
7
+ with Q the heat release rate (kW), rho_inf = 1.204 kg/m3, cp = 1.005 kJ/(kg.K),
8
+ T_inf = 293 K, g = 9.81 m/s2 (FDS User Guide, "Mesh Resolution").
9
+
10
+ D*/dx is the number of cells across the characteristic (not physical) diameter of the
11
+ fire: the more cells, the better the plume is resolved. A common practice, from the
12
+ range of the US NRC verification and validation study (NUREG-1824), reads it as:
13
+
14
+ | D*/dx | Common reading |
15
+ |---|---|
16
+ | < 4 | coarser than that validated range |
17
+ | 4 – 10 | coarse |
18
+ | 10 – 16 | moderate |
19
+ | >= 16 | fine |
20
+
21
+ The FDS User Guide warns that no single value is an "acceptable" minimum: the
22
+ resolution needed depends on the quantity of interest (near-field quantities such as
23
+ flame height or heat flux to nearby targets need more cells than far-field smoke
24
+ spread). A grid sensitivity study (same case with dx halved) is the real check. If the
25
+ HRR changes over time, so does D*/dx.
26
+
27
+ How this server computes it: Q = HRRPUA x burning area of the VENT/OBST faces that use
28
+ the SURF (or MLRPUA x REAC HEAT_OF_COMBUSTION); dx = the largest cell dimension of the
29
+ mesh that contains the fire.
30
+
31
+ Cell size needed for a given fire:
32
+
33
+ {resolution_table}
34
+
35
+ Other mesh rules:
36
+
37
+ - Prefer cubic cells: aspect ratios above 2 to 1 are a known cause of numerical
38
+ instability (FDS User Guide).
39
+ - Abutting meshes should have cells of the same cross-section, or integer ratios
40
+ (FDS User Guide, "Mesh Alignment"); avoid placing the fire across a mesh boundary.
@@ -0,0 +1,16 @@
1
+ # FDS output files
2
+
3
+ | File | Content | Read with |
4
+ |---|---|---|
5
+ | `CHID.out` | diagnostics: set-up summary, time step, simulated time, CFL, final `STOP:` or `ERROR` message | `fds_get_status` (planned) |
6
+ | `CHID_hrr.csv` | heat release rate `HRR` (kW), its components (`Q_RADI`, `Q_CONV`, `Q_COND`…), mass loss rates `MLR_*` (kg/s), zone pressures; every `DT_HRR` s | `fds_read_results` |
7
+ | `CHID_devc.csv` | one column per `&DEVC` (ID = column name), every `DT_DEVC` s; with `&DUMP COLUMN_DUMP_LIMIT=T`, split into `CHID_1_devc.csv`, `CHID_2_devc.csv`… beyond `DEVC_COLUMN_LIMIT` (default 254) | `fds_read_results` |
8
+ | `CHID_ctrl.csv` | state of `&CTRL` functions (-1 false, +1 true) | – |
9
+ | `CHID.smv`, `*.sf`, `*.bf`, `*.s3d` | Smokeview geometry, slices, boundary files, 3D smoke | Smokeview |
10
+ | `CHID.stop` | not an output: creating it stops the run cleanly | `fds_stop_simulation` (planned) |
11
+
12
+ CSV format: first row units, second row column names, then one row per output time;
13
+ the first column is time in s. With `&DUMP DECIMAL_SPECIFIER='COMMA'` the separator is
14
+ `;` and the decimal mark `,`.
15
+
16
+ Useful `&DUMP` parameters: `DT_DEVC`, `DT_HRR`, `DT_SLCF`, `DT_BNDF`, `NFRAMES`.
@@ -0,0 +1,21 @@
1
+ # Working with FDS through this server
2
+
3
+ Typical sequence for an FDS input file (`.fds`):
4
+
5
+ 1. `fds_validate_input` — fix every `error` (FDS would stop or silently drop
6
+ something), review `warning`s, read `info`s (mesh resolution D*/dx).
7
+ 2. `fds_summarize_input` — check meshes, cell count, duration, fires and requested
8
+ outputs against the intent of the study.
9
+ 3. Run FDS (`fds_run_simulation`, then `fds_get_status` until it ends;
10
+ `fds_stop_simulation` to stop cleanly). These three tools are not available yet:
11
+ run FDS outside this server for now.
12
+ 4. `fds_read_results` — heat release rate (`CHID_hrr.csv`) and device time series
13
+ (`CHID_devc.csv`); ask for one column over a time window for details.
14
+
15
+ Issue levels: `error` = must be fixed before running; `warning` = probably a mistake;
16
+ `info` = worth knowing.
17
+
18
+ Other topics: `mesh_resolution`, `best_practices`, `common_errors`, `outputs`.
19
+
20
+ Paths: relative paths are resolved against the server's workspace; when the server runs
21
+ over HTTP, files outside its workspace are refused.