polyfoammesh.core.case_setup
Functions
|
Assign inlet/outlet/wall roles from mesh geometry when patch names carry none (GMSH physical surfaces are |
|
(xmin, xmax, ymin, ymax, zmin, zmax) of the polyMesh points (metres). |
|
Rewrite |
|
Write a runnable OpenFOAM case into case_dir. |
|
Unit vector along the dominant (largest-extent) mesh axis — the obvious default flow direction for an internal-flow passage. |
|
Write the minimal controlDict cartesianMesh needs to run. |
- polyfoammesh.core.case_setup.infer_patch_roles(case_dir, patches, flow_direction=(1.0, 0.0, 0.0))[source]
Assign inlet/outlet/wall roles from mesh geometry when patch names carry none (GMSH physical surfaces are
surface_0…surface_N).The inlet and outlet are the patches sitting at the two extremes of the dominant flow axis whose outward normals are most aligned with that axis; the one whose normal opposes flow_direction is the inlet (flow enters where the wall normal points back at the oncoming stream). Everything else is a wall. Patches whose name already encodes a role are respected.
Returns a
{patch_name: role}map covering every boundary patch.
- polyfoammesh.core.case_setup.mesh_bounds(case_dir)[source]
(xmin, xmax, ymin, ymax, zmin, zmax) of the polyMesh points (metres).
- polyfoammesh.core.case_setup.suggest_flow_direction(case_dir)[source]
Unit vector along the dominant (largest-extent) mesh axis — the obvious default flow direction for an internal-flow passage.
- polyfoammesh.core.case_setup.write_control_dict(case_dir)[source]
Write the minimal controlDict cartesianMesh needs to run.
Single implementation used by every meshing path (mesh_engine, snappy_hex_mesh, main_window) — formerly duplicated verbatim in mesh_engine.py and snappy_hex_mesh.py with subtle field drift.
- polyfoammesh.core.case_setup.set_wall_patch_types(case_dir, wall_names, boundary_type='wall')[source]
Rewrite
constant/polyMesh/boundaryso the named patches gettype wallinstead of the genericpatchtype gmshToFoam writes.Wall-function boundary conditions (
nutkWallFunction,kqRWallFunction,omegaWallFunction) abort at construction time from simpleFoam startup if their patch is typedpatch— the wall-function code requires the mesh boundary to saywall. Seen live on the venturi first run: exit 134 innutkWallFunctionFvPatchScalarField’s constructor.
- polyfoammesh.core.case_setup.setup_case(case_dir, patches, application='simpleFoam', turbulence_model='kOmegaSST', inlet_velocity=None, end_time=None, residual_control=None, write_interval=None, patch_roles=None)[source]
Write a runnable OpenFOAM case into case_dir.
- Parameters:
inlet_velocity (
tuple[float,float,float] |None) – velocity vector imposed on every patch whose name contains “inlet”. Leave as None for the historical placeholder (zero velocity — a case that is set up but not meant to be run).end_time (
int|None) – SIMPLE iteration ceiling (controlDict endTime).residual_control (
float|None) – if given, adds a SIMPLE residualControl block so the run stops on convergence rather than always running to end_time.write_interval (
int|None) – how often to write a time directory. Solution-adaptive refinement only ever reads the last one, so it passes a large value to avoid writing gigabytes of intermediate fields on a big mesh.patch_roles (
dict[str,str] |None) – per-patch role overrides (see_boundary_block). When meshing with GMSH the patches are namedsurface_Nand the name-based roles are useless — passinfer_patch_roles()output.application (str)
turbulence_model (str)