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/TOP_SRC/trc.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/TOP_SRC/trc.F90

    r2568 r2715  
    1919   PUBLIC 
    2020 
     21   PUBLIC   trc_alloc   ! called by nemogcm.F90 
     22 
    2123   !! passive tracers names and units (read in namelist) 
    2224   !! -------------------------------------------------- 
     
    3436   !! passive tracers fields (before,now,after) 
    3537   !! -------------------------------------------------- 
    36    REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk) :: cvol   !: volume correction -degrad option-  
    3738   REAL(wp), PUBLIC ::   trai                          !: initial total tracer 
    3839   REAL(wp), PUBLIC ::   areatot                       !: total volume  
    39  
    40    REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jptra) ::   trn   !: traceur concentration for actual time step 
    41    REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jptra) ::   tra   !: traceur concentration for next time step 
    42    REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jptra) ::   trb   !: traceur concentration for before time step 
     40   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:)   ::   cvol   !: volume correction -degrad option-  
     41   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trn    !: traceur concentration for now time step 
     42   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   tra    !: traceur concentration for next time step 
     43   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trb    !: traceur concentration for before time step 
    4344 
    4445   !! interpolated gradient 
    4546   !!--------------------------------------------------   
    46    REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jptra) ::   gtru   !: horizontal gradient at u-points at bottom ocean level 
    47    REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jptra) ::   gtrv   !: horizontal gradient at v-points at bottom ocean level 
     47   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtru   !: hor. gradient at u-points at bottom ocean level 
     48   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtrv   !: hor. gradient at v-points at bottom ocean level 
    4849    
    4950   !! passive tracers restart (input and output) 
    5051   !! ------------------------------------------   
    51    LOGICAL , PUBLIC          ::  ln_rsttr      !: boolean term for restart i/o for passive tracers (namelist) 
    52    LOGICAL , PUBLIC          ::  lrst_trc      !: logical to control the trc restart write 
    53    INTEGER , PUBLIC          ::  nn_dttrc      !: frequency of step on passive tracers 
    54    INTEGER , PUBLIC          ::  nutwrs        !: output FILE for passive tracers restart 
    55    INTEGER , PUBLIC          ::  nutrst        !: logical unit for restart FILE for passive tracers 
    56    INTEGER , PUBLIC          ::  nn_rsttr      !: control of the time step ( 0 or 1 ) for pass. tr. 
    57    CHARACTER(len=50), PUBLIC ::  cn_trcrst_in  !: suffix of pass. tracer restart name (input) 
    58    CHARACTER(len=50), PUBLIC ::  cn_trcrst_out !: suffix of pass. tracer restart name (output) 
     52   LOGICAL          , PUBLIC ::  ln_rsttr        !: boolean term for restart i/o for passive tracers (namelist) 
     53   LOGICAL          , PUBLIC ::  lrst_trc        !: logical to control the trc restart write 
     54   INTEGER          , PUBLIC ::  nn_dttrc        !: frequency of step on passive tracers 
     55   INTEGER          , PUBLIC ::  nutwrs          !: output FILE for passive tracers restart 
     56   INTEGER          , PUBLIC ::  nutrst          !: logical unit for restart FILE for passive tracers 
     57   INTEGER          , PUBLIC ::  nn_rsttr        !: control of the time step ( 0 or 1 ) for pass. tr. 
     58   CHARACTER(len=50), PUBLIC ::  cn_trcrst_in    !: suffix of pass. tracer restart name (input) 
     59   CHARACTER(len=50), PUBLIC ::  cn_trcrst_out   !: suffix of pass. tracer restart name (output) 
    5960    
    6061   !! information for outputs 
    6162   !! -------------------------------------------------- 
    6263   INTEGER , PUBLIC ::   nn_writetrc   !: time step frequency for concentration outputs (namelist) 
    63    REAL(wp), PUBLIC, DIMENSION(jpk) ::   rdttrc        !: vertical profile of passive tracer time step 
     64   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdttrc        !: vertical profile of passive tracer time step 
    6465    
    6566# if defined key_diatrc && ! defined key_iomput 
    6667   !! additional 2D/3D outputs namelist 
    6768   !! -------------------------------------------------- 
    68    INTEGER , PUBLIC                               ::   nn_writedia   !: frequency of additional arrays outputs(namelist) 
    69    CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia2d) ::   ctrc2d      !: 2d output field name 
    70    CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia2d) ::   ctrc2u      !: 2d output field unit    
    71    CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia3d) ::   ctrc3d      !: 3d output field name 
    72    CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia3d) ::   ctrc3u      !: 3d output field unit 
    73    CHARACTER(len=80), PUBLIC, DIMENSION (jpdia2d) ::   ctrc2l      !: 2d output field long name 
    74    CHARACTER(len=80), PUBLIC, DIMENSION (jpdia3d) ::   ctrc3l      !: 3d output field long name 
     69   INTEGER         , PUBLIC                      ::   nn_writedia   !: frequency of additional arrays outputs(namelist) 
     70   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2d      !: 2d output field name 
     71   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2u      !: 2d output field unit    
     72   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3d      !: 3d output field name 
     73   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3u      !: 3d output field unit 
     74   CHARACTER(len=80), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2l      !: 2d output field long name 
     75   CHARACTER(len=80), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3l      !: 3d output field long name 
    7576 
    76    REAL(wp), PUBLIC, DIMENSION (jpi,jpj,    jpdia2d) ::   trc2d    !:  additional 2d outputs   
    77    REAL(wp), PUBLIC, DIMENSION (jpi,jpj,jpk,jpdia3d) ::   trc3d    !:  additional 3d outputs   
    78     
     77   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,  :) ::   trc2d    !:  additional 2d outputs   
     78   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trc3d    !:  additional 3d outputs   
    7979# endif 
    8080 
    81 #if defined key_diabio || defined key_trdmld_trc 
     81# if defined key_diabio || defined key_trdmld_trc 
    8282   !                                                              !!*  namtop_XXX namelist * 
    8383   INTEGER , PUBLIC                               ::   nn_writebio   !: time step frequency for biological outputs  
     
    8585   CHARACTER(len=20), PUBLIC, DIMENSION(jpdiabio) ::   ctrbiu      !: biological trends unit    
    8686   CHARACTER(len=80), PUBLIC, DIMENSION(jpdiabio) ::   ctrbil      !: biological trends long name 
    87 #endif 
     87# endif 
    8888# if defined key_diabio 
    8989   !! Biological trends 
    9090   !! ----------------- 
    91    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk,jpdiabio) :: trbio   !: biological trends 
     91   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  trbio   !: biological trends 
    9292# endif 
    9393 
     
    9999# endif 
    100100 
     101   !!---------------------------------------------------------------------- 
     102   !! NEMO/TOP 3.3.1 , NEMO Consortium (2010) 
     103   !! $Id$  
     104   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     105   !!---------------------------------------------------------------------- 
     106CONTAINS 
     107 
     108   INTEGER FUNCTION trc_alloc() 
     109      !!------------------------------------------------------------------- 
     110      !!                    *** ROUTINE trc_alloc *** 
     111      !!------------------------------------------------------------------- 
     112      USE lib_mpp, ONLY: ctl_warn 
     113      !!------------------------------------------------------------------- 
     114      ! 
     115      ALLOCATE( cvol(jpi,jpj,jpk      ) ,                           & 
     116         &      trn (jpi,jpj,jpk,jptra) ,                           & 
     117         &      tra (jpi,jpj,jpk,jptra) ,                           & 
     118         &      trb (jpi,jpj,jpk,jptra) ,                           & 
     119         &      gtru(jpi,jpj    ,jptra) , gtrv(jpi,jpj,jptra) ,     & 
     120# if defined key_diatrc && ! defined key_iomput 
     121         &      trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d), & 
     122# endif 
     123# if defined key_diabio 
     124         &      trbio(jpi,jpj,jpk,jpdiabio),                        & 
     125#endif 
     126               rdttrc(jpk) ,  STAT=trc_alloc )       
     127 
     128      IF( trc_alloc /= 0 )   CALL ctl_warn('trc_alloc: failed to allocate arrays') 
     129      ! 
     130   END FUNCTION trc_alloc 
     131 
    101132#else 
    102133   !!---------------------------------------------------------------------- 
     
    105136#endif 
    106137 
    107    !!---------------------------------------------------------------------- 
    108    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    109    !! $Id$  
    110    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    111138   !!====================================================================== 
    112139END MODULE trc 
Note: See TracChangeset for help on using the changeset viewer.