polyfoammesh.commercial.watertight

Watertight (closed-volume) meshing workflow — authoritative.

Inspired by ANSYS Fluent Meshing Watertight Workflow, this module orchestrates the complete end-to-end meshing pipeline:

  1. Import & validate geometry

  2. Heal & watertight check

  3. Feature extraction & auto-sizing

  4. Local refinement sources (box, cylinder, sphere)

  5. Boundary layer specification

  6. Volume mesh generation (cartesian / polyhedral)

  7. Quality check & auto-fix loop

  8. Export in multiple formats

Every step emits Octopoda events for audit-trail and CI/CD integration.

Classes

RefinementSource(name, shape, center, size, ...)

A local refinement region.

WatertightWorkflow([of_config])

End-to-end watertight meshing workflow.

WorkflowResult([success, steps_completed, ...])

WorkflowStep(value)

class polyfoammesh.commercial.watertight.WorkflowStep(value)[source]

Bases: Enum

IMPORT = 1
HEAL = 2
FEATURES = 3
SIZING = 4
REFINEMENT = 5
BOUNDARY_LAYER = 6
VOLUME_MESH = 7
QUALITY = 8
EXPORT = 9
class polyfoammesh.commercial.watertight.RefinementSource(name, shape, center, size, cell_size, enabled=True)[source]

Bases: object

A local refinement region.

Used for box/cylinder/sphere refinment zones that override the global cell size in a specific region.

Parameters:
name: str
shape: str
center: tuple[float, float, float]
size: tuple[float, float, float]
cell_size: float
enabled: bool = True
class polyfoammesh.commercial.watertight.WorkflowResult(success=False, steps_completed=<factory>, case_dir='', quality=None, cell_count=0, wall_time_seconds=0.0, errors=<factory>, warnings=<factory>)[source]

Bases: object

Parameters:
success: bool = False
steps_completed: list[str]
case_dir: str = ''
quality: MeshQualityReport | None = None
cell_count: int = 0
wall_time_seconds: float = 0.0
errors: list[str]
warnings: list[str]
class polyfoammesh.commercial.watertight.WatertightWorkflow(of_config=None)[source]

Bases: object

End-to-end watertight meshing workflow.

Usage:

wf = WatertightWorkflow(of_config)
wf.set_geometry("path/to/model.step")
wf.set_cell_sizes(max_cell=0.05, min_cell=0.01)
result = wf.run()
if result.success:
    print(f"Mesh ready: {result.cell_count} cells")
Parameters:

of_config (OFConfig | None)

set_geometry(path)[source]

Set and validate the geometry file path.

Return type:

ValidationResult

Parameters:

path (str | Path)

set_case_dir(path)[source]

Set the output case directory.

Return type:

ValidationResult

Parameters:

path (str | Path)

set_cell_sizes(max_cell, min_cell, bbox_dim=None)[source]

Set global cell size limits.

Return type:

ValidationResult

Parameters:
set_detail(detail)[source]
Return type:

ValidationResult

Parameters:

detail (str)

set_boundary_layers(n_layers, thickness_ratio, expansion_ratio, wall_patches=None)[source]
Return type:

ValidationResult

Parameters:
add_refinement(source)[source]
Return type:

None

Parameters:

source (RefinementSource)

on_step(step, callback)[source]

Register a callback invoked before a workflow step runs.

The callback receives the WorkflowStep enum value.

Return type:

None

Parameters:
run()[source]

Execute the full watertight workflow.

Returns a WorkflowResult summarising success/failure and quality metrics.

Return type:

WorkflowResult