comparison src/SbpOperators/boundaryops/normal_derivative.jl @ 1351:d7f29359b822

Merge refactor/grids
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 19 May 2023 23:53:36 +0200
parents 08f06bfacd5c
children f4dc17cfafce
comparison
equal deleted inserted replaced
1323:95cac1ee8476 1351:d7f29359b822
1 """ 1 """
2 normal_derivative(grid, closure_stencil::Stencil, boundary) 2 normal_derivative(g, stencil_set::StencilSet, boundary)
3 normal_derivative(g::TensorGrid, stencil_set::StencilSet, boundary::TensorGridBoundary)
4 normal_derivative(g::EquidistantGrid, stencil_set::StencilSet, boundary)
3 5
4 Creates the normal derivative boundary operator `d` as a `LazyTensor` 6 Creates the normal derivative boundary operator `d` as a `LazyTensor`
5 7
6 `d` computes the normal derivative of a grid function on `boundary` a `Stencil` `closure_stencil`. 8 `d` computes the normal derivative at `boundary` of a grid function on `g` using the
7 `d'` is the prolongation of the normal derivative of a grid function to the whole grid using the same `closure_stencil`. 9 'd1' stencil in `stencil_set`. `d'` is the prolongation of the normal
8 On a one-dimensional `grid`, `d` is a `BoundaryOperator`. On a multi-dimensional `grid`, `d` is the inflation of 10 derivative of a grid function to the whole of `g` using the same stencil. On a
9 a `BoundaryOperator`. 11 one-dimensional grid, `d` is a `BoundaryOperator`. On a multi-dimensional
12 grid, `d` is the inflation of a `BoundaryOperator`.
10 13
11 See also: [`BoundaryOperator`](@ref), [`LazyTensors.inflate`](@ref). 14 See also: [`BoundaryOperator`](@ref), [`LazyTensors.inflate`](@ref).
12 """ 15 """
13 function normal_derivative(grid, closure_stencil, boundary) 16 function normal_derivative end
14 direction = dim(boundary)
15 h_inv = inverse_spacing(grid)[direction]
16 17
17 op = BoundaryOperator(restrict(grid, dim(boundary)), scale(closure_stencil,h_inv), region(boundary)) 18
18 return LazyTensors.inflate(op, size(grid), dim(boundary)) 19 function normal_derivative(g::TensorGrid, stencil_set::StencilSet, boundary::TensorGridBoundary)
20 op = normal_derivative(g.grids[grid_id(boundary)], stencil_set, boundary_id(boundary))
21 return LazyTensors.inflate(op, size(g), grid_id(boundary))
19 end 22 end
20 23
21 """ 24 function normal_derivative(g::EquidistantGrid, stencil_set::StencilSet, boundary)
22 normal_derivative(grid, stencil_set, boundary) 25 closure_stencil = parse_stencil(stencil_set["d1"]["closure"])
26 h_inv = inverse_spacing(g)
23 27
24 Creates a `normal_derivative` operator on `grid` given a `stencil_set`. 28 scaled_stencil = scale(closure_stencil,h_inv)
25 """ 29 return BoundaryOperator(g, scaled_stencil, boundary)
26 normal_derivative(grid, stencil_set::StencilSet, boundary) = normal_derivative(grid, parse_stencil(stencil_set["d1"]["closure"]), boundary) 30 end