Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/boundaryops/normal_derivative.jl @ 1288:7de1df0aad6a refactor/grids
Add component_type function to Grid
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 03 Mar 2023 15:42:05 +0100 |
parents | 54c3ed752730 |
children | e94ddef5e72f |
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 """ |
1283
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
2 normal_derivative(g, 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 """ |
1283
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
13 #TODO: Check docstring |
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
14 function normal_derivative(g::TensorGrid, stencil_set::StencilSet, boundary::TensorGridBoundary) |
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
15 op = normal_derivative(g.grids[grid_id(boundary)], stencil_set, boundary_id(boundary)) |
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
16 return LazyTensors.inflate(op, size(g), grid_id(boundary)) |
620
bfc893d03cbf
Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
17 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
|
18 |
1283
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
19 function normal_derivative(g::EquidistantGrid, stencil_set::StencilSet, boundary) |
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
20 closure_stencil = parse_stencil(stencil_set["d1"]["closure"]) |
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
21 h_inv = inverse_spacing(g) |
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
|
22 |
1283
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
23 scaled_stencil = scale(closure_stencil,h_inv) |
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
24 return BoundaryOperator(g, scaled_stencil, boundary) |
54c3ed752730
Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
25 end |