polyfoammesh.core.validation
Functions
|
Whether an existing mesh may be replaced by a fresh cfMesh cartesianMesh. |
|
Remove characters unsafe for Windows/NTFS filenames. |
|
Remove characters that OpenFOAM forbids in patch names. |
|
Validate boundary-layer parameters. |
|
Validate that a case directory is usable for OpenFOAM. |
|
Validate global cell size pair. |
|
Validate detail-level string. |
|
Validate that a geometry file path is usable. |
|
Validate a single QSettings key/value pair. |
Classes
|
- class polyfoammesh.core.validation.ValidationResult(valid=True, message='', warnings=<factory>)[source]
Bases:
object
- polyfoammesh.core.validation.validate_cell_size(max_cell, min_cell, bbox_dim=None)[source]
Validate global cell size pair.
- Parameters:
- Return type:
- Returns:
ValidationResult—validisFalsewhen values are out of range or inconsistent.
- polyfoammesh.core.validation.validate_bl_params(n_layers, thickness_ratio, expansion_ratio, wall_patches=None)[source]
Validate boundary-layer parameters.
- Parameters:
n_layers (
int) – Number of prism layers (1–10).thickness_ratio (
float) – Ratio of first-layer thickness to local cell size (typical 0.001–0.1).expansion_ratio (
float) – Ratio between successive layer thicknesses (typical 1.1–1.5).wall_patches (
Optional[Sequence[str]]) – List of patch names to apply BL to.
- Return type:
- polyfoammesh.core.validation.validate_detail_level(detail)[source]
Validate detail-level string.
- Return type:
- Parameters:
detail (str)
- polyfoammesh.core.validation.validate_geometry_path(path)[source]
Validate that a geometry file path is usable.
Checks: - File exists - Extension is supported (.step/.stp/.stl) - File size is within limits - Path contains no characters that break WSL/bash
- Return type:
- Parameters:
- polyfoammesh.core.validation.validate_case_dir(case_dir)[source]
Validate that a case directory is usable for OpenFOAM.
Checks: - No spaces in path - Path exists (or parent exists and can be created) - No characters that would break WSL/bash
- Return type:
- Parameters:
- polyfoammesh.core.validation.validate_settings(key, value)[source]
Validate a single QSettings key/value pair.
Use before writing to
QSettingsto catch data corruption early.- Return type:
- Parameters:
- polyfoammesh.core.validation.sanitise_patch_name(name)[source]
Remove characters that OpenFOAM forbids in patch names.
- polyfoammesh.core.validation.sanitise_filename(name)[source]
Remove characters unsafe for Windows/NTFS filenames.
- polyfoammesh.core.validation.mesh_remeshable(case_dir)[source]
Whether an existing mesh may be replaced by a fresh cfMesh cartesianMesh.
quality_engine.auto_fix/optimizer.MeshOptimizerre-run cartesianMesh on whatever mesh already exists in the case — if that mesh came from the GMSH tet / tet→poly pipeline, re-meshing would SILENTLY replace the user’s chosen mesh with an unrelated cfMesh hex at different dimensions. That silent-swap class of bug is forbidden (docs §5/§6): this guard refuses when the case carries a non-cfMesh signal.- Signals (all offline, no WSL needed):
constant/polyMesh_tet_backupexists → the tet→poly pipeline built this case (both the GUI barycentric-dual path and poly_aggregator back the tet mesh up there before converting).the existing mesh is a pure tetrahedral mesh (every cell has exactly 4 faces) → direct GMSH tet output.
Returns
(True, reason)when re-meshing is safe,(False, reason)when it would silently destroy a non-cfMesh mesh.