Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/boundaryops/normal_derivative.jl @ 1222:5f677cd6f0b6 refactor/grids
Start refactoring
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 18 Feb 2023 11:37:35 +0100 |
parents | c0ab81e4c39c |
children | 54c3ed752730 |
rev | line source |
---|---|
620
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
1 """ |
925
6b47a9ee1632
Add functionality for creating operators from a stencil set. Note: Tests are not updated yet!
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
871
diff
changeset
|
2 normal_derivative(grid, closure_stencil::Stencil, boundary) |
620
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
3 |
995 | 4 Creates the normal derivative boundary operator `d` as a `LazyTensor` |
620
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
5 |
925
6b47a9ee1632
Add functionality for creating operators from a stencil set. Note: Tests are not updated yet!
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
871
diff
changeset
|
6 `d` computes the normal derivative of a grid function on `boundary` a `Stencil` `closure_stencil`. |
620
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
7 `d'` is the prolongation of the normal derivative of a grid function to the whole grid using the same `closure_stencil`. |
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
8 On a one-dimensional `grid`, `d` is a `BoundaryOperator`. On a multi-dimensional `grid`, `d` is the inflation of |
947 | 9 a `BoundaryOperator`. |
10 | |
1104
c0ab81e4c39c
Update docs
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1100
diff
changeset
|
11 See also: [`BoundaryOperator`](@ref), [`LazyTensors.inflate`](@ref). |
620
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
12 """ |
989
7bf3121c6864
Add type StencilSet
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
947
diff
changeset
|
13 function normal_derivative(grid, closure_stencil, boundary) |
620
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
14 direction = dim(boundary) |
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
15 h_inv = inverse_spacing(grid)[direction] |
1099
05a25a5063bb
Try to remove volume_operator and boundary_operator methods
Jonatan Werpers <jonatan@werpers.com>
parents:
995
diff
changeset
|
16 |
05a25a5063bb
Try to remove volume_operator and boundary_operator methods
Jonatan Werpers <jonatan@werpers.com>
parents:
995
diff
changeset
|
17 op = BoundaryOperator(restrict(grid, dim(boundary)), scale(closure_stencil,h_inv), region(boundary)) |
05a25a5063bb
Try to remove volume_operator and boundary_operator methods
Jonatan Werpers <jonatan@werpers.com>
parents:
995
diff
changeset
|
18 return LazyTensors.inflate(op, size(grid), dim(boundary)) |
620
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
19 end |
925
6b47a9ee1632
Add functionality for creating operators from a stencil set. Note: Tests are not updated yet!
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
871
diff
changeset
|
20 |
6b47a9ee1632
Add functionality for creating operators from a stencil set. Note: Tests are not updated yet!
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
871
diff
changeset
|
21 """ |
6b47a9ee1632
Add functionality for creating operators from a stencil set. Note: Tests are not updated yet!
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
871
diff
changeset
|
22 normal_derivative(grid, stencil_set, boundary) |
6b47a9ee1632
Add functionality for creating operators from a stencil set. Note: Tests are not updated yet!
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
871
diff
changeset
|
23 |
989
7bf3121c6864
Add type StencilSet
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
947
diff
changeset
|
24 Creates a `normal_derivative` operator on `grid` given a `stencil_set`. |
925
6b47a9ee1632
Add functionality for creating operators from a stencil set. Note: Tests are not updated yet!
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
871
diff
changeset
|
25 """ |
989
7bf3121c6864
Add type StencilSet
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
947
diff
changeset
|
26 normal_derivative(grid, stencil_set::StencilSet, boundary) = normal_derivative(grid, parse_stencil(stencil_set["d1"]["closure"]), boundary) |