Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/laplace/laplace.jl @ 1608:8315c456e3b4 feature/boundary_conditions
Simplify parsing of constants from stencil set
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 09 Jun 2024 00:17:44 +0200 |
parents | 7216448d0c5a |
children | e41eddc640f3 |
comparison
equal
deleted
inserted
replaced
1607:7216448d0c5a | 1608:8315c456e3b4 |
---|---|
102 | 102 |
103 | 103 |
104 # TODO: We should consider implementing a proper BoundaryIdentifier for EquidistantGrid and then | 104 # TODO: We should consider implementing a proper BoundaryIdentifier for EquidistantGrid and then |
105 # change bc::BoundaryCondition to id::BoundaryIdentifier | 105 # change bc::BoundaryCondition to id::BoundaryIdentifier |
106 function positivity_limits(Δ::Laplace, g::EquidistantGrid, bc::DirichletCondition) | 106 function positivity_limits(Δ::Laplace, g::EquidistantGrid, bc::DirichletCondition) |
107 pos_prop = positivity_properties(Δ) | |
108 h = spacing(g) | 107 h = spacing(g) |
109 θ_H = pos_prop.theta_H | 108 θ_H = parse_scalar(Δ.stencil_set["H"]["closure"][1]) |
109 θ_R = parse_scalar(Δ.stencil_set["D2"]["positivity"]["theta_R"]) | |
110 | |
110 τ_H = 1/(h*θ_H) | 111 τ_H = 1/(h*θ_H) |
111 θ_R = pos_prop.theta_R | |
112 τ_R = 1/(h*θ_R) | 112 τ_R = 1/(h*θ_R) |
113 return τ_H, τ_R | 113 return τ_H, τ_R |
114 end | 114 end |
115 | 115 |
116 function positivity_limits(Δ::Laplace, g::TensorGrid, bc::DirichletCondition) | 116 function positivity_limits(Δ::Laplace, g::TensorGrid, bc::DirichletCondition) |
117 τ_H, τ_R = positivity_limits(Δ, g.grids[grid_id(boundary(bc))], bc) | 117 τ_H, τ_R = positivity_limits(Δ, g.grids[grid_id(boundary(bc))], bc) |
118 return τ_H*ndims(g), τ_R | 118 return τ_H*ndims(g), τ_R |
119 end | 119 end |
120 | |
121 | |
122 function positivity_properties(Δ::Laplace) | |
123 D2_pos_prop = parse_named_tuple(Δ.stencil_set["D2"]["positivity"]) | |
124 H_closure = parse_tuple(Δ.stencil_set["H"]["closure"]) | |
125 return merge(D2_pos_prop, (theta_H = H_closure[1],)) | |
126 end |