view src/SbpOperators/volumeops/laplace/laplace.jl @ 690:1accc3e051d0 refactor/operator_naming

Start changing the name of functions creating operators that are not types to lower case. E.g SecondDerivative->second_derivative
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 12 Feb 2021 16:16:45 +0100
parents d6edde60909b
children 3cd582257072 b4acd25943f4
line wrap: on
line source

"""
    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 equivalent to `second_derivative`. On a
multi-dimensional `grid`, `Δ` is the sum of multi-dimensional `second_derivative`s
where the sum is carried out lazily.
"""
function laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim
    Δ = second_derivative(grid, inner_stencil, closure_stencils, 1)
    for d = 2:Dim
        Δ += second_derivative(grid, inner_stencil, closure_stencils, d)
    end
    return Δ
end
export laplace