Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/derivatives/dissipation.jl @ 1359:646027afe74b bugfix/lazytensors
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 20 May 2023 14:33:25 +0200 |
parents | 08f06bfacd5c |
children |
comparison
equal
deleted
inserted
replaced
1299:4c0bc52e170f | 1359:646027afe74b |
---|---|
1 """ | 1 """ |
2 undivided_skewed04(g::EquidistantGrid, p, direction) | 2 undivided_skewed04(g::TensorGrid, p, direction) |
3 undivided_skewed04(g::EquidistantGrid, p) | |
3 | 4 |
4 Create undivided difference operators approximating the `p`th derivative. The | 5 Undivided difference operators approximating the `p`th derivative. The |
5 operators do not satisfy any SBP-property and are meant to be used for | 6 operators do not satisfy any SBP property and are meant to be used for |
6 building artificial dissipation terms. | 7 building artificial dissipation terms. |
7 | 8 |
8 The operators and how they are used to create accurate artifical dissipation | 9 The operators and how they are used to create accurate artificial dissipation |
9 is described in "K. Mattsson, M. Svärd, and J. Nordström, “Stable and Accurate | 10 is described in "K. Mattsson, M. Svärd, and J. Nordström, “Stable and Accurate |
10 Artificial Dissipation,” Journal of Scientific Computing, vol. 21, no. 1, pp. | 11 Artificial Dissipation,” Journal of Scientific Computing, vol. 21, no. 1, pp. |
11 57–79, Aug. 2004" | 12 57–79, Aug. 2004" |
12 """ | 13 """ |
13 function undivided_skewed04(g::EquidistantGrid, p, direction) | 14 function undivided_skewed04 end |
15 | |
16 function undivided_skewed04(g::TensorGrid, p, direction) | |
17 D,Dᵀ = undivided_skewed04(g.grids[direction], p) | |
18 return ( | |
19 LazyTensors.inflate(D, size(g), direction), | |
20 LazyTensors.inflate(Dᵀ, size(g), direction), | |
21 ) | |
22 end | |
23 | |
24 function undivided_skewed04(g::EquidistantGrid, p) | |
14 T = eltype(g) | 25 T = eltype(g) |
15 interior_weights = T.(dissipation_interior_weights(p)) | 26 interior_weights = T.(dissipation_interior_weights(p)) |
16 | 27 |
17 D = stencil_operator_distinct_closures( | 28 D = StencilOperatorDistinctClosures( |
18 g, | 29 g, |
19 dissipation_interior_stencil(interior_weights), | 30 dissipation_interior_stencil(interior_weights), |
20 dissipation_lower_closure_stencils(interior_weights), | 31 dissipation_lower_closure_stencils(interior_weights), |
21 dissipation_upper_closure_stencils(interior_weights), | 32 dissipation_upper_closure_stencils(interior_weights), |
22 direction, | |
23 ) | 33 ) |
24 Dᵀ = stencil_operator_distinct_closures( | 34 Dᵀ = StencilOperatorDistinctClosures( |
25 g, | 35 g, |
26 dissipation_transpose_interior_stencil(interior_weights), | 36 dissipation_transpose_interior_stencil(interior_weights), |
27 dissipation_transpose_lower_closure_stencils(interior_weights), | 37 dissipation_transpose_lower_closure_stencils(interior_weights), |
28 dissipation_transpose_upper_closure_stencils(interior_weights), | 38 dissipation_transpose_upper_closure_stencils(interior_weights), |
29 direction, | |
30 ) | 39 ) |
31 | 40 |
32 return D, Dᵀ | 41 return D, Dᵀ |
33 end | 42 end |
34 | |
35 undivided_skewed04(g::EquidistantGrid{1}, p) = undivided_skewed04(g, p, 1) | |
36 | 43 |
37 function dissipation_interior_weights(p) | 44 function dissipation_interior_weights(p) |
38 if p == 0 | 45 if p == 0 |
39 return (1,) | 46 return (1,) |
40 end | 47 end |