Mercurial > repos > public > sbplib_julia
changeset 1741:248304f88e49 feature/grids/curvilinear
Add TBD for deciding about what jacobian_determinant should mean for Rn->Rm grids
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 11 Sep 2024 12:09:41 +0200 |
parents | 9f2bc8ea6a07 |
children | c9c601678a14 |
files | src/Grids/mapped_grid.jl test/Grids/mapped_grid_test.jl |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/mapped_grid.jl Wed Sep 11 09:03:55 2024 +0200 +++ b/src/Grids/mapped_grid.jl Wed Sep 11 12:09:41 2024 +0200 @@ -77,6 +77,9 @@ det(∂x∂ξ) end end +# TBD: Should this be changed to calculate sqrt(g) instead? +# This would make it well defined also for n-dim grids embedded in higher dimensions. +# TBD: Is there a better name? metric_determinant? function metric_tensor(g::MappedGrid) return map(jacobian(g)) do ∂x∂ξ
--- a/test/Grids/mapped_grid_test.jl Wed Sep 11 09:03:55 2024 +0200 +++ b/test/Grids/mapped_grid_test.jl Wed Sep 11 12:09:41 2024 +0200 @@ -258,6 +258,14 @@ 2η^2 - ξ end @test jacobian_determinant(g) ≈ J + + + lg = equidistant_grid((0,0), (1,1), 11, 21) + x̄ = map(ξ̄ -> @SVector[ξ̄[1],ξ̄[2], ξ̄[1] + ξ̄[2]], lg) + J = map(ξ̄ -> @SMatrix[1 0; 0 1; 1 1], lg) + mg = MappedGrid(lg, x̄, J) + + @test_broken jacobian(mg) isa AbstractArray{2,Float64} end @testset "metric_tensor" begin