configure_ocean_varmix Subroutine

private subroutine configure_ocean_varmix(cfg, ocean_state, grid)

Build the STATIC VarMix grid terms (f2_dx2_*, beta_dx2_*, l2_*) on the varmix slot once at configure time, from the filled curvilinear metrics + the cell-centre Coriolis magnitude. The slot scalars are copied earlier by ocean_state_copy_config; this only fills the static arrays (the per-step Res_fn/SN/assembly fire in the dyn step). No-op when VarMix is disabled.

Arguments

Type IntentOptional Attributes Name
type(config_t), intent(in) :: cfg
type(ocean_state_t), intent(inout) :: ocean_state
type(hgrid_t), intent(in) :: grid

Calls

proc~~configure_ocean_varmix~~CallsGraph proc~configure_ocean_varmix configure_ocean_varmix proc~fill_coriolis_centre fill_coriolis_centre proc~configure_ocean_varmix->proc~fill_coriolis_centre proc~ocean_varmix_build_static ocean_varmix_t%ocean_varmix_build_static proc~configure_ocean_varmix->proc~ocean_varmix_build_static proc~metrics_fill_coriolis metrics_fill_coriolis proc~fill_coriolis_centre->proc~metrics_fill_coriolis proc~parse_coriolis_scheme parse_coriolis_scheme proc~fill_coriolis_centre->proc~parse_coriolis_scheme proc~varmix_dfdx_vface varmix_dfdx_vface proc~ocean_varmix_build_static->proc~varmix_dfdx_vface proc~varmix_dfdy_uface varmix_dfdy_uface proc~ocean_varmix_build_static->proc~varmix_dfdy_uface

Called by

proc~~configure_ocean_varmix~~CalledByGraph proc~configure_ocean_varmix configure_ocean_varmix proc~configure_ocean_lateral configure_ocean_lateral proc~configure_ocean_lateral->proc~configure_ocean_varmix proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_lateral proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private, allocatable :: f_centre(:,:)

Source Code

   subroutine configure_ocean_varmix(cfg, ocean_state, grid)
      !! Build the STATIC VarMix grid terms (`f2_dx2_*`, `beta_dx2_*`,
      !! `l2_*`) on the varmix slot once at configure time, from the filled
      !! curvilinear metrics + the cell-centre Coriolis magnitude.  The slot
      !! scalars are copied earlier by `ocean_state_copy_config`; this only
      !! fills the static arrays (the per-step Res_fn/SN/assembly fire in the
      !! dyn step).  No-op when VarMix is disabled.
      type(config_t), intent(in) :: cfg
      type(ocean_state_t), intent(inout) :: ocean_state
      type(hgrid_t), intent(in) :: grid
      real(wp), allocatable :: f_centre(:, :)

      if (.not. ocean_state%varmix%enable) return
      allocate (f_centre(grid%nx_total, grid%ny_total))
      call fill_coriolis_centre(cfg, ocean_state%metrics, grid, f_centre)
      call ocean_state%varmix%build_static(ocean_state%metrics, f_centre)
      deallocate (f_centre)
   end subroutine configure_ocean_varmix