Skip to content

Add explode(grid) function#107

Merged
pjaap merged 1 commit intomasterfrom
feature/explode
Dec 18, 2025
Merged

Add explode(grid) function#107
pjaap merged 1 commit intomasterfrom
feature/explode

Conversation

@pjaap
Copy link
Copy Markdown
Member

@pjaap pjaap commented Dec 8, 2025

This creates a grid without any adjacency information form a given grid.

Cells are duplicated and each cell has independent nodes. Some properties like

  • CellRegions
  • BFaceRegion
  • BFaceCells

are also transferred.

I intend to use it for broken VTK exports.

@pjaap
Copy link
Copy Markdown
Member Author

pjaap commented Dec 9, 2025

The Pr is ready now. We can now do the following with Paraview:

grid = uniform_refine( grid_unitsquare( Triangle2D ), 3)

# explode the grid
ex_grid = explode( grid )

# write cell-wise random node data (e.g.,  discontinuous higher order data)
writeVTK("result.vtu", ex_grid, :some_random_node_data => rand(num_nodes(ex_grid)))

This results in

grafik

@j-fu what do you think?

@j-fu
Copy link
Copy Markdown
Member

j-fu commented Dec 10, 2025

  • For me, the name seems a bit misleading. Something related to "broken" as in "broken FE space" might be more clear
  • Dont't wee need an accompanying method which lifts fe functions from the continuous to the broken space

@chmerdon
Copy link
Copy Markdown
Member

A broken FE space does not require a broken/exploded grid (in the sense that there are no shared vertex ids). In fact broken and continuous FE spaces are equal on broken/exploded grids. However, the usual DG operators in ExtendableFEM would not work on the exploded grid (since every face is now twice in FaceNodes and only has one cell neighbour), for that one would have to glue the cells together again to restore the neighbourhood information. I think @pjaap solely wants this to prepare piecewise plotting data for paraview, but not for any actual discretization schemes. Therefore, I think it is okay to call it exploded and not broken. Concerning the lifting, the usual lazy_interpolate! function allows to interpolate any FE function from the original grid to (any FESpace on) the exploded grid.

@pjaap
Copy link
Copy Markdown
Member Author

pjaap commented Dec 11, 2025

The naming was suggested by an LLM^^ When I investigated how to pass piecewise linear cell data to Paraview.
And yes, as @chmerdon assumes, the method is simply a tool for postprocessing and Paraview export.

  • since parent information is generated and stored, I also see it as similar to uniform_refine
  • this method also enables us to export second order cell information to Paraview by interpolating a result on grid |> explode |> uniform_refine
  • other possible names: crack or shatter ?

@j-fu
Copy link
Copy Markdown
Member

j-fu commented Dec 13, 2025

Ah ok - this appears to be quite helpful.
As for the name, this is a bit misleading, because "exploded view" often means that one splits an object into parts and moves them apart from each other. For grids, see e.g. https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7314570&casa_token=dlb6i-uZ_iAAAAAA:CwGy0bro0Kd9Ed_NOrEXN25CV9kCxZ2CJlliXtjOUOndnB4ZF0jJeBUiDx-nZ3JivY0Juxmfag&tag=1

But EXPLODE in Autocad does exactly what you propose https://www.youtube.com/watch?v=1wQlwP5FyCo
probably the llm has seen this as well. Afters seeing this I thik explode is indeed ok.

@pjaap
Copy link
Copy Markdown
Member Author

pjaap commented Dec 15, 2025

Ok, thanks for the feedback! I used it already in a project, so it is complete and stable for me. Merge?

@pjaap
Copy link
Copy Markdown
Member Author

pjaap commented Dec 18, 2025

As there were no further objections, I'll merge. I do not want to keep this open over the holidays 🎄

@pjaap pjaap merged commit 2b7cd10 into master Dec 18, 2025
14 checks passed
@pjaap pjaap deleted the feature/explode branch December 18, 2025 08:19
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.

3 participants