comparison src/SbpOperators/volumeops/quadratures/quadrature.jl @ 693:d52902f36868

Merging feature/boundary_quads
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Sat, 13 Feb 2021 16:05:02 +0100
parents 728fd5a2455a
children fc755b29d418
comparison
equal deleted inserted replaced
674:621460cf8279 693:d52902f36868
1 """ 1 """
2 Quadrature(grid::EquidistantGrid, inner_stencil, closure_stencils) 2 quadrature(grid::EquidistantGrid, closure_stencils, inner_stencil)
3 quadrature(grid::EquidistantGrid, closure_stencils)
3 4
4 Creates the quadrature operator `H` as a `TensorMapping` 5 Creates the quadrature operator `H` as a `TensorMapping`
5 6
6 The quadrature approximates the integral operator on the grid using 7 `H` approximiates the integral operator on `grid` the using the stencil
7 `inner_stencil` in the interior and a set of stencils `closure_stencils` 8 `inner_stencil` in the interior and a set of stencils `closure_stencils`
8 for the points in the closure regions. 9 for the points in the closure regions. If `inner_stencil` is omitted a central
10 interior stencil with weight 1 is used.
9 11
10 On a one-dimensional `grid`, `H` is a `VolumeOperator`. On a multi-dimensional 12 On a one-dimensional `grid`, `H` is a `VolumeOperator`. On a multi-dimensional
11 `grid`, `H` is the outer product of the 1-dimensional quadrature operators in 13 `grid`, `H` is the outer product of the 1-dimensional quadrature operators in
12 each coordinate direction. Also see the documentation of 14 each coordinate direction. Also see the documentation of
13 `SbpOperators.volume_operator(...)` for more details. 15 `SbpOperators.volume_operator(...)` for more details. On a 0-dimensional `grid`,
16 `H` is a 0-dimensional `IdentityMapping`.
14 """ 17 """
15 function Quadrature(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim 18 function quadrature(grid::EquidistantGrid, closure_stencils, inner_stencil = CenteredStencil(one(eltype(grid))))
16 h = spacing(grid) 19 h = spacing(grid)
17 H = SbpOperators.volume_operator(grid, scale(inner_stencil,h[1]), scale.(closure_stencils,h[1]), even, 1) 20 H = SbpOperators.volume_operator(grid, scale(inner_stencil,h[1]), scale.(closure_stencils,h[1]), even, 1)
18 for i ∈ 2:Dim 21 for i ∈ 2:dimension(grid)
19 Hᵢ = SbpOperators.volume_operator(grid, scale(inner_stencil,h[i]), scale.(closure_stencils,h[i]), even, i) 22 Hᵢ = SbpOperators.volume_operator(grid, scale(inner_stencil,h[i]), scale.(closure_stencils,h[i]), even, i)
20 H = H∘Hᵢ 23 H = H∘Hᵢ
21 end 24 end
22 return H 25 return H
23 end 26 end
24 export Quadrature 27 export quadrature
25 28
26 """ 29 quadrature(grid::EquidistantGrid{0}, closure_stencils, inner_stencil) = IdentityMapping{eltype(grid)}()
27 DiagonalQuadrature(grid::EquidistantGrid, closure_stencils)
28
29 Creates the quadrature operator with the inner stencil 1/h and 1-element sized
30 closure stencils (i.e the operator is diagonal)
31 """
32 function DiagonalQuadrature(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}}) where {M,T}
33 inner_stencil = Stencil(one(T), center=1)
34 return Quadrature(grid, inner_stencil, closure_stencils)
35 end
36 export DiagonalQuadrature