hgrid_t Derived Type

type, public :: hgrid_t


Inherited by

type~~hgrid_t~~InheritedByGraph type~hgrid_t hgrid_t type~bt_wide_t bt_wide_t type~bt_wide_t->type~hgrid_t grid_w type~ocean_budgets_t ocean_budgets_t type~ocean_budgets_t->type~hgrid_t grid type~ocean_diag_t ocean_diag_t type~ocean_diag_t->type~hgrid_t grid type~ocean_engine_t ocean_engine_t type~ocean_engine_t->type~hgrid_t grid type~ocean_state_t ocean_state_t type~ocean_engine_t->type~ocean_state_t state type~ocean_handle_t ocean_handle_t type~ocean_handle_t->type~hgrid_t grid type~ocean_handle_t->type~ocean_engine_t engine type~ocean_handle_t->type~ocean_state_t state type~ocean_dyn_t ocean_dyn_t type~ocean_dyn_t->type~bt_wide_t bt_wide type~ocean_state_t->type~ocean_diag_t diag type~ocean_state_t->type~ocean_dyn_t dyn

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: dx = 0.0_wp

Cell size in x (m)

real(kind=wp), public :: dy = 0.0_wp

Cell size in y (m)

integer, public :: i_offset_global = 0

Global index offset for this subdomain: i_global = i_phys_local + i_offset_global (0 on a single-rank / undecomposed grid — formula fills must add this when converting a local loop index to a physical coordinate)

integer, public :: j_offset_global = 0

Global index offset in y (see i_offset_global)

integer, public :: nghost = 2

Ghost cell width on each side

integer, public :: nx_global = 0

GLOBAL physical (interior) cells in x, i.e. the undecomposed domain extent. Equals nx_phys on a single rank; under MPI it is the sum over the rank row.

Why this lives on the grid: every formula fill (bathymetry setter, IC seeder) that normalises a position by the domain size, or centres a feature on the domain, needs the GLOBAL extent. These used to take nx_global/ny_global (and the offsets) as OPTIONAL dummy arguments defaulting to the LOCAL nx_phys/ny_phys — so a fill that simply forgot to pass them compiled fine and silently rebuilt the whole pattern inside each rank’s tile. That defect shipped three times. Carrying the global extents here, alongside i_offset_global / j_offset_global, makes the correct value the only value a fill can read: there is no argument left to forget.

integer, public :: nx_phys = 0

Physical (interior) cells in x

integer, public :: nx_total = 0

Total cells in x including ghosts (nx_phys + 2*nghost)

integer, public :: ny_global = 0

GLOBAL physical (interior) cells in y (see nx_global)

integer, public :: ny_phys = 0

Physical (interior) cells in y

integer, public :: ny_total = 0

Total cells in y including ghosts


Type-Bound Procedures

procedure, public, non_overridable :: init => grid_init

  • private subroutine grid_init(this, nx_phys, ny_phys, nghost, dx, dy)

    Arguments

    Type IntentOptional Attributes Name
    class(hgrid_t), intent(inout) :: this
    integer, intent(in) :: nx_phys
    integer, intent(in) :: ny_phys
    integer, intent(in) :: nghost
    real(kind=wp), intent(in) :: dx
    real(kind=wp), intent(in) :: dy

Source Code

   type :: hgrid_t
      integer  :: nx_total = 0
         !! Total cells in x including ghosts (nx_phys + 2*nghost)
      integer  :: ny_total = 0
         !! Total cells in y including ghosts
      integer  :: nx_phys = 0
         !! Physical (interior) cells in x
      integer  :: ny_phys = 0
         !! Physical (interior) cells in y
      integer  :: nghost = 2
         !! Ghost cell width on each side
      real(wp) :: dx = 0.0_wp
         !! Cell size in x (m)
      real(wp) :: dy = 0.0_wp
         !! Cell size in y (m)
      integer  :: i_offset_global = 0
         !! Global index offset for this subdomain: i_global = i_phys_local + i_offset_global
         !! (0 on a single-rank / undecomposed grid — formula fills must add this
         !! when converting a local loop index to a physical coordinate)
      integer  :: j_offset_global = 0
         !! Global index offset in y (see i_offset_global)
      integer  :: nx_global = 0
         !! GLOBAL physical (interior) cells in x, i.e. the undecomposed
         !! domain extent.  Equals `nx_phys` on a single rank; under MPI it
         !! is the sum over the rank row.
         !!
         !! Why this lives on the grid: every formula fill (bathymetry
         !! setter, IC seeder) that normalises a position by the domain
         !! size, or centres a feature on the domain, needs the GLOBAL
         !! extent.  These used to take `nx_global`/`ny_global` (and the
         !! offsets) as OPTIONAL dummy arguments defaulting to the LOCAL
         !! `nx_phys`/`ny_phys` — so a fill that simply forgot to pass them
         !! compiled fine and silently rebuilt the whole pattern inside
         !! each rank's tile.  That defect shipped three times.  Carrying
         !! the global extents here, alongside `i_offset_global` /
         !! `j_offset_global`, makes the correct value the only value a
         !! fill can read: there is no argument left to forget.
      integer  :: ny_global = 0
         !! GLOBAL physical (interior) cells in y (see nx_global)
   contains
      procedure, non_overridable :: init => grid_init
   end type hgrid_t