pybFoam.meshing

blockMesh, snappyHexMesh, and checkMesh bindings.

OpenFOAM mesh checking and validation utilities

pybFoam.meshing.checkGeometry(mesh: pybFoam.pybFoam_core.polyMesh, all_geometry: bool = False) dict
pybFoam.meshing.checkGeometry(mesh: pybFoam.pybFoam_core.fvMesh, all_geometry: bool = False) dict

Check mesh geometry and return dictionary with results

pybFoam.meshing.checkMesh(mesh: pybFoam.pybFoam_core.polyMesh, check_topology: bool = True, all_topology: bool = False, all_geometry: bool = False, check_quality: bool = False) dict
pybFoam.meshing.checkMesh(mesh: pybFoam.pybFoam_core.fvMesh, check_topology: bool = True, all_topology: bool = False, all_geometry: bool = False, check_quality: bool = False) dict

Run complete mesh check and return dictionary with detailed results

pybFoam.meshing.checkTopology(mesh: pybFoam.pybFoam_core.polyMesh, all_topology: bool = False, all_geometry: bool = False) dict
pybFoam.meshing.checkTopology(mesh: pybFoam.pybFoam_core.fvMesh, all_topology: bool = False, all_geometry: bool = False) dict

Check mesh topology and return dictionary with results

pybFoam.meshing.generate_blockmesh(runtime: pybFoam.pybFoam_core.Time, blockmesh_dict: pybFoam.pybFoam_core.dictionary, verbose: bool = False, time_name: str = 'constant') pybFoam.pybFoam_core.fvMesh

Generate a block mesh from dictionary and return fvMesh.

Parameters

runtimeTime

OpenFOAM Time object for the case.

blockmesh_dictdictionary

OpenFOAM dictionary with blockMeshDict format. Should contain: vertices, blocks, boundary.

verbosebool, optional

Enable OpenFOAM output messages (default: False).

time_namestr, optional

Time directory for mesh output (default: “constant”).

Returns

fvMesh

The generated OpenFOAM fvMesh object.

Raises

RuntimeError

If mesh generation fails.

Examples

>>> import pybFoam.mesh_generation as mg
>>> from pybFoam.core import Time, dictionary
>>>
>>> # Create Time and dictionary
>>> time = Time("/path/to/case")
>>> mesh_dict = dictionary()
>>>
>>> # Generate mesh
>>> mesh = mg.generate_blockmesh(time, mesh_dict, verbose=True)
>>> print(f"Generated {mesh.nCells()} cells")
pybFoam.meshing.generate_snappy_hex_mesh(mesh: pybFoam.pybFoam_core.fvMesh, dict: pybFoam.pybFoam_core.dictionary, overwrite: bool = True, verbose: bool = True) None

Run snappyHexMesh on an existing mesh

pybFoam.meshing.printMeshStats(mesh: pybFoam.pybFoam_core.polyMesh, all_topology: bool = False) dict
pybFoam.meshing.printMeshStats(mesh: pybFoam.pybFoam_core.fvMesh, all_topology: bool = False) dict

Print mesh statistics and return as dictionary