annotate src/SbpOperators/volumeops/derivatives/first_derivative.jl @ 972:803f60f461c1 feature/first_derivative

Start adding the first derivative
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 14 Mar 2022 16:01:33 +0100
parents
children ba023fc09961
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
972
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
1 export first_derivative
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
2
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
3 """
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
4 first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction)
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
5
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
6 Creates the first-derivative operator `D1` as a `TensorMapping`
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
7
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
8 `D1` approximates the first-derivative d/dξ on `grid` along the coordinate dimension specified by
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
9 `direction`, using the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils`
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
10 for the points in the closure regions.
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
11
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
12 On a one-dimensional `grid`, `D1` is a `VolumeOperator`. On a multi-dimensional `grid`, `D1` is the outer product of the
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
13 one-dimensional operator with the `IdentityMapping`s in orthogonal coordinate dirrections.
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
14
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
15 See also: [`SbpOperators.volume_operator`](@ref).
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
16 """
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
17 function first_derivative(grid::EquidistantGrid, inner_stencil, closure_stencils, direction)
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
18 h_inv = inverse_spacing(grid)[direction]
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
19 return SbpOperators.volume_operator(grid, scale(inner_stencil,h_inv), scale.(closure_stencils,h_inv), odd, direction)
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
20 end
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
21 first_derivative(grid::EquidistantGrid{1}, inner_stencil, closure_stencils) = first_derivative(grid,inner_stencil,closure_stencils,1)
803f60f461c1 Start adding the first derivative
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
22