annotate src/SbpOperators/boundaryops/normal_derivative.jl @ 2015:5c2448d6a201 feature/grids/geometry_functions tip

Structure tests a bit more
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 09 May 2025 15:57:38 +0200
parents 08f06bfacd5c
children f4dc17cfafce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 """
1329
e94ddef5e72f Clean up documentation for changed types in SbpOperatorClean up documentation for changed types in SbpOperatorss
Jonatan Werpers <jonatan@werpers.com>
parents: 1283
diff changeset
2 normal_derivative(g, stencil_set::StencilSet, boundary)
e94ddef5e72f Clean up documentation for changed types in SbpOperatorClean up documentation for changed types in SbpOperatorss
Jonatan Werpers <jonatan@werpers.com>
parents: 1283
diff changeset
3 normal_derivative(g::TensorGrid, stencil_set::StencilSet, boundary::TensorGridBoundary)
e94ddef5e72f Clean up documentation for changed types in SbpOperatorClean up documentation for changed types in SbpOperatorss
Jonatan Werpers <jonatan@werpers.com>
parents: 1283
diff changeset
4 normal_derivative(g::EquidistantGrid, stencil_set::StencilSet, boundary)
620
bfc893d03cbf Add NormalDerivative as a BoundaryOperator and reintroduce tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
5
995
1ba8a398af9c Rename types
Jonatan Werpers <jonatan@werpers.com>
parents: 947
diff changeset
6 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
7
1347
08f06bfacd5c Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 1329
diff changeset
8 `d` computes the normal derivative at `boundary` of a grid function on `g` using the
08f06bfacd5c Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 1329
diff changeset
9 'd1' stencil in `stencil_set`. `d'` is the prolongation of the normal
08f06bfacd5c Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 1329
diff changeset
10 derivative of a grid function to the whole of `g` using the same stencil. On a
08f06bfacd5c Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 1329
diff changeset
11 one-dimensional grid, `d` is a `BoundaryOperator`. On a multi-dimensional
08f06bfacd5c Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 1329
diff changeset
12 grid, `d` is the inflation of a `BoundaryOperator`.
947
38d1752a9aff Reformat "See also:"
Jonatan Werpers <jonatan@werpers.com>
parents: 936
diff changeset
13
1104
c0ab81e4c39c Update docs
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 1100
diff changeset
14 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
15 """
1329
e94ddef5e72f Clean up documentation for changed types in SbpOperatorClean up documentation for changed types in SbpOperatorss
Jonatan Werpers <jonatan@werpers.com>
parents: 1283
diff changeset
16 function normal_derivative end
e94ddef5e72f Clean up documentation for changed types in SbpOperatorClean up documentation for changed types in SbpOperatorss
Jonatan Werpers <jonatan@werpers.com>
parents: 1283
diff changeset
17
e94ddef5e72f Clean up documentation for changed types in SbpOperatorClean up documentation for changed types in SbpOperatorss
Jonatan Werpers <jonatan@werpers.com>
parents: 1283
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::TensorGrid, stencil_set::StencilSet, boundary::TensorGridBoundary)
54c3ed752730 Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents: 1104
diff changeset
20 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
21 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
22 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
23
1283
54c3ed752730 Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents: 1104
diff changeset
24 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
25 closure_stencil = parse_stencil(stencil_set["d1"]["closure"])
54c3ed752730 Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents: 1104
diff changeset
26 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
27
1283
54c3ed752730 Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents: 1104
diff changeset
28 scaled_stencil = scale(closure_stencil,h_inv)
54c3ed752730 Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents: 1104
diff changeset
29 return BoundaryOperator(g, scaled_stencil, boundary)
54c3ed752730 Make tests for normal_derivative work
Jonatan Werpers <jonatan@werpers.com>
parents: 1104
diff changeset
30 end