Skip to content

Cutcell work branch#273

Open
moyner wants to merge 15 commits into
mainfrom
cutcell-work-branch
Open

Cutcell work branch#273
moyner wants to merge 15 commits into
mainfrom
cutcell-work-branch

Conversation

@moyner

@moyner moyner commented Mar 10, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI and others added 15 commits February 13, 2026 13:06
- Added partial_cut keyword to cut_mesh (:positive/:negative/:none)
  for keeping only one side of the cut plane
- Added depth_grid_to_surface to convert depth grids to PolygonalSurface
- Added layered_mesh to build layered reservoir models from surfaces
- Added _point_below_surface helper for classifying cell layers
- Updated module exports and imports

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
- Reverse cut face node ordering when partial_cut=:positive to ensure
  correct outward boundary normal orientation
- Handle edge case where plane is outside mesh with partial_cut
- Add tests for partial_cut, depth_grid_to_surface, and layered_mesh

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
…d comment

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
…truction

Two fixes for the layered_mesh hanging issue:

1. Use each polygon as a bounding_polygon when cutting by a PolygonalSurface.
   Previously each polygon's cutting plane extended to infinity, causing
   O(n_polygons) redundant cuts per cell and exponential mesh growth.
   Now each polygon only cuts cells within its spatial footprint.

2. Fix cut face construction for cells adjacent to already-cut neighbors.
   When a non-split face has nodes on the cutting plane (from a previous
   cut), those nodes must still be collected into the cut face polygon.
   Without this fix, the cut face was incomplete, causing volume loss.

Also simplified layered_mesh to delegate to cut_mesh(mesh, surface)
instead of manually iterating over individual polygons.

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
- New merge_faces.jl: merge_coplanar_faces function that merges interior
  and boundary faces sharing ≥2 nodes, same cell pair/cell, and coplanar
  normals. Re-orders merged polygon nodes for correct orientation.
- New merge_faces keyword (default true) on cut_mesh for both PlaneCut
  and PolygonalSurface methods, passed through to build_cut_mesh.
- Tests for merge on/off, orientation, geometry preservation, extra_out.

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
…undary merge test

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
Algorithm:
1. Collect boundary face polygons/normals from mesh B
2. Cut mesh A with each B boundary face (keeping both sides)
3. Remove cells of cut-A whose centroids are inside B
4. Glue trimmed A with B using glue_mesh
5. Track cell origins (mesh_a/mesh_b) and original indices

Includes _remove_cells helper and _point_inside_mesh ray-casting test.

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
…o extra_out

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
…caling

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
- merge_split_cells: merges cells from same original cell in same layer
- merge_small_cells: merges cells below volume threshold with best neighbor
- merge_coplanar_faces: add same-plane check, convexity check, fix moved
  done-marking after convexity check
- layered_mesh gains merge_cells keyword (default true)
- _dedup_nodes helper removes consecutive duplicate nodes in face polygons

Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
Co-authored-by: moyner <454871+moyner@users.noreply.github.com>
Add layered mesh construction, mesh embedding, and face/cell merging to CutCellMeshes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants