interp_velocity_w Function

public function interp_velocity_w(i, j, k)

Uses

  • proc~~interp_velocity_w~~UsesGraph proc~interp_velocity_w interp_velocity_w module~modfields modfields proc~interp_velocity_w->module~modfields module~modglobal modglobal proc~interp_velocity_w->module~modglobal decomp_2d decomp_2d module~modfields->decomp_2d

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: i
integer, intent(in) :: j
integer, intent(in) :: k

Return Value real, (3)


Source Code

   function interp_velocity_w(i, j, k)
     ! interpolates the velocity at w-grid location i,j,k
     use modglobal, only :  dzf, dzh
     use modfields, only :  u0, v0, w0
     real ::  interp_velocity_w(3)
     integer, intent(in) :: i, j, k

     ! zh(k) is not midway between zf(k-1) and zf(k) on a stretched grid: linear
     ! interpolation weights level k by dzf(k-1) and level k-1 by dzf(k) (sum 2*dzh(k))
     interp_velocity_w(1) = 0.5 * ((u0(i,j,k  ) + u0(i+1,j,k  ))*dzf(k-1) &
                                 + (u0(i,j,k-1) + u0(i+1,j,k-1))*dzf(k  )) / (2.*dzh(k))
     interp_velocity_w(2) = 0.5 * ((v0(i,j,k  ) + v0(i,j+1,k  ))*dzf(k-1) &
                                 + (v0(i,j,k-1) + v0(i,j+1,k-1))*dzf(k  )) / (2.*dzh(k))
     interp_velocity_w(3) = w0(i,j,k)

     return
   end function interp_velocity_w