comparison test/SbpOperators/volumeops/laplace/laplace_test.jl @ 1588:f6774e98d223 feature/sbp_operators/laplace_curvilinear

Add basic test
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 26 Apr 2024 23:36:49 +0200
parents 43e6acbefdd1
children 62cb622cbe6b
comparison
equal deleted inserted replaced
1587:aef3827ef522 1588:f6774e98d223
1 using Test 1 using Test
2 2
3 using Sbplib.SbpOperators 3 using Sbplib.SbpOperators
4 using Sbplib.Grids 4 using Sbplib.Grids
5 using Sbplib.LazyTensors 5 using Sbplib.LazyTensors
6
7 using StaticArrays
6 8
7 @testset "Laplace" begin 9 @testset "Laplace" begin
8 # Default stencils (4th order) 10 # Default stencils (4th order)
9 operator_path = sbp_operators_path()*"standard_diagonal.toml" 11 operator_path = sbp_operators_path()*"standard_diagonal.toml"
10 stencil_set = read_stencil_set(operator_path; order=4) 12 stencil_set = read_stencil_set(operator_path; order=4)
86 @test Δ == Dxx + Dyy + Dzz 88 @test Δ == Dxx + Dyy + Dzz
87 @test Δ isa LazyTensor{Float64,3,3} 89 @test Δ isa LazyTensor{Float64,3,3}
88 end 90 end
89 91
90 @testset "MappedGrid" begin 92 @testset "MappedGrid" begin
91 @test_broken false 93 c = Chart(unitsquare()) do (ξ,η)
94 @SVector[2ξ + η*(1-η), 3η+(1+η/2)*ξ^2]
95 end
96 Grids.jacobian(c::typeof(c), (ξ,η)) = @SMatrix[2 1-2η; 1+η/2 3+ξ^2/2]
97
98 g = equidistant_grid(c, 15,15)
99
100 @test laplace(g, stencil_set) isa LazyTensor{<:Any,2,2}
101
102 gf = map(g) do (x,y)
103 sin((x^2 + y^2))
104 end
105
106 Δ = laplace(g, stencil_set)
107
108 @test collect(Δ*gf) isa Array{<:Any,2}
92 end 109 end
93 end 110 end
94 111