Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/derivatives/first_derivative.jl @ 1347:08f06bfacd5c refactor/grids
Fix typos and formatting of documentation
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 18 May 2023 22:53:31 +0200 |
parents | e94ddef5e72f |
children |
comparison
equal
deleted
inserted
replaced
1345:c2012db881cb | 1347:08f06bfacd5c |
---|---|
1 """ | 1 """ |
2 first_derivative(g, ..., [direction]) | 2 first_derivative(g, ..., [direction]) |
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 `direction`. |
8 """ | 8 """ |
9 function first_derivative end | 9 function first_derivative end |
17 D₁ = first_derivative(g.grids[direction], stencil_set) | 17 D₁ = first_derivative(g.grids[direction], stencil_set) |
18 return LazyTensors.inflate(D₁, size(g), direction) | 18 return LazyTensors.inflate(D₁, size(g), direction) |
19 end | 19 end |
20 | 20 |
21 """ | 21 """ |
22 first_derivative(g::EquidistantGrid, stencil_set) | 22 first_derivative(g::EquidistantGrid, stencil_set::StencilSet) |
23 | 23 |
24 The first derivative operator on a `EquidistantGrid` given a | 24 The first derivative operator on an `EquidistantGrid`. |
25 `StencilSet`. Uses the `D1` stencil in the stencil set. | 25 Uses the `D1` stencil in `stencil_set`. |
26 """ | 26 """ |
27 function first_derivative(g::EquidistantGrid, stencil_set::StencilSet) | 27 function first_derivative(g::EquidistantGrid, stencil_set::StencilSet) |
28 inner_stencil = parse_stencil(stencil_set["D1"]["inner_stencil"]) | 28 inner_stencil = parse_stencil(stencil_set["D1"]["inner_stencil"]) |
29 closure_stencils = parse_stencil.(stencil_set["D1"]["closure_stencils"]) | 29 closure_stencils = parse_stencil.(stencil_set["D1"]["closure_stencils"]) |
30 return first_derivative(g, inner_stencil, closure_stencils); | 30 return first_derivative(g, inner_stencil, closure_stencils); |
31 end | 31 end |
32 | 32 |
33 """ | 33 """ |
34 first_derivative(g::EquidistantGrid, inner_stencil, closure_stencils) | 34 first_derivative(g::EquidistantGrid, inner_stencil::Stencil, closure_stencils) |
35 | 35 |
36 The first derivative operator on a `EquidistantGrid` given an | 36 The first derivative operator on an `EquidistantGrid` given an |
37 `inner_stencil` and a`closure_stencils`. | 37 `inner_stencil` and `closure_stencils`. |
38 """ | 38 """ |
39 function first_derivative(g::EquidistantGrid, inner_stencil::Stencil, closure_stencils) | 39 function first_derivative(g::EquidistantGrid, inner_stencil::Stencil, closure_stencils) |
40 h⁻¹ = inverse_spacing(g) | 40 h⁻¹ = inverse_spacing(g) |
41 return VolumeOperator(g, scale(inner_stencil,h⁻¹), scale.(closure_stencils,h⁻¹), odd) | 41 return VolumeOperator(g, scale(inner_stencil,h⁻¹), scale.(closure_stencils,h⁻¹), odd) |
42 end | 42 end |