comparison test/Grids/mapped_grid_test.jl @ 1775:ecec2b0eea0f feature/grids/curvilinear

Delete jacobian_determinant. User should use map or broadcasting with det instead.
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 15 Sep 2024 18:05:57 +0200
parents 035af82f559a
children 819ab806960f 43c0bfc13de3
comparison
equal deleted inserted replaced
1774:035af82f559a 1775:ecec2b0eea0f
283 @test collect(mg) == map(x̄, lg) 283 @test collect(mg) == map(x̄, lg)
284 284
285 @test mapped_grid(lg, x̄, J) == mg 285 @test mapped_grid(lg, x̄, J) == mg
286 end 286 end
287 287
288 @testset "jacobian_determinant" begin
289 x̄((ξ, η)) = @SVector[ξ*η, ξ + η^2]
290 J((ξ, η)) = @SMatrix[
291 η ξ;
292 1 2η;
293 ]
294
295 g = mapped_grid(x̄, J, 10, 11)
296 J = map(logical_grid(g)) do (ξ,η)
297 2η^2 - ξ
298 end
299 @test jacobian_determinant(g) ≈ J
300
301
302 lg = equidistant_grid((0,0), (1,1), 11, 21)
303 x̄ = map(ξ̄ -> @SVector[ξ̄[1],ξ̄[2], ξ̄[1] + ξ̄[2]], lg)
304 J = map(ξ̄ -> @SMatrix[1 0; 0 1; 1 1], lg)
305 mg = MappedGrid(lg, x̄, J)
306
307 @test_broken jacobian(mg) isa AbstractArray{2,Float64}
308 end
309
310 @testset "metric_tensor" begin 288 @testset "metric_tensor" begin
311 x̄((ξ, η)) = @SVector[ξ*η, ξ + η^2] 289 x̄((ξ, η)) = @SVector[ξ*η, ξ + η^2]
312 J((ξ, η)) = @SMatrix[ 290 J((ξ, η)) = @SMatrix[
313 η ξ; 291 η ξ;
314 1 2η; 292 1 2η;