ocean_data_forcing_apply Subroutine

public subroutine ocean_data_forcing_apply(this, reader, grid, ss, sf, bc, t)

Blend every active tag’s current bracket into its slot. t must be the same model time ocean_data_input_update_all was just called with — the reader enforces this and aborts otherwise.

Only PHYSICAL cells are written here. Stress ghosts are filled afterwards by ocean_seam_refresh_surface_stress (exchange / periodic wrap / fold), which also re-derives stress_mag. The flux tags get no ghost treatment at all — see the module docstring for why that is correct rather than an omission.

Arguments

Type IntentOptional Attributes Name
type(ocean_data_forcing_t), intent(in) :: this
type(ocean_data_input_t), intent(in) :: reader
type(hgrid_t), intent(in) :: grid
type(ocean_surface_stress_t), intent(inout) :: ss
type(ocean_surface_flux_t), intent(inout) :: sf
type(ocean_bc_state_t), intent(in) :: bc

Supplies the periodic / north-fold topology to the seam refresh.

real(kind=wp), intent(in) :: t

Calls

proc~~ocean_data_forcing_apply~~CallsGraph proc~ocean_data_forcing_apply ocean_data_forcing_apply proc~ocean_data_input_update_2d ocean_data_input_update_2d proc~ocean_data_forcing_apply->proc~ocean_data_input_update_2d proc~ocean_seam_refresh_surface_stress ocean_seam_refresh_surface_stress proc~ocean_data_forcing_apply->proc~ocean_seam_refresh_surface_stress proc~check_fresh check_fresh proc~ocean_data_input_update_2d->proc~check_fresh proc~check_registered check_registered proc~ocean_data_input_update_2d->proc~check_registered proc~data_input_blend_2d_impl data_input_blend_2d_impl proc~ocean_data_input_update_2d->proc~data_input_blend_2d_impl interface~ocean_halo_face_x ocean_halo_face_x proc~ocean_seam_refresh_surface_stress->interface~ocean_halo_face_x interface~ocean_halo_face_y ocean_halo_face_y proc~ocean_seam_refresh_surface_stress->interface~ocean_halo_face_y proc~ocean_fold_wrap_stress ocean_fold_wrap_stress proc~ocean_seam_refresh_surface_stress->proc~ocean_fold_wrap_stress proc~ocean_halo_is_decomposed_x ocean_halo_is_decomposed_x proc~ocean_seam_refresh_surface_stress->proc~ocean_halo_is_decomposed_x proc~ocean_halo_is_decomposed_y ocean_halo_is_decomposed_y proc~ocean_seam_refresh_surface_stress->proc~ocean_halo_is_decomposed_y proc~ocean_periodic_wrap_face_x_2d ocean_periodic_wrap_face_x_2d proc~ocean_seam_refresh_surface_stress->proc~ocean_periodic_wrap_face_x_2d proc~ocean_periodic_wrap_face_y_2d ocean_periodic_wrap_face_y_2d proc~ocean_seam_refresh_surface_stress->proc~ocean_periodic_wrap_face_y_2d proc~ocean_surface_stress_set_derived ocean_surface_stress_set_derived proc~ocean_seam_refresh_surface_stress->proc~ocean_surface_stress_set_derived proc~oh_count_suppress_off oh_count_suppress_off proc~ocean_seam_refresh_surface_stress->proc~oh_count_suppress_off proc~oh_count_suppress_on oh_count_suppress_on proc~ocean_seam_refresh_surface_stress->proc~oh_count_suppress_on proc~profiler_start profiler_start proc~ocean_seam_refresh_surface_stress->proc~profiler_start proc~profiler_stop profiler_stop proc~ocean_seam_refresh_surface_stress->proc~profiler_stop proc~ocean_halo_face_x_2d ocean_halo_face_x_2d interface~ocean_halo_face_x->proc~ocean_halo_face_x_2d proc~ocean_halo_face_x_3d ocean_halo_face_x_3d interface~ocean_halo_face_x->proc~ocean_halo_face_x_3d proc~ocean_halo_face_y_2d ocean_halo_face_y_2d interface~ocean_halo_face_y->proc~ocean_halo_face_y_2d proc~ocean_halo_face_y_3d ocean_halo_face_y_3d interface~ocean_halo_face_y->proc~ocean_halo_face_y_3d error error proc~check_fresh->error to_string to_string proc~check_fresh->to_string proc~check_registered->error proc~check_registered->to_string interface~fold_north_u_face fold_north_u_face proc~ocean_fold_wrap_stress->interface~fold_north_u_face interface~fold_north_v_face fold_north_v_face proc~ocean_fold_wrap_stress->interface~fold_north_v_face interface~ocean_fold_pack ocean_fold_pack proc~ocean_fold_wrap_stress->interface~ocean_fold_pack interface~ocean_fold_unpack ocean_fold_unpack proc~ocean_fold_wrap_stress->interface~ocean_fold_unpack proc~ocean_fold_begin ocean_fold_begin proc~ocean_fold_wrap_stress->proc~ocean_fold_begin proc~ocean_fold_end ocean_fold_end proc~ocean_fold_wrap_stress->proc~ocean_fold_end proc~ocean_fold_exchange ocean_fold_exchange proc~ocean_fold_wrap_stress->proc~ocean_fold_exchange proc~ocean_fold_is_distributed ocean_fold_is_distributed proc~ocean_fold_wrap_stress->proc~ocean_fold_is_distributed proc~ocean_surface_stress_apply_cover ocean_surface_stress_apply_cover proc~ocean_surface_stress_set_derived->proc~ocean_surface_stress_apply_cover proc~ocean_surface_stress_refresh_mag ocean_surface_stress_refresh_mag proc~ocean_surface_stress_set_derived->proc~ocean_surface_stress_refresh_mag proc~find_or_create_region find_or_create_region proc~profiler_start->proc~find_or_create_region proc~get_wall_time get_wall_time proc~profiler_start->proc~get_wall_time proc~nvtx_range_push nvtx_range_push proc~profiler_start->proc~nvtx_range_push proc~profiler_stop->proc~get_wall_time proc~nvtx_range_pop nvtx_range_pop proc~profiler_stop->proc~nvtx_range_pop proc~fold_north_u_face_2d fold_north_u_face_2d interface~fold_north_u_face->proc~fold_north_u_face_2d proc~fold_north_u_face_3d fold_north_u_face_3d interface~fold_north_u_face->proc~fold_north_u_face_3d proc~fold_north_v_face_2d fold_north_v_face_2d interface~fold_north_v_face->proc~fold_north_v_face_2d proc~fold_north_v_face_3d fold_north_v_face_3d interface~fold_north_v_face->proc~fold_north_v_face_3d proc~ocean_fold_pack_2d ocean_fold_pack_2d interface~ocean_fold_pack->proc~ocean_fold_pack_2d proc~ocean_fold_pack_3d ocean_fold_pack_3d interface~ocean_fold_pack->proc~ocean_fold_pack_3d proc~ocean_fold_unpack_2d ocean_fold_unpack_2d interface~ocean_fold_unpack->proc~ocean_fold_unpack_2d proc~ocean_fold_unpack_3d ocean_fold_unpack_3d interface~ocean_fold_unpack->proc~ocean_fold_unpack_3d proc~ocean_fold_begin->to_string proc~grow_buffers grow_buffers proc~ocean_fold_begin->proc~grow_buffers warning warning proc~ocean_fold_begin->warning comm_irecv_real_sp_array_n comm_irecv_real_sp_array_n proc~ocean_fold_exchange->comm_irecv_real_sp_array_n comm_isend_real_sp_array_n comm_isend_real_sp_array_n proc~ocean_fold_exchange->comm_isend_real_sp_array_n proc~comm_env_compute_comm comm_env_compute_comm proc~ocean_fold_exchange->proc~comm_env_compute_comm waitall waitall proc~ocean_fold_exchange->waitall proc~ocean_halo_face_x_2d_impl ocean_halo_face_x_2d_impl proc~ocean_halo_face_x_2d->proc~ocean_halo_face_x_2d_impl proc~oh_count_face_x_2d oh_count_face_x_2d proc~ocean_halo_face_x_2d->proc~oh_count_face_x_2d proc~ocean_halo_face_x_3d->comm_irecv_real_sp_array_n proc~ocean_halo_face_x_3d->comm_isend_real_sp_array_n proc~ocean_halo_face_x_3d->proc~comm_env_compute_comm proc~ew_rank_east ew_rank_east proc~ocean_halo_face_x_3d->proc~ew_rank_east proc~ew_rank_west ew_rank_west proc~ocean_halo_face_x_3d->proc~ew_rank_west proc~needs_flags needs_flags proc~ocean_halo_face_x_3d->proc~needs_flags proc~ns_rank_north ns_rank_north proc~ocean_halo_face_x_3d->proc~ns_rank_north proc~ns_rank_south ns_rank_south proc~ocean_halo_face_x_3d->proc~ns_rank_south proc~ocean_halo_buffers_ensure_nz ocean_halo_buffers_ensure_nz proc~ocean_halo_face_x_3d->proc~ocean_halo_buffers_ensure_nz proc~ocean_periodic_wrap_face_x_3d ocean_periodic_wrap_face_x_3d proc~ocean_halo_face_x_3d->proc~ocean_periodic_wrap_face_x_3d proc~oh_count_face_x_3d oh_count_face_x_3d proc~ocean_halo_face_x_3d->proc~oh_count_face_x_3d proc~oh_count_msgs oh_count_msgs proc~ocean_halo_face_x_3d->proc~oh_count_msgs proc~ocean_halo_face_x_3d->waitall proc~ocean_halo_face_y_2d_impl ocean_halo_face_y_2d_impl proc~ocean_halo_face_y_2d->proc~ocean_halo_face_y_2d_impl proc~oh_count_face_y_2d oh_count_face_y_2d proc~ocean_halo_face_y_2d->proc~oh_count_face_y_2d proc~ocean_halo_face_y_3d->comm_irecv_real_sp_array_n proc~ocean_halo_face_y_3d->comm_isend_real_sp_array_n proc~ocean_halo_face_y_3d->proc~comm_env_compute_comm proc~ocean_halo_face_y_3d->proc~ew_rank_east proc~ocean_halo_face_y_3d->proc~ew_rank_west proc~ocean_halo_face_y_3d->proc~needs_flags proc~ocean_halo_face_y_3d->proc~ns_rank_north proc~ocean_halo_face_y_3d->proc~ns_rank_south proc~ocean_halo_face_y_3d->proc~ocean_halo_buffers_ensure_nz proc~ocean_periodic_wrap_face_y_3d ocean_periodic_wrap_face_y_3d proc~ocean_halo_face_y_3d->proc~ocean_periodic_wrap_face_y_3d proc~oh_count_face_y_3d oh_count_face_y_3d proc~ocean_halo_face_y_3d->proc~oh_count_face_y_3d proc~ocean_halo_face_y_3d->proc~oh_count_msgs proc~ocean_halo_face_y_3d->waitall proc~ocean_surface_stress_apply_cover->proc~ocean_surface_stress_refresh_mag proc~ocean_surfstress_cover_impl ocean_surfstress_cover_impl proc~ocean_surface_stress_apply_cover->proc~ocean_surfstress_cover_impl proc~ocean_surfstress_derived_impl ocean_surfstress_derived_impl proc~ocean_surface_stress_refresh_mag->proc~ocean_surfstress_derived_impl comm_world comm_world proc~comm_env_compute_comm->comm_world proc~decomp_rank_from_coords decomp_rank_from_coords proc~ew_rank_east->proc~decomp_rank_from_coords proc~ew_rank_west->proc~decomp_rank_from_coords local local proc~fold_north_v_face_2d->local proc~fold_north_v_face_3d->local proc~ns_rank_north->proc~decomp_rank_from_coords proc~ns_rank_south->proc~decomp_rank_from_coords proc~ocean_fold_pack_2d->proc~ocean_fold_pack_3d proc~fold_stagger_family fold_stagger_family proc~ocean_fold_pack_3d->proc~fold_stagger_family proc~fold_stagger_nrows fold_stagger_nrows proc~ocean_fold_pack_3d->proc~fold_stagger_nrows proc~ocean_fold_unpack_2d->proc~ocean_fold_unpack_3d proc~ocean_fold_unpack_3d->proc~fold_stagger_family proc~ocean_fold_unpack_3d->proc~fold_stagger_nrows proc~ocean_halo_buffers_ensure_nz->to_string proc~ocean_halo_buffers_ensure_nz->warning proc~ocean_halo_face_x_2d_impl->proc~ocean_periodic_wrap_face_x_2d proc~ocean_halo_face_x_2d_impl->comm_irecv_real_sp_array_n proc~ocean_halo_face_x_2d_impl->comm_isend_real_sp_array_n proc~ocean_halo_face_x_2d_impl->proc~comm_env_compute_comm proc~ocean_halo_face_x_2d_impl->proc~ew_rank_east proc~ocean_halo_face_x_2d_impl->proc~ew_rank_west proc~ocean_halo_face_x_2d_impl->proc~needs_flags proc~ocean_halo_face_x_2d_impl->proc~ns_rank_north proc~ocean_halo_face_x_2d_impl->proc~ns_rank_south proc~ocean_halo_face_x_2d_impl->proc~oh_count_msgs proc~ocean_halo_face_x_2d_impl->waitall proc~ocean_halo_face_y_2d_impl->proc~ocean_periodic_wrap_face_y_2d proc~ocean_halo_face_y_2d_impl->comm_irecv_real_sp_array_n proc~ocean_halo_face_y_2d_impl->comm_isend_real_sp_array_n proc~ocean_halo_face_y_2d_impl->proc~comm_env_compute_comm proc~ocean_halo_face_y_2d_impl->proc~ew_rank_east proc~ocean_halo_face_y_2d_impl->proc~ew_rank_west proc~ocean_halo_face_y_2d_impl->proc~needs_flags proc~ocean_halo_face_y_2d_impl->proc~ns_rank_north proc~ocean_halo_face_y_2d_impl->proc~ns_rank_south proc~ocean_halo_face_y_2d_impl->proc~oh_count_msgs proc~ocean_halo_face_y_2d_impl->waitall proc~ocean_surfstress_cover_impl->local proc~ocean_surfstress_derived_impl->local

Called by

proc~~ocean_data_forcing_apply~~CalledByGraph proc~ocean_data_forcing_apply ocean_data_forcing_apply proc~engine_step engine_step proc~engine_step->proc~ocean_data_forcing_apply 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 :: nx
integer, private :: ny

Source Code

   subroutine ocean_data_forcing_apply(this, reader, grid, ss, sf, bc, t)
      !! Blend every active tag's current bracket into its slot.  `t` must
      !! be the same model time `ocean_data_input_update_all` was just
      !! called with — the reader enforces this and aborts otherwise.
      !!
      !! Only PHYSICAL cells are written here.  Stress ghosts are filled
      !! afterwards by `ocean_seam_refresh_surface_stress` (exchange /
      !! periodic wrap / fold), which also re-derives `stress_mag`.  The
      !! flux tags get no ghost treatment at all — see the module
      !! docstring for why that is correct rather than an omission.
      type(ocean_data_forcing_t), intent(in) :: this
      type(ocean_data_input_t), intent(in) :: reader
      type(hgrid_t), intent(in) :: grid
      type(ocean_surface_stress_t), intent(inout) :: ss
      type(ocean_surface_flux_t), intent(inout) :: sf
      type(ocean_bc_state_t), intent(in) :: bc
         !! Supplies the periodic / north-fold topology to the seam refresh.
      real(wp), intent(in) :: t

      integer :: nx, ny

      if (.not. this%active) return

      nx = grid%nx_total
      ny = grid%ny_total

      ! --- wind stress ---
      if (this%id_tau_x > 0) then
         call ocean_data_input_update_2d(reader, this%id_tau_x, t, nx + 1, ny, ss%tau_x)
      end if
      if (this%id_tau_y > 0) then
         call ocean_data_input_update_2d(reader, this%id_tau_y, t, nx, ny + 1, ss%tau_y)
      end if
      if (this%id_tau_x > 0 .or. this%id_tau_y > 0) then
         ! Mandatory, both halves: the ghosts because neighbour-reading
         ! kernels consume them, and `stress_mag` because KPP/EPBL would
         ! otherwise keep mixing on the configure-time wind.
         call ocean_seam_refresh_surface_stress(ss, grid, bc)
      end if

      ! --- surface fluxes (column-local; no ghost fill by design) ---
      if (this%id_heat > 0) then
         if (this%heat_to_component) then
            call ocean_data_input_update_2d(reader, this%id_heat, t, nx, ny, sf%heat_added)
         else
            call ocean_data_input_update_2d(reader, this%id_heat, t, nx, ny, sf%Q_heat)
         end if
      end if
      if (this%id_salt > 0) then
         if (this%salt_to_component) then
            call ocean_data_input_update_2d(reader, this%id_salt, t, nx, ny, sf%salt_flux)
         else
            call ocean_data_input_update_2d(reader, this%id_salt, t, nx, ny, sf%Q_salt)
         end if
      end if
      if (this%id_evap > 0) then
         call ocean_data_input_update_2d(reader, this%id_evap, t, nx, ny, sf%evap)
      end if
      if (this%id_lprec > 0) then
         call ocean_data_input_update_2d(reader, this%id_lprec, t, nx, ny, sf%lprec)
      end if
   end subroutine ocean_data_forcing_apply