massless_interp_back Subroutine

public 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.

Arguments

Type IntentOptional 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).


Called by

proc~~massless_interp_back~~CalledByGraph proc~massless_interp_back massless_interp_back proc~kappa_shear_column_kernel kappa_shear_column_kernel proc~kappa_shear_column_kernel->proc~massless_interp_back proc~kappa_shear_vertex_kernel kappa_shear_vertex_kernel proc~kappa_shear_vertex_kernel->proc~massless_interp_back proc~kappa_shear_compute kappa_shear_compute proc~kappa_shear_compute->proc~kappa_shear_column_kernel proc~kappa_shear_compute->proc~kappa_shear_vertex_kernel proc~vmix_apply_in_stage vmix_apply_in_stage proc~vmix_apply_in_stage->proc~kappa_shear_compute proc~run_stage run_stage proc~run_stage->proc~vmix_apply_in_stage proc~run_stage_split run_stage_split proc~run_stage_split->proc~vmix_apply_in_stage proc~ocean_dyn_step ocean_dyn_step proc~ocean_dyn_step->proc~run_stage proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_stage_split

Variables

Type Visibility Attributes Name Initial
integer, private :: kk

Source Code

   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