comparison test/Grids/mapped_grid_test.jl @ 1787:43c0bfc13de3 feature/grids/curvilinear

Delete metric_tensor_inverse
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 18 Sep 2024 22:39:38 +0200
parents ecec2b0eea0f
children 2b5f81e288f1 d91a9f47380f
comparison
equal deleted inserted replaced
1783:ed1b43d07029 1787:43c0bfc13de3
300 ] 300 ]
301 end 301 end
302 @test metric_tensor(g) ≈ G 302 @test metric_tensor(g) ≈ G
303 end 303 end
304 304
305 @testset "metric_tensor_inverse" begin
306 x̄((ξ, η)) = @SVector[ξ + ξ^2/2, η + η^2 + ξ^2/2]
307 J((ξ, η)) = @SMatrix[
308 1+ξ 0;
309 ξ 1+η;
310 ]
311
312 g = mapped_grid(x̄, J, 10, 11)
313 G⁻¹ = map(logical_grid(g)) do (ξ,η)
314 @SMatrix[
315 (1+η)^2 -ξ*(1+η);
316 -ξ*(1+η) (1+ξ)^2+ξ^2;
317 ]/(((1+ξ)^2+ξ^2)*(1+η)^2 - ξ^2*(1+η)^2)
318
319 end
320
321 @test metric_tensor_inverse(g) ≈ G⁻¹
322 end
323
324 @testset "min_spacing" begin 305 @testset "min_spacing" begin
325 let g = mapped_grid(identity, x->@SMatrix[1], 11) 306 let g = mapped_grid(identity, x->@SMatrix[1], 11)
326 @test min_spacing(g) ≈ 0.1 307 @test min_spacing(g) ≈ 0.1
327 end 308 end
328 309