Mercurial > repos > public > sbplib_julia
changeset 2043:0e93fc7fb2e2 bugfix/zero_dim_grid_boundary_ops
Add implementation of normal_derivative for ZeroDimGrid throwing and error
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Thu, 05 Feb 2026 22:23:19 +0100 |
| parents | 5fb64e42138c |
| children | 8ee4b491c237 |
| files | src/SbpOperators/boundaryops/normal_derivative.jl test/SbpOperators/boundaryops/normal_derivative_test.jl |
| diffstat | 2 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/normal_derivative.jl Thu Feb 05 22:22:25 2026 +0100 +++ b/src/SbpOperators/boundaryops/normal_derivative.jl Thu Feb 05 22:23:19 2026 +0100 @@ -28,3 +28,5 @@ scaled_stencil = scale(closure_stencil,h_inv) return BoundaryOperator(g, scaled_stencil, boundary) end + +normal_derivative(::ZeroDimGrid, stencil_set::StencilSet, boundary) = throw(ArgumentError("ZeroDimGrid has no boundaries"))
--- a/test/SbpOperators/boundaryops/normal_derivative_test.jl Thu Feb 05 22:22:25 2026 +0100 +++ b/test/SbpOperators/boundaryops/normal_derivative_test.jl Thu Feb 05 22:23:19 2026 +0100 @@ -30,6 +30,11 @@ @test d_w isa LazyTensor{T,1,2} where T @test d_n isa LazyTensor{T,1,2} where T end + + @testset "0D" begin + g = ZeroDimGrid(1) + @test_throws ArgumentError("ZeroDimGrid has no boundaries") normal_derivative(g, stencil_set, ()) + end end @testset "Accuracy" begin v = eval_on(g_2D, (x,y)-> x^2 + (y-1)^2 + x*y)
