Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/volumeops/laplace/laplace.jl @ 1607:7216448d0c5a feature/boundary_conditions
REVIEW: Suggest deduplication of positivity decompostion code
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 09 Jun 2024 00:02:40 +0200 |
parents | 93b86625fcfd |
children | 8315c456e3b4 |
rev | line source |
---|---|
624
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
1 """ |
995 | 2 Laplace{T, Dim, TM} <: LazyTensor{T, Dim, Dim} |
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
3 |
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
|
4 The Laplace operator, approximating ∑d²/xᵢ² , i = 1,...,`Dim` as a |
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
|
5 `LazyTensor`. |
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
6 """ |
995 | 7 struct Laplace{T, Dim, TM<:LazyTensor{T, Dim, Dim}} <: LazyTensor{T, Dim, Dim} |
951
66e8faf4bb4b
Reviwe: Some more comments
Jonatan Werpers <jonatan@werpers.com>
parents:
948
diff
changeset
|
8 D::TM # Difference operator |
989
7bf3121c6864
Add type StencilSet
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
962
diff
changeset
|
9 stencil_set::StencilSet # Stencil set of the operator |
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
10 end |
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
11 |
924
12e8e431b43c
Start restructuring Laplace making it more minimal.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
922
diff
changeset
|
12 """ |
1347
08f06bfacd5c
Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1329
diff
changeset
|
13 Laplace(g::Grid, stencil_set::StencilSet) |
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
14 |
1347
08f06bfacd5c
Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1329
diff
changeset
|
15 Creates the `Laplace` operator `Δ` on `g` given `stencil_set`. |
989
7bf3121c6864
Add type StencilSet
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
962
diff
changeset
|
16 |
7bf3121c6864
Add type StencilSet
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
962
diff
changeset
|
17 See also [`laplace`](@ref). |
924
12e8e431b43c
Start restructuring Laplace making it more minimal.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
922
diff
changeset
|
18 """ |
1291
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
19 function Laplace(g::Grid, stencil_set::StencilSet) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
20 Δ = laplace(g, stencil_set) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
21 return Laplace(Δ, stencil_set) |
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
22 end |
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
23 |
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
24 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D) |
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
25 LazyTensors.domain_size(L::Laplace) = LazyTensors.domain_size(L.D) |
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
26 LazyTensors.apply(L::Laplace, v::AbstractArray, I...) = LazyTensors.apply(L.D,v,I...) |
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
27 |
995 | 28 # TODO: Implement pretty printing of Laplace once pretty printing of LazyTensors is implemented. |
924
12e8e431b43c
Start restructuring Laplace making it more minimal.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
922
diff
changeset
|
29 # Base.show(io::IO, L::Laplace) = ... |
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
30 |
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
31 """ |
1291
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
32 laplace(g::Grid, stencil_set) |
624
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
33 |
1347
08f06bfacd5c
Fix typos and formatting of documentation
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1329
diff
changeset
|
34 Creates the Laplace operator operator `Δ` as a `LazyTensor` on `g`. |
624
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
35 |
1291
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
36 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `g`. The |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
37 approximation depends on the type of grid and the stencil set. |
947 | 38 |
39 See also: [`second_derivative`](@ref). | |
624
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
40 """ |
1291
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
41 function laplace end |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
42 function laplace(g::TensorGrid, stencil_set) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
43 # return mapreduce(+, enumerate(g.grids)) do (i, gᵢ) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
44 # Δᵢ = laplace(gᵢ, stencil_set) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
45 # LazyTensors.inflate(Δᵢ, size(g), i) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
46 # end |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
47 |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
48 Δ = LazyTensors.inflate(laplace(g.grids[1], stencil_set), size(g), 1) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
49 for d = 2:ndims(g) |
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
50 Δ += LazyTensors.inflate(laplace(g.grids[d], stencil_set), size(g), d) |
356
0844069ab5ff
Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents:
333
diff
changeset
|
51 end |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
52 return Δ |
947 | 53 end |
1291
356ec6a72974
Implement changes in SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
1128
diff
changeset
|
54 laplace(g::EquidistantGrid, stencil_set) = second_derivative(g, stencil_set) |
1395
bdcdbd4ea9cd
Merge with default. Comment out broken tests for boundary_conditions at sat
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
diff
changeset
|
55 |
1600
b2496b001297
REVIEW: Forgot to save...
Jonatan Werpers <jonatan@werpers.com>
parents:
1599
diff
changeset
|
56 |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
57 """ |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
58 sat_tensors(Δ::Laplace, g::Grid, bc::DirichletCondition; tuning) |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
59 |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
60 The operators required to construct the SAT for imposing a Dirichlet condition. |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
61 `tuning` specifies the strength of the penalty. See |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
62 |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
63 See also: [`sat`,`DirichletCondition`, `positivity_decomposition`](@ref). |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
64 """ |
1606
93b86625fcfd
REVIEW: Suggest split of tuning tuple. Please help with names!
Jonatan Werpers <jonatan@werpers.com>
parents:
1603
diff
changeset
|
65 function sat_tensors(Δ::Laplace, g::Grid, bc::DirichletCondition; H_tuning = 1., R_tuning = 1.) |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
66 id = boundary(bc) |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
67 set = Δ.stencil_set |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
68 H⁻¹ = inverse_inner_product(g,set) |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
69 Hᵧ = inner_product(boundary_grid(g, id), set) |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
70 e = boundary_restriction(g, set, id) |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
71 d = normal_derivative(g, set, id) |
1606
93b86625fcfd
REVIEW: Suggest split of tuning tuple. Please help with names!
Jonatan Werpers <jonatan@werpers.com>
parents:
1603
diff
changeset
|
72 B = positivity_decomposition(Δ, g, bc; H_tuning, R_tuning) |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
73 penalty_tensor = H⁻¹∘(d' - B*e')∘Hᵧ |
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
74 return penalty_tensor, e |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
75 end |
1106
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1040
diff
changeset
|
76 |
1136
470a70a6c1e6
Reformulate boundary routines (sat tensors) for Laplace and fix export
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1133
diff
changeset
|
77 """ |
1484
8d60d045c2a2
Add todo and minor edits to variable naming and docstring
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1396
diff
changeset
|
78 sat_tensors(Δ::Laplace, g::Grid, bc::NeumannCondition) |
1106
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1040
diff
changeset
|
79 |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
80 The operators required to construct the SAT for imposing a Neumann condition |
1484
8d60d045c2a2
Add todo and minor edits to variable naming and docstring
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1396
diff
changeset
|
81 |
1136
470a70a6c1e6
Reformulate boundary routines (sat tensors) for Laplace and fix export
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1133
diff
changeset
|
82 |
470a70a6c1e6
Reformulate boundary routines (sat tensors) for Laplace and fix export
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1133
diff
changeset
|
83 See also: [`sat`,`NeumannCondition`](@ref). |
470a70a6c1e6
Reformulate boundary routines (sat tensors) for Laplace and fix export
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1133
diff
changeset
|
84 """ |
1603
fca4a01d60c9
Remove module BoundaryConditions, moving its content to SbpOperators
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1602
diff
changeset
|
85 function sat_tensors(Δ::Laplace, g::Grid, bc::NeumannCondition) |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
86 id = boundary(bc) |
1106
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1040
diff
changeset
|
87 set = Δ.stencil_set |
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1040
diff
changeset
|
88 H⁻¹ = inverse_inner_product(g,set) |
1136
470a70a6c1e6
Reformulate boundary routines (sat tensors) for Laplace and fix export
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1133
diff
changeset
|
89 Hᵧ = inner_product(boundary_grid(g, id), set) |
1106
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1040
diff
changeset
|
90 e = boundary_restriction(g, set, id) |
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1040
diff
changeset
|
91 d = normal_derivative(g, set, id) |
1395
bdcdbd4ea9cd
Merge with default. Comment out broken tests for boundary_conditions at sat
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
diff
changeset
|
92 |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
93 penalty_tensor = -H⁻¹∘e'∘Hᵧ |
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
94 return penalty_tensor, d |
1106
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1040
diff
changeset
|
95 end |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
96 |
1607
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
97 |
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
98 function positivity_decomposition(Δ::Laplace, g::Grid, bc::DirichletCondition; H_tuning, R_tuning) |
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
99 Nτ_H, τ_R = positivity_limits(Δ,g,bc) |
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
100 return H_tuning*Nτ_H + R_tuning*τ_R |
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
101 end |
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
102 |
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
103 |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
104 # TODO: We should consider implementing a proper BoundaryIdentifier for EquidistantGrid and then |
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
105 # change bc::BoundaryCondition to id::BoundaryIdentifier |
1607
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
106 function positivity_limits(Δ::Laplace, g::EquidistantGrid, bc::DirichletCondition) |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
107 pos_prop = positivity_properties(Δ) |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
108 h = spacing(g) |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
109 θ_H = pos_prop.theta_H |
1607
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
110 τ_H = 1/(h*θ_H) |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
111 θ_R = pos_prop.theta_R |
1607
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
112 τ_R = 1/(h*θ_R) |
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
113 return τ_H, τ_R |
1598
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
114 end |
19cdec9c21cb
Implement and test sat_tensors for Dirichlet and Neumann conditions
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1484
diff
changeset
|
115 |
1607
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
116 function positivity_limits(Δ::Laplace, g::TensorGrid, bc::DirichletCondition) |
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
117 τ_H, τ_R = positivity_limits(Δ, g.grids[grid_id(boundary(bc))], bc) |
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
118 return τ_H*ndims(g), τ_R |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
119 end |
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
120 |
1607
7216448d0c5a
REVIEW: Suggest deduplication of positivity decompostion code
Jonatan Werpers <jonatan@werpers.com>
parents:
1606
diff
changeset
|
121 |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
122 function positivity_properties(Δ::Laplace) |
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
123 D2_pos_prop = parse_named_tuple(Δ.stencil_set["D2"]["positivity"]) |
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
124 H_closure = parse_tuple(Δ.stencil_set["H"]["closure"]) |
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
125 return merge(D2_pos_prop, (theta_H = H_closure[1],)) |
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1600
diff
changeset
|
126 end |