Cosine-ramp implicit relaxation of one cell toward tgt.
decay = exp(-strength*alpha*dt), alpha the cosine ramp at band
position d; result = hTr_curdecay + tgt(1-decay). Funnels
through relax_toward for the shared core algebra (§3.1 / step 10
“one home” — the map-driven kernels derive decay from a per-cell
Idamp instead of this band/strength ramp, but both land on the
same cur*decay + tgt*(1-decay) update).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | hTr_cur | |||
| real(kind=wp), | intent(in) | :: | tgt | |||
| real(kind=wp), | intent(in) | :: | strength | |||
| integer, | intent(in) | :: | d | |||
| integer, | intent(in) | :: | band | |||
| real(kind=wp), | intent(in) | :: | dt |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private, | parameter | :: | PI | = | acos(-1.0_wp) | |
| real(kind=wp), | private | :: | alpha | ||||
| real(kind=wp), | private | :: | decay |
pure real(wp) function relax_one(hTr_cur, tgt, strength, d, band, dt) result(res) !! Cosine-ramp implicit relaxation of one cell toward `tgt`. !! `decay = exp(-strength*alpha*dt)`, alpha the cosine ramp at band !! position `d`; result = hTr_cur*decay + tgt*(1-decay). Funnels !! through `relax_toward` for the shared core algebra (§3.1 / step 10 !! "one home" — the map-driven kernels derive `decay` from a per-cell !! `Idamp` instead of this band/strength ramp, but both land on the !! same `cur*decay + tgt*(1-decay)` update). !$acc routine seq real(wp), intent(in) :: hTr_cur, tgt, strength, dt integer, intent(in) :: d, band real(wp) :: alpha, decay real(wp), parameter :: PI = acos(-1.0_wp) alpha = 0.5_wp*(1.0_wp + cos(PI*real(d, wp)/real(band, wp))) decay = exp(-strength*alpha*dt) res = relax_toward(hTr_cur, tgt, decay) end function relax_one