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/LIM_SRC_2/dom_ice_2.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/LIM_SRC_2/dom_ice_2.F90

    r2528 r2715  
    1515   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    1616   !!---------------------------------------------------------------------- 
    17    USE par_ice_2 
     17   USE par_ice_2   ! LIM parameters 
    1818 
    1919   IMPLICIT NONE 
    2020   PRIVATE 
     21 
     22   PUBLIC    dom_ice_alloc_2    ! Called from nemogcm.F90 
    2123 
    2224   LOGICAL, PUBLIC ::   l_jeq     = .TRUE.     !: Equator inside the domain flag 
     
    2527      !                                        !  (otherwise = jpj+10 (SH) or -10 (SH) ) 
    2628 
    27    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)         ::   fs2cor , fcor     !: coriolis factor and coeficient 
    28    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)         ::   covrai            !: sine of geographic latitude 
    29    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)         ::   area              !: surface of grid cell  
    30    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)         ::   tms    , tmu      !: temperature and velocity points masks 
    31    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,2,2)     ::   wght              !: weight of the 4 neighbours to compute averages 
     29   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)         ::   fs2cor , fcor     !: coriolis factor and coeficient 
     30   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)         ::   covrai            !: sine of geographic latitude 
     31   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)         ::   area              !: surface of grid cell  
     32   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)         ::   tms    , tmu      !: temperature and velocity points masks 
     33   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)     ::   wght              !: weight of the 4 neighbours to compute averages 
    3234 
    3335 
    3436# if defined key_lim2_vp 
    35    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,2,2)     ::   akappa , bkappa   !: first and third group of metric coefficients 
    36    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,2,2,2,2) ::   alambd            !: second group of metric coefficients 
     37   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)     ::   akappa , bkappa   !: first and third group of metric coefficients 
     38   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:,:) ::   alambd            !: second group of metric coefficients 
    3739# else 
    38    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)         ::   tmv    , tmf      !: y-velocity and F-points masks 
    39    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)         ::   tmi               !: ice mask: =1 if ice thick > 0 
     40   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)         ::   tmv    , tmf      !: y-velocity and F-points masks 
     41   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)         ::   tmi               !: ice mask: =1 if ice thick > 0 
    4042# endif 
     43   !!---------------------------------------------------------------------- 
     44   CONTAINS 
     45 
     46   INTEGER FUNCTION dom_ice_alloc_2() 
     47      !!---------------------------------------------------------------------- 
     48      USE lib_mpp, ONLY:   ctl_warn   ! MPP library 
     49      INTEGER :: ierr(2) 
     50      !!---------------------------------------------------------------------- 
     51      ierr(:) = 0 
     52      ! 
     53      ALLOCATE( fs2cor(jpi,jpj)     , fcor(jpi,jpj) ,                                   & 
     54         &      covrai(jpi,jpj)     , area(jpi,jpj) , tms(jpi,jpj) , tmu(jpi,jpj) ,     & 
     55         &      wght  (jpi,jpj,2,2)                                               , STAT=ierr(1) ) 
     56         ! 
     57      ALLOCATE(                                                    & 
     58#if defined key_lim2_vp  
     59         &        akappa(jpi,jpj,2,2)     , bkappa(jpi,jpj,2,2),   & 
     60         &        alambd(jpi,jpj,2,2,2,2) ,                        & 
     61#else 
     62         &        tmv(jpi,jpj) , tmf(jpi,jpj) , tmi(jpi,jpj) ,     & 
     63#endif 
     64         &        STAT=ierr(2) ) 
     65         ! 
     66      dom_ice_alloc_2 = MAXVAL(ierr) 
     67      IF( dom_ice_alloc_2 /= 0 )   CALL ctl_warn('dom_ice_alloc_2: failed to allocate arrays') 
     68      ! 
     69   END FUNCTION dom_ice_alloc_2 
    4170 
    4271#else 
Note: See TracChangeset for help on using the changeset viewer.