comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 1600:b2496b001297 feature/boundary_conditions

REVIEW: Forgot to save...
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 29 May 2024 22:44:18 +0200
parents 37b05221beda
children 3e7438e2a033
comparison
equal deleted inserted replaced
1599:37b05221beda 1600:b2496b001297
51 end 51 end
52 return Δ 52 return Δ
53 end 53 end
54 laplace(g::EquidistantGrid, stencil_set) = second_derivative(g, stencil_set) 54 laplace(g::EquidistantGrid, stencil_set) = second_derivative(g, stencil_set)
55 55
56 # REVIEW: I think the handling of tuning parameters below should be through kwargs instead.
57
56 """ 58 """
57 sat_tensors(Δ::Laplace, g::Grid, bc::DirichletCondition, tuning) 59 sat_tensors(Δ::Laplace, g::Grid, bc::DirichletCondition, tuning)
58 60
59 The operators required to construct the SAT for imposing a Dirichlet condition. 61 The operators required to construct the SAT for imposing a Dirichlet condition.
60 `tuning` specifies the strength of the penalty. See 62 `tuning` specifies the strength of the penalty. See
70 d = normal_derivative(g, set, id) 72 d = normal_derivative(g, set, id)
71 B = positivity_decomposition(Δ, g, bc, tuning) 73 B = positivity_decomposition(Δ, g, bc, tuning)
72 sat_op = H⁻¹∘(d' - B*e')∘Hᵧ 74 sat_op = H⁻¹∘(d' - B*e')∘Hᵧ
73 return sat_op, e 75 return sat_op, e
74 end 76 end
75 BoundaryConditions.sat_tensors(Δ::Laplace, g::Grid, bc::DirichletCondition) = BoundaryConditions.sat_tensors(Δ, g, bc, (1.,1.)) 77 BoundaryConditions.sat_tensors(Δ::Laplace, g::Grid, bc::DirichletCondition) = BoundaryConditions.sat_tensors(Δ, g, bc, (1.,1.)) # REVIEW: Should be possible to replace this with argument default values.
76 78
77 """ 79 """
78 sat_tensors(Δ::Laplace, g::Grid, bc::NeumannCondition) 80 sat_tensors(Δ::Laplace, g::Grid, bc::NeumannCondition)
79 81
80 The operators required to construct the SAT for imposing a Neumann condition 82 The operators required to construct the SAT for imposing a Neumann condition
92 94
93 sat_op = -H⁻¹∘e'∘Hᵧ 95 sat_op = -H⁻¹∘e'∘Hᵧ
94 return sat_op, d 96 return sat_op, d
95 end 97 end
96 98
99 # REVIEW: This function assumes a TensorGrid right? In that case there should probably be a type annotation to get clearer error messages.
97 function positivity_decomposition(Δ::Laplace, g::Grid, bc::DirichletCondition, tuning) 100 function positivity_decomposition(Δ::Laplace, g::Grid, bc::DirichletCondition, tuning)
98 pos_prop = positivity_properties(Δ) 101 pos_prop = positivity_properties(Δ)
99 h = spacing(orthogonal_grid(g, bc.id)) 102 h = spacing(orthogonal_grid(g, bc.id))
100 θ_H = pos_prop.theta_H 103 θ_H = pos_prop.theta_H
101 τ_H = tuning[1]*ndims(g)/(h*θ_H) 104 τ_H = tuning[1]*ndims(g)/(h*θ_H)