Note
Go to the end to download the full example code.
Gmsh: Custom installation¶
Mesh the packaged case17 plate with a hole using an explicit Gmsh executable. Leave the executable as None to use the installed Python Gmsh package. The geometry uses mm. An invalid custom executable never falls back to Python Gmsh. Custom Gmsh executables support .geo files; Python mesh scripts run with Python.
from pathlib import Path
import pyvale.data as dataset
import pyvale.mooseherder as mh
Create the standard output directory so generated files stay together under pyvale-output rather than alongside the packaged input files. Locate the packaged plate geometry to test the selected Gmsh executable.
Set this to your Gmsh executable, for example Path(‘/opt/gmsh/bin/gmsh’).
gmsh_exe_file: Path | None = None
Export an Abaqus .inp mesh: the extension selects the format. Use .msh with msh_version=2.2 when passing the mesh to the bundled MOOSE models.
result: mh.RunResult = mh.GmshRunner(
gmsh_exe_file=gmsh_exe_file, output_file_name="plate.inp"
).run(
geo_file,
output_dir=mh.get_next_run_path(output_path / "mooseherder_ex03c_mesh"),
)
print(result.output_file)