rdb_ocean_set_u Function

public function rdb_ocean_set_u(c_handle, u_data, nx_p, ny_p, nz_p) result(status) bind(c, name="rdb_ocean_set_u")

Overwrite u_face_x_layer on the physical interior faces (nx_p+1 west faces bracketing nx_p physical columns) and narrow-push it. Does NOT re-derive hu_face_x_layer (a separate prognostic transport slot) — that stays whatever it was until the next step recomputes it.

Arguments

Type IntentOptional Attributes Name
type(c_ptr), intent(in), value :: c_handle
real(kind=c_double), intent(in) :: u_data(nx_p+1,ny_p,nz_p)
integer(kind=c_int), intent(in), value :: nx_p
integer(kind=c_int), intent(in), value :: ny_p
integer(kind=c_int), intent(in), value :: nz_p

Return Value integer(kind=c_int)


Calls

proc~~rdb_ocean_set_u~~CallsGraph proc~rdb_ocean_set_u rdb_ocean_set_u proc~fail fail proc~rdb_ocean_set_u->proc~fail proc~resolve_ocean resolve_ocean proc~rdb_ocean_set_u->proc~resolve_ocean proc~shape_matches_interior shape_matches_interior proc~rdb_ocean_set_u->proc~shape_matches_interior error error proc~fail->error proc~error_ring_push error_ring_push proc~fail->proc~error_ring_push proc~handle_check handle_check proc~resolve_ocean->proc~handle_check

Variables

Type Visibility Attributes Name Initial
type(ocean_handle_t), private, pointer :: h
integer, private :: ierr_local
integer, private :: ng

Source Code

   function rdb_ocean_set_u(c_handle, u_data, nx_p, ny_p, nz_p) result(status) &
      bind(c, name="rdb_ocean_set_u")
      !! Overwrite `u_face_x_layer` on the physical interior faces
      !! (`nx_p+1` west faces bracketing `nx_p` physical columns) and
      !! narrow-push it. Does NOT re-derive `hu_face_x_layer` (a separate
      !! prognostic transport slot) — that stays whatever it was until the
      !! next step recomputes it.
      type(c_ptr), intent(in), value :: c_handle
      integer(c_int), intent(in), value :: nx_p, ny_p, nz_p
      real(c_double), intent(in) :: u_data(nx_p + 1, ny_p, nz_p)
      integer(c_int) :: status

      type(ocean_handle_t), pointer :: h
      integer :: ng, ierr_local

      status = resolve_ocean(c_handle, h)
      if (status /= OCEAN_STATUS_OK) return
      if (.not. shape_matches_interior(h, nx_p, ny_p, nz_p)) then
         call fail("rdb_ocean_set_u: shape mismatch against the physical interior", &
                   ierr_local, OCEAN_STATUS_ERR_BAD_SHAPE)
         status = int(ierr_local, c_int)
         return
      end if

      ng = h%grid%nghost
      associate (uf => h%state%multilayer%u_face_x_layer)
         uf(ng + 1:ng + nx_p + 1, ng + 1:ng + ny_p, :) = real(u_data, wp)
         !$acc update device(uf)
      end associate
      status = int(OCEAN_STATUS_OK, c_int)
   end function rdb_ocean_set_u