From f779070d0063966320bc28455c2b924bf8598bb8 Mon Sep 17 00:00:00 2001 From: Liwei Ji Date: Thu, 28 Dec 2023 09:23:09 -0500 Subject: [PATCH] src: Fix bug of set refine boundary in ApplyTransitionZone --- src/Sync.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Sync.jl b/src/Sync.jl index f4ae881..9ded1e0 100644 --- a/src/Sync.jl +++ b/src/Sync.jl @@ -20,10 +20,8 @@ function calc_kfs_from_kcs(kcs, dtc, interp_in_time::Bool) ] end -function transition_profile(a, b, x; type = 1) - @assert(b - x > -1e-12, "b less then a is not allowed") - @assert(x - a > -1e-12, "b less then a is not allowed") - t0 = (x - a) / (b - a) +function transition_profile(xl, xh, x; type = 1) + t0 = (x - xl) / (xh - xl) t = t0 < 0 ? 0 : (t0 > 1 ? 1 : t0) if type == 1 # boxstep @@ -52,10 +50,12 @@ function ApplyTransitionZone(gfs, l, interp_in_time::Bool; ord_s = 3) # for transition zone xbox = gfs.grid.levs[l].xbox dxf = gfs.grid.levs[l].dx + @assert(isapprox(xbox[1], gfs.levs[l].x[1+nbuf]; rtol = 1e-12)) + @assert(isapprox(xbox[2], gfs.levs[l].x[nxa-nbuf]; rtol = 1e-12)) for j = 1:2 # left or right - a = (j == 1) ? xbox[1] : xbox[2] - (ntrans - 1) * dxf - b = (j == 1) ? xbox[1] + (ntrans - 1) * dxf : xbox[2] + a = (j == 1) ? xbox[1] : xbox[2] + b = (j == 1) ? xbox[1] + (ntrans - 1) * dxf : xbox[2] - (ntrans - 1) * dxf for v = 1:gfs.nd uf = levf.u[v] uc_p = levc.u_p[v]