comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 1106:b4ee47f2aafb feature/boundary_conditions

Start implementing functions for boundary conditions associated with Laplace
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 13 Jun 2022 13:46:24 +0200
parents 7fc8df5157a7
children 302d36b5ba8e
comparison
equal deleted inserted replaced
1086:74c54996de6a 1106:b4ee47f2aafb
51 for d = 2:dimension(grid) 51 for d = 2:dimension(grid)
52 Δ += second_derivative(grid, inner_stencil, closure_stencils, d) 52 Δ += second_derivative(grid, inner_stencil, closure_stencils, d)
53 end 53 end
54 return Δ 54 return Δ
55 end 55 end
56
57 sat(Δ::Laplace, g::EquidistantGrid, bc::BoundaryCondition{Neumann}) = neumann_sat(Δ, g, bc.id)
58
59 function neumann_sat(Δ::Laplace, g::EquidistantGrid{1}, id::BoundaryIdentifier)
60 set = Δ.stencil_set
61 H⁻¹ = inverse_inner_product(g,set)
62 e = boundary_restriction(g, set, id)
63 d = normal_derivative(g, set, id)
64 return f(u,data) = H⁻¹∘e'∘(d*u .- data)
65 #closure = H⁻¹∘e'∘d
66 #penalty = -H⁻¹∘e'
67 #return closure, penalty
68 end
69
70
71
72 function neumann_sat(Δ::Laplace, g::EquidistantGrid, id::BoundaryIdentifier)
73 set = Δ.stencil_set
74 H⁻¹ = inverse_inner_product(g, set)
75 orth_dims = Tuple(filter(i -> i != dimension(g), 1:dimension(g)))
76 Hᵧ = inner_product(restrict(g, orth_dims...), set)
77 e = boundary_restriction(g, set, id)
78 d = normal_derivative(g, set, id)
79 return f(u,data) = H⁻¹∘e'∘Hᵧ∘(d*u .- data)
80 #closure = H⁻¹∘e'∘Hᵧ∘d
81 #penalty = -H⁻¹∘e'∘Hᵧ
82 #return closure, penalty
83 end