comparison src/SbpOperators/boundaryops/boundary_operator.jl @ 1099:05a25a5063bb refactor/sbpoperators/inflation

Try to remove volume_operator and boundary_operator methods
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 21 Mar 2022 12:51:39 +0100
parents 52f07c77299d
children 157a78959e5d
comparison
equal deleted inserted replaced
1024:5be17f647018 1099:05a25a5063bb
1 """
2 boundary_operator(grid,closure_stencil,boundary)
3
4 Creates a boundary operator on a `Dim`-dimensional grid for the
5 specified `boundary`. The action of the operator is determined by `closure_stencil`.
6
7 When `Dim=1`, the corresponding `BoundaryOperator` tensor mapping is returned.
8 When `Dim>1`, the `BoundaryOperator` `op` is inflated by the outer product
9 of `IdentityTensors` in orthogonal coordinate directions, e.g for `Dim=3`,
10 the boundary restriction operator in the y-direction direction is `Ix⊗op⊗Iz`.
11 """
12 function boundary_operator(grid::EquidistantGrid, closure_stencil, boundary::CartesianBoundary)
13 #TODO:Check that dim(boundary) <= Dim?
14
15 d = dim(boundary)
16 op = BoundaryOperator(restrict(grid, d), closure_stencil, region(boundary))
17
18 # Create 1D IdentityTensors for each coordinate direction
19 one_d_grids = restrict.(Ref(grid), Tuple(1:dimension(grid)))
20 Is = IdentityTensor{eltype(grid)}.(size.(one_d_grids))
21
22 return LazyTensors.inflate(op, size(grid), d)
23 end
24
25 """ 1 """
26 BoundaryOperator{T,R,N} <: LazyTensor{T,0,1} 2 BoundaryOperator{T,R,N} <: LazyTensor{T,0,1}
27 3
28 Implements the boundary operator `op` for 1D as a `LazyTensor` 4 Implements the boundary operator `op` for 1D as a `LazyTensor`
29 5