comparison test/SbpOperators/volumeops/derivatives/second_derivative_test.jl @ 2080:0f949681d3d3 refactor/sbp_operators/direction_check tip

Check that direction of first/second derivative operators is within the dimension of the grid. Add 1D functions for first/second derivative operators that take a direction.
author Vidar Stiernström <vidar.stiernstrom@gmail.com>
date Fri, 20 Feb 2026 12:01:05 +0100
parents 471a948cd2b2
children
comparison
equal deleted inserted replaced
2079:118c09b168f5 2080:0f949681d3d3
19 g_2D = equidistant_grid((0.0, 0.0), (Lx, Ly), 121, 123) 19 g_2D = equidistant_grid((0.0, 0.0), (Lx, Ly), 121, 123)
20 20
21 @testset "Constructors" begin 21 @testset "Constructors" begin
22 @testset "1D" begin 22 @testset "1D" begin
23 Dₓₓ = second_derivative(g_1D, stencil_set) 23 Dₓₓ = second_derivative(g_1D, stencil_set)
24 @test Dₓₓ == second_derivative(g_1D, stencil_set, 1)
24 @test Dₓₓ == second_derivative(g_1D, inner_stencil, closure_stencils) 25 @test Dₓₓ == second_derivative(g_1D, inner_stencil, closure_stencils)
25 @test Dₓₓ isa LazyTensor{Float64,1,1} 26 @test Dₓₓ isa LazyTensor{Float64,1,1}
27
28 @test_throws DomainError(3, "Direction must be inside [0, 1].") second_derivative(g_1D, stencil_set, 3)
26 end 29 end
27 @testset "2D" begin 30 @testset "2D" begin
28 Dₓₓ = second_derivative(g_2D,stencil_set,1) 31 Dₓₓ = second_derivative(g_2D,stencil_set,1)
29 @test Dₓₓ isa LazyTensor{Float64,2,2} 32 @test Dₓₓ isa LazyTensor{Float64,2,2}
30 end 33 end