Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/volumeops/quadratures/quadrature.jl @ 681:43cf58c69f91 feature/boundary_quads
Remove methods boundary_quadrature, and instead specialize quadrature on a zero-dimensional grid to return the IdentityMapping
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 08 Feb 2021 18:44:44 +0100 |
parents | 1ce3a104afc8 |
children | 728fd5a2455a |
rev | line source |
---|---|
328
9cc5d1498b2d
Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
1 """ |
669
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
2 quadrature(grid::EquidistantGrid, inner_stencil, closure_stencils) |
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
3 quadrature(grid::EquidistantGrid, closure_stencils) |
638
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
4 |
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
5 Creates the quadrature operator `H` as a `TensorMapping` |
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
6 |
669
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
7 `H` approximiates the integral operator on `grid` the using the stencil |
638
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
8 `inner_stencil` in the interior and a set of stencils `closure_stencils` |
669
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
9 for the points in the closure regions. If `inner_stencil` is omitted a central |
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
10 interior stencil with weight 1 is used. |
328
9cc5d1498b2d
Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
11 |
638
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
12 On a one-dimensional `grid`, `H` is a `VolumeOperator`. On a multi-dimensional |
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
13 `grid`, `H` is the outer product of the 1-dimensional quadrature operators in |
640
0e20bfef5cee
remove extra space
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
638
diff
changeset
|
14 each coordinate direction. Also see the documentation of |
681
43cf58c69f91
Remove methods boundary_quadrature, and instead specialize quadrature on a zero-dimensional grid to return the IdentityMapping
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
675
diff
changeset
|
15 `SbpOperators.volume_operator(...)` for more details. On 0-dimensional `grid`, |
43cf58c69f91
Remove methods boundary_quadrature, and instead specialize quadrature on a zero-dimensional grid to return the IdentityMapping
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
675
diff
changeset
|
16 `H` is a 0-dimensional `IdentityMapping`. |
328
9cc5d1498b2d
Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
17 """ |
681
43cf58c69f91
Remove methods boundary_quadrature, and instead specialize quadrature on a zero-dimensional grid to return the IdentityMapping
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
675
diff
changeset
|
18 function quadrature(grid::EquidistantGrid, inner_stencil, closure_stencils) |
638
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
19 h = spacing(grid) |
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
20 H = SbpOperators.volume_operator(grid, scale(inner_stencil,h[1]), scale.(closure_stencils,h[1]), even, 1) |
669
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
21 for i ∈ 2:dimension(grid) |
638
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
22 Hᵢ = SbpOperators.volume_operator(grid, scale(inner_stencil,h[i]), scale.(closure_stencils,h[i]), even, i) |
08b2c7a2d063
Implement the Quadrature operator as a VolumeOperator. Make DiagonalQuadrature a special case of the general Quadrature operator. Update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
636
diff
changeset
|
23 H = H∘Hᵢ |
504
21fba50cb5b0
Use LazyOuterProduct to construct multi-dimensional quadratures. This change allwed to:
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
362
diff
changeset
|
24 end |
21fba50cb5b0
Use LazyOuterProduct to construct multi-dimensional quadratures. This change allwed to:
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
362
diff
changeset
|
25 return H |
21fba50cb5b0
Use LazyOuterProduct to construct multi-dimensional quadratures. This change allwed to:
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
362
diff
changeset
|
26 end |
669
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
27 export quadrature |
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
28 |
681
43cf58c69f91
Remove methods boundary_quadrature, and instead specialize quadrature on a zero-dimensional grid to return the IdentityMapping
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
675
diff
changeset
|
29 quadrature(grid::EquidistantGrid{0,T}, inner_stencil, closure_stencils) where T = IdentityMapping{T}() |
43cf58c69f91
Remove methods boundary_quadrature, and instead specialize quadrature on a zero-dimensional grid to return the IdentityMapping
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
675
diff
changeset
|
30 #TODO: Consider changing the interface of volume_operator to volume_operator(grid,closure_stencils,inner_stencil) |
43cf58c69f91
Remove methods boundary_quadrature, and instead specialize quadrature on a zero-dimensional grid to return the IdentityMapping
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
675
diff
changeset
|
31 # in order to allow for having quadrature(grid, closure_stencils, inner_stencil = CenteredStencil(one(T))) |
43cf58c69f91
Remove methods boundary_quadrature, and instead specialize quadrature on a zero-dimensional grid to return the IdentityMapping
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
675
diff
changeset
|
32 # Then the below function can be removed. |
43cf58c69f91
Remove methods boundary_quadrature, and instead specialize quadrature on a zero-dimensional grid to return the IdentityMapping
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
675
diff
changeset
|
33 function quadrature(grid::EquidistantGrid{Dim,T}, closure_stencils) where {Dim,T} |
675 | 34 inner_stencil = CenteredStencil(one(T)) |
669
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
35 return quadrature(grid, inner_stencil, closure_stencils) |
2a95beb9ef1d
Add methods for getting boundary quadratures of a grid. Align naming of quadrature operators.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
640
diff
changeset
|
36 end |