comparison 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
comparison
equal deleted inserted replaced
1649:b02917bcd7d5 1659:3bbcd496e021
181 @test mg isa MappedGrid{SVector{2,Float64}, 2} 181 @test mg isa MappedGrid{SVector{2,Float64}, 2}
182 182
183 lg = equidistant_grid((0,0), (1,1), 10, 11) 183 lg = equidistant_grid((0,0), (1,1), 10, 11)
184 @test logicalgrid(mg) == lg 184 @test logicalgrid(mg) == lg
185 @test collect(mg) == map(x̄, lg) 185 @test collect(mg) == map(x̄, lg)
186
187
188 @testset "normal" begin
189 @test normal(mg, CartesianBoundary{1,Lower}()) == fill(@SVector[-1,0], 11)
190 @test normal(mg, CartesianBoundary{1,Upper}()) == fill(@SVector[1,0], 11)
191 @test normal(mg, CartesianBoundary{2,Lower}()) == fill(@SVector[0,-1], 10)
192 @test normal(mg, CartesianBoundary{2,Upper}()) ≈ map(boundary_grid(mg,CartesianBoundary{2,Upper}())|>logicalgrid) do ξ̄
193 α = 1-2ξ̄[1]
194 @SVector[α,1]/√(α^2 + 1)
195 end
196 end
186 end 197 end