multilayer_state_destroy Subroutine

private subroutine multilayer_state_destroy(this)

Type Bound

multilayer_state_t

Arguments

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

Calls

proc~~multilayer_state_destroy~~CallsGraph proc~multilayer_state_destroy multilayer_state_t%multilayer_state_destroy proc~tracer_destroy tracer_t%tracer_destroy proc~multilayer_state_destroy->proc~tracer_destroy

Variables

Type Visibility Attributes Name Initial
integer, private :: i

Source Code

   subroutine multilayer_state_destroy(this)
      class(multilayer_state_t), intent(inout) :: this
      integer :: i
      this%is_init = .false.
      if (allocated(this%tracers)) then
         do i = 1, size(this%tracers)
            call this%tracers(i)%destroy()
         end do
         deallocate (this%tracers)
      end if
      this%idx_salinity = 0
      this%idx_temperature = 0
      this%idx_age = 0
      this%idx_pseudo_salt = 0
      this%registry_locked = .false.
      if (allocated(this%h_layer)) deallocate (this%h_layer)
      if (allocated(this%h_layer0)) deallocate (this%h_layer0)
      if (allocated(this%u_face_x_layer)) deallocate (this%u_face_x_layer)
      if (allocated(this%hu_face_x_layer)) deallocate (this%hu_face_x_layer)
      if (allocated(this%v_face_y_layer)) deallocate (this%v_face_y_layer)
      if (allocated(this%hv_face_y_layer)) deallocate (this%hv_face_y_layer)
      if (allocated(this%u_face_x_layer0)) deallocate (this%u_face_x_layer0)
      if (allocated(this%u_av_layer)) deallocate (this%u_av_layer)
      if (allocated(this%v_av_layer)) deallocate (this%v_av_layer)
      if (allocated(this%h_av_layer)) deallocate (this%h_av_layer)
      if (allocated(this%v_face_y_layer0)) deallocate (this%v_face_y_layer0)
      if (allocated(this%mass_flux_x_layer)) deallocate (this%mass_flux_x_layer)
      if (allocated(this%mass_flux_y_layer)) deallocate (this%mass_flux_y_layer)
      if (allocated(this%flux_h_layer)) deallocate (this%flux_h_layer)
      if (allocated(this%rho_layer)) deallocate (this%rho_layer)
      if (allocated(this%p_top)) deallocate (this%p_top)
      if (allocated(this%w_interface)) deallocate (this%w_interface)
      if (allocated(this%mass_budget_continuity)) deallocate (this%mass_budget_continuity)
      if (allocated(this%heat_budget_surface)) deallocate (this%heat_budget_surface)
      if (allocated(this%salt_budget_surface)) deallocate (this%salt_budget_surface)
      if (allocated(this%heat_budget_geothermal)) deallocate (this%heat_budget_geothermal)
      if (allocated(this%heat_budget_sponge)) deallocate (this%heat_budget_sponge)
      if (allocated(this%salt_budget_sponge)) deallocate (this%salt_budget_sponge)
      if (allocated(this%heat_budget_vert_adv)) deallocate (this%heat_budget_vert_adv)
      if (allocated(this%salt_budget_vert_adv)) deallocate (this%salt_budget_vert_adv)
      if (allocated(this%heat_budget_vdiff)) deallocate (this%heat_budget_vdiff)
      if (allocated(this%salt_budget_vdiff)) deallocate (this%salt_budget_vdiff)
      if (allocated(this%heat_budget_hdiff)) deallocate (this%heat_budget_hdiff)
      if (allocated(this%salt_budget_hdiff)) deallocate (this%salt_budget_hdiff)
      if (allocated(this%heat_budget_horiz_adv)) deallocate (this%heat_budget_horiz_adv)
      if (allocated(this%salt_budget_horiz_adv)) deallocate (this%salt_budget_horiz_adv)
      if (allocated(this%mass_budget_remap)) deallocate (this%mass_budget_remap)
      if (allocated(this%heat_budget_remap)) deallocate (this%heat_budget_remap)
      if (allocated(this%salt_budget_remap)) deallocate (this%salt_budget_remap)
      if (allocated(this%wet_mask)) deallocate (this%wet_mask)
      if (allocated(this%k_top)) deallocate (this%k_top)
      if (allocated(this%k_top_u)) deallocate (this%k_top_u)
      if (allocated(this%k_top_v)) deallocate (this%k_top_v)
      if (allocated(this%k_bot)) deallocate (this%k_bot)
      if (allocated(this%k_bot_u)) deallocate (this%k_bot_u)
      if (allocated(this%k_bot_v)) deallocate (this%k_bot_v)
   end subroutine multilayer_state_destroy