diff src/Grids/multiblockgrids.jl @ 2026:1b6f150d95c5 feature/grids/multiblock_grids

Implement min_spacing, coarsen, refine
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 10 Apr 2025 16:20:22 +0200
parents d35a4cb170ff
children 06f4b2ab43e8
line wrap: on
line diff
--- a/src/Grids/multiblockgrids.jl	Thu Apr 10 08:45:08 2025 +0200
+++ b/src/Grids/multiblockgrids.jl	Thu Apr 10 16:20:22 2025 +0200
@@ -18,9 +18,25 @@
 # function boundary_identifiers end # Requires function from manifolds?
 # function boundary_grid end # Should return a MultiBlockGrid with the right connections?
 
-# function min_spacing end
-# function refine end
-# function coarsen end
+
+min_spacing(g::MultiBlockGrid) = minimum(min_spacing, grids(g))
+
+function refine(g::MultiBlockGrid, n)
+    gs = map(grids(g)) do gᵢ
+        refine(gᵢ,n)
+    end
+
+    return MultiBlockGrid(gs, connections(g))
+end
+
+function coarsen(g::MultiBlockGrid, n)
+    gs = map(grids(g)) do gᵢ
+        coarsen(gᵢ,n)
+    end
+
+    return MultiBlockGrid(gs, connections(g))
+end
+
 
 # function boundary_indices end # Need to figure out the grid functions first?
 # function eval_on end # Need to figure out the grid functions first?