upxo.meshing.gbconformant.pipeline.region_quality module

Quality of the tetrahedra and surface triangles at chosen places of a grain-conformal mesh.

The places are the grain boundary surface, the junction lines and the junction points (mesh_regions), each seen from the elements touching it (layer 1) out to a chosen number of layers. For the grain boundary surface the elements that touch a junction line, or a junction point, can be left out so that what is left shows the boundary sheet itself.

Everything here works on plain arrays. region_quality() returns the result that is kept with a run (tables of statistics and histograms, and the layer of every element), and the per-element arrays that only the files of write_region_files() need.

class upxo.meshing.gbconformant.pipeline.region_quality.RegionSettings(order: int = 3, mode: str = 'layers 1 to N', touch: str = 'face or edge', include_rve_faces: bool = False, features: tuple = ('gb_surface', 'junction_lines', 'junction_points'), exclude_lines: bool = False, exclude_points: bool = False, exclude_order: int = 1, min_dihedral: float = 15.0, target_dihedral: float = 30.0, max_dihedral: float = 150.0, min_angle: float = 30.0)[source]

Bases: object

What to look at: which features, how many layers, how to count touching, what to leave out, the limits.

order: int = 3
mode: str = 'layers 1 to N'
touch: str = 'face or edge'
include_rve_faces: bool = False
features: tuple = ('gb_surface', 'junction_lines', 'junction_points')
exclude_lines: bool = False
exclude_points: bool = False
exclude_order: int = 1
min_dihedral: float = 15.0
target_dihedral: float = 30.0
max_dihedral: float = 150.0
min_angle: float = 30.0
upxo.meshing.gbconformant.pipeline.region_quality.region_figures(result: dict, *, figsize=(6.4, 3.4)) → list[tuple][source]

[(key, title, figure)] of every figure the result supports.

upxo.meshing.gbconformant.pipeline.region_quality.region_flat_table(result: dict) → tuple[source]

One row per region and layer with every statistic, for a spreadsheet: (title, columns, rows).

upxo.meshing.gbconformant.pipeline.region_quality.region_quality(points, tetrahedra, grains, quality=None, settings: RegionSettings | None = None)[source]

Quality of the elements at the chosen features: (result, arrays).

result is kept with the run: settings, counts, rows (one per region and layer, each with the statistics, the limits it breaks and a histogram of every measure), limits, the layer of every element and the surface triangles they refer to. arrays holds the per-element measures and selections, for the files.

upxo.meshing.gbconformant.pipeline.region_quality.region_settings(cfg: dict) → RegionSettings[source]

The region-quality settings of a run’s configuration (checked).

upxo.meshing.gbconformant.pipeline.region_quality.region_tables(result: dict) → list[tuple][source]

[(title, columns, rows)] for the tetrahedra and for the surface triangles.

upxo.meshing.gbconformant.pipeline.region_quality.summary_numbers(result: dict) → dict[source]

The few numbers a stage reports: what was found and the lowest smallest-dihedral of each plotted region.

upxo.meshing.gbconformant.pipeline.region_quality.triangle_measures(points, triangles) → dict[source]

Smallest angle, largest angle (degrees) and shape quality of every triangle.

upxo.meshing.gbconformant.pipeline.region_quality.write_region_files(folder, points, tetrahedra, grains, result: dict, arrays: dict) → list[str][source]

Write the per-region table (CSV), the tetrahedra (VTU) and the surface triangles (VTP) with their layers and measures.