Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 704:a7efedbdede9 feature/laplace_opset
Update docs
| author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
|---|---|
| date | Mon, 15 Feb 2021 17:31:32 +0100 |
| parents | 3cd582257072 |
| children | 693f5487ddba |
comparison
equal
deleted
inserted
replaced
| 703:988e9cfcd58d | 704:a7efedbdede9 |
|---|---|
| 1 """ | 1 """ |
| 2 Laplace{T,Dim,...}() | 2 Laplace{T, Dim, ...} <: TensorMapping{T,Dim,Dim} |
| 3 Laplace(grid::EquidistantGrid, fn; order) | 3 Laplace(grid::EquidistantGrid, fn; order) |
| 4 | 4 |
| 5 Implements the Laplace operator, approximating ∑d²/xᵢ² , i = 1,...,`Dim` as a | 5 Implements the Laplace operator, approximating ∑d²/xᵢ² , i = 1,...,`Dim` as a |
| 6 `TensorMapping`. Additionally, `Laplace` stores the quadrature, and boundary | 6 `TensorMapping`. Additionally, `Laplace` stores the inner product and boundary |
| 7 operators relevant for constructing a SBP finite difference scheme as `TensorMapping`s. | 7 operators relevant for constructing a SBP finite difference scheme as `TensorMapping`s. |
| 8 | 8 |
| 9 Laplace(grid::EquidistantGrid, fn; order) creates the Laplace operator on an | 9 Laplace(grid::EquidistantGrid, fn; order) creates the Laplace operator on an |
| 10 equidistant grid, where the operators are read from a TOML. The laplace operator | 10 equidistant grid, where the operators are read from a TOML. The differential operator |
| 11 is created using laplace(grid,...). | 11 is created using `laplace(grid,...)`. |
| 12 """ | 12 """ |
| 13 struct Laplace{T, Dim, Rb, TMdiffop<:TensorMapping{T,Dim,Dim}, # Differential operator tensor mapping | 13 struct Laplace{T, Dim, Rb, TMdiffop<:TensorMapping{T,Dim,Dim}, # Differential operator |
| 14 TMqop<:TensorMapping{T,Dim,Dim}, # Quadrature operator tensor mapping | 14 TMipop<:TensorMapping{T,Dim,Dim}, # Inner product operator |
| 15 TMbop<:TensorMapping{T,Rb,Dim}, # Boundary operator tensor mapping | 15 TMbop<:TensorMapping{T,Rb,Dim}, # Boundary operator |
| 16 TMbqop<:TensorMapping{T,Rb,Rb}, # Boundary quadrature tensor mapping | 16 TMbqop<:TensorMapping{T,Rb,Rb}, # Boundary quadrature |
| 17 BID<:BoundaryIdentifier} <: TensorMapping{T,Dim,Dim} | 17 BID<:BoundaryIdentifier} <: TensorMapping{T,Dim,Dim} |
| 18 D::TMdiffop # Difference operator | 18 D::TMdiffop # Difference operator |
| 19 H::TMqop # Quadrature (norm) operator | 19 H::TMipop # Inner product operator |
| 20 H_inv::TMqop # Inverse quadrature (norm) operator | 20 H_inv::TMipop # Inverse inner product operator |
| 21 e::Dict{BID,TMbop} # Boundary restriction operators | 21 e::Dict{BID,TMbop} # Boundary restriction operators |
| 22 d::Dict{BID,TMbop} # Normal derivative operators | 22 d::Dict{BID,TMbop} # Normal derivative operators |
| 23 H_boundary::Dict{BID,TMbqop} # Boundary quadrature operators | 23 H_boundary::Dict{BID,TMbqop} # Boundary quadrature operators |
| 24 end | 24 end |
| 25 export Laplace | 25 export Laplace |
| 51 | 51 |
| 52 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D) | 52 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D) |
| 53 LazyTensors.domain_size(L::Laplace) = LazyTensors.domain_size(L.D) | 53 LazyTensors.domain_size(L::Laplace) = LazyTensors.domain_size(L.D) |
| 54 LazyTensors.apply(L::Laplace, v::AbstractArray, I...) = LazyTensors.apply(L.D,v,I...) | 54 LazyTensors.apply(L::Laplace, v::AbstractArray, I...) = LazyTensors.apply(L.D,v,I...) |
| 55 | 55 |
| 56 quadrature(L::Laplace) = L.H | 56 inner_product(L::Laplace) = L.H |
| 57 export quadrature | 57 export inner_product |
| 58 inverse_quadrature(L::Laplace) = L.H_inv | 58 inverse_inner_product(L::Laplace) = L.H_inv |
| 59 export inverse_quadrature | 59 export inverse_inner_product |
| 60 boundary_restriction(L::Laplace,bid::BoundaryIdentifier) = L.e[bid] | 60 boundary_restriction(L::Laplace,bid::BoundaryIdentifier) = L.e[bid] |
| 61 export boundary_restriction | 61 export boundary_restriction |
| 62 normal_derivative(L::Laplace,bid::BoundaryIdentifier) = L.d[bid] | 62 normal_derivative(L::Laplace,bid::BoundaryIdentifier) = L.d[bid] |
| 63 export normal_derivative | 63 export normal_derivative |
| 64 boundary_quadrature(L::Laplace,bid::BoundaryIdentifier) = L.H_boundary[bid] | 64 boundary_quadrature(L::Laplace,bid::BoundaryIdentifier) = L.H_boundary[bid] |
| 65 export boundary_quadrature | 65 export boundary_quadrature |
| 66 | 66 |
| 67 """ | 67 """ |
| 68 laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) | 68 laplace(grid::EquidistantGrid, inner_stencil, closure_stencils) |
| 69 | 69 |
| 70 Creates the Laplace operator operator `Δ` as a `TensorMapping` | 70 Creates the Laplace operator operator `Δ` as a `TensorMapping` |
| 71 | 71 |
| 72 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using | 72 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,N on the N-dimensional |
| 73 the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` | 73 `grid`, using the stencil `inner_stencil` in the interior and a set of stencils |
| 74 for the points in the closure regions. | 74 `closure_stencils` for the points in the closure regions. |
| 75 | 75 |
| 76 On a one-dimensional `grid`, `Δ` is equivalent to `second_derivative`. On a | 76 On a one-dimensional `grid`, `Δ` is equivalent to `second_derivative`. On a |
| 77 multi-dimensional `grid`, `Δ` is the sum of multi-dimensional `second_derivative`s | 77 multi-dimensional `grid`, `Δ` is the sum of multi-dimensional `second_derivative`s |
| 78 where the sum is carried out lazily. | 78 where the sum is carried out lazily. |
| 79 """ | 79 """ |
| 80 function laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim | 80 function laplace(grid::EquidistantGrid, inner_stencil, closure_stencils) |
| 81 Δ = second_derivative(grid, inner_stencil, closure_stencils, 1) | 81 Δ = second_derivative(grid, inner_stencil, closure_stencils, 1) |
| 82 for d = 2:Dim | 82 for d = 2:dimension(grid) |
| 83 Δ += second_derivative(grid, inner_stencil, closure_stencils, d) | 83 Δ += second_derivative(grid, inner_stencil, closure_stencils, d) |
| 84 end | 84 end |
| 85 return Δ | 85 return Δ |
| 86 end | 86 end |
| 87 export laplace | 87 export laplace |
