comparison src/SbpOperators/volumeops/derivatives/first_derivative.jl @ 1047:d12ab8120d29 feature/first_derivative

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 23 Mar 2022 12:43:03 +0100
parents 7fc8df5157a7
children 157a78959e5d
comparison
equal deleted inserted replaced
1046:e00eb000346e 1047:d12ab8120d29
1 """ 1 """
2 first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction) 2 first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction)
3 3
4 Creates the first-derivative operator `D1` as a `TensorMapping` 4 Creates the first-derivative operator `D1` as a `LazyTensor`
5 5
6 `D1` approximates the first-derivative d/dξ on `grid` along the coordinate dimension specified by 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` 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. 8 for the points in the closure regions.
9 9
10 On a one-dimensional `grid`, `D1` is a `VolumeOperator`. On a multi-dimensional `grid`, `D1` is the outer product of the 10 On a one-dimensional `grid`, `D1` is a `VolumeOperator`. On a multi-dimensional `grid`, `D1` is the outer product of the
11 one-dimensional operator with the `IdentityMapping`s in orthogonal coordinate dirrections. 11 one-dimensional operator with the `IdentityTensor`s in orthogonal coordinate dirrections.
12 12
13 See also: [`volume_operator`](@ref). 13 See also: [`volume_operator`](@ref).
14 """ 14 """
15 function first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction) 15 function first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction)
16 h_inv = inverse_spacing(grid)[direction] 16 h_inv = inverse_spacing(grid)[direction]
17 return SbpOperators.volume_operator(grid, scale(inner_stencil,h_inv), scale.(closure_stencils,h_inv), odd, direction) 17 return SbpOperators.volume_operator(grid, scale(inner_stencil,h_inv), scale.(closure_stencils,h_inv), odd, direction)
18 end 18 end
19 first_derivative(grid::EquidistantGrid{1}, inner_stencil::Stencil, closure_stencils) = first_derivative(grid,inner_stencil,closure_stencils,1) 19
20 20
21 """ 21 """
22 first_derivative(grid, stencil_set, direction) 22 first_derivative(grid, inner_stencil, closure_stencils)
23 23
24 Creates a `first_derivative` operator on `grid` along coordinate dimension `direction` given a parsed TOML 24 Creates a `first_derivative` operator on a 1D `grid` given `inner_stencil` and `closure_stencils`.
25 `stencil_set`.
26 """ 25 """
27 function first_derivative(grid::EquidistantGrid, stencil_set, direction) 26 first_derivative(grid::EquidistantGrid{1}, inner_stencil::Stencil, closure_stencils) = first_derivative(grid, inner_stencil, closure_stencils, 1)
27
28
29 """
30 first_derivative(grid, stencil_set::StencilSet, direction)
31
32 Creates a `first_derivative` operator on `grid` along coordinate dimension `direction` given a `stencil_set`.
33 """
34 function first_derivative(grid::EquidistantGrid, stencil_set::StencilSet, direction)
28 inner_stencil = parse_stencil(stencil_set["D1"]["inner_stencil"]) 35 inner_stencil = parse_stencil(stencil_set["D1"]["inner_stencil"])
29 closure_stencils = parse_stencil.(stencil_set["D1"]["closure_stencils"]) 36 closure_stencils = parse_stencil.(stencil_set["D1"]["closure_stencils"])
30 first_derivative(grid,inner_stencil,closure_stencils,direction); 37 first_derivative(grid,inner_stencil,closure_stencils,direction);
31 end 38 end
39
40
41 """
42 first_derivative(grid, stencil_set)
43
44 Creates a `first_derivative` operator on a 1D `grid` given a `stencil_set`.
45 """
46 first_derivative(grid::EquidistantGrid{1}, stencil_set::StencilSet) = first_derivative(grid, stencil_set, 1)