Skip to content
Snippets Groups Projects
Commit fb6dc01d authored by Florian Atteneder's avatar Florian Atteneder
Browse files

Limiter: factor out convex hull limiter logic...

Limiter: factor out convex hull limiter logic (!225)

for convenience for making plots
parent acd803ca
No related branches found
No related tags found
1 merge request!225Limiter: factor out convex hull limiter logic
Pipeline #7268 passed
......@@ -207,16 +207,22 @@ function limit_slope_convex_hull!(var::AbstractArray, mask::AbstractArray,
idxs_lhs, idxs_rhs = cellindices.(Ref(mesh), (k-1,k+1))
vvar_lhs, vvar_rhs = view.(Ref(var), (idxs_lhs,idxs_rhs))
vtmp_var[1] = vvar[1] + (vvar_lhs[end]-vvar[1])*w
vtmp_var[end] = vvar[end] + (vvar_rhs[1]-vvar[end])*w
for i in 2:Npts-1
ul, uc, ur = vvar[i-1], vvar[i], vvar[i+1]
xl, xc, xr = vx[i-1], vx[i], vx[i+1]
um = ul + (ur-ul)/(xr-xl)*(xc-xl)
vtmp_var[i] = uc + (um-uc)*w
end
impl_limit_slope_convex_hull!(vtmp_var, vvar, vvar_lhs, vvar_rhs, vx, w)
end
copyto!(var, tmp_var)
end
end
@inline function impl_limit_slope_convex_hull!(vtmp_var, vvar, vvar_lhs, vvar_rhs, vx, w)
vtmp_var[1] = vvar[1] + (vvar_lhs[end]-vvar[1])*w
vtmp_var[end] = vvar[end] + (vvar_rhs[1]-vvar[end])*w
Npts = length(vvar)
for i in 2:Npts-1
ul, uc, ur = vvar[i-1], vvar[i], vvar[i+1]
xl, xc, xr = vx[i-1], vx[i], vx[i+1]
um = ul + (ur-ul)/(xr-xl)*(xc-xl)
vtmp_var[i] = uc + (um-uc)*w
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment