diff src/Grids/curvilinear_grid.jl @ 1503:704a84eef8b6 feature/grids/curvilinear

Add tests for boundary_grid
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 16 Feb 2024 14:31:27 +0100
parents a2dc80396808
children 976f5784d7b9
line wrap: on
line diff
--- a/src/Grids/curvilinear_grid.jl	Fri Feb 16 10:58:17 2024 +0100
+++ b/src/Grids/curvilinear_grid.jl	Fri Feb 16 14:31:27 2024 +0100
@@ -31,10 +31,21 @@
 
 function boundary_grid(g::CurvilinearGrid, id::TensorGridBoundary)
     b_indices = boundary_indices(g.logicalgrid, id)
+
+    # Calculate indices of needed jacobian combonents
+    D = ndims(g)
+    all_indices = SVector{D}(1:D)
+    free_variable_indices = deleteat(all_indices, grid_id(id))
+    jacobian_components = (:, free_variable_indices)
+
+    # Create grid function for boundary grid jacobian
+    boundary_jacobian = componentview((@view g.jacobian[b_indices...])  , jacobian_components...)
+    boundary_physicalcoordinates = @view g.physicalcoordinates[b_indices...]
+
     return CurvilinearGrid(
         boundary_grid(g.logicalgrid, id),
-        g.physicalcoordinates[b_indices...],
-        g.jacobian[b_indices...],
+        boundary_physicalcoordinates,
+        boundary_jacobian,
     )
 end