Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 648:d6edde60909b feature/volume_and_boundary_operators
Fix typo in documentation and remove obsolete out-commented code.
| author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
|---|---|
| date | Fri, 08 Jan 2021 16:05:53 +0100 |
| parents | a85db383484f |
| children | f3a0d1f7d842 1accc3e051d0 |
comparison
equal
deleted
inserted
replaced
| 647:f13d45c10f55 | 648:d6edde60909b |
|---|---|
| 1 """ | 1 """ |
| 2 Laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) | 2 Laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) |
| 3 | 3 |
| 4 Creates the Laplace ooperator operator `Δ` as a `TensorMapping` | 4 Creates the Laplace operator operator `Δ` as a `TensorMapping` |
| 5 | 5 |
| 6 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using | 6 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using |
| 7 the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` | 7 the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` |
| 8 for the points in the closure regions. | 8 for the points in the closure regions. |
| 9 | 9 |
| 16 Δ += SecondDerivative(grid, inner_stencil, closure_stencils, d) | 16 Δ += SecondDerivative(grid, inner_stencil, closure_stencils, d) |
| 17 end | 17 end |
| 18 return Δ | 18 return Δ |
| 19 end | 19 end |
| 20 export Laplace | 20 export Laplace |
| 21 | |
| 22 # quadrature(L::Laplace) = Quadrature(L.op, L.grid) | |
| 23 # inverse_quadrature(L::Laplace) = InverseQuadrature(L.op, L.grid) | |
| 24 # boundary_value(L::Laplace, bId::CartesianBoundary) = BoundaryValue(L.op, L.grid, bId) | |
| 25 # normal_derivative(L::Laplace, bId::CartesianBoundary) = NormalDerivative(L.op, L.grid, bId) | |
| 26 # boundary_quadrature(L::Laplace, bId::CartesianBoundary) = BoundaryQuadrature(L.op, L.grid, bId) | |
| 27 | |
| 28 # """ | |
| 29 # BoundaryQuadrature{T,N,M,K} <: TensorOperator{T,1} | |
| 30 # | |
| 31 # Implements the boundary operator `q` as a TensorOperator | |
| 32 # """ | |
| 33 # export BoundaryQuadrature | |
| 34 # struct BoundaryQuadrature{T,N,M,K} <: TensorOperator{T,1} | |
| 35 # op::D2{T,N,M,K} | |
| 36 # grid::EquidistantGrid{2} | |
| 37 # bId::CartesianBoundary | |
| 38 # end | |
| 39 # | |
| 40 # | |
| 41 # # TODO: Make this independent of dimension | |
| 42 # function LazyTensors.apply(q::BoundaryQuadrature{T}, v::AbstractArray{T,1}, I::NTuple{1,Index}) where T | |
| 43 # h = spacing(q.grid)[3-dim(q.bId)] | |
| 44 # N = size(v) | |
| 45 # return apply_quadrature(q.op, h, v[I[1]], I[1], N[1]) | |
| 46 # end | |
| 47 # | |
| 48 # LazyTensors.apply_transpose(q::BoundaryQuadrature{T}, v::AbstractArray{T,1}, I::NTuple{1,Index}) where T = LazyTensors.apply(q,v,I) | |
| 49 # | |
| 50 # | |
| 51 # | |
| 52 # | |
| 53 # struct Neumann{Bid<:BoundaryIdentifier} <: BoundaryCondition end | |
| 54 # | |
| 55 # function sat(L::Laplace{2,T}, bc::Neumann{Bid}, v::AbstractArray{T,2}, g::AbstractVector{T}, I::CartesianIndex{2}) where {T,Bid} | |
| 56 # e = boundary_value(L, Bid()) | |
| 57 # d = normal_derivative(L, Bid()) | |
| 58 # Hᵧ = boundary_quadrature(L, Bid()) | |
| 59 # H⁻¹ = inverse_quadrature(L) | |
| 60 # return (-H⁻¹*e*Hᵧ*(d'*v - g))[I] | |
| 61 # end | |
| 62 # | |
| 63 # struct Dirichlet{Bid<:BoundaryIdentifier} <: BoundaryCondition | |
| 64 # tau::Float64 | |
| 65 # end | |
| 66 # | |
| 67 # function sat(L::Laplace{2,T}, bc::Dirichlet{Bid}, v::AbstractArray{T,2}, g::AbstractVector{T}, i::CartesianIndex{2}) where {T,Bid} | |
| 68 # e = boundary_value(L, Bid()) | |
| 69 # d = normal_derivative(L, Bid()) | |
| 70 # Hᵧ = boundary_quadrature(L, Bid()) | |
| 71 # H⁻¹ = inverse_quadrature(L) | |
| 72 # return (-H⁻¹*(tau/h*e + d)*Hᵧ*(e'*v - g))[I] | |
| 73 # # Need to handle scalar multiplication and addition of TensorMapping | |
| 74 # end | |
| 75 | |
| 76 # function apply(s::MyWaveEq{D}, v::AbstractArray{T,D}, i::CartesianIndex{D}) where D | |
| 77 # return apply(s.L, v, i) + | |
| 78 # sat(s.L, Dirichlet{CartesianBoundary{1,Lower}}(s.tau), v, s.g_w, i) + | |
| 79 # sat(s.L, Dirichlet{CartesianBoundary{1,Upper}}(s.tau), v, s.g_e, i) + | |
| 80 # sat(s.L, Dirichlet{CartesianBoundary{2,Lower}}(s.tau), v, s.g_s, i) + | |
| 81 # sat(s.L, Dirichlet{CartesianBoundary{2,Upper}}(s.tau), v, s.g_n, i) | |
| 82 # end |
