Allocate the wide shadow state. Builds grid_w (same nx_phys/ny_phys
as grid, nghost = grid%nghost + bt_halo), fills wide metrics via the
same formula generator, fills wide f_corner.
grid_config must be GRID_CONFIG_CARTESIAN or GRID_CONFIG_SPHERICAL;
supergrid/tripolar are excluded at configure time.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(bt_wide_t), | intent(inout) | :: | this | |||
| type(hgrid_t), | intent(in) | :: | grid |
Normal-width grid descriptor for this subdomain. |
||
| real(kind=wp), | intent(in) | :: | dx |
Cell spacing (m for Cartesian; deg for spherical). |
||
| real(kind=wp), | intent(in) | :: | dy |
Cell spacing (m for Cartesian; deg for spherical). |
||
| real(kind=wp), | intent(in) | :: | lon_west |
South-west corner (used only for spherical; ignored for Cartesian). |
||
| real(kind=wp), | intent(in) | :: | lat_south |
South-west corner (used only for spherical; ignored for Cartesian). |
||
| real(kind=wp), | intent(in) | :: | rad_earth |
Earth radius (m; used only for spherical; ignored for Cartesian). |
||
| integer, | intent(in) | :: | grid_config |
GRID_CONFIG_CARTESIAN or GRID_CONFIG_SPHERICAL. |
||
| real(kind=wp), | intent(in) | :: | f_0 |
Beta-plane Coriolis parameters. |
||
| real(kind=wp), | intent(in) | :: | beta |
Beta-plane Coriolis parameters. |
||
| real(kind=wp), | intent(in) | :: | y_ref |
Beta-plane Coriolis parameters. |
||
| integer, | intent(in) | :: | coriolis_scheme |
CORIOLIS_SCHEME_BETA_PLANE or CORIOLIS_SCHEME_PLANETARY. |
||
| real(kind=wp), | intent(in), | optional | :: | omega |
Planetary rotation rate for the planetary scheme. Absent => 0. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | bt_h | ||||
| integer, | private | :: | nx_w | ||||
| integer, | private | :: | ny_w | ||||
| real(kind=wp), | private | :: | omega_l |
subroutine bt_wide_init(this, grid, dx, dy, lon_west, lat_south, & rad_earth, grid_config, & f_0, beta, y_ref, coriolis_scheme, omega) !! Allocate the wide shadow state. Builds `grid_w` (same nx_phys/ny_phys !! as `grid`, nghost = grid%nghost + bt_halo), fills wide metrics via the !! same formula generator, fills wide f_corner. !! `grid_config` must be GRID_CONFIG_CARTESIAN or GRID_CONFIG_SPHERICAL; !! supergrid/tripolar are excluded at configure time. class(bt_wide_t), intent(inout) :: this type(hgrid_t), intent(in) :: grid !! Normal-width grid descriptor for this subdomain. real(wp), intent(in) :: dx, dy !! Cell spacing (m for Cartesian; deg for spherical). real(wp), intent(in) :: lon_west, lat_south !! South-west corner (used only for spherical; ignored for Cartesian). real(wp), intent(in) :: rad_earth !! Earth radius (m; used only for spherical; ignored for Cartesian). integer, intent(in) :: grid_config !! GRID_CONFIG_CARTESIAN or GRID_CONFIG_SPHERICAL. real(wp), intent(in) :: f_0, beta, y_ref !! Beta-plane Coriolis parameters. integer, intent(in) :: coriolis_scheme !! CORIOLIS_SCHEME_BETA_PLANE or CORIOLIS_SCHEME_PLANETARY. real(wp), intent(in), optional :: omega !! Planetary rotation rate for the planetary scheme. Absent => 0. real(wp) :: omega_l integer :: nx_w, ny_w, bt_h omega_l = 0.0_wp if (present(omega)) omega_l = omega bt_h = this%bt_halo this%ng_wide = grid%nghost + bt_h this%num_cycles = bt_h/2 ! Build the wide grid descriptor. Physical size identical to the normal ! grid; nghost increases by bt_halo. Global offsets must match so the ! formula-metric and f_corner fills land on the correct physical rows. call this%grid_w%init(grid%nx_phys, grid%ny_phys, this%ng_wide, dx, dy) this%grid_w%i_offset_global = grid%i_offset_global this%grid_w%j_offset_global = grid%j_offset_global this%grid_w%nx_global = grid%nx_global this%grid_w%ny_global = grid%ny_global nx_w = this%grid_w%nx_total ny_w = this%grid_w%ny_total ! Build wide metrics via the same formula generator. call this%metrics_w%init(this%grid_w) select case (grid_config) case (GRID_CONFIG_SPHERICAL) call metrics_fill_spherical(this%metrics_w, this%grid_w, & lon_west, lat_south, dx, dy, rad_earth) case default ! GRID_CONFIG_CARTESIAN call metrics_fill_cartesian(this%metrics_w, this%grid_w, dx, dy) end select call metrics_finalize(this%metrics_w) ! Fill wide f_corner via metrics_fill_coriolis. allocate (this%f_corner_w(nx_w + 1, ny_w + 1), source=0.0_wp) block real(wp), allocatable :: f_centre_scratch(:, :) allocate (f_centre_scratch(nx_w, ny_w), source=0.0_wp) call metrics_fill_coriolis(this%metrics_w, coriolis_scheme, & f_0, beta, y_ref, omega_l, & this%grid_w, this%f_corner_w, f_centre_scratch) deallocate (f_centre_scratch) end block ! Allocate wide shadow arrays, initialised to zero. allocate (this%w_eta(nx_w, ny_w), source=0.0_wp) allocate (this%w_H_ref(nx_w, ny_w), source=0.0_wp) allocate (this%w_eta_new(nx_w, ny_w), source=0.0_wp) allocate (this%w_ke(nx_w, ny_w), source=0.0_wp) allocate (this%w_eta_sum(nx_w, ny_w), source=0.0_wp) allocate (this%w_eta_end(nx_w, ny_w), source=0.0_wp) allocate (this%w_ubt(nx_w + 1, ny_w), source=0.0_wp) allocate (this%w_ubt_prev(nx_w + 1, ny_w), source=0.0_wp) allocate (this%w_rem_u(nx_w + 1, ny_w), source=1.0_wp) allocate (this%w_ubt_sum(nx_w + 1, ny_w), source=0.0_wp) allocate (this%w_uhbt_sum(nx_w + 1, ny_w), source=0.0_wp) allocate (this%w_uhbt(nx_w + 1, ny_w), source=0.0_wp) allocate (this%w_ubt_end(nx_w + 1, ny_w), source=0.0_wp) allocate (this%w_vbt(nx_w, ny_w + 1), source=0.0_wp) allocate (this%w_vbt_prev(nx_w, ny_w + 1), source=0.0_wp) allocate (this%w_rem_v(nx_w, ny_w + 1), source=1.0_wp) allocate (this%w_vbt_sum(nx_w, ny_w + 1), source=0.0_wp) allocate (this%w_vhbt_sum(nx_w, ny_w + 1), source=0.0_wp) allocate (this%w_vhbt(nx_w, ny_w + 1), source=0.0_wp) allocate (this%w_vbt_end(nx_w, ny_w + 1), source=0.0_wp) allocate (this%w_zeta(nx_w + 1, ny_w + 1), source=0.0_wp) allocate (this%w_force_u(nx_w + 1, ny_w), source=0.0_wp) allocate (this%w_force_v(nx_w, ny_w + 1), source=0.0_wp) this%is_init = .true. end subroutine bt_wide_init