comparison src/SbpOperators/volumeops/derivatives/first_derivative.jl @ 2089:1bc63fa55145 refactor/sbp_operators/direction_check

Change variable name from `direction` to `dim`
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 02 Mar 2026 14:11:32 +0100
parents 438dc7664c1f
children 67d8fbbb9e58
comparison
equal deleted inserted replaced
2088:438dc7664c1f 2089:1bc63fa55145
1 """ 1 """
2 first_derivative(g, ..., [direction]) 2 first_derivative(g, ..., [dim])
3 3
4 The first derivative operator `D1` as a `LazyTensor` on the given grid. 4 The first derivative operator `D1` as a `LazyTensor` on the given grid.
5 5
6 `D1` approximates the first-derivative d/dξ on `g` along the coordinate 6 `D1` approximates the first-derivative d/dξ on `g` along the coordinate
7 dimension specified by `direction`. 7 dimension specified by `dim`.
8 """ 8 """
9 function first_derivative end 9 function first_derivative end
10 10
11 """ 11 """
12 first_derivative(g::TensorGrid, stencil_set, direction) 12 first_derivative(g::TensorGrid, stencil_set, dim)
13 13
14 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref). 14 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref).
15 """ 15 """
16 function first_derivative(g::TensorGrid, stencil_set, direction) 16 function first_derivative(g::TensorGrid, stencil_set, dim)
17 if direction ∉ 1:ndims(g) 17 if dim ∉ 1:ndims(g)
18 throw(DomainError(direction, "Direction must be inside [0, $(ndims(g))].")) 18 throw(DomainError(dim, "Direction must be inside [0, $(ndims(g))]."))
19 end 19 end
20 D₁ = first_derivative(g.grids[direction], stencil_set) 20 D₁ = first_derivative(g.grids[dim], stencil_set)
21 return LazyTensors.inflate(D₁, size(g), direction) 21 return LazyTensors.inflate(D₁, size(g), dim)
22 end 22 end
23 23
24 function first_derivative(g::EquidistantGrid, stencil_set, direction) 24 function first_derivative(g::EquidistantGrid, stencil_set, dim)
25 return first_derivative(TensorGrid(g), stencil_set, direction) 25 return first_derivative(TensorGrid(g), stencil_set, dim)
26 end 26 end
27 27
28 """ 28 """
29 first_derivative(g::EquidistantGrid, stencil_set::StencilSet) 29 first_derivative(g::EquidistantGrid, stencil_set::StencilSet)
30 30