comparison test/SbpOperators/volumeops/derivatives/first_derivative_test.jl @ 1679:529b533a1dbb feature/sbp_operators/laplace_curvilinear

Merge feature/sbp_operators/laplace_curvilinear
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 30 Jun 2024 10:57:05 +0200
parents 8e28cadfefb3
children 471a948cd2b2
comparison
equal deleted inserted replaced
1663:de6300bd36cc 1679:529b533a1dbb
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