comparison src/SbpOperators/boundaryops/normal_derivative.jl @ 1395:bdcdbd4ea9cd feature/boundary_conditions

Merge with default. Comment out broken tests for boundary_conditions at sat
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 26 Jul 2023 21:35:50 +0200
parents 08f06bfacd5c
children f4dc17cfafce
comparison
equal deleted inserted replaced
1217:ea2e8254820a 1395:bdcdbd4ea9cd
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: [`boundary_operator`](@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) 17
15 h_inv = inverse_spacing(grid)[direction] 18
16 return SbpOperators.boundary_operator(grid, scale(closure_stencil,h_inv), 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))
17 end 22 end
18 23
19 """ 24 function normal_derivative(g::EquidistantGrid, stencil_set::StencilSet, boundary)
20 normal_derivative(grid, stencil_set, boundary) 25 closure_stencil = parse_stencil(stencil_set["d1"]["closure"])
26 h_inv = inverse_spacing(g)
21 27
22 Creates a `normal_derivative` operator on `grid` given a `stencil_set`. 28 scaled_stencil = scale(closure_stencil,h_inv)
23 """ 29 return BoundaryOperator(g, scaled_stencil, boundary)
24 normal_derivative(grid, stencil_set::StencilSet, boundary) = normal_derivative(grid, parse_stencil(stencil_set["d1"]["closure"]), boundary) 30 end