ocean_sea_ice_destroy Subroutine

private subroutine ocean_sea_ice_destroy(this)

Reverse of init. Clears is_init first (use-after-destroy guard), then releases allocations.

Type Bound

ocean_sea_ice_t

Arguments

Type IntentOptional Attributes Name
class(ocean_sea_ice_t), intent(inout) :: this

Calls

proc~~ocean_sea_ice_destroy~~CallsGraph proc~ocean_sea_ice_destroy ocean_sea_ice_t%ocean_sea_ice_destroy proc~evp_workspace_destroy evp_workspace_t%evp_workspace_destroy proc~ocean_sea_ice_destroy->proc~evp_workspace_destroy

Source Code

   subroutine ocean_sea_ice_destroy(this)
      !! Reverse of `init`.  Clears `is_init` first (use-after-destroy
      !! guard), then releases allocations.
      class(ocean_sea_ice_t), intent(inout) :: this
      this%is_init = .false.
      if (allocated(this%frazil_heat)) deallocate (this%frazil_heat)
      if (allocated(this%heat_budget_frazil)) deallocate (this%heat_budget_frazil)
      if (allocated(this%part_size)) deallocate (this%part_size)
      if (allocated(this%m_ice)) deallocate (this%m_ice)
      if (allocated(this%m_snow)) deallocate (this%m_snow)
      if (allocated(this%enth_ice)) deallocate (this%enth_ice)
      if (allocated(this%enth_snow)) deallocate (this%enth_snow)
      if (allocated(this%sal_ice)) deallocate (this%sal_ice)
      if (allocated(this%m_frozen_diag)) deallocate (this%m_frozen_diag)
      if (allocated(this%salt_flux_diag)) deallocate (this%salt_flux_diag)
      if (allocated(this%atm_sf0)) deallocate (this%atm_sf0)
      if (allocated(this%atm_dsfdt)) deallocate (this%atm_dsfdt)
      if (allocated(this%atm_sw_dn)) deallocate (this%atm_sw_dn)
      if (allocated(this%atm_fprec)) deallocate (this%atm_fprec)
      if (allocated(this%fb)) deallocate (this%fb)
      if (allocated(this%sst_seam)) deallocate (this%sst_seam)
      if (allocated(this%ssurf_seam)) deallocate (this%ssurf_seam)
      if (allocated(this%tfw_seam)) deallocate (this%tfw_seam)
      if (allocated(this%tsurf_out)) deallocate (this%tsurf_out)
      if (allocated(this%h2o_ocn_to_ice)) deallocate (this%h2o_ocn_to_ice)
      if (allocated(this%h2o_ice_to_ocn)) deallocate (this%h2o_ice_to_ocn)
      if (allocated(this%heat_to_ocn)) deallocate (this%heat_to_ocn)
      if (allocated(this%sw_thru)) deallocate (this%sw_thru)
      if (allocated(this%snow_to_ice)) deallocate (this%snow_to_ice)
      if (allocated(this%heat_flux_diag)) deallocate (this%heat_flux_diag)
      if (allocated(this%sw_thru_diag)) deallocate (this%sw_thru_diag)
      if (allocated(this%m_melt_diag)) deallocate (this%m_melt_diag)
      if (allocated(this%fprec_ocn_diag)) deallocate (this%fprec_ocn_diag)
      if (allocated(this%h_lim)) deallocate (this%h_lim)
      if (allocated(this%mh_lim)) deallocate (this%mh_lim)
      if (allocated(this%hlim_cfg)) deallocate (this%hlim_cfg)
      if (allocated(this%fb_part_sum)) deallocate (this%fb_part_sum)
      if (allocated(this%snow_part_ocn)) deallocate (this%snow_part_ocn)
      if (allocated(this%u_ice)) deallocate (this%u_ice)
      if (allocated(this%v_ice)) deallocate (this%v_ice)
      if (allocated(this%str_d)) deallocate (this%str_d)
      if (allocated(this%str_t)) deallocate (this%str_t)
      if (allocated(this%str_s)) deallocate (this%str_s)
      if (allocated(this%tau_a_x)) deallocate (this%tau_a_x)
      if (allocated(this%tau_a_y)) deallocate (this%tau_a_y)
      if (allocated(this%fxoc)) deallocate (this%fxoc)
      if (allocated(this%fyoc)) deallocate (this%fyoc)
      if (allocated(this%tau_ocn_x)) deallocate (this%tau_ocn_x)
      if (allocated(this%tau_ocn_y)) deallocate (this%tau_ocn_y)
      this%tau_ocn_valid = 0.0_wp
      if (this%dynamics) call this%evp_ws%destroy()
      if (allocated(this%mca_ice)) deallocate (this%mca_ice)
      if (allocated(this%mca_snow)) deallocate (this%mca_snow)
      if (allocated(this%uh_ice)) deallocate (this%uh_ice)
      if (allocated(this%vh_ice)) deallocate (this%vh_ice)
      if (allocated(this%uh_snow)) deallocate (this%uh_snow)
      if (allocated(this%vh_snow)) deallocate (this%vh_snow)
      if (allocated(this%htot_work)) deallocate (this%htot_work)
      if (allocated(this%hl_x_work)) deallocate (this%hl_x_work)
      if (allocated(this%hr_x_work)) deallocate (this%hr_x_work)
      if (allocated(this%hl_y_work)) deallocate (this%hl_y_work)
      if (allocated(this%hr_y_work)) deallocate (this%hr_y_work)
      if (allocated(this%uhtot_work)) deallocate (this%uhtot_work)
      if (allocated(this%vhtot_work)) deallocate (this%vhtot_work)
      if (allocated(this%tr_flux_x_work)) deallocate (this%tr_flux_x_work)
      if (allocated(this%tr_flux_y_work)) deallocate (this%tr_flux_y_work)
      this%nx_total = 0
      this%ny_total = 0
   end subroutine ocean_sea_ice_destroy