diff src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl @ 2091:e21c295fb2da refactor/sbp_operators/direction_check

Restructure methods for equidistant grids with a dim argument
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 02 Mar 2026 15:41:14 +0100
parents 67d8fbbb9e58
children 5af7534e5b3c
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl	Mon Mar 02 14:21:58 2026 +0100
+++ b/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl	Mon Mar 02 15:41:14 2026 +0100
@@ -1,5 +1,5 @@
 """
-    second_derivative_variable(g, coeff ..., [dim])
+    second_derivative_variable(g, coeff, ..., [dim])
 
 The variable second derivative operator as a `LazyTensor` on the given grid.
 `coeff` is a grid function of the variable coefficient.
@@ -19,12 +19,15 @@
     return second_derivative_variable(g, coeff, inner_stencil, closure_stencils, dim)
 end
 
-function second_derivative_variable(g::EquidistantGrid, coeff, stencil_set, dim)
-    return second_derivative_variable(TensorGrid(g), coeff, stencil_set, dim)
+function second_derivative_variable(g::EquidistantGrid, coeff, stencil_set)
+    return second_derivative_variable(TensorGrid(g), coeff, stencil_set, 1)
 end
 
-function second_derivative_variable(g::EquidistantGrid, coeff, stencil_set)
-    return second_derivative_variable(g::EquidistantGrid, coeff, stencil_set, 1)
+function second_derivative_variable(g::EquidistantGrid, coeff, stencil_set, dim)
+    if dim != 1
+        throw(DomainError(dim, "Derivative direction must be 1."))
+    end
+    return second_derivative_variable(g, coeff, stencil_set)
 end
 
 function second_derivative_variable(g::TensorGrid, coeff, inner_stencil::NestedStencil, closure_stencils, dim)