Grow the porous-barrier arrays from their (1,1)/(1,1,1)
placeholder size to full face size. Call ONLY when
&ocean_porous_nml enable is on, at configure time — i.e. after
init and BEFORE ocean_state_enter_data, so the device map
captures the final shapes (a realloc after enter_data would
leave the device pointing at freed host memory).
The open fractions start at 1 (fully open) so that a stage which reads them before the first recompute sees an inert scheme.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_metrics_t), | intent(inout) | :: | this | |||
| type(hgrid_t), | intent(in) | :: | grid | |||
| integer, | intent(in) | :: | nz |
Number of layers ( |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | nx | ||||
| integer, | private | :: | ny |
subroutine metrics_porous_alloc(this, grid, nz) !! Grow the porous-barrier arrays from their `(1,1)`/`(1,1,1)` !! placeholder size to full face size. Call ONLY when !! `&ocean_porous_nml enable` is on, at configure time — i.e. after !! `init` and BEFORE `ocean_state_enter_data`, so the device map !! captures the final shapes (a realloc after `enter_data` would !! leave the device pointing at freed host memory). !! !! The open fractions start at 1 (fully open) so that a stage which !! reads them before the first recompute sees an inert scheme. type(ocean_metrics_t), intent(inout) :: this type(hgrid_t), intent(in) :: grid integer, intent(in) :: nz !! Number of layers (`multilayer%nz_ml`). integer :: nx, ny nx = grid%nx_total ny = grid%ny_total if (allocated(this%por_bed)) deallocate (this%por_bed) if (allocated(this%por_dmin_u)) deallocate (this%por_dmin_u) if (allocated(this%por_dmax_u)) deallocate (this%por_dmax_u) if (allocated(this%por_davg_u)) deallocate (this%por_davg_u) if (allocated(this%por_dmin_v)) deallocate (this%por_dmin_v) if (allocated(this%por_dmax_v)) deallocate (this%por_dmax_v) if (allocated(this%por_davg_v)) deallocate (this%por_davg_v) if (allocated(this%por_face_area_u)) deallocate (this%por_face_area_u) if (allocated(this%por_face_area_v)) deallocate (this%por_face_area_v) allocate (this%por_bed(nx, ny), source=0.0_wp) allocate (this%por_dmin_u(nx + 1, ny), source=0.0_wp) allocate (this%por_dmax_u(nx + 1, ny), source=0.0_wp) allocate (this%por_davg_u(nx + 1, ny), source=0.0_wp) allocate (this%por_dmin_v(nx, ny + 1), source=0.0_wp) allocate (this%por_dmax_v(nx, ny + 1), source=0.0_wp) allocate (this%por_davg_v(nx, ny + 1), source=0.0_wp) allocate (this%por_face_area_u(nx + 1, ny, nz), source=1.0_wp) allocate (this%por_face_area_v(nx, ny + 1, nz), source=1.0_wp) end subroutine metrics_porous_alloc