Meshing objects¶
Meshing objects describe intent and validation constraints. Submitting a
configuration through gradientdynamics.Geometry.mesh() returns a
typed asynchronous gradientdynamics.jobs.Job whose result is a
gradientdynamics.Mesh.
Prism layers¶
- class gradientdynamics.meshing.PrismLayers(*, count: int, first_height: float, growth_rate: float = 1.2)¶
Near-wall prism-layer definition. Lengths use the geometry coordinate system.
- count: int¶
Number of prism layers. Must be non-negative.
- first_height: float¶
Height of the wall-adjacent layer.
- growth_rate: float¶
Ratio between successive layer heights.
Local refinement¶
- class gradientdynamics.meshing.RefinementBox(*, minimum: tuple[float, float, float], maximum: tuple[float, float, float], spacing: float, name: str | None = None)¶
Axis-aligned volume refinement.
- minimum: tuple[float, float, float]¶
- maximum: tuple[float, float, float]¶
- spacing: float¶
Target Cartesian spacing inside the box.
External-flow configuration¶
- class gradientdynamics.meshing.PrismOctreeConfig(*, domain_min: tuple[float, float, float], domain_max: tuple[float, float, float], target_cell_count: int, minimum_spacing: float, maximum_spacing: float, prism_layers: PrismLayers | None = None, refinement_boxes: Sequence[RefinementBox] = (), surface_preparation: str = 'auto', output_format: str = 'cgns')¶
Configuration for an external-flow prism–octree mesh.
- domain_min: tuple[float, float, float]¶
Minimum corner of the fluid domain.
- domain_max: tuple[float, float, float]¶
Maximum corner of the fluid domain.
- target_cell_count: int¶
Requested global cell-count target. The realised count is reported by the completed mesh manifest.
- minimum_spacing: float¶
Smallest permitted octree spacing.
- maximum_spacing: float¶
Coarsest permitted octree spacing.
- prism_layers: PrismLayers | None¶
Optional wall-layer definition.
- refinement_boxes: Sequence[RefinementBox]¶
Local volume-refinement requests, applied in sequence.
- model_dump() dict[str, Any]¶
Return a JSON-compatible representation for audit or persistence.
from gradientdynamics.meshing import (
PrismLayers,
PrismOctreeConfig,
RefinementBox,
)
config = PrismOctreeConfig(
domain_min=(-5.0, -2.0, -1.0),
domain_max=(12.0, 2.0, 4.0),
minimum_spacing=0.01,
maximum_spacing=0.50,
target_cell_count=5_000_000,
surface_preparation="auto",
prism_layers=PrismLayers(
count=14,
first_height=0.00025,
growth_rate=1.2,
),
refinement_boxes=[
RefinementBox(
name="wake",
minimum=(-1.0, -1.0, -0.2),
maximum=(8.0, 1.0, 2.0),
spacing=0.04,
)
],
)
mesh = geometry.mesh(config).wait().result()
print(mesh.cell_count)
print(mesh.manifest.quality)
The values are illustrative. Determine domain size, first-layer height and refinement from the case physics and validation target.
Multi-region CHT configuration¶
- class gradientdynamics.meshing.CHTMeshConfig(*, target_cell_count: int, material_regions: Mapping[str, str], interfaces: Sequence[tuple[str, str]], minimum_spacing: float | None = None, maximum_spacing: float | None = None, output_format: str = 'cgns')¶
Configuration for a named multi-solid STEP assembly.
- material_regions: Mapping[str, str]¶
Mapping from STEP body names to material-region labels.
- interfaces: Sequence[tuple[str, str]]¶
Expected touching-region pairs. Missing or unexpected topology is rejected rather than silently changing the region model.
from gradientdynamics.meshing import CHTMeshConfig
assembly = project.geometry.upload("cold-plate.step")
mesh = assembly.mesh(
CHTMeshConfig(
target_cell_count=8_000_000,
material_regions={
"fluid_volume": "coolant",
"cold_plate": "aluminium",
"heater": "copper",
},
interfaces=[
("coolant", "aluminium"),
("aluminium", "copper"),
],
)
).wait().result()