Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 624:a85db383484f feature/volume_and_boundary_operators
Update documentation and remove some out-commented lines
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 21 Dec 2020 23:12:37 +0100 |
parents | c64793f77509 |
children | d6edde60909b |
comparison
equal
deleted
inserted
replaced
623:914428a1fc61 | 624:a85db383484f |
---|---|
1 # """ | 1 """ |
2 # Laplace{Dim,T<:Real,N,M,K} <: TensorMapping{T,Dim,Dim} | 2 Laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) |
3 # | 3 |
4 # Implements the Laplace operator `L` in Dim dimensions as a tensor operator | 4 Creates the Laplace ooperator operator `Δ` as a `TensorMapping` |
5 # The multi-dimensional tensor operator consists of a tuple of 1D SecondDerivative | 5 |
6 # tensor operators. | 6 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using |
7 # """ | 7 the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` |
8 for the points in the closure regions. | |
9 | |
10 On a one-dimensional `grid`, `Δ` is a `SecondDerivative`. On a multi-dimensional `grid`, `Δ` is the sum of | |
11 multi-dimensional `SecondDerivative`s where the sum is carried out lazily. | |
12 """ | |
8 function Laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim | 13 function Laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim |
9 Δ = SecondDerivative(grid, inner_stencil, closure_stencils, 1) | 14 Δ = SecondDerivative(grid, inner_stencil, closure_stencils, 1) |
10 for d = 2:Dim | 15 for d = 2:Dim |
11 Δ += SecondDerivative(grid, inner_stencil, closure_stencils, d) | 16 Δ += SecondDerivative(grid, inner_stencil, closure_stencils, d) |
12 end | 17 end |
17 # quadrature(L::Laplace) = Quadrature(L.op, L.grid) | 22 # quadrature(L::Laplace) = Quadrature(L.op, L.grid) |
18 # inverse_quadrature(L::Laplace) = InverseQuadrature(L.op, L.grid) | 23 # inverse_quadrature(L::Laplace) = InverseQuadrature(L.op, L.grid) |
19 # boundary_value(L::Laplace, bId::CartesianBoundary) = BoundaryValue(L.op, L.grid, bId) | 24 # boundary_value(L::Laplace, bId::CartesianBoundary) = BoundaryValue(L.op, L.grid, bId) |
20 # normal_derivative(L::Laplace, bId::CartesianBoundary) = NormalDerivative(L.op, L.grid, bId) | 25 # normal_derivative(L::Laplace, bId::CartesianBoundary) = NormalDerivative(L.op, L.grid, bId) |
21 # boundary_quadrature(L::Laplace, bId::CartesianBoundary) = BoundaryQuadrature(L.op, L.grid, bId) | 26 # boundary_quadrature(L::Laplace, bId::CartesianBoundary) = BoundaryQuadrature(L.op, L.grid, bId) |
22 # export NormalDerivative | 27 |
23 # """ | |
24 # NormalDerivative{T,N,M,K} <: TensorMapping{T,2,1} | |
25 # | |
26 # Implements the boundary operator `d` as a TensorMapping | |
27 # """ | |
28 # struct NormalDerivative{T,N,M,K} <: TensorMapping{T,2,1} | |
29 # op::D2{T,N,M,K} | |
30 # grid::EquidistantGrid{2} | |
31 # bId::CartesianBoundary | |
32 # end | |
33 # | |
34 # # TODO: This is obviouly strange. Is domain_size just discarded? Is there a way to avoid storing grid in BoundaryValue? | |
35 # # Can we give special treatment to TensorMappings that go to a higher dim? | |
36 # function LazyTensors.range_size(e::NormalDerivative, domain_size::NTuple{1,Integer}) | |
37 # if dim(e.bId) == 1 | |
38 # return (UnknownDim, domain_size[1]) | |
39 # elseif dim(e.bId) == 2 | |
40 # return (domain_size[1], UnknownDim) | |
41 # end | |
42 # end | |
43 # LazyTensors.domain_size(e::NormalDerivative, range_size::NTuple{2,Integer}) = (range_size[3-dim(e.bId)],) | |
44 # | |
45 # # TODO: Not type stable D:< | |
46 # # TODO: Make this independent of dimension | |
47 # function LazyTensors.apply(d::NormalDerivative{T}, v::AbstractArray{T}, I::NTuple{2,Index}) where T | |
48 # i = I[dim(d.bId)] | |
49 # j = I[3-dim(d.bId)] | |
50 # N_i = size(d.grid)[dim(d.bId)] | |
51 # h_inv = inverse_spacing(d.grid)[dim(d.bId)] | |
52 # return apply_normal_derivative(d.op, h_inv, v[j], i, N_i, region(d.bId)) | |
53 # end | |
54 # | |
55 # function LazyTensors.apply_transpose(d::NormalDerivative{T}, v::AbstractArray{T}, I::NTuple{1,Index}) where T | |
56 # u = selectdim(v,3-dim(d.bId),Int(I[1])) | |
57 # return apply_normal_derivative_transpose(d.op, inverse_spacing(d.grid)[dim(d.bId)], u, region(d.bId)) | |
58 # end | |
59 # | |
60 # """ | 28 # """ |
61 # BoundaryQuadrature{T,N,M,K} <: TensorOperator{T,1} | 29 # BoundaryQuadrature{T,N,M,K} <: TensorOperator{T,1} |
62 # | 30 # |
63 # Implements the boundary operator `q` as a TensorOperator | 31 # Implements the boundary operator `q` as a TensorOperator |
64 # """ | 32 # """ |