Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/derivatives/second_derivative.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 | 08f06bfacd5c |
| children |
comparison
equal
deleted
inserted
replaced
| 2079:118c09b168f5 | 2080:0f949681d3d3 |
|---|---|
| 1 """ | 1 """ |
| 2 second_derivative(g::EquidistantGrid, stencil_set, direction) | 2 second_derivative(g::TensorGrid, stencil_set, direction) |
| 3 second_derivative(g::EquidistantGrid, stencil_set, direction) | |
| 3 | 4 |
| 4 Creates the second derivative operator `D2` as a `LazyTensor` | 5 Creates the second derivative operator `D2` as a `LazyTensor` |
| 5 | 6 |
| 6 `D2` approximates the second-derivative d²/dξ² on `g` along the coordinate | 7 `D2` approximates the second-derivative d²/dξ² on `g` along the coordinate |
| 7 dimension specified by `direction`. | 8 dimension specified by `direction`. |
| 8 | 9 |
| 9 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref). | 10 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref). |
| 10 """ | 11 """ |
| 11 function second_derivative(g::TensorGrid, stencil_set, direction) | 12 function second_derivative(g::TensorGrid, stencil_set, direction) |
| 13 if direction ∉ Interval(0, ndims(g)) | |
| 14 throw(DomainError(direction, "Direction must be inside [0, $(ndims(g))].")) | |
| 15 end | |
| 12 D₂ = second_derivative(g.grids[direction], stencil_set) | 16 D₂ = second_derivative(g.grids[direction], stencil_set) |
| 13 return LazyTensors.inflate(D₂, size(g), direction) | 17 return LazyTensors.inflate(D₂, size(g), direction) |
| 18 end | |
| 19 | |
| 20 function second_derivative(g::EquidistantGrid, stencil_set::StencilSet, direction) | |
| 21 return second_derivative(TensorGrid(g), stencil_set, direction) | |
| 14 end | 22 end |
| 15 | 23 |
| 16 """ | 24 """ |
| 17 second_derivative(g::EquidistantGrid, stencil_set::::StencilSet) | 25 second_derivative(g::EquidistantGrid, stencil_set::::StencilSet) |
| 18 | 26 |
