Mercurial > repos > public > sbplib_julia
changeset 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 | 2a4f36aca2ea 5bfc03cf3ba7 |
files | test/SbpOperators/volumeops/derivatives/first_derivative_test.jl |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/test/SbpOperators/volumeops/derivatives/first_derivative_test.jl Tue Mar 15 21:17:58 2022 +0100 +++ b/test/SbpOperators/volumeops/derivatives/first_derivative_test.jl Tue Mar 15 21:30:56 2022 +0100 @@ -37,7 +37,7 @@ @test first_derivative(g₂, interior_stencil, closure_stencils, 2) isa TensorMapping{Float64,2,2} end - @testset "Accuracy" begin + @testset "Accuracy conditions" begin N = 20 g = EquidistantGrid(N, 0//1,2//1) @testset for order ∈ [2,4] @@ -66,5 +66,16 @@ end end end + + @testset "Accuracy on function" begin + g = EquidistantGrid(30, 0.,1.) + v = evalOn(g, x->exp(x)) + @testset for (order, tol) ∈ [(2, 6e-3),(4, 2e-4)] + stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order) + D₁ = first_derivative(g, stencil_set, 1) + + @test D₁*v ≈ v rtol=tol + end + end end