New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 2715 for trunk/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_oce.F90 – NEMO

Ignore:
Timestamp:
2011-03-30T17:58:35+02:00 (13 years ago)
Author:
rblod
Message:

First attempt to put dynamic allocation on the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_oce.F90

    r2528 r2715  
    44   !! Ocean physics :  lateral tracer mixing coefficient defined in memory  
    55   !!===================================================================== 
    6    !! History :  9.0  !  02-11  (G. Madec)  Original code 
     6   !! History :  9.0  !  2002-11  (G. Madec)  Original code 
    77   !!---------------------------------------------------------------------- 
    8    USE par_oce         ! ocean parameters 
     8   USE par_oce        ! ocean parameters 
     9   USE in_out_manager ! I/O manager 
     10   USE lib_mpp         ! MPP library 
    911 
    1012   IMPLICIT NONE 
    1113   PRIVATE 
     14 
     15   PUBLIC ldftra_oce_alloc ! called by nemo_init->nemo_alloc, nemogcm.F90 
    1216 
    1317   !!---------------------------------------------------------------------- 
     
    3236 
    3337#if defined key_traldf_c3d 
    34    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   ahtt, ahtu, ahtv, ahtw   !: ** 3D coefficients ** at T-, U-, V-, W-points 
     38   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ahtt, ahtu, ahtv, ahtw   !: ** 3D coefficients ** at T-,U-,V-,W-points 
    3539#elif defined key_traldf_c2d 
    36    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)     ::   ahtt, ahtu, ahtv, ahtw   !: ** 2D coefficients ** at T-, U-, V-, W-points 
     40   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   ahtt, ahtu, ahtv, ahtw   !: ** 2D coefficients ** at T-,U-,V-,W-points 
    3741#elif defined key_traldf_c1d 
    38    REAL(wp), PUBLIC, DIMENSION(jpk)         ::   ahtt, ahtu, ahtv, ahtw   !: ** 1D coefficients ** at T-, U-, V-, W-points 
     42   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)     ::   ahtt, ahtu, ahtv, ahtw   !: ** 1D coefficients ** at T-,U-,V-,W-points 
    3943#else 
    40    REAL(wp), PUBLIC                         ::   ahtt, ahtu, ahtv, ahtw   !: ** 0D coefficients ** at T-, U-, V-, W-points 
     44   REAL(wp), PUBLIC                                      ::   ahtt, ahtu, ahtv, ahtw   !: ** 0D coefficients ** at T-,U-,V-,W-points 
    4145#endif 
    42  
    4346 
    4447#if defined key_traldf_eiv 
     
    4750   !!---------------------------------------------------------------------- 
    4851   LOGICAL, PUBLIC, PARAMETER               ::   lk_traldf_eiv   = .TRUE.   !: eddy induced velocity flag 
    49        
     52    
     53   !                                                                              !!! eddy coefficients at U-, V-, W-points  [m2/s] 
    5054# if defined key_traldf_c3d 
    51    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   aeiu, aeiv, aeiw  !: ** 3D coefficients ** at U-, V-, W-points  [m2/s] 
     55   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   aeiu , aeiv , aeiw   !: ** 3D coefficients ** 
    5256# elif defined key_traldf_c2d 
    53    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)     ::   aeiu, aeiv, aeiw  !: ** 2D coefficients ** at U-, V-, W-points  [m2/s] 
     57   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   aeiu , aeiv , aeiw   !: ** 2D coefficients ** 
    5458# elif defined key_traldf_c1d 
    55    REAL(wp), PUBLIC, DIMENSION(jpk)         ::   aeiu, aeiv, aeiw  !: ** 1D coefficients ** at U-, V-, W-points  [m2/s] 
     59   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)     ::   aeiu , aeiv , aeiw   !: ** 1D coefficients ** 
    5660# else 
    57    REAL(wp), PUBLIC                         ::   aeiu, aeiv, aeiw  !: ** 0D coefficients ** at U-, V-, W-points  [m2/s] 
     61   REAL(wp), PUBLIC                                      ::   aeiu , aeiv , aeiw   !: ** 0D coefficients ** 
    5862# endif 
    5963# if defined key_diaeiv 
    60    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   u_eiv, v_eiv, w_eiv   !: eddy induced velocity [m/s] 
     64   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   u_eiv, v_eiv, w_eiv   !: eddy induced velocity [m/s] 
    6165# endif 
    6266 
     
    7377   !! $Id$  
    7478   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     79   !!---------------------------------------------------------------------- 
     80CONTAINS 
     81 
     82   INTEGER FUNCTION ldftra_oce_alloc() 
     83     !!---------------------------------------------------------------------- 
     84      !!                 ***  FUNCTION ldftra_oce_alloc  *** 
     85     !!---------------------------------------------------------------------- 
     86     INTEGER, DIMENSION(3) :: ierr 
     87     !!---------------------------------------------------------------------- 
     88     ierr(:) = 0 
     89 
     90#if defined key_traldf_c3d 
     91      ALLOCATE( ahtt(jpi,jpj,jpk) , ahtu(jpi,jpj,jpk) , ahtv(jpi,jpj,jpk) , ahtw(jpi,jpj,jpk) , STAT=ierr(1) ) 
     92#elif defined key_traldf_c2d 
     93      ALLOCATE( ahtt(jpi,jpj    ) , ahtu(jpi,jpj    ) , ahtv(jpi,jpj    ) , ahtw(jpi,jpj    ) , STAT=ierr(1) ) 
     94#elif defined key_traldf_c1d 
     95      ALLOCATE( ahtt(        jpk) , ahtu(        jpk) , ahtv(        jpk) , ahtw(        jpk) , STAT=ierr(1) ) 
     96#endif 
     97      ! 
     98#if defined key_traldf_eiv 
     99# if defined key_traldf_c3d 
     100      ALLOCATE( aeiu(jpi,jpj,jpk) , aeiv(jpi,jpj,jpk) , aeiw(jpi,jpj,jpk) , STAT=ierr(2) ) 
     101# elif defined key_traldf_c2d 
     102      ALLOCATE( aeiu(jpi,jpj    ) , aeiv(jpi,jpj    ) , aeiw(jpi,jpj    ) , STAT=ierr(2) ) 
     103# elif defined key_traldf_c1d 
     104      ALLOCATE( aeiu(        jpk) , aeiv(        jpk) , aeiw(        jpk) , STAT=ierr(2) ) 
     105# endif 
     106# if defined key_diaeiv 
     107      ALLOCATE( u_eiv(jpi,jpj,jpk), v_eiv(jpi,jpj,jpk), w_eiv(jpi,jpj,jpk), STAT=ierr(3)) 
     108# endif 
     109#endif 
     110      ldftra_oce_alloc = MAXVAL( ierr ) 
     111      IF( ldftra_oce_alloc /= 0 )   CALL ctl_warn('ldftra_oce_alloc: failed to allocate arrays') 
     112      ! 
     113   END FUNCTION ldftra_oce_alloc 
     114 
    75115   !!===================================================================== 
    76116END MODULE ldftra_oce 
Note: See TracChangeset for help on using the changeset viewer.