ocean_state_bytes Function

private pure function ocean_state_bytes(this) result(nbytes)

Counted allocatable footprint of the whole ocean god state, summed from each slot’s own bytes() (each term is 0 when that slot’s arrays are unallocated, so the DEFAULT-OFF closures gated in ocean_state_init contribute nothing — the total tracks the conditional allocation directly). Reported before enter_data and reconciled against the measured device mapping — a new array added without a matching bytes() term makes the measured map exceed this count and self-announces the drift (see rdb_mem_report). Slots with no allocatables (eos, restart) carry no term. The diag%vars registry USED to be excluded — it is now counted, per registered variable, by diag_var_bytes (it was the single largest uncounted device block: ~3.2 GB for the default catalog at 1000x800x50). data_input (PR-14) DOES have allocatables (f0/f1 per registered field) and IS device-mapped, so it carries a real term below — zero registered fields on every shipped namelist keeps that term at 0.

Type Bound

ocean_state_t

Arguments

Type IntentOptional Attributes Name
class(ocean_state_t), intent(in) :: this

Return Value integer(kind=int64)


Calls

proc~~ocean_state_bytes~~CallsGraph proc~ocean_state_bytes ocean_state_t%ocean_state_bytes proc~barotropic_state_bytes barotropic_state_t%barotropic_state_bytes proc~ocean_state_bytes->proc~barotropic_state_bytes interface~arr_bytes arr_bytes proc~barotropic_state_bytes->interface~arr_bytes proc~arr_bytes_i1 arr_bytes_i1 interface~arr_bytes->proc~arr_bytes_i1 proc~arr_bytes_i2 arr_bytes_i2 interface~arr_bytes->proc~arr_bytes_i2 proc~arr_bytes_i3 arr_bytes_i3 interface~arr_bytes->proc~arr_bytes_i3 proc~arr_bytes_l1 arr_bytes_l1 interface~arr_bytes->proc~arr_bytes_l1 proc~arr_bytes_l2 arr_bytes_l2 interface~arr_bytes->proc~arr_bytes_l2 proc~arr_bytes_l3 arr_bytes_l3 interface~arr_bytes->proc~arr_bytes_l3 proc~arr_bytes_r1 arr_bytes_r1 interface~arr_bytes->proc~arr_bytes_r1 proc~arr_bytes_r2 arr_bytes_r2 interface~arr_bytes->proc~arr_bytes_r2 proc~arr_bytes_r3 arr_bytes_r3 interface~arr_bytes->proc~arr_bytes_r3 proc~arr_bytes_r4 arr_bytes_r4 interface~arr_bytes->proc~arr_bytes_r4

Called by

proc~~ocean_state_bytes~~CalledByGraph proc~ocean_state_bytes ocean_state_t%ocean_state_bytes proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~ocean_state_bytes proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Source Code

   pure function ocean_state_bytes(this) result(nbytes)
      !! Counted allocatable footprint of the whole ocean god state, summed
      !! from each slot's own `bytes()` (each term is 0 when that slot's
      !! arrays are unallocated, so the DEFAULT-OFF closures gated in
      !! `ocean_state_init` contribute nothing — the total tracks the
      !! conditional allocation directly).  Reported before `enter_data` and
      !! reconciled against the measured device mapping — a new array added
      !! without a matching `bytes()` term makes the measured map exceed this
      !! count and self-announces the drift (see rdb_mem_report).  Slots with
      !! no allocatables (eos, restart) carry no term.  The `diag%vars`
      !! registry USED to be excluded — it is now counted, per registered
      !! variable, by `diag_var_bytes` (it was the single largest uncounted
      !! device block: ~3.2 GB for the default catalog at 1000x800x50).
      !! `data_input` (PR-14) DOES have
      !! allocatables (`f0`/`f1` per registered field) and IS
      !! device-mapped, so it carries a real term below — zero registered
      !! fields on every shipped namelist keeps that term at 0.
      class(ocean_state_t), intent(in) :: this
      integer(int64) :: nbytes

      nbytes = this%barotropic%bytes() &
               + this%metrics%bytes() &
               + this%dyn%bytes() &
               + this%continuity%bytes() &
               + this%coriolis_adv%bytes() &
               + this%pressure_force%bytes() &
               + this%vmix%bytes() &
               + this%wavespeed%bytes() &
               + this%lateral_mix%bytes() &
               + this%hvisc%bytes() &
               + this%bdrag%bytes() &
               + this%tdrag%bytes() &
               + this%surface_stress%bytes() &
               + this%surface_flux%bytes() &
               + this%cavity_flux%bytes() &
               + this%vert_advect%bytes() &
               + this%hdiff_tracer%bytes() &
               + this%vdiff%bytes() &
               + this%vcoord%bytes() &
               + this%diag%bytes() &
               + this%epbl%bytes() &
               + this%kshear%bytes() &
               + this%vmix_tidal%bytes() &
               + this%slopes%bytes() &
               + this%mle%bytes() &
               + this%gm%bytes() &
               + this%redi%bytes() &
               + this%varmix%bytes() &
               + this%meke%bytes() &
               + this%ice%bytes() &
               + this%tides%bytes() &
               + this%p_surf%bytes() &
               + this%obc%bytes() &
               + this%bc%bytes() &
               + this%sponge%bytes()
#ifndef RDB_NO_NETCDF
      nbytes = nbytes + this%data_input%bytes()
#endif
      if (this%use_multilayer) nbytes = nbytes + this%multilayer%bytes()
   end function ocean_state_bytes