multilayer_state_bytes Function

private pure function multilayer_state_bytes(this) result(nbytes)

Counted allocatable footprint of the ocean C-grid layer slot: the layer prognostics + face transports + RK2 saves + density/vertical diagnostics, the per-tracer registry (each tracer sums its own arrays; ideal-age rides the registry when on), and the device-resident conservation-budget accumulators.

Type Bound

multilayer_state_t

Arguments

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

Return Value integer(kind=int64)


Calls

proc~~multilayer_state_bytes~~CallsGraph proc~multilayer_state_bytes multilayer_state_t%multilayer_state_bytes interface~arr_bytes arr_bytes proc~multilayer_state_bytes->interface~arr_bytes proc~tracer_bytes tracer_t%tracer_bytes proc~multilayer_state_bytes->proc~tracer_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 proc~tracer_bytes->interface~arr_bytes

Variables

Type Visibility Attributes Name Initial
integer, private :: it

Source Code

   pure function multilayer_state_bytes(this) result(nbytes)
      !! Counted allocatable footprint of the ocean C-grid layer slot: the
      !! layer prognostics + face transports + RK2 saves + density/vertical
      !! diagnostics, the per-tracer registry (each tracer sums its own
      !! arrays; ideal-age rides the registry when on), and the
      !! device-resident conservation-budget accumulators.
      class(multilayer_state_t), intent(in) :: this
      integer(int64) :: nbytes
      integer :: it

      nbytes = arr_bytes(this%h_layer) + arr_bytes(this%h_layer0) &
               + arr_bytes(this%u_face_x_layer) + arr_bytes(this%hu_face_x_layer) &
               + arr_bytes(this%v_face_y_layer) + arr_bytes(this%hv_face_y_layer) &
               + arr_bytes(this%u_face_x_layer0) + arr_bytes(this%v_face_y_layer0) &
               + arr_bytes(this%u_av_layer) + arr_bytes(this%v_av_layer) &
               + arr_bytes(this%h_av_layer) &
               + arr_bytes(this%mass_flux_x_layer) + arr_bytes(this%mass_flux_y_layer) &
               + arr_bytes(this%flux_h_layer) + arr_bytes(this%rho_layer) &
               + arr_bytes(this%p_top) &
               + arr_bytes(this%w_interface) + arr_bytes(this%wet_mask) &
               + arr_bytes(this%k_top) + arr_bytes(this%k_top_u) &
               + arr_bytes(this%k_top_v) &
               + arr_bytes(this%k_bot) + arr_bytes(this%k_bot_u) &
               + arr_bytes(this%k_bot_v) &
               + arr_bytes(this%mass_budget_continuity) &
               + arr_bytes(this%heat_budget_surface) + arr_bytes(this%salt_budget_surface) &
               + arr_bytes(this%heat_budget_geothermal) &
               + arr_bytes(this%heat_budget_sponge) + arr_bytes(this%salt_budget_sponge) &
               + arr_bytes(this%heat_budget_vert_adv) + arr_bytes(this%salt_budget_vert_adv) &
               + arr_bytes(this%heat_budget_vdiff) + arr_bytes(this%salt_budget_vdiff) &
               + arr_bytes(this%heat_budget_hdiff) + arr_bytes(this%salt_budget_hdiff) &
               + arr_bytes(this%heat_budget_horiz_adv) + arr_bytes(this%salt_budget_horiz_adv) &
               + arr_bytes(this%mass_budget_remap) &
               + arr_bytes(this%heat_budget_remap) + arr_bytes(this%salt_budget_remap)

      if (allocated(this%tracers)) then
         do it = 1, size(this%tracers)
            nbytes = nbytes + this%tracers(it)%bytes()
         end do
      end if
   end function multilayer_state_bytes