Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/derivatives/second_derivative.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 |
comparison
equal
deleted
inserted
replaced
| 2090:67d8fbbb9e58 | 2091:e21c295fb2da |
|---|---|
| 1 """ | 1 """ |
| 2 second_derivative(g::TensorGrid, stencil_set, dim) | 2 second_derivative(g::TensorGrid, stencil_set, dim) |
| 3 second_derivative(g::EquidistantGrid, stencil_set, dim) | |
| 4 | 3 |
| 5 Creates the second derivative operator `D2` as a `LazyTensor` | 4 Creates the second derivative operator `D2` as a `LazyTensor` |
| 6 | 5 |
| 7 `D2` approximates the second-derivative d²/dξ² on `g` along the coordinate | 6 `D2` approximates the second-derivative d²/dξ² on `g` along the coordinate |
| 8 dimension specified by `dim`. | 7 dimension specified by `dim`. |
| 15 end | 14 end |
| 16 D₂ = second_derivative(g.grids[dim], stencil_set) | 15 D₂ = second_derivative(g.grids[dim], stencil_set) |
| 17 return LazyTensors.inflate(D₂, size(g), dim) | 16 return LazyTensors.inflate(D₂, size(g), dim) |
| 18 end | 17 end |
| 19 | 18 |
| 20 function second_derivative(g::EquidistantGrid, stencil_set::StencilSet, dim) | |
| 21 return second_derivative(TensorGrid(g), stencil_set, dim) | |
| 22 end | |
| 23 | |
| 24 """ | 19 """ |
| 25 second_derivative(g::EquidistantGrid, stencil_set::::StencilSet) | 20 second_derivative(g::EquidistantGrid, stencil_set::::StencilSet) |
| 26 | 21 |
| 27 The second derivative operator on an `EquidistantGrid`. | 22 The second derivative operator on an `EquidistantGrid`. |
| 28 Uses the `D2` stencil in `stencil_set`. | 23 Uses the `D2` stencil in `stencil_set`. |
| 31 inner_stencil = parse_stencil(stencil_set["D2"]["inner_stencil"]) | 26 inner_stencil = parse_stencil(stencil_set["D2"]["inner_stencil"]) |
| 32 closure_stencils = parse_stencil.(stencil_set["D2"]["closure_stencils"]) | 27 closure_stencils = parse_stencil.(stencil_set["D2"]["closure_stencils"]) |
| 33 return second_derivative(g, inner_stencil, closure_stencils) | 28 return second_derivative(g, inner_stencil, closure_stencils) |
| 34 end | 29 end |
| 35 | 30 |
| 31 function second_derivative(g::EquidistantGrid, stencil_set::StencilSet, dim) | |
| 32 if dim != 1 | |
| 33 throw(DomainError(dim, "Derivative direction must be 1.")) | |
| 34 end | |
| 35 return second_derivative(g, stencil_set) | |
| 36 end | |
| 37 | |
| 36 """ | 38 """ |
| 37 second_derivative(g::EquidistantGrid, inner_stencil::Stencil, closure_stencils) | 39 second_derivative(g::EquidistantGrid, inner_stencil::Stencil, closure_stencils) |
| 38 | 40 |
| 39 The second derivative operator on an `EquidistantGrid`, given `inner_stencil` and | 41 The second derivative operator on an `EquidistantGrid`, given `inner_stencil` and |
| 40 `closure_stencils`. | 42 `closure_stencils`. |
