comparison src/SbpOperators/volumeops/derivatives/first_derivative.jl @ 974:ba023fc09961 feature/first_derivative

Add stencil_set method and accuracy tests
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 15 Mar 2022 07:29:41 +0100
parents 803f60f461c1
children 7bf3121c6864 1ba8a398af9c
comparison
equal deleted inserted replaced
973:4c17a7d6ae5e 974:ba023fc09961
1 export first_derivative
2
3 """ 1 """
4 first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction) 2 first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction)
5 3
6 Creates the first-derivative operator `D1` as a `TensorMapping` 4 Creates the first-derivative operator `D1` as a `TensorMapping`
7 5
10 for the points in the closure regions. 8 for the points in the closure regions.
11 9
12 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
13 one-dimensional operator with the `IdentityMapping`s in orthogonal coordinate dirrections. 11 one-dimensional operator with the `IdentityMapping`s in orthogonal coordinate dirrections.
14 12
15 See also: [`SbpOperators.volume_operator`](@ref). 13 See also: [`volume_operator`](@ref).
16 """ 14 """
17 function first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction) 15 function first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction)
18 h_inv = inverse_spacing(grid)[direction] 16 h_inv = inverse_spacing(grid)[direction]
19 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)
20 end 18 end
21 first_derivative(grid::EquidistantGrid{1}, inner_stencil, closure_stencils) = first_derivative(grid,inner_stencil,closure_stencils,1) 19 first_derivative(grid::EquidistantGrid{1}, inner_stencil::Stencil, closure_stencils) = first_derivative(grid,inner_stencil,closure_stencils,1)
22 20
21 """
22 first_derivative(grid, stencil_set, direction)
23
24 Creates a `first_derivative` operator on `grid` along coordinate dimension `direction` given a parsed TOML
25 `stencil_set`.
26 """
27 function first_derivative(grid::EquidistantGrid, stencil_set, direction)
28 inner_stencil = parse_stencil(stencil_set["D1"]["inner_stencil"])
29 closure_stencils = parse_stencil.(stencil_set["D1"]["closure_stencils"])
30 first_derivative(grid,inner_stencil,closure_stencils,direction);
31 end