dealloc_resol_mod.F90 Source File


This file depends on

sourcefile~~dealloc_resol_mod.f90~~EfferentGraph sourcefile~dealloc_resol_mod.f90 dealloc_resol_mod.F90 sourcefile~seefmm_mix.f90 seefmm_mix.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~seefmm_mix.f90 sourcefile~set_resol_mod.f90 set_resol_mod.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~set_resol_mod.f90 sourcefile~tpm_ctl.f90 tpm_ctl.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~tpm_ctl.f90 sourcefile~tpm_dim.f90 tpm_dim.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~tpm_dim.f90 sourcefile~tpm_distr.f90 tpm_distr.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~tpm_distr.f90 sourcefile~tpm_fft.f90 tpm_fft.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~tpm_fft.f90 sourcefile~tpm_fields.f90 tpm_fields.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~tpm_fields.f90 sourcefile~tpm_flt.f90 tpm_flt.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~tpm_flt.f90 sourcefile~tpm_gen.f90 tpm_gen.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~tpm_gen.f90 sourcefile~tpm_geometry.f90 tpm_geometry.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~tpm_geometry.f90 sourcefile~tpm_hicfft.f90 tpm_hicfft.F90 sourcefile~dealloc_resol_mod.f90->sourcefile~tpm_hicfft.f90 sourcefile~parkind_ectrans.f90 parkind_ectrans.F90 sourcefile~seefmm_mix.f90->sourcefile~parkind_ectrans.f90 sourcefile~wts500_mod.f90 wts500_mod.F90 sourcefile~seefmm_mix.f90->sourcefile~wts500_mod.f90 sourcefile~set_resol_mod.f90->sourcefile~tpm_ctl.f90 sourcefile~set_resol_mod.f90->sourcefile~tpm_dim.f90 sourcefile~set_resol_mod.f90->sourcefile~tpm_distr.f90 sourcefile~set_resol_mod.f90->sourcefile~tpm_fft.f90 sourcefile~set_resol_mod.f90->sourcefile~tpm_fields.f90 sourcefile~set_resol_mod.f90->sourcefile~tpm_flt.f90 sourcefile~set_resol_mod.f90->sourcefile~tpm_gen.f90 sourcefile~set_resol_mod.f90->sourcefile~tpm_geometry.f90 sourcefile~set_resol_mod.f90->sourcefile~tpm_hicfft.f90 sourcefile~abort_trans_mod.f90 abort_trans_mod.F90 sourcefile~set_resol_mod.f90->sourcefile~abort_trans_mod.f90 sourcefile~sharedmem_mod.f90 sharedmem_mod.F90 sourcefile~tpm_ctl.f90->sourcefile~sharedmem_mod.f90 sourcefile~tpm_fft.f90->sourcefile~parkind_ectrans.f90 sourcefile~tpm_fields.f90->sourcefile~parkind_ectrans.f90 sourcefile~tpm_flt.f90->sourcefile~seefmm_mix.f90 sourcefile~tpm_flt.f90->sourcefile~parkind_ectrans.f90 sourcefile~tpm_gen.f90->sourcefile~parkind_ectrans.f90 sourcefile~tpm_geometry.f90->sourcefile~parkind_ectrans.f90 sourcefile~growing_allocator_mod.f90 growing_allocator_mod.F90 sourcefile~tpm_hicfft.f90->sourcefile~growing_allocator_mod.f90 sourcefile~tpm_hicfft.f90->sourcefile~parkind_ectrans.f90 sourcefile~abort_trans_mod.f90->sourcefile~tpm_distr.f90 sourcefile~abort_trans_mod.f90->sourcefile~tpm_gen.f90 sourcefile~wts500_mod.f90->sourcefile~parkind_ectrans.f90

Files dependent on this one

sourcefile~~dealloc_resol_mod.f90~~AfferentGraph sourcefile~dealloc_resol_mod.f90 dealloc_resol_mod.F90 sourcefile~trans_end.f90 trans_end.F90 sourcefile~trans_end.f90->sourcefile~dealloc_resol_mod.f90 sourcefile~trans_end.f90~2 trans_end.F90 sourcefile~trans_end.f90~2->sourcefile~dealloc_resol_mod.f90 sourcefile~trans_release.f90 trans_release.F90 sourcefile~trans_release.f90->sourcefile~dealloc_resol_mod.f90 sourcefile~trans_release.f90~2 trans_release.F90 sourcefile~trans_release.f90~2->sourcefile~dealloc_resol_mod.f90

Source Code

! (C) Copyright 2013- ECMWF.
! (C) Copyright 2013- Meteo-France.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
! In applying this licence, ECMWF does not waive the privileges and immunities
! granted to it by virtue of its status as an intergovernmental organisation
! nor does it submit to any jurisdiction.
!

MODULE DEALLOC_RESOL_MOD
CONTAINS
SUBROUTINE DEALLOC_RESOL(KRESOL)

!**** *DEALLOC_RESOL* - Deallocations of a resolution

!     Purpose.
!     --------
!     Release allocated arrays for a given resolution

!**   Interface.
!     ----------
!     CALL DEALLOC_RESOL

!     Explicit arguments : KRESOL : resolution tag
!     --------------------

!     Method.
!     -------

!     Externals.  None
!     ----------

!     Author.
!     -------
!        R. El Khatib *METEO-FRANCE*

!     Modifications.
!     --------------
!        Original : 09-Jul-2013 from trans_end

!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPIM

USE TPM_DIM         ,ONLY : R
USE TPM_GEN         ,ONLY : LENABLED, NOUT,NDEF_RESOL
USE TPM_DISTR       ,ONLY : D,NPRTRV
USE TPM_GEOMETRY    ,ONLY : G
USE TPM_FIELDS      ,ONLY : F
USE TPM_FFT         ,ONLY : T
USE TPM_FLT         ,ONLY : S
USE TPM_CTL         ,ONLY : C
USE TPM_HICFFT      ,ONLY : DESTROY_ALL_PLANS_FFT
USE SEEFMM_MIX

USE SET_RESOL_MOD   ,ONLY : SET_RESOL
!

IMPLICIT NONE

INTEGER(KIND=JPIM),  INTENT(IN) :: KRESOL
INTEGER(KIND=JPIM) :: JMLOC,IPRTRV,JSETV,IMLOC,IM,ILA,ILS, JRESOL

!     ------------------------------------------------------------------

IF (.NOT.LENABLED(KRESOL)) THEN

  WRITE(UNIT=NOUT,FMT='('' DEALLOC_RESOL WARNING : KRESOL = '',I3,'' ALREADY DISABLED '')') KRESOL

ELSE

  CALL SET_RESOL(KRESOL)

  CALL DESTROY_ALL_PLANS_FFT()

  !TPM_FLT
  IF( ALLOCATED(S%FA) ) THEN
    DO JMLOC=1,D%NUMP,NPRTRV  ! +++++++++++++++++++++ JMLOC LOOP ++++++++++
      IPRTRV=MIN(NPRTRV,D%NUMP-JMLOC+1)
      DO JSETV=1,IPRTRV
        IMLOC=JMLOC+JSETV-1
        IM = D%MYMS(IMLOC)
        ILA = (R%NSMAX-IM+2)/2
        ILS = (R%NSMAX-IM+3)/2
        IF(.NOT.C%CIO_TYPE == 'mbuf' .AND. ASSOCIATED(S%FA(IMLOC)%RPNMA)) DEALLOCATE(S%FA(IMLOC)%RPNMA)
        IF(.NOT.C%CIO_TYPE == 'mbuf' .AND. ASSOCIATED(S%FA(IMLOC)%RPNMS)) DEALLOCATE(S%FA(IMLOC)%RPNMS)
        IF(S%LDLL) THEN
          IF(.NOT.C%CIO_TYPE == 'mbuf' .AND. ASSOCIATED(S%FA(IMLOC)%RPNMWI)) DEALLOCATE(S%FA(IMLOC)%RPNMWI)
          IF(.NOT.C%CIO_TYPE == 'mbuf' .AND. ASSOCIATED(S%FA(IMLOC)%RPNMWO)) DEALLOCATE(S%FA(IMLOC)%RPNMWO)
        ENDIF
      ENDDO
    ENDDO
    DEALLOCATE(S%FA)
  ENDIF
  IF(S%LDLL) THEN
    CALL FREE_SEEFMM(S%FMM_INTI)
    IF(ASSOCIATED(S%FMM_INTI)) DEALLOCATE(S%FMM_INTI)
  ENDIF

  !TPM_DISTR
  IF(ALLOCATED(D%NFRSTLAT)) DEALLOCATE(D%NFRSTLAT)
  IF(ALLOCATED(D%NLSTLAT)) DEALLOCATE(D%NLSTLAT)
  IF(ALLOCATED(D%NPTRLAT)) DEALLOCATE(D%NPTRLAT)
  IF(ALLOCATED(D%NPTRFRSTLAT)) DEALLOCATE(D%NPTRFRSTLAT)
  IF(ALLOCATED(D%NPTRLSTLAT)) DEALLOCATE(D%NPTRLSTLAT)
  IF(ALLOCATED(D%LSPLITLAT)) DEALLOCATE(D%LSPLITLAT)
  IF(ALLOCATED(D%NSTA)) DEALLOCATE(D%NSTA)
  IF(ALLOCATED(D%NONL)) DEALLOCATE(D%NONL)
  IF(ALLOCATED(D%NGPTOTL)) DEALLOCATE(D%NGPTOTL)
  IF(ALLOCATED(D%NPROCA_GP)) DEALLOCATE(D%NPROCA_GP)

  IF(D%LWEIGHTED_DISTR) THEN
    IF(ALLOCATED(D%RWEIGHT)) DEALLOCATE(D%RWEIGHT)
  ENDIF

  IF(ALLOCATED(D%MYMS)) DEALLOCATE(D%MYMS)
  IF(ALLOCATED(D%NUMPP)) DEALLOCATE(D%NUMPP)
  IF(ALLOCATED(D%NPOSSP)) DEALLOCATE(D%NPOSSP)
  IF(ALLOCATED(D%NPROCM)) DEALLOCATE(D%NPROCM)
  IF(ALLOCATED(D%NDIM0G)) DEALLOCATE(D%NDIM0G)
  IF(ALLOCATED(D%NASM0)) DEALLOCATE(D%NASM0)
  IF(ALLOCATED(D%NATM0)) DEALLOCATE(D%NATM0)
  IF(ALLOCATED(D%NLATLS)) DEALLOCATE(D%NLATLS)
  IF(ALLOCATED(D%NLATLE)) DEALLOCATE(D%NLATLE)
  IF(ALLOCATED(D%NPMT)) DEALLOCATE(D%NPMT)
  IF(ALLOCATED(D%NPMS)) DEALLOCATE(D%NPMS)
  IF(ALLOCATED(D%NPMG)) DEALLOCATE(D%NPMG)
  IF(ALLOCATED(D%NULTPP)) DEALLOCATE(D%NULTPP)
  IF(ALLOCATED(D%NPROCL)) DEALLOCATE(D%NPROCL)
  IF(ALLOCATED(D%NPTRLS)) DEALLOCATE(D%NPTRLS)
  IF(ALLOCATED(D%NALLMS)) DEALLOCATE(D%NALLMS)
  IF(ALLOCATED(D%NPTRMS)) DEALLOCATE(D%NPTRMS)
  IF(ALLOCATED(D%NSTAGT0B)) DEALLOCATE(D%NSTAGT0B)
  IF(ALLOCATED(D%NSTAGT1B)) DEALLOCATE(D%NSTAGT1B)
  IF(ALLOCATED(D%NPNTGTB0)) DEALLOCATE(D%NPNTGTB0)
  IF(ALLOCATED(D%NPNTGTB1)) DEALLOCATE(D%NPNTGTB1)
  IF(ALLOCATED(D%NLTSFTB)) DEALLOCATE(D%NLTSFTB)
  IF(ALLOCATED(D%NLTSGTB)) DEALLOCATE(D%NLTSGTB)
  IF(ALLOCATED(D%MSTABF)) DEALLOCATE(D%MSTABF)
  IF(ALLOCATED(D%NSTAGTF)) DEALLOCATE(D%NSTAGTF)

  !TPM_FFT
  IF (.NOT.D%LCPNMONLY) THEN
    IF( ASSOCIATED(T) ) THEN
      IF( ALLOCATED(T%TRIGS) ) DEALLOCATE(T%TRIGS)
      IF( ALLOCATED(T%NFAX) )  DEALLOCATE(T%NFAX)
!!      IF( ALLOCATED(T%LUSEFFT992)) DEALLOCATE(T%LUSEFFT992)
    ENDIF
  ENDIF


  !TPM_FIELDS
  IF(ALLOCATED(F%RMU)) DEALLOCATE(F%RMU)
  IF(ALLOCATED(F%RW)) DEALLOCATE(F%RW)
  IF(ALLOCATED(F%R1MU2)) DEALLOCATE(F%R1MU2)
  IF(ALLOCATED(F%RACTHE)) DEALLOCATE(F%RACTHE)
  IF(ALLOCATED(F%REPSNM)) DEALLOCATE(F%REPSNM)
  IF(ALLOCATED(F%RN)) DEALLOCATE(F%RN)
  IF(ALLOCATED(F%RLAPIN)) DEALLOCATE(F%RLAPIN)
  IF(ALLOCATED(F%NLTN)) DEALLOCATE(F%NLTN)
  IF( S%LKEEPRPNM ) THEN
    IF(ALLOCATED(F%RPNM)) DEALLOCATE(F%RPNM)
  ENDIF
  IF( S%LDLL ) THEN
    IF(ALLOCATED(F%RMU2)) DEALLOCATE(F%RMU2)
    IF(ALLOCATED(F%RACTHE2)) DEALLOCATE(F%RACTHE2)
  ENDIF

  !TPM_GEOMETRY
  IF(ALLOCATED(G%NMEN)) DEALLOCATE(G%NMEN)
  IF(ALLOCATED(G%NDGLU)) DEALLOCATE(G%NDGLU)
  IF(ALLOCATED(G%NLOEN)) DEALLOCATE(G%NLOEN)

  LENABLED(KRESOL)=.FALSE.
  NDEF_RESOL = COUNT(LENABLED)
  ! Do not stay on a disabled resolution
  DO JRESOL=1,SIZE(LENABLED)
    IF (LENABLED(JRESOL)) THEN
      CALL SET_RESOL(JRESOL)
      EXIT
    ENDIF
  ENDDO

ENDIF
!     ------------------------------------------------------------------

END SUBROUTINE DEALLOC_RESOL
END MODULE DEALLOC_RESOL_MOD