Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/quadratures/quadrature.jl @ 651:67639b1c99ea
Merged feature/volume_and_boundary_operators
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 20 Jan 2021 17:52:55 +0100 |
parents | 0e20bfef5cee |
children | 2a95beb9ef1d e14627e79a54 |
comparison
equal
deleted
inserted
replaced
615:52749b687a67 | 651:67639b1c99ea |
---|---|
1 """ | |
2 Quadrature(grid::EquidistantGrid, inner_stencil, closure_stencils) | |
3 | |
4 Creates the quadrature operator `H` as a `TensorMapping` | |
5 | |
6 The quadrature approximates the integral operator on the grid using | |
7 `inner_stencil` in the interior and a set of stencils `closure_stencils` | |
8 for the points in the closure regions. | |
9 | |
10 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 | |
12 each coordinate direction. Also see the documentation of | |
13 `SbpOperators.volume_operator(...)` for more details. | |
14 """ | |
15 function Quadrature(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim | |
16 h = spacing(grid) | |
17 H = SbpOperators.volume_operator(grid, scale(inner_stencil,h[1]), scale.(closure_stencils,h[1]), even, 1) | |
18 for i ∈ 2:Dim | |
19 Hᵢ = SbpOperators.volume_operator(grid, scale(inner_stencil,h[i]), scale.(closure_stencils,h[i]), even, i) | |
20 H = H∘Hᵢ | |
21 end | |
22 return H | |
23 end | |
24 export Quadrature | |
25 | |
26 """ | |
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(Tuple{T}(1),center=1) | |
34 return Quadrature(grid, inner_stencil, closure_stencils) | |
35 end | |
36 export DiagonalQuadrature |