Mercurial > repos > public > sbplib_julia
comparison test/SbpOperators/volumeops/derivatives/dissipation_test.jl @ 1344:760a4a1ec4b7 refactor/grids
Add 2D tests for dissipation operators and fix bug
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 15 May 2023 22:37:55 +0200 |
parents | 356ec6a72974 |
children | 43aaf710463e |
comparison
equal
deleted
inserted
replaced
1343:fa3695f634de | 1344:760a4a1ec4b7 |
---|---|
45 vₚₓ = eval_on(g, x->monomial(x,k-p)) | 45 vₚₓ = eval_on(g, x->monomial(x,k-p)) |
46 | 46 |
47 @test D*v == h^p * vₚₓ | 47 @test D*v == h^p * vₚₓ |
48 end | 48 end |
49 end | 49 end |
50 | |
51 # TODO: Add 2D tests | |
52 end | 50 end |
53 | 51 |
54 @testset "transpose equality" begin | 52 @testset "transpose equality" begin |
55 function get_matrix(D) | 53 function get_matrix(D) |
56 N = only(range_size(D)) | 54 N = only(range_size(D)) |
77 D̄ᵀ = get_matrix(Dᵀ) | 75 D̄ᵀ = get_matrix(Dᵀ) |
78 | 76 |
79 @test D̄ == D̄ᵀ' | 77 @test D̄ == D̄ᵀ' |
80 end | 78 end |
81 end | 79 end |
80 | |
81 @testset "2D" begin | |
82 N = 20 | |
83 g = equidistant_grid((N,2N), (0,0), (2,1)) | |
84 h = spacing.(g.grids) | |
85 | |
86 D,Dᵀ = undivided_skewed04(g, 3, 2) | |
87 | |
88 v = eval_on(g, x->monomial(x[1],4)*monomial(x[2],3)) | |
89 d³vdy³ = eval_on(g, x->monomial(x[1],4)*monomial(x[2],0)) | |
90 | |
91 @test D*v ≈ h[2]^3*d³vdy³ | |
92 end | |
82 end | 93 end |
83 | 94 |
84 @testset "dissipation_interior_weights" begin | 95 @testset "dissipation_interior_weights" begin |
85 @test dissipation_interior_weights(1) == (-1, 1) | 96 @test dissipation_interior_weights(1) == (-1, 1) |
86 @test dissipation_interior_weights(2) == (1,-2, 1) | 97 @test dissipation_interior_weights(2) == (1,-2, 1) |