Mercurial > repos > public > sbplib_julia
comparison test/SbpOperators/volumeops/derivatives/first_derivative_test.jl @ 1640:8e28cadfefb3 bugfix/warnings
Move `monomial` in tests into a local scope to avoid overwriting warnings
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 25 Jun 2024 20:44:06 +0200 |
parents | 43aaf710463e |
children | 471a948cd2b2 |
comparison
equal
deleted
inserted
replaced
1639:61aacc51d38a | 1640:8e28cadfefb3 |
---|---|
4 using Sbplib.SbpOperators | 4 using Sbplib.SbpOperators |
5 using Sbplib.Grids | 5 using Sbplib.Grids |
6 using Sbplib.LazyTensors | 6 using Sbplib.LazyTensors |
7 | 7 |
8 using Sbplib.SbpOperators: closure_size, Stencil, VolumeOperator | 8 using Sbplib.SbpOperators: closure_size, Stencil, VolumeOperator |
9 | |
10 """ | |
11 monomial(x,k) | |
12 | |
13 Evaluates ``x^k/k!` with the convetion that it is ``0`` for all ``k<0``. | |
14 Has the property that ``d/dx monomial(x,k) = monomial(x,k-1)`` | |
15 """ | |
16 function monomial(x,k) | |
17 if k < 0 | |
18 return zero(x) | |
19 end | |
20 x^k/factorial(k) | |
21 end | |
22 | 9 |
23 @testset "first_derivative" begin | 10 @testset "first_derivative" begin |
24 @testset "Constructors" begin | 11 @testset "Constructors" begin |
25 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=2) | 12 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=2) |
26 | 13 |
37 end | 24 end |
38 | 25 |
39 @testset "Accuracy conditions" begin | 26 @testset "Accuracy conditions" begin |
40 N = 20 | 27 N = 20 |
41 g = equidistant_grid(0//1, 2//1, N) | 28 g = equidistant_grid(0//1, 2//1, N) |
29 | |
30 monomial(x,k) = k < 0 ? zero(x) : x^k/factorial(k) | |
42 @testset for order ∈ [2,4] | 31 @testset for order ∈ [2,4] |
43 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order) | 32 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order) |
44 D₁ = first_derivative(g, stencil_set) | 33 D₁ = first_derivative(g, stencil_set) |
45 | 34 |
46 @testset "boundary x^$k" for k ∈ 0:order÷2 | 35 @testset "boundary x^$k" for k ∈ 0:order÷2 |