view src/SbpOperators/volumeops/derivatives/second_derivative.jl @ 932:863287577ad4 feature/variable_derivatives

Temporarily add specialized methods for 2D
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 22 Feb 2022 07:24:22 +0100
parents b4acd25943f4
children 6b47a9ee1632
line wrap: on
line source

"""
    second_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction)

Creates the second-derivative operator `D2` as a `TensorMapping`

`D2` approximates the second-derivative d²/dξ² on `grid` along the coordinate dimension specified by
`direction`, 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`, `D2` is a `VolumeOperator`. On a multi-dimensional `grid`, `D2` is the outer product of the
one-dimensional operator with the `IdentityMapping`s in orthogonal coordinate dirrections.
Also see the documentation of `SbpOperators.volume_operator(...)` for more details.
"""
function second_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction)
    h_inv = inverse_spacing(grid)[direction]
    return SbpOperators.volume_operator(grid, scale(inner_stencil,h_inv^2), scale.(closure_stencils,h_inv^2), even, direction)
end
second_derivative(grid::EquidistantGrid{1}, inner_stencil, closure_stencils) = second_derivative(grid,inner_stencil,closure_stencils,1)
export second_derivative