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/trcdia.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/trcdia.F90

    r2567 r2715  
    2525   USE par_trc 
    2626   USE dianam    ! build name of file (routine) 
    27    USE in_out_manager  ! I/O manager 
    28    USE lib_mpp 
    2927   USE ioipsl 
    3028 
     
    3230   PRIVATE 
    3331 
    34    PUBLIC   trc_dia   ! called by XXX module  
     32   PUBLIC   trc_dia        ! called by XXX module  
     33   PUBLIC   trc_dia_alloc  ! called by nemogcm.F90 
    3534 
    3635   INTEGER  ::   nit5      !: id for tracer output file 
     
    4039   INTEGER  ::   ndimt51   !: number of ocean points in index array 
    4140   REAL(wp) ::   zjulian   !: ????   not DOCTOR ! 
    42    INTEGER , DIMENSION (jpij*jpk) ::   ndext50   !: integer arrays for ocean 3D index 
    43    INTEGER , DIMENSION (jpij)    ::   ndext51   !: integer arrays for ocean surface index 
     41   INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) ::   ndext50   !: integer arrays for ocean 3D index 
     42   INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) ::   ndext51   !: integer arrays for ocean surface index 
    4443# if defined key_diatrc 
    4544   INTEGER  ::   nitd      !: id for additional array output file 
     
    5857   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    5958   !! $Id$  
    60    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
     59   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    6160   !!---------------------------------------------------------------------- 
    6261CONTAINS 
     
    6867      !! ** Purpose :   output passive tracers fields  
    6968      !!--------------------------------------------------------------------- 
    70       INTEGER, INTENT( in ) :: kt 
    71       INTEGER               :: kindic 
     69      INTEGER, INTENT(in) ::   kt   ! ocean time-step 
     70      ! 
     71      INTEGER ::   kindic   ! local integer 
    7272      !!--------------------------------------------------------------------- 
    7373      ! 
     
    9595      !!        IF kindic >0, output of fields before the time step loop 
    9696      !!---------------------------------------------------------------------- 
    97       INTEGER, INTENT( in ) ::   kt          ! ocean time-step 
    98       INTEGER, INTENT( in ) ::   kindic      ! indicator of abnormal termination 
    99       !! 
     97      INTEGER, INTENT(in) ::   kt       ! ocean time-step 
     98      INTEGER, INTENT(in) ::   kindic   ! indicator of abnormal termination 
     99      ! 
    100100      INTEGER ::   jn 
    101101      LOGICAL ::   ll_print = .FALSE. 
     
    183183         DO jn = 1, jptra 
    184184            IF( lutsav(jn) ) THEN 
    185                cltra  = ctrcnm(jn)   ! short title for tracer 
    186                cltral = ctrcnl(jn)   ! long title for tracer 
    187                cltrau = ctrcun(jn)   ! UNIT for tracer 
     185               cltra  = TRIM( ctrcnm(jn) )   ! short title for tracer 
     186               cltral = TRIM( ctrcnl(jn) )   ! long title for tracer 
     187               cltrau = TRIM( ctrcun(jn) )   ! UNIT for tracer 
    188188               CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5,  & 
    189189                  &          ipk, 1, ipk,  ndepit5, 32, clop, zsto, zout )  
     
    208208 
    209209      DO jn = 1, jptra 
    210          cltra = ctrcnm(jn)      ! short title for tracer 
     210         cltra  = TRIM( ctrcnm(jn) )   ! short title for tracer 
    211211         IF( lutsav(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) 
    212212      END DO 
     
    216216      IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nit5 ) 
    217217      ! 
    218  
    219218   END SUBROUTINE trcdit_wr 
    220219 
     
    237236      !!        IF kindic >0, output of fields before the time step loop 
    238237      !!---------------------------------------------------------------------- 
    239       INTEGER, INTENT( in ) ::   kt          ! ocean time-step 
    240       INTEGER, INTENT( in ) ::   kindic      ! indicator of abnormal termination 
     238      INTEGER, INTENT(in) ::   kt       ! ocean time-step 
     239      INTEGER, INTENT(in) ::   kindic   ! indicator of abnormal termination 
    241240      !! 
    242241      LOGICAL ::   ll_print = .FALSE. 
     
    308307         ! more 3D horizontal arrays 
    309308         DO jl = 1, jpdia3d 
    310             cltra  = ctrc3d(jl)   ! short title for 3D diagnostic 
    311             cltral = ctrc3l(jl)   ! long title for 3D diagnostic 
    312             cltrau = ctrc3u(jl)   ! UNIT for 3D diagnostic 
     309            cltra  = TRIM( ctrc3d(jl) )   ! short title for 3D diagnostic 
     310            cltral = TRIM( ctrc3l(jl) )  ! long title for 3D diagnostic 
     311            cltrau = TRIM( ctrc3u(jl) )  ! UNIT for 3D diagnostic 
    313312            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,   & 
    314313               &          ipk, 1, ipk,  ndepitd, 32, clop, zsto, zout ) 
     
    317316         ! more 2D horizontal arrays 
    318317         DO jl = 1, jpdia2d 
    319             cltra  = ctrc2d(jl)    ! short title for 2D diagnostic 
    320             cltral = ctrc2l(jl)   ! long title for 2D diagnostic 
    321             cltrau = ctrc2u(jl)   ! UNIT for 2D diagnostic 
     318            cltra  = TRIM( ctrc2d(jl) )   ! short title for 2D diagnostic 
     319            cltral = TRIM( ctrc2l(jl) )  ! long title for 2D diagnostic 
     320            cltrau = TRIM( ctrc2u(jl) )  ! UNIT for 2D diagnostic 
    322321            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,  & 
    323322               &          1, 1, 1,  -99, 32, clop, zsto, zout ) 
     
    345344      ! more 3D horizontal arrays 
    346345      DO jl = 1, jpdia3d 
    347          cltra = ctrc3d(jl)   ! short title for 3D diagnostic 
     346         cltra  = TRIM( ctrc3d(jl) )   ! short title for 3D diagnostic 
    348347         CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jl), ndimt50 ,ndext50) 
    349348      END DO 
     
    351350      ! more 2D horizontal arrays 
    352351      DO jl = 1, jpdia2d 
    353          cltra = ctrc2d(jl)   ! short title for 2D diagnostic 
     352         cltra  = TRIM( ctrc2d(jl) )   ! short title for 2D diagnostic 
    354353         CALL histwrite(nitd, cltra, it, trc2d(:,:,jl), ndimt51  ,ndext51) 
    355354      END DO 
     
    364363# else 
    365364   SUBROUTINE trcdii_wr( kt, kindic )                      ! Dummy routine 
    366       INTEGER, INTENT ( in ) :: kt, kindic 
     365      INTEGER, INTENT (in) :: kt, kindic 
    367366   END SUBROUTINE trcdii_wr 
    368367# endif 
     
    400399      ! Initialisation 
    401400      ! -------------- 
    402  
    403401       
    404402      ! local variable for debugging 
     
    451449         ! biological trends 
    452450         DO jl = 1, jpdiabio 
    453             cltra  = ctrbio(jl)   ! short title for biological diagnostic 
    454             cltral = ctrbil(jl)   ! long title for biological diagnostic 
    455             cltrau = ctrbiu(jl)   ! UNIT for biological diagnostic 
     451            cltra  = TRIM( ctrbio(jl) )   ! short title for biological diagnostic 
     452            cltral = TRIM( ctrbil(jl) )  ! long title for biological diagnostic 
     453            cltrau = TRIM( ctrbiu(jl) )  ! UNIT for biological diagnostic 
    456454            CALL histdef( nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb,  & 
    457455               &         ipk, 1, ipk,  ndepitb, 32, clop, zsto, zout) 
     
    477475 
    478476      DO jl = 1, jpdiabio 
    479          cltra = ctrbio(jl)  ! short title for biological diagnostic 
     477         cltra  = TRIM( ctrbio(jl) )   ! short title for biological diagnostic 
    480478         CALL histwrite(nitb, cltra, it, trbio(:,:,:,jl), ndimt50,ndext50) 
    481479      END DO 
     
    485483      IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nitb ) 
    486484      ! 
    487  
    488485   END SUBROUTINE trcdib_wr 
    489486 
     
    496493# endif  
    497494 
     495   INTEGER FUNCTION trc_dia_alloc() 
     496      !!--------------------------------------------------------------------- 
     497      !!                     ***  ROUTINE trc_dia_alloc  *** 
     498      !!--------------------------------------------------------------------- 
     499      ALLOCATE( ndext50(jpij*jpk), ndext51(jpij), STAT=trc_dia_alloc ) 
     500      ! 
     501      IF( trc_dia_alloc /= 0 )   CALL ctl_warn('trc_dia_alloc : failed to allocate arrays') 
     502      ! 
     503   END FUNCTION trc_dia_alloc 
    498504#else 
    499505   !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.