Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/volumeops/quadratures/quadrature.jl @ 698:5ddf28ddee18 refactor/operator_naming
Test inverse_inner_product on 0-dimensional grid
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Sun, 14 Feb 2021 13:52:13 +0100 |
parents | fc755b29d418 |
children |
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 """ |
695
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
2 inner_product(grid::EquidistantGrid, closure_stencils, inner_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
|
3 |
695
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
4 Creates the discrete inner product operator `H` as a `TensorMapping` on an equidistant |
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
5 grid, defined as `(u,v) = u'Hv` for grid functions `u,v`. |
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
|
6 |
695
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
7 `inner_product(grid::EquidistantGrid, closure_stencils, inner_stencil)` creates |
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
8 `H` on `grid` the using a set of stencils `closure_stencils` for the points in |
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
9 the closure regions and the stencil and `inner_stencil` in the interior. If |
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
10 `inner_stencil` is omitted a central 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 |
695
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
12 On a 1-dimensional `grid`, `H` is a `VolumeOperator`. On a N-dimensional |
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
13 `grid`, `H` is the outer product of the 1-dimensional inner product 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 |
689
728fd5a2455a
Change order of arguments for quadrature, and make inner_stencil have a default argument
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
681
diff
changeset
|
15 `SbpOperators.volume_operator(...)` for more details. On a 0-dimensional `grid`, |
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
|
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 """ |
695
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
18 function inner_product(grid::EquidistantGrid, closure_stencils, inner_stencil = CenteredStencil(one(eltype(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
|
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 |
695
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
27 export inner_product |
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
|
28 |
695
fc755b29d418
Rename quadrature to inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
689
diff
changeset
|
29 inner_product(grid::EquidistantGrid{0}, closure_stencils, inner_stencil) = IdentityMapping{eltype(grid)}() |