Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 871:86776d06b883 feature/laplace_opset
REVIEW: Move export statements. Some to the top of the file and some to SbpOperators.jl since they seem more general
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 25 Jan 2022 08:19:02 +0100 |
parents | c4dd4ceb2d40 |
children | 067a322e4f73 0bf5952c240d |
comparison
equal
deleted
inserted
replaced
870:c4dd4ceb2d40 | 871:86776d06b883 |
---|---|
1 export Laplace | |
2 export laplace | |
3 # REVIEW: Makes more sense to me to have the exports at the top of the file. | |
4 # Might as well start fixing that. | |
5 | |
1 # REVIEW: The style of name `Laplace` might clash with other concepts. When | 6 # REVIEW: The style of name `Laplace` might clash with other concepts. When |
2 # thinking about implementing the variable second derivative I think I will | 7 # thinking about implementing the variable second derivative I think I will |
3 # have to create it as a full TM for the full dimensional problem instead of | 8 # have to create it as a full TM for the full dimensional problem instead of |
4 # building it as a 1D operator and then use that with outer products. The | 9 # building it as a 1D operator and then use that with outer products. The |
5 # natural name there would be `VariableSecondDerivative` (or something | 10 # natural name there would be `VariableSecondDerivative` (or something |
36 H_inv::TensorMapping # Inverse inner product operator | 41 H_inv::TensorMapping # Inverse inner product operator |
37 e::StaticDict{<:BoundaryIdentifier,<:TensorMapping} # Boundary restriction operators. | 42 e::StaticDict{<:BoundaryIdentifier,<:TensorMapping} # Boundary restriction operators. |
38 d::StaticDict{<:BoundaryIdentifier,<:TensorMapping} # Normal derivative operators | 43 d::StaticDict{<:BoundaryIdentifier,<:TensorMapping} # Normal derivative operators |
39 H_boundary::StaticDict{<:BoundaryIdentifier,<:TensorMapping} # Boundary quadrature operators | 44 H_boundary::StaticDict{<:BoundaryIdentifier,<:TensorMapping} # Boundary quadrature operators |
40 end | 45 end |
41 export Laplace | |
42 | 46 |
43 function Laplace(grid, filename; order) | 47 function Laplace(grid, filename; order) |
44 | 48 |
45 # Read stencils | 49 # Read stencils |
46 stencil_set = read_stencil_set(filename; order) | 50 stencil_set = read_stencil_set(filename; order) |
82 inner_product(L::Laplace) | 86 inner_product(L::Laplace) |
83 | 87 |
84 Returns the inner product operator associated with `L` | 88 Returns the inner product operator associated with `L` |
85 """ | 89 """ |
86 inner_product(L::Laplace) = L.H | 90 inner_product(L::Laplace) = L.H |
87 export inner_product | |
88 | 91 |
89 | 92 |
90 """ | 93 """ |
91 inverse_inner_product(L::Laplace) | 94 inverse_inner_product(L::Laplace) |
92 | 95 |
93 Returns the inverse of the inner product operator associated with `L` | 96 Returns the inverse of the inner product operator associated with `L` |
94 """ | 97 """ |
95 inverse_inner_product(L::Laplace) = L.H_inv | 98 inverse_inner_product(L::Laplace) = L.H_inv |
96 export inverse_inner_product | |
97 | 99 |
98 | 100 |
99 """ | 101 """ |
100 boundary_restriction(L::Laplace, id::BoundaryIdentifier) | 102 boundary_restriction(L::Laplace, id::BoundaryIdentifier) |
101 boundary_restriction(L::Laplace, ids::Tuple) | 103 boundary_restriction(L::Laplace, ids::Tuple) |
112 # `BoundaryIdentifier`, for example we should be able to handle groups of | 114 # `BoundaryIdentifier`, for example we should be able to handle groups of |
113 # boundaries as a single `BoundaryIdentifier`. I don't know if we can figure | 115 # boundaries as a single `BoundaryIdentifier`. I don't know if we can figure |
114 # out the interface for that now or if we save it for the future but either | 116 # out the interface for that now or if we save it for the future but either |
115 # way these methods will be affected. | 117 # way these methods will be affected. |
116 | 118 |
117 export boundary_restriction | |
118 | 119 |
119 | 120 |
120 """ | 121 """ |
121 normal_derivative(L::Laplace, id::BoundaryIdentifier) | 122 normal_derivative(L::Laplace, id::BoundaryIdentifier) |
122 normal_derivative(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) | 123 normal_derivative(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) |
126 identified by id(s). | 127 identified by id(s). |
127 """ | 128 """ |
128 normal_derivative(L::Laplace, id::BoundaryIdentifier) = L.d[id] | 129 normal_derivative(L::Laplace, id::BoundaryIdentifier) = L.d[id] |
129 normal_derivative(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) where N = ntuple(i->L.d[ids[i]],N) | 130 normal_derivative(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) where N = ntuple(i->L.d[ids[i]],N) |
130 normal_derivative(L::Laplace, ids::Vararg{BoundaryIdentifier,N}) where N = ntuple(i->L.d[ids[i]],N) | 131 normal_derivative(L::Laplace, ids::Vararg{BoundaryIdentifier,N}) where N = ntuple(i->L.d[ids[i]],N) |
131 export normal_derivative | |
132 | 132 |
133 | 133 |
134 """ | 134 """ |
135 boundary_quadrature(L::Laplace, id::BoundaryIdentifier) | 135 boundary_quadrature(L::Laplace, id::BoundaryIdentifier) |
136 boundary_quadrature(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) | 136 boundary_quadrature(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) |
140 identified by id(s). | 140 identified by id(s). |
141 """ | 141 """ |
142 boundary_quadrature(L::Laplace, id::BoundaryIdentifier) = L.H_boundary[id] | 142 boundary_quadrature(L::Laplace, id::BoundaryIdentifier) = L.H_boundary[id] |
143 boundary_quadrature(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) where N = ntuple(i->L.H_boundary[ids[i]],N) | 143 boundary_quadrature(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) where N = ntuple(i->L.H_boundary[ids[i]],N) |
144 boundary_quadrature(L::Laplace, ids::Vararg{BoundaryIdentifier,N}) where N = ntuple(i->L.H_boundary[ids[i]],N) | 144 boundary_quadrature(L::Laplace, ids::Vararg{BoundaryIdentifier,N}) where N = ntuple(i->L.H_boundary[ids[i]],N) |
145 export boundary_quadrature | |
146 | 145 |
147 | 146 |
148 """ | 147 """ |
149 laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) | 148 laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) |
150 | 149 |
163 for d = 2:dimension(grid) | 162 for d = 2:dimension(grid) |
164 Δ += second_derivative(grid, inner_stencil, closure_stencils, d) | 163 Δ += second_derivative(grid, inner_stencil, closure_stencils, d) |
165 end | 164 end |
166 return Δ | 165 return Δ |
167 end | 166 end |
168 export laplace |