varmix_compute Subroutine

public subroutine varmix_compute(grid, metrics, this, slopes, wavespeed, ms)

Fill res_fn_*, sn_*, khth_*, khtr_* (the pre-CFL base face coefficients) from the static grid terms, the slopes/N^2 slot, and the first-mode wave speed cg1. No-op when disabled / the deps are absent. The CFL cap is applied downstream by GM.

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(ocean_metrics_t), intent(in) :: metrics
type(ocean_varmix_t), intent(inout) :: this
type(ocean_slopes_t), intent(in) :: slopes
type(ocean_wave_speed_t), intent(in) :: wavespeed
type(multilayer_state_t), intent(in) :: ms

Calls

proc~~varmix_compute~~CallsGraph proc~varmix_compute varmix_compute proc~varmix_compute_impl varmix_compute_impl proc~varmix_compute->proc~varmix_compute_impl local local proc~varmix_compute_impl->local proc~varmix_assemble varmix_assemble proc~varmix_compute_impl->proc~varmix_assemble proc~varmix_res_fn varmix_res_fn proc~varmix_compute_impl->proc~varmix_res_fn proc~varmix_sn_u varmix_sn_u proc~varmix_compute_impl->proc~varmix_sn_u proc~varmix_sn_v varmix_sn_v proc~varmix_compute_impl->proc~varmix_sn_v proc~varmix_sn_u->local proc~varmix_sn_v->local

Called by

proc~~varmix_compute~~CalledByGraph proc~varmix_compute varmix_compute proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~varmix_compute 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
logical, private :: do_visbeck
integer, private :: nx
integer, private :: ny
integer, private :: nz

Source Code

   subroutine varmix_compute(grid, metrics, this, slopes, wavespeed, ms)
      !! Fill `res_fn_*`, `sn_*`, `khth_*`, `khtr_*` (the pre-CFL base face
      !! coefficients) from the static grid terms, the slopes/N^2 slot, and
      !! the first-mode wave speed `cg1`.  No-op when disabled / the deps are
      !! absent.  The CFL cap is applied downstream by GM.
      type(hgrid_t), intent(in) :: grid
      type(ocean_metrics_t), intent(in) :: metrics
      type(ocean_varmix_t), intent(inout) :: this
      type(ocean_slopes_t), intent(in) :: slopes
      type(ocean_wave_speed_t), intent(in) :: wavespeed
      type(multilayer_state_t), intent(in) :: ms
      integer :: nx, ny, nz
      logical :: do_visbeck

      if (.not. this%is_init) return
      if (.not. this%enable) return
      if (.not. slopes%is_init) return
      if (.not. wavespeed%is_init) return
      if (.not. allocated(wavespeed%cg1)) return
      if (.not. allocated(ms%h_layer)) return
      if (.not. allocated(slopes%slope_x)) return

      nx = grid%nx_total
      ny = grid%ny_total
      nz = ms%nz_ml
      if (this%nz_ml /= nz) return
      if (slopes%nz_ml /= nz) return

      ! Eady SN only when a Visbeck coefficient is on (item 8).
      do_visbeck = this%use_visbeck .and. &
                   (this%khth_slope_cff > 0.0_wp .or. this%khtr_slope_cff > 0.0_wp)

      call varmix_compute_impl(nx, ny, nz, this%kh_res_fn_power, &
                               this%kh_res_scale_coef, this%resoln_scaled_khth, &
                               this%resoln_scaled_khtr, this%interpolate_res_fn, &
                               do_visbeck, this%visbeck_max_slope, &
                               this%khth, this%khtr, this%khth_slope_cff, &
                               this%khtr_slope_cff, this%khth_min, this%khth_max, &
                               this%khtr_min, this%khtr_max, &
                               this%f2_dx2_u, this%f2_dx2_v, &
                               this%beta_dx2_u, this%beta_dx2_v, &
                               this%l2_u, this%l2_v, &
                               wavespeed%cg1, ms%h_layer, &
                               slopes%slope_x, slopes%slope_y, &
                               slopes%n2_u, slopes%n2_v, &
                               this%res_fn_u, this%res_fn_v, &
                               this%sn_u, this%sn_v, &
                               this%khth_u, this%khth_v, &
                               this%khtr_u, this%khtr_v)
   end subroutine varmix_compute