Shared core algebra for BOTH sponge paths: cur*decay +
tgt*(1-decay) — the exact solution of dphi/dt = -Idamp*(phi -
phi_ref) over one step at constant phi_ref, for whatever
decay = exp(-rate*dt) the caller derived (relax_one derives it
from the legacy edge/band cosine ramp; the map kernels above derive
it directly from a per-cell Idamp). “One home” for the algebra
per the plan (§3.1 / step 10).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | cur | |||
| real(kind=wp), | intent(in) | :: | tgt | |||
| real(kind=wp), | intent(in) | :: | decay |
pure real(wp) function relax_toward(cur, tgt, decay) result(res) !! Shared core algebra for BOTH sponge paths: `cur*decay + !! tgt*(1-decay)` — the exact solution of `dphi/dt = -Idamp*(phi - !! phi_ref)` over one step at constant `phi_ref`, for whatever !! `decay = exp(-rate*dt)` the caller derived (`relax_one` derives it !! from the legacy edge/band cosine ramp; the map kernels above derive !! it directly from a per-cell `Idamp`). "One home" for the algebra !! per the plan (§3.1 / step 10). !$acc routine seq real(wp), intent(in) :: cur, tgt, decay res = cur*decay + tgt*(1.0_wp - decay) end function relax_toward