Mercurial > repos > public > sbplib_julia
view src/SbpOperators/volumeops/derivatives/second_derivative.jl @ 1354:150313ed2cae
Merge refactor/grids (missed delete of a note)
Changes from previous merge:
* `EquidistantGrid` is now only a 1D thing.
* Higher dimensions are supported through `TensorGrid`.
* The old behavior of `EquidistantGrid` has been moved to the function `equidistant_grid`.
* Grids embedded in higher dimensions are now supported through tensor products with `ZeroDimGrid`s.
* Vector valued grid functions are now supported and the default element type is `SVector`.
* Grids are now expected to support Julia's indexing and iteration interface.
* `eval_on` can be called with both `f(x,y,...)` and `f(x̄)`.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 20 May 2023 14:19:20 +0200 |
parents | 08f06bfacd5c |
children |
line wrap: on
line source
""" second_derivative(g::EquidistantGrid, stencil_set, direction) Creates the second derivative operator `D2` as a `LazyTensor` `D2` approximates the second-derivative d²/dξ² on `g` along the coordinate dimension specified by `direction`. See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref). """ function second_derivative(g::TensorGrid, stencil_set, direction) D₂ = second_derivative(g.grids[direction], stencil_set) return LazyTensors.inflate(D₂, size(g), direction) end """ second_derivative(g::EquidistantGrid, stencil_set::::StencilSet) The second derivative operator on an `EquidistantGrid`. Uses the `D2` stencil in `stencil_set`. """ function second_derivative(g::EquidistantGrid, stencil_set::StencilSet) inner_stencil = parse_stencil(stencil_set["D2"]["inner_stencil"]) closure_stencils = parse_stencil.(stencil_set["D2"]["closure_stencils"]) return second_derivative(g, inner_stencil, closure_stencils) end """ second_derivative(g::EquidistantGrid, inner_stencil::Stencil, closure_stencils) The second derivative operator on an `EquidistantGrid`, given `inner_stencil` and `closure_stencils`. """ function second_derivative(g::EquidistantGrid, inner_stencil::Stencil, closure_stencils) h⁻¹ = inverse_spacing(g) return VolumeOperator(g, scale(inner_stencil,h⁻¹^2), scale.(closure_stencils,h⁻¹^2), even) end