comparison 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
comparison
equal deleted inserted replaced
2090:67d8fbbb9e58 2091:e21c295fb2da
1 """ 1 """
2 second_derivative_variable(g, coeff ..., [dim]) 2 second_derivative_variable(g, coeff, ..., [dim])
3 3
4 The variable second derivative operator as a `LazyTensor` on the given grid. 4 The variable second derivative operator as a `LazyTensor` on the given grid.
5 `coeff` is a grid function of the variable coefficient. 5 `coeff` is a grid function of the variable coefficient.
6 6
7 Approximates the d/dξ c d/dξ on `g` along the coordinate dimension specified 7 Approximates the d/dξ c d/dξ on `g` along the coordinate dimension specified
17 closure_stencils = parse_nested_stencil.(eltype(coeff), stencil_set["D2variable"]["closure_stencils"]) 17 closure_stencils = parse_nested_stencil.(eltype(coeff), stencil_set["D2variable"]["closure_stencils"])
18 18
19 return second_derivative_variable(g, coeff, inner_stencil, closure_stencils, dim) 19 return second_derivative_variable(g, coeff, inner_stencil, closure_stencils, dim)
20 end 20 end
21 21
22 function second_derivative_variable(g::EquidistantGrid, coeff, stencil_set, dim) 22 function second_derivative_variable(g::EquidistantGrid, coeff, stencil_set)
23 return second_derivative_variable(TensorGrid(g), coeff, stencil_set, dim) 23 return second_derivative_variable(TensorGrid(g), coeff, stencil_set, 1)
24 end 24 end
25 25
26 function second_derivative_variable(g::EquidistantGrid, coeff, stencil_set) 26 function second_derivative_variable(g::EquidistantGrid, coeff, stencil_set, dim)
27 return second_derivative_variable(g::EquidistantGrid, coeff, stencil_set, 1) 27 if dim != 1
28 throw(DomainError(dim, "Derivative direction must be 1."))
29 end
30 return second_derivative_variable(g, coeff, stencil_set)
28 end 31 end
29 32
30 function second_derivative_variable(g::TensorGrid, coeff, inner_stencil::NestedStencil, closure_stencils, dim) 33 function second_derivative_variable(g::TensorGrid, coeff, inner_stencil::NestedStencil, closure_stencils, dim)
31 check_coefficient(g, coeff) 34 check_coefficient(g, coeff)
32 35