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/DOM – 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

Location:
trunk/NEMOGCM/NEMO/OPA_SRC/DOM
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90

    r2528 r2715  
    4646   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    4747   !! $Id$ 
    48    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    49    !!---------------------------------------------------------------------- 
    50  
     48   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     49   !!---------------------------------------------------------------------- 
    5150CONTAINS 
    5251 
     
    181180      REAL(wp)                    ::   zze2 
    182181      REAL(wp), DIMENSION (jpncs) ::   zfwf  
    183   
    184182      !!---------------------------------------------------------------------- 
    185183      ! 
     
    366364         DO jj = ncsj1(jc), ncsj2(jc) 
    367365            DO ji = ncsi1(jc), ncsi2(jc) 
    368                pbat(ji,jj) = 0.e0    
     366               pbat(ji,jj) = 0._wp    
    369367               kbat(ji,jj) = 0    
    370368            END DO  
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90

    r2528 r2715  
    4646   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    4747   !! $Id$ 
    48    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     48   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    4949   !!---------------------------------------------------------------------- 
    50  
    5150CONTAINS 
    5251 
     
    6867      !!              - nmonth_len, nyear_len, nmonth_half, nmonth_end through day_mth 
    6968      !!---------------------------------------------------------------------- 
    70       INTEGER :: inbday, idweek 
    71       REAL(wp) :: zjul 
     69      INTEGER  ::  inbday, idweek 
     70      REAL(wp) ::   zjul 
    7271      !!---------------------------------------------------------------------- 
    7372 
     
    129128      CALL day( nit000 ) 
    130129 
    131        
    132130   END SUBROUTINE day_init 
    133131 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90

    r2528 r2715  
    77   !! History :  1.0  ! 2005-10  (A. Beckmann, G. Madec)  reactivate s-coordinate  
    88   !!            3.3  ! 2010-11  (G. Madec) add mbk. arrays associated to the deepest ocean level 
    9    !!---------------------------------------------------------------------- 
    10    USE par_oce      ! ocean parameters 
     9   !!            4.0  ! 2011-01  (A. R. Porter, STFC Daresbury) dynamical allocation 
     10   !!---------------------------------------------------------------------- 
     11 
     12   !!---------------------------------------------------------------------- 
     13   !!   Agrif_Root    : dummy function used when lk_agrif=F 
     14   !!   Agrif_CFixed  : dummy function used when lk_agrif=F 
     15   !!   dom_oce_alloc : dynamical allocation of dom_oce arrays 
     16   !!---------------------------------------------------------------------- 
     17   USE par_oce        ! ocean parameters 
    1118 
    1219   IMPLICIT NONE 
    13    PUBLIC           ! allows the acces to par_oce when dom_oce is used 
    14    !                ! exception to coding rules... to be suppressed ??? 
     20   PUBLIC             ! allows the acces to par_oce when dom_oce is used 
     21   !                  ! exception to coding rules... to be suppressed ??? 
     22 
     23   PUBLIC dom_oce_alloc  ! Called from nemogcm.F90 
    1524 
    1625   !!---------------------------------------------------------------------- 
     
    4554   INTEGER , PUBLIC ::   nclosea         !: =0 suppress closed sea/lake from the ORCA domain or not (=1) 
    4655 
    47  
    4856   !                                                  !!! associated variables 
    4957   INTEGER , PUBLIC                 ::   neuler  = 0   !: restart euler forward option (0=Euler) 
    5058   REAL(wp), PUBLIC                 ::   atfp1         !: asselin time filter coeff. (atfp1= 1-2*atfp) 
    51    REAL(wp), PUBLIC, DIMENSION(jpk) ::   rdttra        !: vertical profile of tracer time step 
     59   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdttra  !: vertical profile of tracer time step 
     60   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dtra  !: = 2*rdttra except at nit000 (=rdttra) if neuler=0 
    5261 
    5362   !                                         !!* Namelist namcla : cross land advection 
     
    8392   INTEGER, PUBLIC ::   nidom             !: ??? 
    8493 
    85    INTEGER, PUBLIC, DIMENSION(jpi)    ::   mig        !: local  ==> global domain i-index 
    86    INTEGER, PUBLIC, DIMENSION(jpj)    ::   mjg        !: local  ==> global domain j-index 
    87    INTEGER, PUBLIC, DIMENSION(jpidta) ::   mi0, mi1   !: global ==> local  domain i-index    !!bug ==> other solution? 
     94   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   mig        !: local  ==> global domain i-index 
     95   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   mjg        !: local  ==> global domain j-index 
     96   INTEGER, PUBLIC,               DIMENSION(jpidta) ::   mi0, mi1   !: global ==> local  domain i-index    !!bug ==> other solution? 
    8897   !                                                  ! (mi0=1 and mi1=0 if the global index is not in the local domain) 
    89    INTEGER, PUBLIC, DIMENSION(jpjdta) ::   mj0, mj1   !: global ==> local  domain j-index     !!bug ==> other solution? 
     98   INTEGER, PUBLIC,               DIMENSION(jpjdta) ::   mj0, mj1   !: global ==> local  domain j-index     !!bug ==> other solution? 
    9099   !                                                  ! (mi0=1 and mi1=0 if the global index is not in the local domain) 
    91    INTEGER, PUBLIC, DIMENSION(jpnij) ::   nimppt, njmppt   !: i-, j-indexes for each processor 
    92    INTEGER, PUBLIC, DIMENSION(jpnij) ::   ibonit, ibonjt   !: i-, j- processor neighbour existence 
    93    INTEGER, PUBLIC, DIMENSION(jpnij) ::   nlcit , nlcjt    !: dimensions of every subdomain 
    94    INTEGER, PUBLIC, DIMENSION(jpnij) ::   nldit , nldjt    !: first, last indoor index for each i-domain 
    95    INTEGER, PUBLIC, DIMENSION(jpnij) ::   nleit , nlejt    !: first, last indoor index for each j-domain 
     100   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nimppt, njmppt   !: i-, j-indexes for each processor 
     101   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ibonit, ibonjt   !: i-, j- processor neighbour existence 
     102   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nlcit , nlcjt    !: dimensions of every subdomain 
     103   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nldit , nldjt    !: first, last indoor index for each i-domain 
     104   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nleit , nlejt    !: first, last indoor index for each j-domain 
    96105 
    97106   !!---------------------------------------------------------------------- 
    98107   !! horizontal curvilinear coordinate and scale factors 
    99108   !! --------------------------------------------------------------------- 
    100    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   glamt, glamu   !: longitude of t-, u-, v- and f-points (degre) 
    101    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   glamv, glamf   !: 
    102    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   gphit, gphiu   !: latitude  of t-, u-, v- and f-points (degre) 
    103    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   gphiv, gphif   !: 
    104    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   e1t, e2t       !: horizontal scale factors at t-point (m) 
    105    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   e1u, e2u       !: horizontal scale factors at u-point (m) 
    106    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   e1v, e2v       !: horizontal scale factors at v-point (m) 
    107    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   e1f, e2f       !: horizontal scale factors at f-point (m) 
    108    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ff             !: coriolis factor (2.*omega*sin(yphi) ) (s-1) 
     109   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  glamt, glamu   !: longitude of t-, u-, v- and f-points (degre) 
     110   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  glamv, glamf   !: 
     111   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  gphit, gphiu   !: latitude  of t-, u-, v- and f-points (degre) 
     112   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  gphiv, gphif   !: 
     113   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  e1t, e2t       !: horizontal scale factors at t-point (m) 
     114   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  e1u, e2u       !: horizontal scale factors at u-point (m) 
     115   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  e1v, e2v       !: horizontal scale factors at v-point (m) 
     116   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  e1f, e2f       !: horizontal scale factors at f-point (m) 
     117   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  e1e2t          !: surface at t-point (m2) 
     118   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  ff             !: coriolis factor (2.*omega*sin(yphi) ) (s-1) 
    109119 
    110120   !!---------------------------------------------------------------------- 
     
    118128   !! All coordinates 
    119129   !! --------------- 
    120    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   gdep3w          !: depth of T-points (sum of e3w) (m) 
    121    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   gdept , gdepw   !: analytical depth at T-W  points (m) 
    122    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3v   , e3f     !: analytical vertical scale factors at  V--F 
    123    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3t   , e3u     !:                                       T--U  points (m) 
    124    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3vw            !: analytical vertical scale factors at  VW-- 
    125    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3w   , e3uw    !:                                        W--UW  points (m) 
     130   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   gdep3w          !: depth of T-points (sum of e3w) (m) 
     131   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   gdept , gdepw   !: analytical depth at T-W  points (m) 
     132   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3v   , e3f     !: analytical vertical scale factors at  V--F 
     133   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3t   , e3u     !:                                       T--U  points (m) 
     134   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3vw            !: analytical vertical scale factors at  VW-- 
     135   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3w   , e3uw    !:                                        W--UW  points (m) 
    126136#if defined key_vvl 
    127137   LOGICAL, PUBLIC, PARAMETER ::   lk_vvl = .TRUE.    !: variable grid flag 
     
    129139   !! All coordinates 
    130140   !! --------------- 
    131    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   gdep3w_1           !: depth of T-points (sum of e3w) (m) 
    132    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   gdept_1, gdepw_1   !: analytical depth at T-W  points (m) 
    133    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3v_1  , e3f_1     !: analytical vertical scale factors at  V--F 
    134    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3t_1  , e3u_1     !:                                       T--U  points (m) 
    135    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3vw_1             !: analytical vertical scale factors at  VW-- 
    136    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3w_1  , e3uw_1    !:                                       W--UW  points (m) 
    137    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3t_b              !: before         -      -      -    -   T      points (m) 
    138    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e3u_b  , e3v_b     !:   -            -      -      -    -   U--V   points (m) 
     141   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   gdep3w_1           !: depth of T-points (sum of e3w) (m) 
     142   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   gdept_1, gdepw_1   !: analytical depth at T-W  points (m) 
     143   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3v_1  , e3f_1     !: analytical vertical scale factors at  V--F 
     144   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3t_1  , e3u_1     !:                                       T--U  points (m) 
     145   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3vw_1             !: analytical vertical scale factors at  VW-- 
     146   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3w_1  , e3uw_1    !:                                       W--UW  points (m) 
     147   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3t_b              !: before         -      -      -    -   T      points (m) 
     148   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e3u_b  , e3v_b     !:   -            -      -      -    -   U--V   points (m) 
    139149#else 
    140150   LOGICAL, PUBLIC, PARAMETER ::   lk_vvl = .FALSE.   !: fixed grid flag 
    141151#endif 
    142    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hur  , hvr    !: inverse of u and v-points ocean depth (1/m) 
    143    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hu   , hv     !: depth at u- and v-points (meters) 
    144    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hu_0 , hv_0   !: refernce depth at u- and v-points (meters) 
     152   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hur  , hvr    !: inverse of u and v-points ocean depth (1/m) 
     153   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hu   , hv     !: depth at u- and v-points (meters) 
     154   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hu_0 , hv_0   !: refernce depth at u- and v-points (meters) 
    145155 
    146156   INTEGER, PUBLIC ::   nla10              !: deepest    W level Above  ~10m (nlb10 - 1) 
     
    149159   !! z-coordinate with full steps (also used in the other cases as reference z-coordinate) 
    150160   !! =-----------------====------ 
    151    REAL(wp), PUBLIC, DIMENSION(jpk)     ::   gdept_0, gdepw_0  !: reference depth of t- and w-points (m) 
    152    REAL(wp), PUBLIC, DIMENSION(jpk)     ::   e3t_0  , e3w_0     !: reference vertical scale factors at T- and W-pts (m) 
    153    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   e3tp   , e3wp      !: ocean bottom level thickness at T and W points 
     161   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   :: gdept_0, gdepw_0 !: reference depth of t- and w-points (m) 
     162   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   :: e3t_0  , e3w_0   !: reference vertical scale factors at T- and W-pts (m) 
     163   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: e3tp   , e3wp    !: ocean bottom level thickness at T and W points 
    154164 
    155165   !! s-coordinate and hybrid z-s-coordinate 
    156166   !! =----------------======--------------- 
    157    REAL(wp), PUBLIC, DIMENSION(jpk) ::   gsigt, gsigw   !: model level depth coefficient at t-, w-levels (analytic) 
    158    REAL(wp), PUBLIC, DIMENSION(jpk) ::   gsi3w          !: model level depth coefficient at w-level (sum of gsigw) 
    159    REAL(wp), PUBLIC, DIMENSION(jpk) ::   esigt, esigw   !: vertical scale factor coef. at t-, w-levels 
    160  
    161    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hbatv , hbatf    !: ocean depth at the vertical of  V--F 
    162    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hbatt , hbatu    !:                                 T--U  points (m) 
    163    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   scosrf, scobot   !: ocean surface and bottom topographies  
    164    !                                                          !  (if deviating from coordinate surfaces in HYBRID) 
    165    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hifv  , hiff     !: interface depth between stretching at  V--F 
    166    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hift  , hifu     !: and quasi-uniform spacing              T--U  points (m) 
     167   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   gsigt, gsigw   !: model level depth coefficient at t-, w-levels (analytic) 
     168   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   gsi3w          !: model level depth coefficient at w-level (sum of gsigw) 
     169   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   esigt, esigw   !: vertical scale factor coef. at t-, w-levels 
     170 
     171   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hbatv , hbatf    !: ocean depth at the vertical of  V--F 
     172   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hbatt , hbatu    !:                                 T--U  points (m) 
     173   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   scosrf, scobot   !: ocean surface and bottom topographies  
     174   !                                        !  (if deviating from coordinate surfaces in HYBRID) 
     175   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hifv  , hiff     !: interface depth between stretching at  V--F 
     176   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hift  , hifu     !: and quasi-uniform spacing              T--U  points (m) 
    167177 
    168178   !!---------------------------------------------------------------------- 
    169179   !! masks, bathymetry 
    170180   !! --------------------------------------------------------------------- 
    171    INTEGER , PUBLIC, DIMENSION(jpi,jpj) ::   mbathy       !: number of ocean level (=0, 1, ... , jpk-1) 
    172    INTEGER , PUBLIC, DIMENSION(jpi,jpj) ::   mbkt         !: vertical index of the bottom last T- ocean level 
    173    INTEGER , PUBLIC, DIMENSION(jpi,jpj) ::   mbku, mbkv   !: vertical index of the bottom last U- and W- ocean level 
    174    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   bathy        !: ocean depth (meters) 
    175    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   tmask_i      !: interior domain T-point mask 
    176    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   bmask        !: land/ocean mask of barotropic stream function 
    177  
    178    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::  tmask, umask, vmask, fmask   !: land/ocean mask at T-, U-, V- and F-pts 
     181   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   mbathy       !: number of ocean level (=0, 1, ... , jpk-1) 
     182   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   mbkt         !: vertical index of the bottom last T- ocean level 
     183   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   mbku, mbkv   !: vertical index of the bottom last U- and W- ocean level 
     184   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   bathy        !: ocean depth (meters) 
     185   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tmask_i      !: interior domain T-point mask 
     186   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   bmask        !: land/ocean mask of barotropic stream function 
     187 
     188   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tmask, umask, vmask, fmask   !: land/ocean mask at T-, U-, V- and F-pts 
    179189 
    180190   REAL(wp), PUBLIC, DIMENSION(jpiglo) ::   tpol, fpol          !: north fold mask (jperio= 3 or 4) 
    181191 
    182192#if defined key_noslip_accurate 
    183    INTEGER, PUBLIC, DIMENSION            (4,jpk) ::   npcoa          !: ??? 
    184    INTEGER, PUBLIC, DIMENSION(2*(jpi+jpj),4,jpk) ::   nicoa, njcoa  !: ??? 
     193   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:  ) :: npcoa        !: ??? 
     194   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: nicoa, njcoa !: ??? 
    185195#endif 
    186196 
     
    215225   LOGICAL, PUBLIC, PARAMETER ::   lk_mpp_rep = .FALSE.   !: agrif flag 
    216226#endif 
     227 
    217228   !!---------------------------------------------------------------------- 
    218229   !! agrif domain 
     
    222233#else 
    223234   LOGICAL, PUBLIC, PARAMETER ::   lk_agrif = .FALSE.   !: agrif flag 
    224  
     235#endif 
     236 
     237   !!---------------------------------------------------------------------- 
     238   !! NEMO/OPA 4.0 , NEMO Consortium (2011) 
     239   !! $Id$  
     240   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     241   !!---------------------------------------------------------------------- 
    225242CONTAINS 
     243 
     244#if ! defined key_agrif 
     245   !!---------------------------------------------------------------------- 
     246   !! NOT 'key_agrif'      dummy function                     No AGRIF zoom 
     247   !!---------------------------------------------------------------------- 
    226248   LOGICAL FUNCTION Agrif_Root() 
    227249      Agrif_Root = .TRUE. 
     
    229251 
    230252   CHARACTER(len=3) FUNCTION Agrif_CFixed() 
    231      Agrif_CFixed = '0'  
     253      Agrif_CFixed = '0'  
    232254   END FUNCTION Agrif_CFixed 
    233255#endif 
    234    !!---------------------------------------------------------------------- 
    235    !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    236    !! $Id$  
    237    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     256 
     257   INTEGER FUNCTION dom_oce_alloc() 
     258      !!---------------------------------------------------------------------- 
     259      INTEGER, DIMENSION(11) :: ierr 
     260      !!---------------------------------------------------------------------- 
     261      ierr(:) = 0 
     262      ! 
     263      ALLOCATE( rdttra(jpk), r2dtra(jpk), mig(jpi), mjg(jpj), STAT=ierr(1) ) 
     264         ! 
     265      ALLOCATE( nimppt(jpnij) , ibonit(jpnij) , nlcit(jpnij) , nlcjt(jpnij) ,     & 
     266         &      njmppt(jpnij) , ibonjt(jpnij) , nldit(jpnij) , nldjt(jpnij) ,     & 
     267         &                                      nleit(jpnij) , nlejt(jpnij) , STAT=ierr(2) ) 
     268         ! 
     269      ALLOCATE( glamt(jpi,jpj) , gphit(jpi,jpj) , e1t(jpi,jpj) , e2t(jpi,jpj) ,                      &  
     270         &      glamu(jpi,jpj) , gphiu(jpi,jpj) , e1u(jpi,jpj) , e2u(jpi,jpj) ,                      &   
     271         &      glamv(jpi,jpj) , gphiv(jpi,jpj) , e1v(jpi,jpj) , e2v(jpi,jpj) , e1e2t(jpi,jpj) ,     &   
     272         &      glamf(jpi,jpj) , gphif(jpi,jpj) , e1f(jpi,jpj) , e2f(jpi,jpj) , ff   (jpi,jpj) , STAT=ierr(3) )      
     273         ! 
     274      ALLOCATE( gdep3w(jpi,jpj,jpk) , e3v(jpi,jpj,jpk) , e3f (jpi,jpj,jpk) ,                         & 
     275         &      gdept (jpi,jpj,jpk) , e3t(jpi,jpj,jpk) , e3u (jpi,jpj,jpk) ,                         & 
     276         &      gdepw (jpi,jpj,jpk) , e3w(jpi,jpj,jpk) , e3vw(jpi,jpj,jpk) , e3uw(jpi,jpj,jpk) , STAT=ierr(4) ) 
     277         ! 
     278#if defined key_vvl 
     279      ALLOCATE( gdep3w_1(jpi,jpj,jpk) , e3v_1(jpi,jpj,jpk) , e3f_1 (jpi,jpj,jpk) ,                           & 
     280         &      gdept_1 (jpi,jpj,jpk) , e3t_1(jpi,jpj,jpk) , e3u_1 (jpi,jpj,jpk) ,                           & 
     281         &      gdepw_1 (jpi,jpj,jpk) , e3w_1(jpi,jpj,jpk) , e3vw_1(jpi,jpj,jpk) , e3uw_1(jpi,jpj,jpk) ,     & 
     282         &      e3t_b   (jpi,jpj,jpk) , e3u_b(jpi,jpj,jpk) , e3v_b (jpi,jpj,jpk)                       , STAT=ierr(5) ) 
     283#endif 
     284         ! 
     285      ALLOCATE( hu(jpi,jpj) , hur(jpi,jpj) , hu_0(jpi,jpj) ,     & 
     286         &      hv(jpi,jpj) , hvr(jpi,jpj) , hv_0(jpi,jpj) , STAT=ierr(6) ) 
     287         ! 
     288      ALLOCATE( gdept_0(jpk) , gdepw_0(jpk) ,                                     & 
     289         &      e3t_0  (jpk) , e3w_0  (jpk) , e3tp (jpi,jpj), e3wp(jpi,jpj) ,     & 
     290         &      gsigt  (jpk) , gsigw  (jpk) , gsi3w(jpk)    ,                     & 
     291         &      esigt  (jpk) , esigw  (jpk)                                 , STAT=ierr(7) ) 
     292         ! 
     293      ALLOCATE( hbatv (jpi,jpj) , hbatf (jpi,jpj) ,     & 
     294         &      hbatt (jpi,jpj) , hbatu (jpi,jpj) ,     & 
     295         &      scosrf(jpi,jpj) , scobot(jpi,jpj) ,     & 
     296         &      hifv  (jpi,jpj) , hiff  (jpi,jpj) ,     & 
     297         &      hift  (jpi,jpj) , hifu  (jpi,jpj) , STAT=ierr(8) ) 
     298 
     299      ALLOCATE( mbathy(jpi,jpj) , bathy(jpi,jpj) ,                     & 
     300         &     tmask_i(jpi,jpj) , bmask(jpi,jpj) ,                     & 
     301         &     mbkt   (jpi,jpj) , mbku (jpi,jpj) , mbkv(jpi,jpj) , STAT=ierr(9) ) 
     302 
     303      ALLOCATE( tmask(jpi,jpj,jpk) , umask(jpi,jpj,jpk),     &  
     304         &      vmask(jpi,jpj,jpk) , fmask(jpi,jpj,jpk), STAT=ierr(10) ) 
     305 
     306#if defined key_noslip_accurate 
     307      ALLOCATE( npcoa(4,jpk), nicoa(2*(jpi+jpj),4,jpk), njcoa(2*(jpi+jpj),4,jpk), STAT=ierr(11) ) 
     308#endif 
     309      ! 
     310      dom_oce_alloc = MAXVAL(ierr) 
     311      ! 
     312   END FUNCTION dom_oce_alloc 
     313 
    238314   !!====================================================================== 
    239315END MODULE dom_oce 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domcfg.F90

    r2528 r2715  
    2424   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009) 
    2525   !! $Id$  
    26    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     26   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    2727   !!---------------------------------------------------------------------- 
    28  
    2928CONTAINS 
    3029 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domhgr.F90

    r2528 r2715  
    1414   !!                            use of parameters in par_CONFIG-Rxx.h90, not in namelist 
    1515   !!             -   ! 2004-05  (A. Koch-Larrouy) Add Gyre configuration  
     16   !!            4.0  ! 2011-02  (G. Madec) add cell surface (e1e2t) 
    1617   !!---------------------------------------------------------------------- 
    1718 
     
    3334 
    3435   !!---------------------------------------------------------------------- 
    35    !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
     36   !! NEMO/OPA 4.0 , NEMO Consortium (2011) 
    3637   !! $Id$  
    3738   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    448449 
    449450      END SELECT 
     451       
     452      ! T-cell surface 
     453      ! -------------- 
     454      e1e2t(:,:) = e1t(:,:) * e2t(:,:) 
    450455 
    451456 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90

    r2528 r2715  
    3434   PRIVATE 
    3535 
    36    PUBLIC   dom_msk    ! routine called by inidom.F90 
     36   PUBLIC   dom_msk         ! routine called by inidom.F90 
     37   PUBLIC   dom_msk_alloc   ! routine called by nemogcm.F90 
    3738 
    3839   !                            !!* Namelist namlbc : lateral boundary condition * 
    3940   REAL(wp) ::   rn_shlat = 2.   ! type of lateral boundary condition on velocity 
    40     
     41 
     42   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  icoord ! Workspace for dom_msk_nsa() 
     43 
    4144   !! * Substitutions 
    4245#  include "vectopt_loop_substitute.h90" 
     
    4851CONTAINS 
    4952    
     53   INTEGER FUNCTION dom_msk_alloc() 
     54      !!--------------------------------------------------------------------- 
     55      !!                 ***  FUNCTION dom_msk_alloc  *** 
     56      !!--------------------------------------------------------------------- 
     57      dom_msk_alloc = 0 
     58#if defined key_noslip_accurate 
     59      ALLOCATE(icoord(jpi*jpj*jpk,3), STAT=dom_msk_alloc) 
     60#endif 
     61      IF( dom_msk_alloc /= 0 )   CALL ctl_warn('dom_msk_alloc: failed to allocate icoord array') 
     62      ! 
     63   END FUNCTION dom_msk_alloc 
     64 
     65 
    5066   SUBROUTINE dom_msk 
    5167      !!--------------------------------------------------------------------- 
     
    109125      !!               tmask_i  : interior ocean mask 
    110126      !!---------------------------------------------------------------------- 
     127      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released, iwrk_in_use, iwrk_not_released 
     128      USE wrk_nemo, ONLY:   zwf  =>  wrk_2d_1      ! 2D real    workspace 
     129      USE wrk_nemo, ONLY:   imsk => iwrk_2d_1      ! 2D integer workspace 
     130      ! 
    111131      INTEGER  ::   ji, jj, jk      ! dummy loop indices 
    112       INTEGER  ::   iif, iil, ii0, ii1, ii 
    113       INTEGER  ::   ijf, ijl, ij0, ij1 
    114       INTEGER , DIMENSION(jpi,jpj) ::  imsk 
    115       REAL(wp), DIMENSION(jpi,jpj) ::   zwf 
     132      INTEGER  ::   iif, iil, ii0, ii1, ii   ! local integers 
     133      INTEGER  ::   ijf, ijl, ij0, ij1       !   -       - 
    116134      !! 
    117135      NAMELIST/namlbc/ rn_shlat 
    118136      !!--------------------------------------------------------------------- 
    119137       
     138      IF( wrk_in_use(2, 1) .OR. iwrk_in_use(2, 1) ) THEN 
     139         CALL ctl_stop('dom_msk: requested workspace arrays unavailable')   ;   RETURN 
     140      ENDIF 
     141 
    120142      REWIND( numnam )              ! Namelist namlbc : lateral momentum boundary condition 
    121143      READ  ( numnam, namlbc ) 
     
    414436      ENDIF 
    415437      ! 
     438      IF( wrk_not_released(2, 1)  .OR.   & 
     439         iwrk_not_released(2, 1)  )   CALL ctl_stop('dom_msk: failed to release workspace arrays') 
     440      ! 
    416441   END SUBROUTINE dom_msk 
    417442 
     
    431456      !! ** Action : 
    432457      !!---------------------------------------------------------------------- 
    433       INTEGER  :: ji, jj, jk, jl      ! dummy loop indices 
     458      INTEGER  ::   ji, jj, jk, jl      ! dummy loop indices 
    434459      INTEGER  ::   ine, inw, ins, inn, itest, ierror, iind, ijnd 
    435460      REAL(wp) ::   zaa 
    436       INTEGER, DIMENSION(jpi*jpj*jpk,3) ::  icoord 
    437461      !!--------------------------------------------------------------------- 
    438        
    439  
    440       IF(lwp)WRITE(numout,*) 
    441       IF(lwp)WRITE(numout,*) 'dom_msk_nsa : noslip accurate boundary condition' 
    442       IF(lwp)WRITE(numout,*) '~~~~~~~~~~~   using Schchepetkin and O Brian scheme' 
    443       IF( lk_mpp ) CALL ctl_stop( ' mpp version is not yet implemented' ) 
     462 
     463      IF(lwp) WRITE(numout,*) 
     464      IF(lwp) WRITE(numout,*) 'dom_msk_nsa : noslip accurate boundary condition' 
     465      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   using Schchepetkin and O Brian scheme' 
     466      IF( lk_mpp )   CALL ctl_stop( ' mpp version is not yet implemented' ) 
    444467 
    445468      ! mask for second order calculation of vorticity 
     
    596619         CALL ctl_stop( 'We stop...' ) 
    597620      ENDIF 
    598  
     621      ! 
    599622   END SUBROUTINE dom_msk_nsa 
    600623 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domngb.F90

    r2528 r2715  
    88 
    99   !!---------------------------------------------------------------------- 
    10    !!   dom_ngb       : find the closest grid point from a given on/lat position 
     10   !!   dom_ngb       : find the closest grid point from a given lon/lat position 
    1111   !!---------------------------------------------------------------------- 
    12    USE dom_oce         ! ocean space and time domain 
    13    USE lib_mpp         ! for mppsum 
     12   USE dom_oce        ! ocean space and time domain 
     13   USE lib_mpp        ! for mppsum 
    1414 
    1515   IMPLICIT NONE 
    1616   PRIVATE 
    1717 
    18    PUBLIC   dom_ngb    ! routine called in iom.F90 module 
     18   PUBLIC   dom_ngb   ! routine called in iom.F90 module 
    1919 
    2020   !!---------------------------------------------------------------------- 
    2121   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    2222   !! $Id$  
    23    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     23   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    2424   !!---------------------------------------------------------------------- 
    25  
    2625CONTAINS 
    2726 
     
    3029      !!                    ***  ROUTINE dom_ngb  *** 
    3130      !! 
    32       !! ** Purpose :   find the closest grid point from a given on/lat position 
     31      !! ** Purpose :   find the closest grid point from a given lon/lat position 
    3332      !! 
    3433      !! ** Method  :   look for minimum distance in cylindrical projection  
    3534      !!                -> not good if located at too high latitude... 
    36       !! 
    3735      !!---------------------------------------------------------------------- 
     36      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     37      USE wrk_nemo, ONLY:   zglam => wrk_2d_2 , zgphi => wrk_2d_3 , zmask => wrk_2d_4 , zdist => wrk_2d_5 
     38      ! 
    3839      REAL(wp)        , INTENT(in   ) ::   plon, plat   ! longitude,latitude of the point 
    3940      INTEGER         , INTENT(  out) ::   kii, kjj     ! i-,j-index of the closes grid point 
    4041      CHARACTER(len=1), INTENT(in   ) ::   cdgrid       ! grid name 'T', 'U', 'V', 'W' 
    41       !! 
    42       INTEGER , DIMENSION(2)        ::   iloc 
    43       REAL(wp), DIMENSION(jpi,jpj)  ::   zglam, zgphi, zmask, zdist 
    44       REAL(wp)                      ::   zlon 
    45       REAL(wp)                      ::   zmini 
     42      ! 
     43      INTEGER , DIMENSION(2) ::   iloc 
     44      REAL(wp)               ::   zlon, zmini 
    4645      !!-------------------------------------------------------------------- 
    47        
    48       zmask(:,:) = 0. 
     46      ! 
     47      IF( wrk_in_use(2, 2,3,4,5) )   CALL ctl_stop('dom_ngb: Requested workspaces already in use') 
     48      ! 
     49      zmask(:,:) = 0._wp 
    4950      SELECT CASE( cdgrid ) 
    5051      CASE( 'U' )  ; zglam(:,:) = glamu(:,:) ; zgphi(:,:) = gphiu(:,:) ; zmask(nldi:nlei,nldj:nlej) = umask(nldi:nlei,nldj:nlej,1) 
     
    7071         kjj = iloc(2) + njmpp - 1 
    7172      ENDIF 
    72  
     73      ! 
     74      IF( wrk_not_released(2, 2,3,4,5) )   CALL ctl_stop('dom_ngb: error releasing workspaces') 
     75      ! 
    7376   END SUBROUTINE dom_ngb 
    7477 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domstp.F90

    r2528 r2715  
    88   !!   dom_stp        : ocean time domain initialization 
    99   !!---------------------------------------------------------------------- 
    10    !! History : 
    11    !!        !  90-10  (O. Marti)  Original code 
    12    !!        !  96-01  (G. Madec)  terrain following coordinates 
    13    !!   8.5  !  02-08  (G. Madec)  F90: Free form and module 
     10   !! History :  OPA  ! 1990-10  (O. Marti)  Original code 
     11   !!                 ! 1996-01  (G. Madec)  terrain following coordinates 
     12   !!   NEMO     1.0  ! 2002-08  (G. Madec)  F90: Free form and module 
    1413   !!---------------------------------------------------------------------- 
    15    !! * Modules used 
    16    USE oce             ! ocean dynamics and tracers 
    17    USE dom_oce         ! ocean space and time domain 
    18    USE in_out_manager  ! I/O manager 
     14   USE oce            ! ocean dynamics and tracers 
     15   USE dom_oce        ! ocean space and time domain 
     16   USE in_out_manager ! I/O manager 
     17   USE lib_mpp        ! MPP library 
    1918 
    2019   IMPLICIT NONE 
    2120   PRIVATE 
    2221 
    23    !! * routine accessibility 
    24    PUBLIC dom_stp        ! routine called by inidom.F90 
     22   PUBLIC   dom_stp   ! routine called by inidom.F90 
    2523 
    2624   !! * Substitutions 
     
    2927   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    3028   !! $Id$  
    31    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     29   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    3230   !!---------------------------------------------------------------------- 
    33  
    3431CONTAINS 
    3532 
     
    5956      !!              - atfp1    : = 1 - 2*atfp 
    6057      !! 
    61       !! References : 
    62       !!      Bryan, K., 1984, J. Phys. Oceanogr., 14, 666-673. 
     58      !! References :   Bryan, K., 1984, J. Phys. Oceanogr., 14, 666-673. 
    6359      !!---------------------------------------------------------------------- 
    6460      INTEGER ::   jk              ! dummy loop indice 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90

    r2528 r2715  
    2424   PRIVATE 
    2525 
    26    PUBLIC   dom_vvl    ! called by domain.F90 
    27  
    28    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)     ::   ee_t, ee_u, ee_v, ee_f   !: ??? 
    29    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   mut, muu, muv, muf       !: ???  
    30  
    31    REAL(wp), DIMENSION(jpk) ::   r2dt   ! vertical profile time-step, = 2 rdttra  
    32       !                                 ! except at nit000 (=rdttra) if neuler=0 
     26   PUBLIC   dom_vvl       ! called by domain.F90 
     27   PUBLIC   dom_vvl_alloc ! called by nemogcm.F90 
     28 
     29   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   ee_t, ee_u, ee_v, ee_f   !: ??? 
     30   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   mut , muu , muv , muf    !: ???  
     31 
     32   REAL(wp),         ALLOCATABLE, SAVE, DIMENSION(:)     ::   r2dt   ! vertical profile time-step, = 2 rdttra  
     33      !                                                              ! except at nit000 (=rdttra) if neuler=0 
    3334 
    3435   !! * Substitutions 
     
    3637#  include "vectopt_loop_substitute.h90" 
    3738   !!---------------------------------------------------------------------- 
    38    !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
     39   !! NEMO/OPA 4.0 , NEMO Consortium (2011) 
    3940   !! $Id$ 
    40    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    41    !!---------------------------------------------------------------------- 
    42  
     41   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     42   !!---------------------------------------------------------------------- 
    4343CONTAINS        
     44 
     45   INTEGER FUNCTION dom_vvl_alloc() 
     46      !!---------------------------------------------------------------------- 
     47      !!                ***  ROUTINE dom_vvl_alloc  *** 
     48      !!---------------------------------------------------------------------- 
     49      ! 
     50      ALLOCATE( mut (jpi,jpj,jpk) , muu (jpi,jpj,jpk) , muv (jpi,jpj,jpk) , muf (jpi,jpj,jpk) ,     & 
     51         &      ee_t(jpi,jpj)     , ee_u(jpi,jpj)     , ee_v(jpi,jpj)     , ee_f(jpi,jpj)     ,     & 
     52         &      r2dt        (jpk)                                                             , STAT=dom_vvl_alloc ) 
     53         ! 
     54      IF( lk_mpp             )   CALL mpp_sum ( dom_vvl_alloc ) 
     55      IF( dom_vvl_alloc /= 0 )   CALL ctl_warn('dom_vvl_alloc: failed to allocate arrays') 
     56      ! 
     57   END FUNCTION dom_vvl_alloc 
     58 
    4459 
    4560   SUBROUTINE dom_vvl 
     
    5065      !!               ssh over the whole water column (scale factors) 
    5166      !!---------------------------------------------------------------------- 
    52       INTEGER  ::   ji, jj, jk 
    53       REAL(wp) ::   zcoefu , zcoefv   , zcoeff                   ! temporary scalars 
    54       REAL(wp) ::   zv_t_ij, zv_t_ip1j, zv_t_ijp1, zv_t_ip1jp1   !     -        - 
    55       REAL(wp), DIMENSION(jpi,jpj) ::  zs_t, zs_u_1, zs_v_1      !     -     2D workspace 
    56       !!---------------------------------------------------------------------- 
    57  
    58       IF(lwp)   THEN 
     67      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     68      USE wrk_nemo, ONLY:   zs_t   => wrk_2d_1 , zs_u_1 => wrk_2d_2 , zs_v_1 => wrk_2d_3     ! 2D workspace 
     69      ! 
     70      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     71      REAL(wp) ::   zcoefu , zcoefv   , zcoeff                   ! local scalars 
     72      REAL(wp) ::   zv_t_ij, zv_t_ip1j, zv_t_ijp1, zv_t_ip1jp1   !   -      - 
     73      !!---------------------------------------------------------------------- 
     74 
     75      IF( wrk_in_use(2, 1,2,3) ) THEN 
     76         CALL ctl_stop('dom_vvl: requested workspace arrays unavailable')   ;   RETURN 
     77      ENDIF 
     78 
     79      IF(lwp) THEN 
    5980         WRITE(numout,*) 
    60          WRITE(numout,*) 'dom_vvl : Variable volume activated' 
     81         WRITE(numout,*) 'dom_vvl : Variable volume initialization' 
    6182         WRITE(numout,*) '~~~~~~~~  compute coef. used to spread ssh over each layers' 
    6283      ENDIF 
    63  
     84       
     85      IF( dom_vvl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'dom_vvl : unable to allocate arrays' ) 
    6486 
    6587      fsdept(:,:,:) = gdept (:,:,:) 
     
    167189      fse3v_b(:,:,:) = fse3v_b(:,:,:) + fse3v_0(:,:,:) 
    168190      ! 
     191      IF( wrk_not_released(2, 1,2,3) )   CALL ctl_stop('dom_vvl: failed to release workspace arrays') 
     192      ! 
    169193   END SUBROUTINE dom_vvl 
    170194 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90

    r2528 r2715  
    22   !!====================================================================== 
    33   !!                       ***  MODULE domwri  *** 
    4    !! Ocean initialization : write the ocean domain mesh ask file(s) 
     4   !! Ocean initialization : write the ocean domain mesh file(s) 
    55   !!====================================================================== 
    66   !! History :  OPA  ! 1997-02  (G. Madec)  Original code 
    77   !!            8.1  ! 1999-11  (M. Imbard)  NetCDF FORMAT with IOIPSL 
    88   !!   NEMO     1.0  ! 2002-08  (G. Madec)  F90 and several file 
     9   !!            3.0  ! 2008-01  (S. Masson) add dom_uniq  
     10   !!            4.0  ! 2011-01  (A. R. Porter, STFC Daresbury) dynamical allocation 
    911   !!---------------------------------------------------------------------- 
    1012 
    1113   !!---------------------------------------------------------------------- 
    1214   !!   dom_wri        : create and write mesh and mask file(s) 
    13    !!                    nmsh = 1  :   mesh_mask file 
    14    !!                         = 2  :   mesh and mask file 
    15    !!                         = 3  :   mesh_hgr, mesh_zgr and mask 
     15   !!   dom_uniq       : 
    1616   !!---------------------------------------------------------------------- 
    1717   USE dom_oce         ! ocean space and time domain 
     
    6363      !!                                   masks, depth and vertical scale factors 
    6464      !!---------------------------------------------------------------------- 
     65      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     66      USE wrk_nemo, ONLY:   zprt  => wrk_2d_1 , zprw  => wrk_2d_2    ! 2D workspace 
     67      USE wrk_nemo, ONLY:   zdepu => wrk_3d_1 , zdepv => wrk_3d_2    ! 3D     - 
     68      !! 
    6569      INTEGER           ::   inum0    ! temprary units for 'mesh_mask.nc' file 
    6670      INTEGER           ::   inum1    ! temprary units for 'mesh.nc'      file 
     
    7478      CHARACTER(len=21) ::   clnam4   ! filename (vertical   mesh informations) 
    7579      INTEGER           ::   ji, jj, jk   ! dummy loop indices 
    76       REAL(wp), DIMENSION(jpi,jpj)     ::   zprt , zprw    ! 2D workspace 
    77       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdepu, zdepv   ! 3D workspace 
    78      !!---------------------------------------------------------------------- 
     80      !!---------------------------------------------------------------------- 
     81 
     82      IF( wrk_in_use(2, 1,2) .OR. wrk_in_use(3, 1,2) )THEN 
     83         CALL ctl_stop('dom_wri: requested workspace arrays unavailable')   ;   RETURN 
     84      END IF 
    7985 
    8086      IF(lwp) WRITE(numout,*) 
     
    122128      CALL iom_rstput( 0, 0, inum2, 'fmask', fmask, ktype = jp_i1 ) 
    123129       
    124        
    125       zprt = tmask(:,:,1) * dom_uniq('T')                               !    ! unique point mask 
     130      CALL dom_uniq( zprw, 'T' ) 
     131      zprt = tmask(:,:,1) * zprw                               !    ! unique point mask 
    126132      CALL iom_rstput( 0, 0, inum2, 'tmaskutil', zprt, ktype = jp_i1 )   
    127       zprt = umask(:,:,1) * dom_uniq('U') 
     133      CALL dom_uniq( zprw, 'U' ) 
     134      zprt = umask(:,:,1) * zprw 
    128135      CALL iom_rstput( 0, 0, inum2, 'umaskutil', zprt, ktype = jp_i1 )   
    129       zprt = vmask(:,:,1) * dom_uniq('V') 
     136      CALL dom_uniq( zprw, 'V' ) 
     137      zprt = vmask(:,:,1) * zprw 
    130138      CALL iom_rstput( 0, 0, inum2, 'vmaskutil', zprt, ktype = jp_i1 )   
    131       zprt = fmask(:,:,1) * dom_uniq('F') 
     139      CALL dom_uniq( zprw, 'F' ) 
     140      zprt = fmask(:,:,1) * zprw 
    132141      CALL iom_rstput( 0, 0, inum2, 'fmaskutil', zprt, ktype = jp_i1 )   
    133142 
     
    251260      END SELECT 
    252261      ! 
     262      IF( wrk_not_released(2, 1,2)  .OR.   & 
     263          wrk_not_released(3, 1,2)  )   CALL ctl_stop('dom_wri: failed to release workspace arrays') 
     264      ! 
    253265   END SUBROUTINE dom_wri 
    254266 
    255267 
    256    FUNCTION dom_uniq( cdgrd )   RESULT( puniq ) 
     268   SUBROUTINE dom_uniq( puniq, cdgrd ) 
    257269      !!---------------------------------------------------------------------- 
    258270      !!                  ***  ROUTINE dom_uniq  *** 
     
    263275      !!                2) check which elements have been changed 
    264276      !!---------------------------------------------------------------------- 
    265       CHARACTER(len=1)            , INTENT(in   ) ::  cdgrd   !  
    266       REAL(wp), DIMENSION(jpi,jpj)                ::  puniq   !  
    267       ! 
    268       REAL(wp), DIMENSION(jpi,jpj  ) ::  ztstref   ! array with different values for each element  
    269       REAL(wp)                       ::  zshift    ! shift value link to the process number 
    270       LOGICAL , DIMENSION(jpi,jpj,1) ::  lldbl     ! is the point unique or not? 
    271       INTEGER                        ::  ji        ! dummy loop indices 
    272       !!---------------------------------------------------------------------- 
    273       ! 
     277      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     278      USE wrk_nemo, ONLY:   ztstref => wrk_2d_3      ! array with different values for each element 
     279      ! 
     280      CHARACTER(len=1)        , INTENT(in   ) ::   cdgrd   !  
     281      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   puniq   !  
     282      ! 
     283      REAL(wp) ::  zshift   ! shift value link to the process number 
     284      INTEGER  ::  ji       ! dummy loop indices 
     285      LOGICAL, DIMENSION(SIZE(puniq,1),SIZE(puniq,2),1) ::  lldbl  ! store whether each point is unique or not 
     286      !!---------------------------------------------------------------------- 
     287 
     288      IF( wrk_in_use(2, 3) ) THEN 
     289         CALL ctl_stop('dom_uniq: requested workspace array unavailable')   ;   RETURN 
     290      ENDIF 
     291 
    274292      ! build an array with different values for each element  
    275293      ! in mpp: make sure that these values are different even between process 
     
    286304      puniq(nldi:nlei,nldj:nlej) = REAL( COUNT( lldbl(nldi:nlei,nldj:nlej,:), dim = 3 ) , wp ) 
    287305      ! 
    288    END FUNCTION dom_uniq 
     306      IF( wrk_not_released(2, 3) )   CALL ctl_stop('dom_uniq: failed to release workspace array') 
     307      ! 
     308   END SUBROUTINE dom_uniq 
    289309 
    290310   !!====================================================================== 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90

    r2712 r2715  
    4242   PRIVATE 
    4343 
    44    PUBLIC   dom_zgr      ! called by dom_init.F90 
     44   PUBLIC   dom_zgr        ! called by dom_init.F90 
    4545 
    4646   !                                       !!* Namelist namzgr_sco * 
     
    5454   !                                        ! ( rn_bb=0; top only, rn_bb =1; top and bottom) 
    5555   REAL(wp) ::   rn_hc       =  150._wp     ! Critical depth for s-sigma coordinates 
    56   
    57    !! * Substitutions 
     56 
     57  !! * Substitutions 
    5858#  include "domzgr_substitute.h90" 
    5959#  include "vectopt_loop_substitute.h90" 
    6060   !!---------------------------------------------------------------------- 
    61    !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
     61   !! NEMO/OPA 3.3.1 , NEMO Consortium (2011) 
    6262   !! $Id$ 
    6363   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    121121      ! 
    122122      ! 
     123 
    123124      IF( nprint == 1 .AND. lwp )   THEN 
    124125         WRITE(numout,*) ' MIN val mbathy ', MINVAL( mbathy(:,:) ), ' MAX ', MAXVAL( mbathy(:,:) ) 
     
    588589      !!              - update bathy : meter bathymetry (in meters) 
    589590      !!---------------------------------------------------------------------- 
     591      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     592      USE wrk_nemo, ONLY:   zbathy => wrk_2d_1 
     593      !! 
    590594      INTEGER ::   ji, jj, jl                    ! dummy loop indices 
    591595      INTEGER ::   icompt, ibtest, ikmax         ! temporary integers 
    592       REAL(wp), DIMENSION(jpi,jpj) ::   zbathy   ! temporary workspace 
    593       !!---------------------------------------------------------------------- 
     596      !!---------------------------------------------------------------------- 
     597 
     598      IF( wrk_in_use(2, 1) ) THEN 
     599         CALL ctl_stop('zgr_bat_ctl: requested workspace array unavailable')   ;   RETURN 
     600      ENDIF 
    594601 
    595602      IF(lwp) WRITE(numout,*) 
     
    695702      ENDIF 
    696703      ! 
     704      IF( wrk_not_released(2, 1) )   CALL ctl_stop('zgr_bat_ctl: failed to release workspace array') 
     705      ! 
    697706   END SUBROUTINE zgr_bat_ctl 
    698707 
     
    710719      !!                                     (min value = 1 over land) 
    711720      !!---------------------------------------------------------------------- 
     721      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     722      USE wrk_nemo, ONLY:   zmbk => wrk_2d_1 
     723      !! 
    712724      INTEGER ::   ji, jj   ! dummy loop indices 
    713       REAL(wp), DIMENSION(jpi,jpj) ::   zmbk   ! 2D workspace  
    714       !!---------------------------------------------------------------------- 
     725      !!---------------------------------------------------------------------- 
     726      ! 
     727      IF( wrk_in_use(2, 1) ) THEN 
     728         CALL ctl_stop('zgr_bot_level: requested 2D workspace unavailable')   ;   RETURN 
     729      ENDIF 
    715730      ! 
    716731      IF(lwp) WRITE(numout,*) 
     
    729744      zmbk(:,:) = REAL( mbku(:,:), wp )   ;   CALL lbc_lnk(zmbk,'U',1.)   ;   mbku  (:,:) = MAX( INT( zmbk(:,:) ), 1 ) 
    730745      zmbk(:,:) = REAL( mbkv(:,:), wp )   ;   CALL lbc_lnk(zmbk,'V',1.)   ;   mbkv  (:,:) = MAX( INT( zmbk(:,:) ), 1 ) 
     746      ! 
     747      IF( wrk_not_released(2, 1) )   CALL ctl_stop('zgr_bot_level: failed to release workspace array') 
    731748      ! 
    732749   END SUBROUTINE zgr_bot_level 
     
    805822      !!  Reference :   Pacanowsky & Gnanadesikan 1997, Mon. Wea. Rev., 126, 3248-3270. 
    806823      !!---------------------------------------------------------------------- 
     824      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     825      USE wrk_nemo, ONLY:   zprt => wrk_3d_1 
     826      !! 
    807827      INTEGER  ::   ji, jj, jk       ! dummy loop indices 
    808828      INTEGER  ::   ik, it           ! temporary integers 
     
    813833      REAL(wp) ::   zdiff            ! temporary scalar 
    814834      REAL(wp) ::   zrefdep          ! temporary scalar 
    815       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zprt   ! 3D workspace 
    816835      !!--------------------------------------------------------------------- 
     836      !  
     837      IF( wrk_in_use(3, 1) ) THEN 
     838         CALL ctl_stop('zgr_zps: requested workspace unavailable.')   ;   RETURN 
     839      ENDIF 
    817840 
    818841      IF(lwp) WRITE(numout,*) 
     
    822845 
    823846      ll_print = .FALSE.                   ! Local variable for debugging 
    824 !!    ll_print = .TRUE. 
    825847       
    826848      IF(lwp .AND. ll_print) THEN          ! control print of the ocean depth 
     
    10061028      ENDIF   
    10071029      ! 
     1030      IF( wrk_not_released(3, 1) )   CALL ctl_stop('zgr_zps: failed to release workspace') 
     1031      ! 
    10081032   END SUBROUTINE zgr_zps 
    10091033 
     
    10921116      !! Reference : Madec, Lott, Delecluse and Crepon, 1996. JPO, 26, 1393-1408. 
    10931117      !!---------------------------------------------------------------------- 
     1118      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     1119      USE wrk_nemo, ONLY:   zenv => wrk_2d_1 , ztmp => wrk_2d_2 , zmsk  => wrk_2d_3 
     1120      USE wrk_nemo, ONLY:   zri  => wrk_2d_4 , zrj  => wrk_2d_5 , zhbat => wrk_2d_6 
     1121      USE wrk_nemo, ONLY:   gsigw3  => wrk_3d_1 
     1122      USE wrk_nemo, ONLY:   gsigt3  => wrk_3d_2 
     1123      USE wrk_nemo, ONLY:   gsi3w3  => wrk_3d_3 
     1124      USE wrk_nemo, ONLY:   esigt3  => wrk_3d_4 
     1125      USE wrk_nemo, ONLY:   esigw3  => wrk_3d_5 
     1126      USE wrk_nemo, ONLY:   esigtu3 => wrk_3d_6 
     1127      USE wrk_nemo, ONLY:   esigtv3 => wrk_3d_7 
     1128      USE wrk_nemo, ONLY:   esigtf3 => wrk_3d_8 
     1129      USE wrk_nemo, ONLY:   esigwu3 => wrk_3d_9 
     1130      USE wrk_nemo, ONLY:   esigwv3 => wrk_3d_10 
     1131      ! 
    10941132      INTEGER  ::   ji, jj, jk, jl           ! dummy loop argument 
    10951133      INTEGER  ::   iip1, ijp1, iim1, ijm1   ! temporary integers 
    10961134      REAL(wp) ::   zcoeft, zcoefw, zrmax, ztaper   ! temporary scalars 
    1097       REAL(wp), DIMENSION(jpi,jpj) ::   zenv, ztmp, zmsk    ! 2D workspace 
    1098       REAL(wp), DIMENSION(jpi,jpj) ::   zri , zrj , zhbat   !  -     - 
    1099       !! 
    1100       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   gsigw3 
    1101       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   gsigt3 
    1102       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   gsi3w3 
    1103       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   esigt3 
    1104       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   esigw3 
    1105       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   esigtu3 
    1106       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   esigtv3 
    1107       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   esigtf3 
    1108       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   esigwu3 
    1109       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   esigwv3 
    1110       !! 
     1135      ! 
     1136 
    11111137      NAMELIST/namzgr_sco/ rn_sbot_max, rn_sbot_min, rn_theta, rn_thetb, rn_rmax, ln_s_sigma, rn_bb, rn_hc 
    11121138      !!---------------------------------------------------------------------- 
    11131139 
    1114       REWIND( numnam )                        ! Read Namelist namzgr_sco : sigma-stretching parameters 
     1140      IF( wrk_in_use(2, 1,2,3,4,5,6) .OR. wrk_in_use(3, 1,2,3,4,5,6,7,8,9,10) ) THEN 
     1141         CALL ctl_stop('zgr_sco: ERROR - requested workspace arrays unavailable')   ;   RETURN 
     1142      ENDIF 
     1143 
     1144      REWIND( numnam )                       ! Read Namelist namzgr_sco : sigma-stretching parameters 
    11151145      READ  ( numnam, namzgr_sco ) 
    11161146 
    1117       IF(lwp) THEN                            ! control print 
     1147      IF(lwp) THEN                           ! control print 
    11181148         WRITE(numout,*) 
    11191149         WRITE(numout,*) 'dom:zgr_sco : s-coordinate or hybrid z-s-coordinate' 
     
    11461176      DO jj = 1, jpj 
    11471177         DO ji = 1, jpi 
    1148            IF( bathy(ji,jj) > 0._wp ) THEN 
    1149               bathy(ji,jj) = MAX( rn_sbot_min, bathy(ji,jj) ) 
    1150            ENDIF 
     1178           IF( bathy(ji,jj) > 0._wp )   bathy(ji,jj) = MAX( rn_sbot_min, bathy(ji,jj) ) 
    11511179         END DO 
    11521180      END DO 
     
    13721400         END DO    ! for all ji's 
    13731401 
    1374          DO ji = 1, jpi 
    1375             DO jj = 1, jpj 
     1402         DO ji = 1, jpim1 
     1403            DO jj = 1, jpjm1 
    13761404               DO jk = 1, jpk 
    13771405                  esigtu3(ji,jj,jk) = ( hbatt(ji,jj)*esigt3(ji,jj,jk)+hbatt(ji+1,jj)*esigt3(ji+1,jj,jk) )   & 
     
    13981426            END DO 
    13991427         END DO 
     1428 
     1429         CALL lbc_lnk( e3t , 'T', 1._wp ) 
     1430         CALL lbc_lnk( e3u , 'U', 1._wp ) 
     1431         CALL lbc_lnk( e3v , 'V', 1._wp ) 
     1432         CALL lbc_lnk( e3f , 'F', 1._wp ) 
     1433         CALL lbc_lnk( e3w , 'W', 1._wp ) 
     1434         CALL lbc_lnk( e3uw, 'U', 1._wp ) 
     1435         CALL lbc_lnk( e3vw, 'V', 1._wp ) 
     1436 
    14001437         ! 
    14011438      ELSE   ! not ln_s_sigma 
     
    15531590!!gm bug    #endif 
    15541591      ! 
     1592      IF( wrk_not_released(2, 1,2,3,4,5,6) .OR. wrk_not_released(3, 1,2,3,4,5,6,7,8,9,10) )  & 
     1593        &  CALL ctl_stop('dom:zgr_sco: failed to release workspace arrays') 
     1594      ! 
    15551595   END SUBROUTINE zgr_sco 
    1556  
    15571596 
    15581597   !!====================================================================== 
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90

    r2528 r2715  
    4343   USE dynspg_ts       ! pressure gradient schemes 
    4444   USE traswp          ! Swap arrays                      (tra_swp routine) 
    45     
     45   USE lib_mpp         ! MPP library 
     46 
    4647   IMPLICIT NONE 
    4748   PRIVATE 
     
    5556   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    5657   !! $Id$ 
    57    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     58   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    5859   !!---------------------------------------------------------------------- 
    59  
    6060CONTAINS 
    6161 
     
    446446      !!                 p=integral [ rau*g dz ] 
    447447      !!---------------------------------------------------------------------- 
     448      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     449      USE wrk_nemo, ONLY:   zprn => wrk_3d_1    ! 3D workspace 
     450 
    448451      USE dynspg          ! surface pressure gradient             (dyn_spg routine) 
    449452      USE divcur          ! hor. divergence & rel. vorticity      (div_cur routine) 
     
    453456      INTEGER ::   indic             ! ??? 
    454457      REAL(wp) ::   zmsv, zphv, zmsu, zphu, zalfg     ! temporary scalars 
    455       REAL(wp), DIMENSION (jpi,jpj,jpk) ::   zprn     ! workspace 
    456       !!---------------------------------------------------------------------- 
     458      !!---------------------------------------------------------------------- 
     459 
     460      IF(wrk_in_use(3, 1) ) THEN 
     461         CALL ctl_stop('istage_uvg: requested workspace array unavailable')   ;   RETURN 
     462      ENDIF 
    457463 
    458464      IF(lwp) WRITE(numout,*)  
     
    551557      rotb (:,:,:) = rotn (:,:,:)       ! set the before to the now value 
    552558      ! 
     559      IF( wrk_not_released(3, 1) ) THEN 
     560         CALL ctl_stop('istage_uvg: failed to release workspace array') 
     561      ENDIF 
     562      ! 
    553563   END SUBROUTINE istate_uvg 
    554564 
Note: See TracChangeset for help on using the changeset viewer.