Mercurial > repos > public > sbplib_julia
comparison test/SbpOperators/boundaryops/normal_derivative_test.jl @ 1751:f3d7e2d7a43f feature/sbp_operators/laplace_curvilinear
Merge feature/grids/manifolds
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 11 Sep 2024 16:26:19 +0200 |
parents | de2c4b2663b4 471a948cd2b2 |
children |
comparison
equal
deleted
inserted
replaced
1731:3684db043add | 1751:f3d7e2d7a43f |
---|---|
1 using Test | 1 using Test |
2 | 2 |
3 using Sbplib.SbpOperators | 3 using Diffinitive.SbpOperators |
4 using Sbplib.Grids | 4 using Diffinitive.Grids |
5 using Sbplib.LazyTensors | 5 using Diffinitive.LazyTensors |
6 using Sbplib.RegionIndices | 6 using Diffinitive.RegionIndices |
7 import Sbplib.SbpOperators.BoundaryOperator | 7 import Diffinitive.SbpOperators.BoundaryOperator |
8 | 8 |
9 using StaticArrays | 9 using StaticArrays |
10 using LinearAlgebra | 10 using LinearAlgebra |
11 | 11 |
12 @testset "normal_derivative" begin | 12 @testset "normal_derivative" begin |
13 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=4) | 13 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=4) |
14 | 14 |
15 @testset "EquidistantGrid" begin | 15 @testset "EquidistantGrid" begin |
16 g_1D = equidistant_grid(0.0, 1.0, 11) | 16 g_1D = equidistant_grid(0.0, 1.0, 11) |
17 | 17 |
18 d_l = normal_derivative(g_1D, stencil_set, Lower()) | 18 d_l = normal_derivative(g_1D, stencil_set, LowerBoundary()) |
19 @test d_l == normal_derivative(g_1D, stencil_set, Lower()) | 19 @test d_l == normal_derivative(g_1D, stencil_set, LowerBoundary()) |
20 @test d_l isa BoundaryOperator{T,Lower} where T | 20 @test d_l isa BoundaryOperator{T,LowerBoundary} where T |
21 @test d_l isa LazyTensor{T,0,1} where T | 21 @test d_l isa LazyTensor{T,0,1} where T |
22 end | 22 end |
23 | 23 |
24 @testset "TensorGrid" begin | 24 @testset "TensorGrid" begin |
25 g_2D = equidistant_grid((0.0, 0.0), (1.0,1.0), 11, 12) | 25 g_2D = equidistant_grid((0.0, 0.0), (1.0,1.0), 11, 12) |
26 d_w = normal_derivative(g_2D, stencil_set, CartesianBoundary{1,Lower}()) | 26 d_w = normal_derivative(g_2D, stencil_set, CartesianBoundary{1,LowerBoundary}()) |
27 d_n = normal_derivative(g_2D, stencil_set, CartesianBoundary{2,Upper}()) | 27 d_n = normal_derivative(g_2D, stencil_set, CartesianBoundary{2,UpperBoundary}()) |
28 Ix = IdentityTensor{Float64}((size(g_2D)[1],)) | 28 Ix = IdentityTensor{Float64}((size(g_2D)[1],)) |
29 Iy = IdentityTensor{Float64}((size(g_2D)[2],)) | 29 Iy = IdentityTensor{Float64}((size(g_2D)[2],)) |
30 d_l = normal_derivative(g_2D.grids[1], stencil_set, Lower()) | 30 d_l = normal_derivative(g_2D.grids[1], stencil_set, LowerBoundary()) |
31 d_r = normal_derivative(g_2D.grids[2], stencil_set, Upper()) | 31 d_r = normal_derivative(g_2D.grids[2], stencil_set, UpperBoundary()) |
32 @test d_w == normal_derivative(g_2D, stencil_set, CartesianBoundary{1,Lower}()) | 32 @test d_w == normal_derivative(g_2D, stencil_set, CartesianBoundary{1,LowerBoundary}()) |
33 @test d_w == d_l⊗Iy | 33 @test d_w == d_l⊗Iy |
34 @test d_n == Ix⊗d_r | 34 @test d_n == Ix⊗d_r |
35 @test d_w isa LazyTensor{T,1,2} where T | 35 @test d_w isa LazyTensor{T,1,2} where T |
36 @test d_n isa LazyTensor{T,1,2} where T | 36 @test d_n isa LazyTensor{T,1,2} where T |
37 | 37 |