Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/volumeops/derivatives/second_derivative.jl @ 2002:4300c59bbeff feature/grids/geometry_functions
Merge feature/grids/manifolds
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 29 Apr 2025 09:00:42 +0200 |
parents | 08f06bfacd5c |
children |
rev | line source |
---|---|
623
914428a1fc61
Add documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
619
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:
1291
diff
changeset
|
2 second_derivative(g::EquidistantGrid, stencil_set, direction) |
623
914428a1fc61
Add documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
619
diff
changeset
|
3 |
1347
08f06bfacd5c
Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1329
diff
changeset
|
4 Creates the second derivative operator `D2` as a `LazyTensor` |
623
914428a1fc61
Add documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
619
diff
changeset
|
5 |
1329
e94ddef5e72f
Clean up documentation for changed types in SbpOperatorClean up documentation for changed types in SbpOperatorss
Jonatan Werpers <jonatan@werpers.com>
parents:
1291
diff
changeset
|
6 `D2` approximates the second-derivative d²/dξ² on `g` along the coordinate |
e94ddef5e72f
Clean up documentation for changed types in SbpOperatorClean up documentation for changed types in SbpOperatorss
Jonatan Werpers <jonatan@werpers.com>
parents:
1291
diff
changeset
|
7 dimension specified by `direction`. |
623
914428a1fc61
Add documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
619
diff
changeset
|
8 |
1104
c0ab81e4c39c
Update docs
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1100
diff
changeset
|
9 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref). |
623
914428a1fc61
Add documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
619
diff
changeset
|
10 """ |
1291
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
11 function second_derivative(g::TensorGrid, stencil_set, direction) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
12 D₂ = second_derivative(g.grids[direction], stencil_set) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
13 return LazyTensors.inflate(D₂, size(g), direction) |
356
0844069ab5ff
Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents:
348
diff
changeset
|
14 end |
990
b6238afd3bb0
Add methods for creating derivative operators in 1D from stencil sets without providing directions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
989
diff
changeset
|
15 |
964
2ae62dbaf839
Add method for creating second derivative from a stencil set.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
952
diff
changeset
|
16 """ |
1347
08f06bfacd5c
Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1329
diff
changeset
|
17 second_derivative(g::EquidistantGrid, stencil_set::::StencilSet) |
952
6a8d7fbf55fc
Review: Stencil set method for second_derivative?
Jonatan Werpers <jonatan@werpers.com>
parents:
947
diff
changeset
|
18 |
1347
08f06bfacd5c
Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1329
diff
changeset
|
19 The second derivative operator on an `EquidistantGrid`. |
08f06bfacd5c
Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1329
diff
changeset
|
20 Uses the `D2` stencil in `stencil_set`. |
964
2ae62dbaf839
Add method for creating second derivative from a stencil set.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
952
diff
changeset
|
21 """ |
1291
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
22 function second_derivative(g::EquidistantGrid, stencil_set::StencilSet) |
964
2ae62dbaf839
Add method for creating second derivative from a stencil set.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
952
diff
changeset
|
23 inner_stencil = parse_stencil(stencil_set["D2"]["inner_stencil"]) |
2ae62dbaf839
Add method for creating second derivative from a stencil set.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
952
diff
changeset
|
24 closure_stencils = parse_stencil.(stencil_set["D2"]["closure_stencils"]) |
1291
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
25 return second_derivative(g, inner_stencil, closure_stencils) |
990
b6238afd3bb0
Add methods for creating derivative operators in 1D from stencil sets without providing directions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
989
diff
changeset
|
26 end |
b6238afd3bb0
Add methods for creating derivative operators in 1D from stencil sets without providing directions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
989
diff
changeset
|
27 |
b6238afd3bb0
Add methods for creating derivative operators in 1D from stencil sets without providing directions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
989
diff
changeset
|
28 """ |
1347
08f06bfacd5c
Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1329
diff
changeset
|
29 second_derivative(g::EquidistantGrid, inner_stencil::Stencil, closure_stencils) |
990
b6238afd3bb0
Add methods for creating derivative operators in 1D from stencil sets without providing directions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
989
diff
changeset
|
30 |
1347
08f06bfacd5c
Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1329
diff
changeset
|
31 The second derivative operator on an `EquidistantGrid`, given `inner_stencil` and |
1329
e94ddef5e72f
Clean up documentation for changed types in SbpOperatorClean up documentation for changed types in SbpOperatorss
Jonatan Werpers <jonatan@werpers.com>
parents:
1291
diff
changeset
|
32 `closure_stencils`. |
990
b6238afd3bb0
Add methods for creating derivative operators in 1D from stencil sets without providing directions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
989
diff
changeset
|
33 """ |
1291
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
34 function second_derivative(g::EquidistantGrid, inner_stencil::Stencil, closure_stencils) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
35 h⁻¹ = inverse_spacing(g) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
36 return VolumeOperator(g, scale(inner_stencil,h⁻¹^2), scale.(closure_stencils,h⁻¹^2), even) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1104
diff
changeset
|
37 end |