mask_time_mean_velocities Subroutine

private pure subroutine mask_time_mean_velocities(metrics, ms)

Apply the land contract of mask_layer_velocities — static wet_u/wet_v, times the z-level open_u/open_v when zfixed_closed_faces is on — to the pred_corr time-mean velocities u_av/v_av. Called once, on the step-0 seed: the renormaliser’s u_cor, their only other writer, never writes a masked face, so what the seed leaves there is what every later step reads. (Wet/dry is refused under pred_corr, so its dynamic mask has no branch here.) All-wet, knob off ⇒ products with exactly 1, i.e. byte-identical.

Arguments

Type IntentOptional Attributes Name
type(ocean_metrics_t), intent(in) :: metrics
type(multilayer_state_t), intent(inout) :: ms

Called by

proc~~mask_time_mean_velocities~~CalledByGraph proc~mask_time_mean_velocities mask_time_mean_velocities proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~mask_time_mean_velocities proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step_split proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
integer, private :: k
integer, private :: nx_face
integer, private :: nx_vface
integer, private :: ny_face
integer, private :: ny_uface
integer, private :: nz

Source Code

   pure subroutine mask_time_mean_velocities(metrics, ms)
      !! Apply the land contract of `mask_layer_velocities` — static
      !! `wet_u`/`wet_v`, times the z-level `open_u`/`open_v` when
      !! `zfixed_closed_faces` is on — to the `pred_corr` time-mean
      !! velocities `u_av`/`v_av`.  Called once, on the step-0 seed: the
      !! renormaliser's `u_cor`, their only other writer, never writes a
      !! masked face, so what the seed leaves there is what every later
      !! step reads.  (Wet/dry is refused under `pred_corr`, so its
      !! dynamic mask has no branch here.)  All-wet, knob off ⇒ products
      !! with exactly 1, i.e. byte-identical.
      type(ocean_metrics_t), intent(in) :: metrics
      type(multilayer_state_t), intent(inout) :: ms
      integer :: i, j, k, nz, nx_face, ny_uface, nx_vface, ny_face

      nz = ms%nz_ml
      nx_face = size(ms%u_av_layer, 1)
      ny_uface = size(ms%u_av_layer, 2)
      nx_vface = size(ms%v_av_layer, 1)
      ny_face = size(ms%v_av_layer, 2)
      do concurrent(k=1:nz, j=1:ny_uface, i=1:nx_face)
         ms%u_av_layer(i, j, k) = metrics%wet_u(i, j)*ms%u_av_layer(i, j, k)
      end do
      do concurrent(k=1:nz, j=1:ny_face, i=1:nx_vface)
         ms%v_av_layer(i, j, k) = metrics%wet_v(i, j)*ms%v_av_layer(i, j, k)
      end do
      if (metrics%use_closed_faces) then
         do concurrent(k=1:nz, j=1:ny_uface, i=1:nx_face)
            ms%u_av_layer(i, j, k) = metrics%open_u(i, j, k)*ms%u_av_layer(i, j, k)
         end do
         do concurrent(k=1:nz, j=1:ny_face, i=1:nx_vface)
            ms%v_av_layer(i, j, k) = metrics%open_v(i, j, k)*ms%v_av_layer(i, j, k)
         end do
      end if
   end subroutine mask_time_mean_velocities