annotate src/SbpOperators/volumeops/quadratures/inverse_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 0bec3c4e78c0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
696
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
1 """
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
2 inverse_inner_product(grid::EquidistantGrid, inv_inner_stencil, inv_closure_stencils)
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
3 inverse_inner_product(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}})
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
4
696
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
5 Creates the inverse inner product operator `H⁻¹` as a `TensorMapping` on an
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
6 equidistant grid. `H⁻¹` is defined implicitly by `H⁻¹∘H = I`, where
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
7 `H` is the corresponding inner product operator and `I` is the `IdentityMapping`.
642
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
8
696
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
9 `inverse_inner_product(grid::EquidistantGrid, inv_inner_stencil, inv_closure_stencils)`
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
10 constructs `H⁻¹` using a set of stencils `inv_closure_stencils` for the points
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
11 in the closure regions and the stencil `inv_inner_stencil` in the interior. If
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
12 `inv_closure_stencils` is omitted, a central interior stencil with weight 1 is used.
342
3c2238c681b5 Add missing file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
13
696
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
14 `inverse_inner_product(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}})`
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
15 constructs a diagonal inverse inner product operator where `closure_stencils` are the
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
16 closure stencils of `H` (not `H⁻¹`!).
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
17
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
18 On a 1-dimensional `grid`, `H⁻¹` is a `VolumeOperator`. On a N-dimensional
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
19 `grid`, `H⁻¹` is the outer product of the 1-dimensional inverse inner product
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
20 operators in each coordinate direction. Also see the documentation of
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
21 `SbpOperators.volume_operator(...)` for more details. On a 0-dimensional `grid`,
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
22 `H⁻¹` is a 0-dimensional `IdentityMapping`.
342
3c2238c681b5 Add missing file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
23 """
696
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
24 function inverse_inner_product(grid::EquidistantGrid, inv_closure_stencils, inv_inner_stencil = CenteredStencil(one(eltype(grid))))
642
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
25 h⁻¹ = inverse_spacing(grid)
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
26 H⁻¹ = SbpOperators.volume_operator(grid,scale(inv_inner_stencil,h⁻¹[1]),scale.(inv_closure_stencils,h⁻¹[1]),even,1)
696
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
27 for i ∈ 2:dimension(grid)
642
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
28 Hᵢ⁻¹ = SbpOperators.volume_operator(grid,scale(inv_inner_stencil,h⁻¹[i]),scale.(inv_closure_stencils,h⁻¹[i]),even,i)
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
29 H⁻¹ = H⁻¹∘Hᵢ⁻¹
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
30 end
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
31 return H⁻¹
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
32 end
696
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
33 export inverse_inner_product
642
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
34
696
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
35 inverse_inner_product(grid::EquidistantGrid{0}, inv_closure_stencils, inv_inner_stencil) = IdentityMapping{eltype(grid)}()
642
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
36
696
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
37 function inverse_inner_product(grid::EquidistantGrid, closure_stencils::NTuple{M,Stencil{T,1}}) where {M,T}
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
38 inv_closure_stencils = reciprocal_stencil.(closure_stencils)
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
39 inv_inner_stencil = CenteredStencil(one(T))
0bec3c4e78c0 Rename InverseQuadrature to inverse_inner_product. Make InverseDiagonalQuadrature a special case of inverse_inner_product
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 671
diff changeset
40 return inverse_inner_product(grid, inv_closure_stencils, inv_inner_stencil)
342
3c2238c681b5 Add missing file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
41 end
3c2238c681b5 Add missing file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
42
642
f4a16b403487 Implement the inverse quadrature operator as a volume operator and update tests.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 636
diff changeset
43 reciprocal_stencil(s::Stencil{T}) where T = Stencil(s.range,one(T)./s.weights)