Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 708:693f5487ddba feature/laplace_opset
Minor clean up
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Tue, 16 Feb 2021 07:50:30 +0100 |
parents | a7efedbdede9 |
children | 0402b9042adc |
comparison
equal
deleted
inserted
replaced
707:ee1808820929 | 708:693f5487ddba |
---|---|
5 Implements the Laplace operator, approximating ∑d²/xᵢ² , i = 1,...,`Dim` as a | 5 Implements the Laplace operator, approximating ∑d²/xᵢ² , i = 1,...,`Dim` as a |
6 `TensorMapping`. Additionally, `Laplace` stores the inner product and boundary | 6 `TensorMapping`. Additionally, `Laplace` stores the inner product and boundary |
7 operators relevant for constructing a SBP finite difference scheme as `TensorMapping`s. | 7 operators relevant for constructing a SBP finite difference scheme as `TensorMapping`s. |
8 | 8 |
9 Laplace(grid::EquidistantGrid, fn; order) creates the Laplace operator on an | 9 Laplace(grid::EquidistantGrid, fn; order) creates the Laplace operator on an |
10 equidistant grid, where the operators are read from a TOML. The differential operator | 10 equidistant grid, where the operators are read from TOML. The differential operator |
11 is created using `laplace(grid,...)`. | 11 is created using `laplace(grid,...)`. |
12 """ | 12 """ |
13 struct Laplace{T, Dim, Rb, TMdiffop<:TensorMapping{T,Dim,Dim}, # Differential operator | 13 struct Laplace{T, Dim, Rb, TMdiffop<:TensorMapping{T,Dim,Dim}, # Differential operator |
14 TMipop<:TensorMapping{T,Dim,Dim}, # Inner product operator | 14 TMipop<:TensorMapping{T,Dim,Dim}, # Inner product operator |
15 TMbop<:TensorMapping{T,Rb,Dim}, # Boundary operator | 15 TMbop<:TensorMapping{T,Rb,Dim}, # Boundary operator |
39 Δ = laplace(grid, D_inner_stecil, D_closure_stencils) | 39 Δ = laplace(grid, D_inner_stecil, D_closure_stencils) |
40 H = inner_product(grid, H_closure_stencils) | 40 H = inner_product(grid, H_closure_stencils) |
41 H⁻¹ = inverse_inner_product(grid, H_closure_stencils) | 41 H⁻¹ = inverse_inner_product(grid, H_closure_stencils) |
42 | 42 |
43 # Boundary operator - id pairs | 43 # Boundary operator - id pairs |
44 bids = boundary_identifiers(grid) | 44 ids = boundary_identifiers(grid) |
45 e_pairs = ntuple(i -> Pair(bids[i],boundary_restriction(grid,e_closure_stencil,bids[i])),length(bids)) | 45 n_ids = length(ids) |
46 d_pairs = ntuple(i -> Pair(bids[i],normal_derivative(grid,d_closure_stencil,bids[i])),length(bids)) | 46 e_pairs = ntuple(i -> Pair(ids[i],boundary_restriction(grid,e_closure_stencil,ids[i])),n_ids) |
47 Hᵧ_pairs = ntuple(i -> Pair(bids[i],inner_product(boundary_grid(grid,bids[i]),H_closure_stencils)),length(bids)) | 47 d_pairs = ntuple(i -> Pair(ids[i],normal_derivative(grid,d_closure_stencil,ids[i])),n_ids) |
48 Hᵧ_pairs = ntuple(i -> Pair(ids[i],inner_product(boundary_grid(grid,ids[i]),H_closure_stencils)),n_ids) | |
48 | 49 |
49 return Laplace(Δ, H, H⁻¹, Dict(e_pairs), Dict(d_pairs), Dict(Hᵧ_pairs)) | 50 return Laplace(Δ, H, H⁻¹, Dict(e_pairs), Dict(d_pairs), Dict(Hᵧ_pairs)) |
50 end | 51 end |
51 | 52 |
52 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D) | 53 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D) |
59 export inverse_inner_product | 60 export inverse_inner_product |
60 boundary_restriction(L::Laplace,bid::BoundaryIdentifier) = L.e[bid] | 61 boundary_restriction(L::Laplace,bid::BoundaryIdentifier) = L.e[bid] |
61 export boundary_restriction | 62 export boundary_restriction |
62 normal_derivative(L::Laplace,bid::BoundaryIdentifier) = L.d[bid] | 63 normal_derivative(L::Laplace,bid::BoundaryIdentifier) = L.d[bid] |
63 export normal_derivative | 64 export normal_derivative |
65 # TODO: boundary_inner_product? | |
64 boundary_quadrature(L::Laplace,bid::BoundaryIdentifier) = L.H_boundary[bid] | 66 boundary_quadrature(L::Laplace,bid::BoundaryIdentifier) = L.H_boundary[bid] |
65 export boundary_quadrature | 67 export boundary_quadrature |
66 | 68 |
67 """ | 69 """ |
68 laplace(grid::EquidistantGrid, inner_stencil, closure_stencils) | 70 laplace(grid::EquidistantGrid, inner_stencil, closure_stencils) |