Mercurial > repos > public > sbplib_julia
changeset 1606:93b86625fcfd feature/boundary_conditions
REVIEW: Suggest split of tuning tuple. Please help with names!
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 08 Jun 2024 23:47:23 +0200 |
parents | 1388149b54ad |
children | 7216448d0c5a |
files | src/SbpOperators/volumeops/laplace/laplace.jl |
diffstat | 1 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/laplace/laplace.jl Sat Jun 08 23:43:49 2024 +0200 +++ b/src/SbpOperators/volumeops/laplace/laplace.jl Sat Jun 08 23:47:23 2024 +0200 @@ -62,14 +62,14 @@ See also: [`sat`,`DirichletCondition`, `positivity_decomposition`](@ref). """ -function sat_tensors(Δ::Laplace, g::Grid, bc::DirichletCondition; tuning = (1., 1.)) +function sat_tensors(Δ::Laplace, g::Grid, bc::DirichletCondition; H_tuning = 1., R_tuning = 1.) id = boundary(bc) set = Δ.stencil_set H⁻¹ = inverse_inner_product(g,set) Hᵧ = inner_product(boundary_grid(g, id), set) e = boundary_restriction(g, set, id) d = normal_derivative(g, set, id) - B = positivity_decomposition(Δ, g, bc, tuning) + B = positivity_decomposition(Δ, g, bc; H_tuning, R_tuning) penalty_tensor = H⁻¹∘(d' - B*e')∘Hᵧ return penalty_tensor, e end @@ -97,24 +97,24 @@ # TODO: We should consider implementing a proper BoundaryIdentifier for EquidistantGrid and then # change bc::BoundaryCondition to id::BoundaryIdentifier -function positivity_decomposition(Δ::Laplace, g::EquidistantGrid, bc::BoundaryCondition, tuning) +function positivity_decomposition(Δ::Laplace, g::EquidistantGrid, bc::BoundaryCondition; H_tuning, R_tuning) pos_prop = positivity_properties(Δ) h = spacing(g) θ_H = pos_prop.theta_H - τ_H = tuning[1]*ndims(g)/(h*θ_H) + τ_H = H_tuning*ndims(g)/(h*θ_H) θ_R = pos_prop.theta_R - τ_R = tuning[2]/(h*θ_R) + τ_R = R_tuning/(h*θ_R) B = τ_H + τ_R return B end -function positivity_decomposition(Δ::Laplace, g::TensorGrid, bc::BoundaryCondition, tuning) +function positivity_decomposition(Δ::Laplace, g::TensorGrid, bc::BoundaryCondition; H_tuning, R_tuning) pos_prop = positivity_properties(Δ) h = spacing(g.grids[grid_id(boundary(bc))]) # grid spacing of the 1D grid normal to the boundary θ_H = pos_prop.theta_H - τ_H = tuning[1]*ndims(g)/(h*θ_H) + τ_H = H_tuning*ndims(g)/(h*θ_H) θ_R = pos_prop.theta_R - τ_R = tuning[2]/(h*θ_R) + τ_R = R_tuning/(h*θ_R) B = τ_H + τ_R return B end