| name | gmsh-verify |
| description | Verify GMSH .geo + .msh files generated by Radia panels BEFORE opening in the GUI. Catches invalid options (Mesh.Volumes), duplicate element IDs, missing Merge targets, node count mismatches. Run AFTER any calc_*.py edit that touches GMSH export, BEFORE clicking Open GMSH. |
gmsh-verify
Sanity-check GMSH output files generated by the Radia panels
before opening them in the GUI. Catches bugs that would
otherwise show up as "Open GMSH doesn't work" or "GMSH is black".
When to use
- After editing any GMSH export code in
calc_*.py or
gmsh_post_export.py
- After a BEM / FEM solve completes and you want to verify the
output before clicking Open GMSH
- After a field-producing Simulink application run; its run-directory
<application>_fields.msh is a required .msh v4.1 artifact
- As a pre-commit check when you touched
.geo companion writers
What it checks
| Check | What it catches |
|---|
| Invalid .geo options | Mesh.Volumes (does not exist in GMSH 4.x) and other unknown options |
| Merge targets exist | Merge "foo.msh" in .geo but foo.msh is missing |
| Duplicate element IDs | Two-file merge where both start element numbering from 1 |
| NodeData node count | NodeData declares N nodes but the $Nodes section has M != N |
| View index range | .geo references View[2] but only 1 NodeData section exists |
| Physical group consistency | Element tags reference physical groups not declared in $PhysicalNames |
Run
python tests/panels/verify_gmsh_output.py path/to/inductance.geo
python tests/panels/verify_gmsh_output.py path/to/model.msh
python tests/panels/verify_gmsh_output.py src/radia/panels/samples/
python tests/panels/verify_gmsh_output.py \
src/radia/panels/samples/inductance.geo
Expected output:
=== inductance.geo ===
[OK] All Merge targets exist
[OK] No invalid GMSH options
[OK] View indices within range
=== inductance.msh ===
[OK] No duplicate element IDs (14598 vol + 710 surf + 703 wire)
[OK] NodeData "B" node count matches (3083)
[OK] NodeData "J" node count matches (710)
PASS: 6/6 checks
Integration with notebook validation
The verify_gmsh_output.py script can be called from pytest:
from tests.panels.verify_gmsh_output import verify_geo, verify_msh
def test_bem_output_valid(tmp_path):
assert verify_geo(tmp_path / "inductance.geo")
assert verify_msh(tmp_path / "inductance.msh")
Known invalid options (GMSH 4.x)
These option names do NOT exist and will crash gmsh.merge():
| Invalid | Use instead |
|---|
Mesh.Volumes | Mesh.VolumeEdges + Mesh.VolumeFaces |
Mesh.Surfaces | Mesh.SurfaceEdges + Mesh.SurfaceFaces |
The valid mesh-visibility options in GMSH 4.15.2 are:
Mesh.VolumeEdges (default 1)
Mesh.VolumeFaces (default 0)
Mesh.SurfaceEdges (default 1)
Mesh.SurfaceFaces (default 0)
Mesh.Points (default 0)
Mesh.NumSubEdges (default 1, set to 4 for curved elements)
Reference
- Pitfall:
panel_gui_pitfalls(topic="gmsh_file_sanity")
- Root cause commit:
e9cfe4c (Mesh.Volumes crash)
- Root cause commit:
5267f97 (duplicate element ID crash)