diff src/SbpOperators/volumeops/laplace/laplace.jl @ 651:67639b1c99ea

Merged feature/volume_and_boundary_operators
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 20 Jan 2021 17:52:55 +0100
parents d6edde60909b
children f3a0d1f7d842 1accc3e051d0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/SbpOperators/volumeops/laplace/laplace.jl	Wed Jan 20 17:52:55 2021 +0100
@@ -0,0 +1,20 @@
+"""
+    Laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils)
+
+Creates the Laplace operator operator `Δ` as a `TensorMapping`
+
+`Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using
+the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils`
+for the points in the closure regions.
+
+On a one-dimensional `grid`, `Δ` is a `SecondDerivative`. On a multi-dimensional `grid`, `Δ` is the sum of
+multi-dimensional `SecondDerivative`s where the sum is carried out lazily.
+"""
+function Laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim
+    Δ = SecondDerivative(grid, inner_stencil, closure_stencils, 1)
+    for d = 2:Dim
+        Δ += SecondDerivative(grid, inner_stencil, closure_stencils, d)
+    end
+    return Δ
+end
+export Laplace