Repository navigation
Conversation
Create Octree-Informed Structured Mesh builds a rectilinear hexahedral mesh for a structural model computed on an OctreeGrid: n_x * n_y * n_z cells like a regular grid, but each axis spaced by equidistributing alpha * (share of max-level octree cells per slab) + (1 - alpha) * uniform, with cells at least one finest octree cell and neighbour ratios up to max_growth. Each cell takes the lithology of the octree cell at its center (look-up, no interpolation). octree_informed_edges returns the coordinate lists (e.g. MOOSE CartesianMeshGenerator dx). pre_check_octree_grid refuses models on a RegularGrid or not computed. New MeshType.OCTREE_INFORMED; the Exodus exporter takes its hexahedral path for it. The SfePy builder does not support it yet. Co-Authored-By: Claude Opus 5.5
MESH_TYPE_CODES maps MeshType.OCTREE_INFORMED to "imp": hexahedra with block ids take the implicit mesh's export and run path. Fault zones are voxel-based (a trace in the shape of a regular lith_block), so compute_fault_zone_cell_mask now refuses structural models on an OctreeGrid with a clear message instead of failing inside. Tests: octree fixtures (model 1, 16^3) and the octree-informed mesh; builder accepts it, fault zones are refused, a real SfePy run on it. Co-Authored-By: Claude Opus 5.5
compute_fault_zone_cell_mask now selects the mesh cells whose centroid lies within fault_zone_n_voxels + 0.5 structural grid cells of a fault's UNMASKED surface mesh (VTK point-to-surface distance, per axis in cells of the structural grid; finest cells on an OctreeGrid), keeping the fault_activity rule via each cell's block id. It works for structural models on both grids and every mesh type, replacing the voxel trace (fault_trace_on_grid, binary dilation, nearest-voxel look-up), which only worked on a RegularGrid. For a fault parallel to a grid plane the zone is the voxel version's; oblique faults are no longer widened by the voxel staircase (model 2's pinned counts 764 / 596 become 658 / 504). Octree models no longer refuse fault zones. Co-Authored-By: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5
octree_informed.py was the only module with a @wbgeo_component that used 'from __future__ import annotations'. That turns every annotation into a string, which the DSL rejects (test_component_signatures failed for all six parameters and the return type), so the component would not have registered in the Workbench. Co-Authored-By: Claude Opus 5.5
Brings in main with MR !46 (GOLEM). Conflicts from the SfePy renames (SfepyHydrothermalProblemBuilder, SfepyCustomBuilder, sfepy_model_builder): kept the geometric fault zone docstrings and counts (658/504) with the new names, kept both sides of the octree and export/petsc tests; the octree SfePy tests use linear_solver="iterative" (default is now petsc). Co-Authored-By: Claude Opus 5.5
Conflicts resolved by keeping both sides: the octree_informed mesh type together with the palette colour of MeshTypeType, and the octree imports together with the palette import in the SfePy builder. Co-Authored-By: Claude Opus 5.5
main now requires palette constants and a positionInGroup for every component (tests/test_workbench_palette.py): MESH colour like the other meshers, position 960 right below Create Structured Implicit Mesh. Co-Authored-By: Claude Opus 5.5
The octree-informed mesh is exported like the implicit mesh (hexahedra, one block per lithology, no boundary blocks), which the GOLEM builders already handle; it only had to be added to GOLEM_SUPPORTED_MESH_TYPES. The error messages now list the accepted types from that set. Tests (model 1 on an octree): the generated hydrothermal problem accepts the mesh and passes validate_golem_input, all blocks are material blocks, the temperature gradient is anchored to the mesh nodes, the custom builder accepts it, and the Exodus export has one hexahedral block per mesh block. Checked with a real GOLEM run in Docker (model 1, octree max level 4, 4,096 hexahedra, 3 steps, 67 s): pressure and temperature within the boundary values except a ~1 K temperature overshoot in the thermal boundary layer below the top, where the octree-informed cells are coarsest (110-144 m); the implicit mesh (62.5 m) has none. Co-Authored-By: Claude Opus 5.5
The unstructured mesher takes its surfaces from the extended masked meshes, which exist on both grids. Only the lithology lookup and the cell size read the regular grid layout: - build_grid_litho samples the octree lithology exactly at the finest cell centres (to_regular), so the table matches a RegularGrid at the finest resolution - the piece-area threshold and the B-spline step use the finest octree cell size pre_check_regular_grid stays on the implicit and the structured explicit mesh; its message now points to the two meshers that accept octree models. Check on model 2 (1 fault, 2 groups, 40x16x16 finest cells): octree and equivalent regular grid give the same 5 volumes, tetra counts within 3 %, the same element quality and lithology purity. Co-Authored-By: Claude Opus 5.5
- Model 1 and model 2 examples: new optional section 5 (commented out) runs the model on an Octree Grid: structural (and fault) model, octree-informed structured mesh, unstructured mesh, SfePy run on the octree-informed mesh. Both sections were run uncommented (model 2's SfePy run with linear_solver="direct"; "iterative" does not converge with the fault zone's permeability contrast, noted in the example). - Meshing manual: new step 4 for Create Octree-Informed Structured Mesh (method, parameters, when it pays off, limits); unstructured mesh on octree models; red connection for the implicit and structured mesh; Exodus type and mesh_type in the output. - Simulation manual: octree-informed mesh for SfePy and GOLEM; fault zone width in finest cells on an Octree Grid. - Structural modeling manual: meshing options for octree models, pointer to the example sections. Co-Authored-By: Claude Opus 5.5
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Meshing and simulation for structural models computed on an Octree Grid. Until now every mesher refused octree models. With this PR:
Related: #5 (the geometric fault zone here is groundwork for damage zones; it will change once damage zones become part of the structural model).
Meshing changes (please review: @baes2021)
1. New component: Create Octree-Informed Structured Mesh (
core/meshing_components/implicit/octree_informed.py, identifierwbgeo::meshing_create_octree_informed_structured_mesh, Meshing group, position 960)n_cells_x * n_cells_y * n_cells_zcells on three coordinate lists, like a regular grid but with its own non-uniform spacing per axis.alpha * density + (1 - alpha) * uniform, so cells are finewhere the octree is refined (contacts, erosion boundaries, faults) and coarse elsewhere.
max_growth.n_cells_x/y/z(0 = half the finest resolution),alpha(0.7; 0 gives a uniform grid),max_growth(1.3).MeshResultswith hexahedra grouped by lithology (cell_data["block_id"]), boundary point sets (reusesbuild_point_sets/classify_boundary_nodesfrom the unstructured mesher), newMeshType.OCTREE_INFORMED(also added to the Workbench dropdown string).
pre_check_octree_grid(new, inpre_checks.py): only accepts models on an Octree Grid that have been computed.OCTREE_INFORMEDto the hexahedral path of the implicit mesh (Exo_format.py, one line).2. Unstructured mesher accepts octree models (
explicit/unstructured/structural_surfaces.py,mesh_data.py)extended_maskedmeshes, which exist on both grids. Only two places read the regular grid layout:build_grid_litho: on an Octree Grid the lithology is sampled exactly at the centres of the finest cells (to_regular), so the table looks like the one of a Regular Grid at the finest resolution._cell_spacing).pre_check_regular_gridremoved fromcreate_unstructured_mesh_dataonly.assignment.
3. Implicit and structured explicit mesh stay blocked
pre_check_regular_gridstays on both; only its docstring and message changed. Why we did not port them:hexahedral mesh of an octree model is already available: the octree-informed mesh with
alpha = 0.a port (and it only supports unfaulted models).
In the Workbench the block works as intended: dragging a connection from a computed octree structural model to either of the two meshers turns it red, and the pre-check message tells the user to use "Create Octree-Informed
Structured Mesh" or "Create Unstructured Explicit Mesh". The check also runs at the start of execution, so it cannot be bypassed.
Simulation changes
OCTREE_INFORMEDruns through the hexahedral path of the implicit mesh (MESH_TYPE_CODES).OCTREE_INFORMEDadded toGOLEM_SUPPORTED_MESH_TYPES; the error messages list the supported types from that set.compute_fault_zone_cell_masknow selects the cells whose centroid lies withinfault_zone_n_voxels + 0.5structural grid cells of the fault's unmasked surface (VTK exactdistance, per axis in structural cells, finest cells on an octree), with the same
fault_activityrule as before. This replaces the voxel version (fault_trace_on_grid), which only worked on a Regular Grid.Evaluation: octree-informed vs uniform mesh
SfePy on three models (horizontal layers, layers dipping 30°, model 2 with fault), conduction and coupled flow, strong property contrasts between units. Temperature error (RMS, K) against a uniform reference at the finest
octree resolution, at equal cell count:
along an axis (exact for horizontal layers; a tensor-product mesh cannot follow dipping boundaries).
alpha = 0.7was the best of the tested values (0, 0.7, 1).Compatibility
plane the zone is unchanged. Pinned test counts for model 2 (30 x 15 x 15) changed from 764/596 to 658/504 cells.
MeshTypegains a value.Known issue (not caused by this PR)
With coupled flow, SfePy temperatures can exceed the boundary values on coarse meshes (e.g. 67 °C at a 60 °C boundary). This happens equally on the implicit mesh from a Regular Grid, so it is not specific to the octree mesh;
most likely the advection term without stabilization. GOLEM showed a ~1 K overshoot in the same situation. To be tracked in a separate issue.
Tests
tests/tests_meshing_components/implicit/test_octree_informed_mesh.py(pre-check, rectilinear grid with the octree's lithology, finer cells at interfaces within the size and growth limits,alpha = 0uniform,parameter checks, Exodus export); unstructured octree test and updated refusal tests in
test_pre_checks.py; SfePy run, builder and fault-zone tests on octree fixtures; GOLEM builder and Exodus export tests forOCTREE_INFORMED.mainmerged): 1322 passed, 1 skipped.Examples and manuals
Both sections were run uncommented. For model 2 without PETSc,
linear_solver="direct"converges (about 15 minutes);"iterative"does not, because of the fault zone's permeability contrast (noted in the example).mesh_typein the output.