Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/derivatives/first_derivative.jl @ 1207:f1c2a4fa0ee1 performance/get_region_type_inference
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 03 Feb 2023 22:14:47 +0100 |
parents | c0ab81e4c39c |
children | 356ec6a72974 |
comparison
equal
deleted
inserted
replaced
919:b41180efb6c2 | 1207:f1c2a4fa0ee1 |
---|---|
1 """ | |
2 first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction) | |
3 | |
4 Creates the first-derivative operator `D1` as a `LazyTensor` | |
5 | |
6 `D1` approximates the first-derivative d/dξ on `grid` along the coordinate dimension specified by | |
7 `direction`, using the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` | |
8 for the points in the closure regions. | |
9 | |
10 On a one-dimensional `grid`, `D1` is a `VolumeOperator`. On a multi-dimensional `grid`, `D1` is the inflation of | |
11 a `VolumeOperator`. | |
12 | |
13 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref). | |
14 """ | |
15 function first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction) | |
16 h_inv = inverse_spacing(grid)[direction] | |
17 | |
18 D₁ = VolumeOperator(restrict(grid, direction), scale(inner_stencil,h_inv), scale.(closure_stencils,h_inv), odd) | |
19 return LazyTensors.inflate(D₁, size(grid), direction) | |
20 end | |
21 | |
22 | |
23 """ | |
24 first_derivative(grid, inner_stencil, closure_stencils) | |
25 | |
26 Creates a `first_derivative` operator on a 1D `grid` given `inner_stencil` and `closure_stencils`. | |
27 """ | |
28 first_derivative(grid::EquidistantGrid{1}, inner_stencil::Stencil, closure_stencils) = first_derivative(grid, inner_stencil, closure_stencils, 1) | |
29 | |
30 | |
31 """ | |
32 first_derivative(grid, stencil_set::StencilSet, direction) | |
33 | |
34 Creates a `first_derivative` operator on `grid` along coordinate dimension `direction` given a `stencil_set`. | |
35 """ | |
36 function first_derivative(grid::EquidistantGrid, stencil_set::StencilSet, direction) | |
37 inner_stencil = parse_stencil(stencil_set["D1"]["inner_stencil"]) | |
38 closure_stencils = parse_stencil.(stencil_set["D1"]["closure_stencils"]) | |
39 first_derivative(grid,inner_stencil,closure_stencils,direction); | |
40 end | |
41 | |
42 | |
43 """ | |
44 first_derivative(grid, stencil_set) | |
45 | |
46 Creates a `first_derivative` operator on a 1D `grid` given a `stencil_set`. | |
47 """ | |
48 first_derivative(grid::EquidistantGrid{1}, stencil_set::StencilSet) = first_derivative(grid, stencil_set, 1) |