Uniform draft draft inside the shelf box [x0,x1] x [y0,y1],
zero outside it (open ocean, including everything beyond the
calving front at x1). Any bound at or beyond
CAVITY_BOUND_INF is ignored — the shelf is then open on that
side, which is what the namelist defaults ask for.
Positions are in GRID coordinate units and are compared against
the CELL-CENTRE position, built the same way every formula
bathymetry setter builds it:
x = (i - nghost + i_offset_global - 0.5)*dx. Because the
offsets and the global extents come off grid, each rank fills
its own window of ONE global shelf; on a single rank the offsets
are 0 and this is the undecomposed formula.
FILLS THE FULL ARRAY INCLUDING GHOSTS, by evaluating the formula at the ghost index — the same rule the bathymetry setters follow. A ghost row left at its alloc-time zero would put a phantom calving front one cell outside every wall.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | z_draft(:,:) | |||
| type(hgrid_t), | intent(in) | :: | grid | |||
| real(kind=wp), | intent(in) | :: | draft |
Draft depth (m, positive down) inside the box. |
||
| real(kind=wp), | intent(in) | :: | x0 |
Shelf box in GRID coordinate units; a bound at or beyond
|
||
| real(kind=wp), | intent(in) | :: | x1 |
Shelf box in GRID coordinate units; a bound at or beyond
|
||
| real(kind=wp), | intent(in) | :: | y0 |
Shelf box in GRID coordinate units; a bound at or beyond
|
||
| real(kind=wp), | intent(in) | :: | y1 |
Shelf box in GRID coordinate units; a bound at or beyond
|
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| integer, | private | :: | ioff | ||||
| integer, | private | :: | j | ||||
| integer, | private | :: | joff | ||||
| integer, | private | :: | ng | ||||
| integer, | private | :: | nxt | ||||
| integer, | private | :: | nyt | ||||
| real(kind=wp), | private | :: | x_phys | ||||
| real(kind=wp), | private | :: | y_phys |
pure subroutine set_draft_flat(z_draft, grid, draft, x0, x1, y0, y1) !! Uniform draft `draft` inside the shelf box `[x0,x1] x [y0,y1]`, !! zero outside it (open ocean, including everything beyond the !! calving front at `x1`). Any bound at or beyond !! `CAVITY_BOUND_INF` is ignored — the shelf is then open on that !! side, which is what the namelist defaults ask for. !! !! Positions are in GRID coordinate units and are compared against !! the CELL-CENTRE position, built the same way every formula !! bathymetry setter builds it: !! `x = (i - nghost + i_offset_global - 0.5)*dx`. Because the !! offsets and the global extents come off `grid`, each rank fills !! its own window of ONE global shelf; on a single rank the offsets !! are 0 and this is the undecomposed formula. !! !! FILLS THE FULL ARRAY INCLUDING GHOSTS, by evaluating the formula !! at the ghost index — the same rule the bathymetry setters follow. !! A ghost row left at its alloc-time zero would put a phantom !! calving front one cell outside every wall. real(wp), intent(inout) :: z_draft(:, :) type(hgrid_t), intent(in) :: grid real(wp), intent(in) :: draft !! Draft depth (m, positive down) inside the box. real(wp), intent(in) :: x0, x1, y0, y1 !! Shelf box in GRID coordinate units; a bound at or beyond !! `CAVITY_BOUND_INF` is ignored (open on that side). integer :: i, j, ng, nxt, nyt, ioff, joff real(wp) :: x_phys, y_phys ng = grid%nghost ioff = grid%i_offset_global joff = grid%j_offset_global nxt = size(z_draft, 1) nyt = size(z_draft, 2) do j = 1, nyt y_phys = (real(j - ng + joff, wp) - 0.5_wp)*grid%dy do i = 1, nxt x_phys = (real(i - ng + ioff, wp) - 0.5_wp)*grid%dx if (in_shelf_box(x_phys, y_phys, x0, x1, y0, y1)) then z_draft(i, j) = draft else z_draft(i, j) = 0.0_wp end if end do end do end subroutine set_draft_flat