polyfoammesh.commercial.mosaic

Polyhedral conversion via cfMesh polyDualMesh.

Runs cfMesh’s polyDualMesh over the whole hex-dominant mesh, converting every cell to an arbitrary polyhedron (a dual-mesh operation). Despite the historical “Mosaic” name, this is NOT a Star-CCM+ Mosaic-style mesher: there is no hex core, no conformal polyhedral transition cap layer and no interface detection — the entire mesh is converted in place.

Pipeline:
  1. Count hex cells before conversion

  2. polyDualMesh 90 -overwrite over the whole mesh

  3. Count poly cells after conversion

  4. Estimate a volume-ratio proxy (checkMesh max/min volume, else heuristic)

Classes

MosaicEngine([of_config])

PolyDualMesh conversion engine (historically named "Mosaic").

MosaicParams([n_smoothing_iterations, ...])

Parameters controlling the polyDualMesh conversion.

MosaicResult([success, case_dir, hex_cells, ...])

class polyfoammesh.commercial.mosaic.MosaicParams(n_smoothing_iterations=3, volume_ratio_target=8.0, preserve_original=True, poly_dual_aggregation=True)[source]

Bases: object

Parameters controlling the polyDualMesh conversion.

Parameters:
  • n_smoothing_iterations (int)

  • volume_ratio_target (float)

  • preserve_original (bool)

  • poly_dual_aggregation (bool)

n_smoothing_iterations: int = 3
volume_ratio_target: float = 8.0
preserve_original: bool = True
poly_dual_aggregation: bool = True
class polyfoammesh.commercial.mosaic.MosaicResult(success=False, case_dir='', hex_cells=0, poly_cells=0, cell_reduction_pct=0.0, volume_ratio=0.0, warnings=<factory>, errors=<factory>, wall_time_seconds=0.0)[source]

Bases: object

Parameters:
success: bool = False
case_dir: str = ''
hex_cells: int = 0
poly_cells: int = 0
cell_reduction_pct: float = 0.0
volume_ratio: float = 0.0
warnings: list[str]
errors: list[str]
wall_time_seconds: float = 0.0
class polyfoammesh.commercial.mosaic.MosaicEngine(of_config=None)[source]

Bases: object

PolyDualMesh conversion engine (historically named “Mosaic”).

Converts the whole hex-dominant mesh to polyhedral via cfMesh’s polyDualMesh. The “Mosaic” name is historical — this is not a Star-CCM+ Mosaic-style mesher.

Usage:

me = MosaicEngine(of_config)
me.set_case_dir("path/to/case")
result = me.run()
Parameters:

of_config (OFConfig | None)

set_case_dir(case_dir)[source]
Return type:

None

Parameters:

case_dir (Path | str)

set_params(params)[source]
Return type:

None

Parameters:

params (MosaicParams)

run()[source]

Execute the polyDualMesh conversion.

Return type:

MosaicResult

Steps:
  1. Run polyDualMesh on the hex-dominant mesh

  2. Parse cell count before/after

  3. Estimate a volume-ratio proxy

volume_ratio_acceptable()[source]

Check if the volume ratio meets the MAX_VOLUME_RATIO threshold.

Return type:

bool