Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 702:3cd582257072 feature/laplace_opset
Merge in default
| author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
|---|---|
| date | Mon, 15 Feb 2021 11:30:34 +0100 |
| parents | 011863b3f24c 1accc3e051d0 |
| children | a7efedbdede9 |
comparison
equal
deleted
inserted
replaced
| 679:54ce3f9771e5 | 702:3cd582257072 |
|---|---|
| 35 e_closure_stencil = op.eClosure | 35 e_closure_stencil = op.eClosure |
| 36 d_closure_stencil = op.dClosure | 36 d_closure_stencil = op.dClosure |
| 37 | 37 |
| 38 # Volume operators | 38 # Volume operators |
| 39 Δ = laplace(grid, D_inner_stecil, D_closure_stencils) | 39 Δ = laplace(grid, D_inner_stecil, D_closure_stencils) |
| 40 H = quadrature(grid, H_closure_stencils) | 40 H = inner_product(grid, H_closure_stencils) |
| 41 H⁻¹ = InverseDiagonalQuadrature(grid, H_closure_stencils) | 41 H⁻¹ = inverse_inner_product(grid, H_closure_stencils) |
| 42 | 42 |
| 43 # Boundary operator - id pairs | 43 # Boundary operator - id pairs |
| 44 bids = boundary_identifiers(grid) | 44 bids = boundary_identifiers(grid) |
| 45 e_pairs = ntuple(i -> Pair(bids[i],BoundaryRestriction(grid,e_closure_stencil,bids[i])),length(bids)) | 45 e_pairs = ntuple(i -> Pair(bids[i],boundary_restriction(grid,e_closure_stencil,bids[i])),length(bids)) |
| 46 d_pairs = ntuple(i -> Pair(bids[i],NormalDerivative(grid,d_closure_stencil,bids[i])),length(bids)) | 46 d_pairs = ntuple(i -> Pair(bids[i],normal_derivative(grid,d_closure_stencil,bids[i])),length(bids)) |
| 47 Hᵧ_pairs = ntuple(i -> Pair(bids[i],boundary_quadrature(grid,H_closure_stencils,bids[i])),length(bids)) | 47 Hᵧ_pairs = ntuple(i -> Pair(bids[i],inner_product(boundary_grid(grid,bids[i]),H_closure_stencils)),length(bids)) |
| 48 | 48 |
| 49 return Laplace(Δ, H, H⁻¹, Dict(e_pairs), Dict(d_pairs), Dict(Hᵧ_pairs)) | 49 return Laplace(Δ, H, H⁻¹, Dict(e_pairs), Dict(d_pairs), Dict(Hᵧ_pairs)) |
| 50 end | 50 end |
| 51 | 51 |
| 52 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D) | 52 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D) |
| 71 | 71 |
| 72 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using | 72 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using |
| 73 the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` | 73 the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` |
| 74 for the points in the closure regions. | 74 for the points in the closure regions. |
| 75 | 75 |
| 76 On a one-dimensional `grid`, `Δ` is a `SecondDerivative`. On a multi-dimensional `grid`, `Δ` is the sum of | 76 On a one-dimensional `grid`, `Δ` is equivalent to `second_derivative`. On a |
| 77 multi-dimensional `SecondDerivative`s where the sum is carried out lazily. | 77 multi-dimensional `grid`, `Δ` is the sum of multi-dimensional `second_derivative`s |
| 78 where the sum is carried out lazily. | |
| 78 """ | 79 """ |
| 79 function laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim | 80 function laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim |
| 80 Δ = SecondDerivative(grid, inner_stencil, closure_stencils, 1) | 81 Δ = second_derivative(grid, inner_stencil, closure_stencils, 1) |
| 81 for d = 2:Dim | 82 for d = 2:Dim |
| 82 Δ += SecondDerivative(grid, inner_stencil, closure_stencils, d) | 83 Δ += second_derivative(grid, inner_stencil, closure_stencils, d) |
| 83 end | 84 end |
| 84 return Δ | 85 return Δ |
| 85 end | 86 end |
| 86 export laplace | 87 export laplace |
