ocean_slopes_compute Subroutine

public subroutine ocean_slopes_compute(grid, metrics, eos, slopes, ms, dt)

Public entry point — fill slope_x/slope_y + n2_u/n2_v at all interfaces. No-op if absent / uninitialised / disabled, so the driver can call it unconditionally. Pipeline: vert-fill T/S → build interface heights e_int → u-face pass → v-face pass.

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(ocean_metrics_t), intent(in) :: metrics
type(eos_t), intent(in) :: eos
type(ocean_slopes_t), intent(inout), optional :: slopes
type(multilayer_state_t), intent(in) :: ms
real(kind=wp), intent(in) :: dt

Calls

proc~~ocean_slopes_compute~~CallsGraph proc~ocean_slopes_compute ocean_slopes_compute proc~ocean_slopes_compute_impl ocean_slopes_compute_impl proc~ocean_slopes_compute->proc~ocean_slopes_compute_impl proc~ocean_slopes_build_e ocean_slopes_build_e proc~ocean_slopes_compute_impl->proc~ocean_slopes_build_e proc~ocean_slopes_mask_open_column ocean_slopes_mask_open_column proc~ocean_slopes_compute_impl->proc~ocean_slopes_mask_open_column proc~ocean_slopes_pass_x ocean_slopes_pass_x proc~ocean_slopes_compute_impl->proc~ocean_slopes_pass_x proc~ocean_slopes_pass_y ocean_slopes_pass_y proc~ocean_slopes_compute_impl->proc~ocean_slopes_pass_y proc~ocean_slopes_vert_fill_ts ocean_slopes_vert_fill_ts proc~ocean_slopes_compute_impl->proc~ocean_slopes_vert_fill_ts local local proc~ocean_slopes_pass_x->local proc~eos_density_specvol_derivs eos_density_specvol_derivs proc~ocean_slopes_pass_x->proc~eos_density_specvol_derivs proc~pressure_above_x pressure_above_x proc~ocean_slopes_pass_x->proc~pressure_above_x proc~ocean_slopes_pass_y->local proc~ocean_slopes_pass_y->proc~eos_density_specvol_derivs proc~ocean_slopes_pass_y->proc~pressure_above_x proc~ocean_slopes_vert_fill_ts->local proc~roquet_spv_point roquet_spv_point proc~eos_density_specvol_derivs->proc~roquet_spv_point

Called by

proc~~ocean_slopes_compute~~CalledByGraph proc~ocean_slopes_compute ocean_slopes_compute proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~ocean_slopes_compute proc~run_stage run_stage proc~run_stage->proc~ocean_slopes_compute proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step_split proc~ocean_dyn_step ocean_dyn_step proc~engine_step->proc~ocean_dyn_step proc~ocean_dyn_step->proc~run_stage 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

Source Code

   subroutine ocean_slopes_compute(grid, metrics, eos, slopes, ms, dt)
      !! Public entry point — fill `slope_x`/`slope_y` + `n2_u`/`n2_v` at
      !! all interfaces.  No-op if absent / uninitialised / disabled, so
      !! the driver can call it unconditionally.  Pipeline: vert-fill T/S
      !! → build interface heights `e_int` → u-face pass → v-face pass.
      type(hgrid_t), intent(in) :: grid
      type(ocean_metrics_t), intent(in) :: metrics
      type(eos_t), intent(in) :: eos
      type(ocean_slopes_t), intent(inout), optional :: slopes
      type(multilayer_state_t), intent(in) :: ms
      real(wp), intent(in) :: dt

      if (.not. present(slopes)) return
      if (.not. slopes%is_init) return
      if (.not. slopes%enable) return
      if (ms%idx_temperature <= 0 .or. ms%idx_salinity <= 0) return
      if (.not. allocated(ms%h_layer)) return
      if (.not. slopes%bathy_set) then
         error stop "ocean_slopes_compute: bed datum never set; call "// &
            "slopes%set_bathymetry(barotropic%b) before enter_data"
      end if

      ! Outer shim: dereference the tracer-registry hTr arrays (array of
      ! derived types ⇒ device indirection) on the host, pass the flat
      ! top-level allocatables into the flat-impl kernel.
      call ocean_slopes_compute_impl(grid, metrics, eos, slopes, ms, &
                                     ms%h_layer, &
                                     ms%tracers(ms%idx_temperature)%hTr, &
                                     ms%tracers(ms%idx_salinity)%hTr, dt)
   end subroutine ocean_slopes_compute