diff test/Grids/mapped_grid_test.jl @ 1659:3bbcd496e021 feature/grids/curvilinear

Add function for computing the normal at the boundary of a mapped grid as a grid function
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 28 Jun 2024 17:02:47 +0200
parents 063a2bfb03da
children 6d196fb85133 4ce9cb21220c
line wrap: on
line diff
--- a/test/Grids/mapped_grid_test.jl	Wed Jun 26 12:41:03 2024 +0200
+++ b/test/Grids/mapped_grid_test.jl	Fri Jun 28 17:02:47 2024 +0200
@@ -183,4 +183,15 @@
     lg = equidistant_grid((0,0), (1,1), 10, 11)
     @test logicalgrid(mg) == lg
     @test collect(mg) == map(x̄, lg)
+
+
+    @testset "normal" begin
+        @test normal(mg, CartesianBoundary{1,Lower}()) == fill(@SVector[-1,0], 11)
+        @test normal(mg, CartesianBoundary{1,Upper}()) == fill(@SVector[1,0], 11)
+        @test normal(mg, CartesianBoundary{2,Lower}()) == fill(@SVector[0,-1], 10)
+        @test normal(mg, CartesianBoundary{2,Upper}()) ≈ map(boundary_grid(mg,CartesianBoundary{2,Upper}())|>logicalgrid) do ξ̄
+            α = 1-2ξ̄[1]
+            @SVector[α,1]/√(α^2 + 1)
+        end
+    end
 end