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

    r2555 r2715  
    44   !! TOP :   Manage the passive tracer initialization 
    55   !!====================================================================== 
    6    !! History :    -   !  1991-03  ()  original code 
    7    !!             1.0  ! 2005-03 (O. Aumont, A. El Moussaoui) F90 
    8    !!              -   !  2005-10 (C. Ethe) print control 
    9    !!             2.0  !  2005-10 (C. Ethe, G. Madec) revised architecture 
     6   !! History :   -   ! 1991-03 (O. Marti)  original code 
     7   !!            1.0  ! 2005-03 (O. Aumont, A. El Moussaoui) F90 
     8   !!            2.0  ! 2005-10 (C. Ethe, G. Madec) revised architecture 
     9   !!            4.0  ! 2011-01 (A. R. Porter, STFC Daresbury) dynamical allocation 
    1010   !!---------------------------------------------------------------------- 
    1111#if defined key_top 
     
    1313   !!   'key_top'                                                TOP models 
    1414   !!---------------------------------------------------------------------- 
    15    !!---------------------------------------------------------------------- 
    16    !!   trc_init :   Initialization for passive tracer 
     15   !!   trc_init  :   Initialization for passive tracer 
     16   !!   top_alloc :   allocate the TOP arrays 
    1717   !!---------------------------------------------------------------------- 
    1818   USE oce_trc 
     
    2626   USE trcini_my_trc   ! MY_TRC   initialisation 
    2727   USE trcdta    
    28 #if defined key_offline 
    2928   USE daymod 
    30 #endif 
    3129   USE zpshde          ! partial step: hor. derivative   (zps_hde routine) 
    32    USE in_out_manager  ! I/O manager 
    3330   USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine) 
    34    USE lib_mpp         ! distributed memory computing library 
    35    USE lib_fortran     !  
    3631    
    3732   IMPLICIT NONE 
     
    4237    !! * Substitutions 
    4338#  include "domzgr_substitute.h90" 
    44    
     39   !!---------------------------------------------------------------------- 
     40   !! NEMO/TOP 4.0 , NEMO Consortium (2011) 
     41   !! $Id$  
     42   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     43   !!---------------------------------------------------------------------- 
    4544CONTAINS 
    4645    
     
    5958      INTEGER ::   jk, jn    ! dummy loop indices 
    6059      CHARACTER (len=25) :: charout 
    61  
    6260      !!--------------------------------------------------------------------- 
    6361 
     
    6664      IF(lwp) WRITE(numout,*) '~~~~~~~' 
    6765 
    68       !                 ! masked grid volume 
     66      CALL top_alloc()              ! allocate TOP arrays 
     67 
     68      !                             ! masked grid volume 
    6969      DO jk = 1, jpk 
    7070         cvol(:,:,jk) = e1t(:,:) * e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk)  
    7171      END DO 
    7272 
    73       ! total volume of the ocean 
     73      !                             ! total volume of the ocean 
    7474#if ! defined key_degrad 
    7575      areatot = glob_sum( cvol(:,:,:) ) 
     
    7878#endif 
    7979 
    80                                   CALL trc_nam      ! read passive tracers namelists 
    81  
    82       ! restart for passive tracer (input) 
     80      CALL trc_nam                  ! read passive tracers namelists 
     81 
     82      !                             ! restart for passive tracer (input) 
    8383      IF( ln_rsttr ) THEN 
    8484         IF(lwp) WRITE(numout,*) '       read a restart file for passive tracer : ', cn_trcrst_in 
    8585         IF(lwp) WRITE(numout,*) ' ' 
    8686      ELSE 
    87          IF(lwp) WRITE(numout,*) 
    88          DO jn = 1, jptra 
    89             IF( lwp .AND. lutini(jn) )  &                  ! open input FILE only IF lutini(jn) is true 
    90             &  WRITE(numout,*) '        read an initial file  for passive tracer number :', jn, ' traceur : ', ctrcnm(jn)  
    91          END DO 
     87         IF( lwp .AND. lk_dtatrc ) THEN 
     88            DO jn = 1, jptra 
     89               IF( lutini(jn) )  &                  ! open input FILE only IF lutini(jn) is true 
     90                  &  WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' traceur : ', ctrcnm(jn)  
     91             END DO 
     92          ENDIF 
     93          IF( lwp ) WRITE(numout,*) 
    9294      ENDIF 
    9395 
     
    138140      ENDIF 
    139141  
    140       tra(:,:,:,:) = 0. 
     142      tra(:,:,:,:) = 0._wp 
    141143       
    142144      IF( ln_zps .AND. .NOT. lk_c1d )   &              ! Partial steps: before horizontal gradient of passive 
    143       &                     CALL zps_hde( nit000, jptra, trn, gtru, gtrv )       ! tracers at the bottom ocean level 
    144  
    145  
    146       !                 ! Computation content of all tracers 
    147       trai = 0.e0 
     145        &    CALL zps_hde( nit000, jptra, trn, gtru, gtrv )       ! tracers at the bottom ocean level 
     146 
     147 
     148      !            
     149      trai = 0._wp         ! Computation content of all tracers 
    148150      DO jn = 1, jptra 
    149151#if ! defined key_degrad 
     
    154156      END DO       
    155157 
    156       !                 ! control print 
    157       IF(lwp) WRITE(numout,*) 
    158       IF(lwp) WRITE(numout,*) 
    159       IF(lwp) WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra 
    160       IF(lwp) WRITE(numout,*) '          *** Total volume of ocean                = ', areatot 
    161       IF(lwp) WRITE(numout,*) '          *** Total inital content of all tracers  = ', trai 
    162       IF(lwp) WRITE(numout,*) 
    163  
    164       IF( ln_ctl )   CALL prt_ctl_trc_init      ! control print 
    165       ! 
    166  
    167       IF(ln_ctl) THEN      ! print mean trends (used for debugging) 
     158      IF(lwp) THEN               ! control print 
     159         WRITE(numout,*) 
     160         WRITE(numout,*) 
     161         WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra 
     162         WRITE(numout,*) '          *** Total volume of ocean                = ', areatot 
     163         WRITE(numout,*) '          *** Total inital content of all tracers  = ', trai 
     164         WRITE(numout,*) 
     165      ENDIF 
     166 
     167      IF(ln_ctl) THEN            ! print mean trends (used for debugging) 
     168         CALL prt_ctl_trc_init 
    168169         WRITE(charout, FMT="('ini ')") 
    169170         CALL prt_ctl_trc_info( charout ) 
    170171         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) 
    171172      ENDIF 
    172  
     173      ! 
    173174   END SUBROUTINE trc_init 
     175 
     176 
     177   SUBROUTINE top_alloc 
     178      !!---------------------------------------------------------------------- 
     179      !!                     ***  ROUTINE top_alloc  *** 
     180      !! 
     181      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules 
     182      !!---------------------------------------------------------------------- 
     183      USE trcadv        , ONLY:   trc_adv_alloc          ! TOP-related alloc routines... 
     184      USE trc           , ONLY:   trc_alloc 
     185      USE trcnxt        , ONLY:   trc_nxt_alloc 
     186      USE trczdf        , ONLY:   trc_zdf_alloc 
     187      USE trdmod_trc_oce, ONLY:   trd_mod_trc_oce_alloc 
     188#if ! defined key_iomput 
     189      USE trcdia        , ONLY:   trc_dia_alloc 
     190#endif 
     191#if defined key_trcdmp  
     192      USE trcdmp        , ONLY:   trc_dmp_alloc 
     193#endif 
     194#if defined key_dtatrc 
     195      USE trcdta        , ONLY:   trc_dta_alloc 
     196#endif 
     197#if defined key_trdmld_trc   ||   defined key_esopa 
     198      USE trdmld_trc    , ONLY:   trd_mld_trc_alloc 
     199#endif 
     200      ! 
     201      INTEGER :: ierr 
     202      !!---------------------------------------------------------------------- 
     203      ! 
     204      ierr =        trc_adv_alloc()          ! Start of TOP-related alloc routines... 
     205      ierr = ierr + trc_alloc    () 
     206      ierr = ierr + trc_nxt_alloc() 
     207      ierr = ierr + trc_zdf_alloc() 
     208      ierr = ierr + trd_mod_trc_oce_alloc() 
     209#if ! defined key_iomput 
     210      ierr = ierr + trc_dia_alloc() 
     211#endif 
     212#if defined key_trcdmp  
     213      ierr = ierr + trc_dmp_alloc() 
     214#endif 
     215#if defined key_dtatrc 
     216      ierr = ierr + trc_dta_alloc() 
     217#endif 
     218#if defined key_trdmld_trc   ||   defined key_esopa 
     219      ierr = ierr + trd_mld_trc_alloc() 
     220#endif 
     221      ! 
     222      IF( lk_mpp    )   CALL mpp_sum( ierr ) 
     223      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' ) 
     224      ! 
     225   END SUBROUTINE top_alloc 
    174226 
    175227#else 
     
    182234#endif 
    183235 
    184    !!---------------------------------------------------------------------- 
    185    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    186    !! $Id$  
    187    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    188236   !!====================================================================== 
    189237END MODULE trcini 
Note: See TracChangeset for help on using the changeset viewer.