Inverse map: interpolate an interface quantity qc(1:nzc+1) on the
merged grid back to the original nz+1 interfaces. kf==0 takes a
pure lookup; interior interfaces take the linear blend between merged
interfaces kc(K) and kc(K)+1 (in range since kf>0 only when
kc(K) < nzc+1). Identity case: kf==0 everywhere -> q==qc.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | qc(NZLI) |
Interface quantity on the merged grid (valid 1..nzc+1). |
||
| integer, | intent(in) | :: | kc(NZLI) | |||
| real(kind=wp), | intent(in) | :: | kf(NZLI) | |||
| integer, | intent(in) | :: | nz | |||
| real(kind=wp), | intent(out) | :: | q(NZLI) |
Interface quantity on the original grid (filled 1..nz+1). |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | kk |
pure subroutine massless_interp_back(qc, kc, kf, nz, q) !! Inverse map: interpolate an interface quantity `qc(1:nzc+1)` on the !! merged grid back to the original `nz+1` interfaces. `kf==0` takes a !! pure lookup; interior interfaces take the linear blend between merged !! interfaces `kc(K)` and `kc(K)+1` (in range since `kf>0` only when !! `kc(K) < nzc+1`). Identity case: `kf==0` everywhere -> `q==qc`. !$acc routine seq integer, intent(in) :: nz real(wp), intent(in) :: qc(NZLI) !! Interface quantity on the merged grid (valid 1..nzc+1). integer, intent(in) :: kc(NZLI) real(wp), intent(in) :: kf(NZLI) real(wp), intent(out) :: q(NZLI) !! Interface quantity on the original grid (filled 1..nz+1). integer :: kk do kk = 1, nz + 1 if (kf(kk) == 0.0_wp) then q(kk) = qc(kc(kk)) else q(kk) = (1.0_wp - kf(kk))*qc(kc(kk)) + kf(kk)*qc(kc(kk) + 1) end if end do end subroutine massless_interp_back