Mercurial > repos > public > sbplib_julia
comparison test/SbpOperators/volumeops/derivatives/first_derivative_test.jl @ 979:b90446eb5f27 feature/first_derivative
Add accuracy test for funtion
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 15 Mar 2022 21:30:56 +0100 |
parents | 1a05009e731b |
children | 5bfc03cf3ba7 |
comparison
equal
deleted
inserted
replaced
978:1a05009e731b | 979:b90446eb5f27 |
---|---|
35 | 35 |
36 @test first_derivative(g₁, interior_stencil, closure_stencils, 1) isa TensorMapping{Float64,1,1} | 36 @test first_derivative(g₁, interior_stencil, closure_stencils, 1) isa TensorMapping{Float64,1,1} |
37 @test first_derivative(g₂, interior_stencil, closure_stencils, 2) isa TensorMapping{Float64,2,2} | 37 @test first_derivative(g₂, interior_stencil, closure_stencils, 2) isa TensorMapping{Float64,2,2} |
38 end | 38 end |
39 | 39 |
40 @testset "Accuracy" begin | 40 @testset "Accuracy conditions" begin |
41 N = 20 | 41 N = 20 |
42 g = EquidistantGrid(N, 0//1,2//1) | 42 g = EquidistantGrid(N, 0//1,2//1) |
43 @testset for order ∈ [2,4] | 43 @testset for order ∈ [2,4] |
44 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order) | 44 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order) |
45 D₁ = first_derivative(g, stencil_set, 1) | 45 D₁ = first_derivative(g, stencil_set, 1) |
64 x, = points(g)[10] | 64 x, = points(g)[10] |
65 @test (D₁*v)[10] == monomial(x,k-1) | 65 @test (D₁*v)[10] == monomial(x,k-1) |
66 end | 66 end |
67 end | 67 end |
68 end | 68 end |
69 | |
70 @testset "Accuracy on function" begin | |
71 g = EquidistantGrid(30, 0.,1.) | |
72 v = evalOn(g, x->exp(x)) | |
73 @testset for (order, tol) ∈ [(2, 6e-3),(4, 2e-4)] | |
74 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order) | |
75 D₁ = first_derivative(g, stencil_set, 1) | |
76 | |
77 @test D₁*v ≈ v rtol=tol | |
78 end | |
79 end | |
69 end | 80 end |
70 | 81 |