Skip to content

Validating, approving and reporting gaps for fast-mesh

fast-mesh is an experimental Rust mesh engine. It is independent of HEC, and it is not official HEC software. HEC-RAS stays RAS Commander's default mesh engine. This page shows how to prove, on your own project, that fast-mesh reproduces HEC-RAS 7.0.1's mesh. It also covers saving an approval so that engine="auto" uses fast-mesh, and reporting a gap when the engines differ. The engine itself is described in Experimental mesh engine.

Prerequisites

  • Windows with HEC-RAS 7.0.1 installed. RAS Commander runs HEC-RAS geometry preprocessing on a staged copy for the reference. Accepting HEC's Terms and Conditions for Use is a separate step that this procedure does not do.
  • The fast-mesh executable:
  • pip install "ras-commander[fast-mesh]" (or pip install ras-commander-fast-mesh) on Windows x64 and Linux x86_64;
  • or set RAS_COMMANDER_FAST_MESH_EXE to a locally built executable. GeomMeshEngine.is_fast_mesh_available() checks either.
  • A plan that uses the geometry, because native preprocessing runs through a plan.
  • Free disk space for two copies of the project, and a short workspace path, because HEC-RAS needs short paths.

1. Validate

Python
from ras_commander import RasEngineQualification

report = RasEngineQualification.validate_mesh(
    r"D:\models\Muncie",          # project folder, .prj or RasPrj
    "02",                         # geometry number or .g## path
    profile="hec701-exact",       # the only qualifiable profile
    seeds="stored",               # or "generated"
    repair=False,
    workspace=r"D:\rasq",         # staged copies and reports go here
)
print(report.status)              # equivalent, not_equivalent, fast_mesh_failed, comparison_failed, ...
print(report.summary())
print(report.tables)              # one row per area and mesh table

The source project is only read. validate_mesh does the following: - it fingerprints the source tree before and after the run; - it builds the HEC-RAS 7.0.1 mesh on one staged copy through GeomPreprocessor.run_geometry_preprocessor; - it runs fast-mesh into another copy; - it compares the 15 mesh tables of every 2D area. A table matches only with the same shape, the same dtype and the same bytes; - it checks the fast-mesh run manifest.

It writes the full report to qualification_report.json in the workspace. The staged copies are deleted afterward unless keep_projects=True.

Native HEC-RAS 7.0.1 vs fast-mesh 0.1.0 side-by-side byte-for-byte verification on Muncie g02

Example validate_mesh equivalence outcome on the public HEC example project Muncie (g02, 5,391 real cells), with a 76-cell breakline-junction zoom showing face-for-face identity: all 15 geometry HDF mesh tables produced by ras-commander-fast-mesh 0.1.0 match native HEC-RAS 7.0.1 byte for byte with identical SHA-256 digests.

status Meaning Next step
equivalent Every table is identical, every check passed, and the source is unchanged Approve
not_equivalent At least one table or manifest check differs Report the gap
fast_mesh_failed fast-mesh refused the input or failed; report.checks["fast_mesh_run"]["code"] holds its error code Report the gap
comparison_failed An output could not be compared, for example an unreadable geometry HDF; the staged copies are still cleaned up and the source is still checked Report the gap
engine_changed The fast-mesh executable changed between the start of validation and the candidate build, so the result is credited to neither build Keep one engine installed and validate again
native_reference_failed HEC-RAS preprocessing failed, so fast-mesh was not judged Fix the model in HEC-RAS first; this is not a fast-mesh gap
reference_not_qualifying The reference was built with a HEC-RAS version other than 7.0.1, which hec701-exact requires Re-run with HEC-RAS 7.0.1

2. Approve

Python
status = report.approve(note="Validated on the 2026 existing-conditions geometry")

approve() refuses unless the report is equivalent, and unless the inputs and the installed engine still match the report. It writes one file, <project>/.ras-commander/engine_approvals.json, which records: - the engine, version and commit, profile, repair and seeds; - the SHA-256 of the geometry text, the source geometry HDF and the .prj; - the HEC-RAS reference version and method; - the date, user and ras-commander version, and the report summary.

Then:

Python
from ras_commander import GeomMeshEngine

GeomMeshEngine.resolve_mesh_engine("02", project=r"D:\models\Muncie")
# {'engine': 'fast-mesh', 'reason': 'valid approval (...)'}
GeomMeshEngine.build_mesh("02", r"D:\work\Muncie_meshed", engine="auto",
                          project=r"D:\models\Muncie")

An approval applies only to the project file (.prj), geometry, profile, repair and seeds it was made for. In a folder that holds several projects, pass the .prj (or a RasPrj); auto never uses an approval made for another project in the same folder. areas= is accepted only by an explicit engine="fast-mesh" run, because approvals cover the whole geometry. Several changes make it invalid, and auto then runs HEC-RAS again: - editing the geometry text; - rewriting the geometry HDF, including running HEC-RAS preprocessing in the source project; - changing the .prj; - installing another fast-mesh version or build (the executable's SHA-256 is recorded).

Manage approvals with these helpers:

Python
RasEngineQualification.status(r"D:\models\Muncie", engine="fast-mesh", scope="02")
RasEngineQualification.list_approvals(r"D:\models\Muncie")   # valid and reasons columns
RasEngineQualification.revoke(r"D:\models\Muncie", engine="fast-mesh", scope="02")

3. Report a gap

When the result is not equivalent, validate_mesh writes fast-mesh-gap-report.md and fast-mesh-gap-report.json under <workspace>/.../gap-report/ (report.gap_report). You can also write one yourself:

Python
paths = RasEngineQualification.write_gap_report(report, r"D:\rasq\gap")

The bundle lists: - the engine, version, commit, profile, repair and seeds; - the HEC-RAS reference; - the mismatching tables, with counts and the first differing row index; - the manifest validation codes; - reproduction guidance; - a pre-filled GitHub issue title and body, and guidance for preparing a pull request.

By default it contains no project data: area names become area-1, area-2, ..., and it holds no coordinates, values, paths, project names or user names. Pass include_project_data=True only if you are allowed to share those details, and review the bundle before sharing it. Nothing is ever posted for you.

To contribute:

  1. Open an issue at gpt-cmdr/ras-commander-fast-mesh with the pre-filled text (wrapper issues belong in gpt-cmdr/ras-commander).
  2. Better still, reproduce the gap on a public RasExamples project, or cut it down to one area with synthetic coordinates, and attach that instead of private model files.
  3. If you can fix it, prepare a pull request with a failing conformance case built from public or synthetic data. A gap in RAS Commander's wrapper, rather than in the engine, belongs in a pull request to gpt-cmdr/ras-commander.

Every reported gap, and every project that validates cleanly, widens the inputs on which the engine's equivalence is demonstrated.

Measured scaling and peak memory on large eBFE meshes

On a quiet 8-core Windows 11 workstation (Intel Xeon W-1370P, 24 GiB RAM), published ras-commander-fast-mesh 0.1.0 (a46d6774) matched all 15 HEC-RAS 7.0.1 geometry HDF mesh tables byte for byte — with identical hashes across FAST_MESH_THREADS = 1, 2, 4, 6, 8 — on all five qualifying public Texas eBFE areas (291k–1.51M cells) plus BaldEagle g01 (87k cells).

Area (cells) HEC-RAS 7.0.1 (1w) HEC Peak RAM fast-mesh 1T / 4T / 8T Speedup (8T) Efficiency (4T / 8T) fast-mesh Peak RAM (1T / 8T)
BaldEagle g01 (87,039) 13.99 s 0.33 GiB 0.73 / 0.49 / 0.48 s 29.0× 37% / 19% 0.08 / 0.09 GiB
Texas eBFE area A (291,423) 48.22 s 0.63 GiB 4.18 / 2.46 / 2.11 s 22.9× 42% / 25% 0.29 / 0.34 GiB
Texas eBFE area B (403,801) 70.67 s 0.80 GiB 6.10 / 3.66 / 3.14 s 22.5× 42% / 24% 0.41 / 0.50 GiB
Texas eBFE area C (440,086)* 154.95 s 1.03 GiB 8.87 / 6.14 / 5.61 s 27.6× 36% / 20% 1.19 / 1.19 GiB
Texas eBFE area D (460,815)* 180.18 s 1.00 GiB 8.24 / 5.46 / 4.99 s 36.1× 38% / 21% 0.78 / 0.78 GiB
Cummins2D eBFE (1,511,766) 178.28 s 1.98 GiB 16.00 / 9.02 / 7.61 s 23.4× 44% / 26% 1.16 / 1.37 GiB

*Areas C and D include internal SA/2D bridge connections and use --source-hdf for 15/15 equivalence. Medians of n = 5 interleaved runs (warm-up discarded). HEC-RAS 7.0.1 runs terrain-less geometry preprocessing via RAS Commander (native_worker_threads=1; 8 and default tested within 2.2%–3.6% wall time) and also performs geometry work (startup, connections, boundary lines, property-table checks) that fast-mesh does not. Memory is Windows kernel PeakWorkingSetSize (fast-mesh) and Ras.exe process-tree peak working set (HEC-RAS), in GiB (1 GiB = 1,024 MiB).

Recommended thread count: 4 threads (FAST_MESH_THREADS=4) is typically the best balance of performance and efficiency on hosts with 4 or more cores (use fewer threads on smaller hosts). This is typical, not universal, based on the 8-core Windows benchmark above: 4 threads deliver 84%–98% of 8-thread speed with 36%–44% parallel efficiency (compared with 19%–26% at 8 threads), because triangulation and HDF5 library writes run on one thread (even though HDF5 chunk precompression runs in parallel) and limit further gains. Peak memory stays flat from 2 to 8 threads, and the 15 geometry HDF mesh tables are deterministic across thread counts (verified byte-identical across 1, 2, 4, 6, 8 threads on all six benchmarked areas; HDF5 timestamps such as Data Date still vary per run).

fast-mesh 0.1.0 thread scaling and peak memory across 1–8 threads on public eBFE models

Measured thread scaling, speedup vs HEC-RAS 7.0.1, parallel efficiency, and peak working set across 1–8 threads for ras-commander-fast-mesh 0.1.0 (15/15 byte-identical on all 30 area × thread pairs).

fast-mesh 0.1.0 qualification summary and documented residuals

Published ras-commander-fast-mesh 0.1.0 qualification baseline, including the two corpus areas below 15/15 and the Windows-vs-Linux difference on generated-seed --repair runs (netpow32.exe runs on Windows only).