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 12143 for NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/nemogcm.F90 – NEMO

Ignore:
Timestamp:
2019-12-10T12:57:49+01:00 (4 years ago)
Author:
mathiot
Message:

update ENHANCE-02_ISF_nemo to 12072 (sette in progress)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/nemogcm.F90

    r11553 r12143  
    5959   USE diaobs         ! Observation diagnostics       (dia_obs_init routine) 
    6060   USE diacfl         ! CFL diagnostics               (dia_cfl_init routine) 
     61   USE diaharm        ! tidal harmonics diagnostics  (dia_harm_init routine) 
    6162   USE step           ! NEMO time-stepping                 (stp     routine) 
    6263   USE isfstp         ! ice shelf                     (isf_stp_init routine) 
     
    104105 
    105106#if defined key_mpp_mpi 
     107   ! need MPI_Wtime 
    106108   INCLUDE 'mpif.h' 
    107109#endif 
     
    129131      !!---------------------------------------------------------------------- 
    130132      INTEGER ::   istp   ! time step index 
     133      REAL(wp)::   zstptiming   ! elapsed time for 1 time step 
    131134      !!---------------------------------------------------------------------- 
    132135      ! 
     
    189192         ! 
    190193         DO WHILE( istp <= nitend .AND. nstop == 0 ) 
    191 #if defined key_mpp_mpi 
     194 
    192195            ncom_stp = istp 
    193             IF ( istp == ( nit000 + 1 ) ) elapsed_time = MPI_Wtime() 
    194             IF ( istp ==         nitend ) elapsed_time = MPI_Wtime() - elapsed_time 
    195 #endif 
     196            IF( ln_timing ) THEN 
     197               zstptiming = MPI_Wtime() 
     198               IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming 
     199               IF ( istp ==         nitend ) elapsed_time = zstptiming - elapsed_time 
     200            ENDIF 
     201             
    196202            CALL stp        ( istp )  
    197203            istp = istp + 1 
     204 
     205            IF( lwp .AND. ln_timing )   WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming 
     206 
    198207         END DO 
    199208         ! 
     
    221230      ! 
    222231      IF( nstop /= 0 .AND. lwp ) THEN        ! error print 
    223          WRITE(numout,cform_err) 
    224          WRITE(numout,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found' 
    225          WRITE(numout,*) 
     232         WRITE(ctmp1,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found' 
     233         CALL ctl_stop( ctmp1 ) 
    226234      ENDIF 
    227235      ! 
     
    235243#else 
    236244      IF    ( lk_oasis ) THEN   ;   CALL cpl_finalize   ! end coupling and mpp communications with OASIS 
    237       ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop( ldfinal = .TRUE. )   ! end mpp communications 
     245      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop      ! end mpp communications 
    238246      ENDIF 
    239247#endif 
     
    241249      IF(lwm) THEN 
    242250         IF( nstop == 0 ) THEN   ;   STOP 0 
    243          ELSE                    ;   STOP 999 
     251         ELSE                    ;   STOP 123 
    244252         ENDIF 
    245253      ENDIF 
     
    254262      !! ** Purpose :   initialization of the NEMO GCM 
    255263      !!---------------------------------------------------------------------- 
    256       INTEGER  ::   ji                 ! dummy loop indices 
    257       INTEGER  ::   ios, ilocal_comm   ! local integers 
    258       CHARACTER(len=120), DIMENSION(60) ::   cltxt, cltxt2, clnam 
     264      INTEGER ::   ios, ilocal_comm   ! local integers 
    259265      !! 
    260266      NAMELIST/namctl/ ln_ctl   , sn_cfctl, nn_print, nn_ictls, nn_ictle,   & 
     
    264270      !!---------------------------------------------------------------------- 
    265271      ! 
    266       cltxt  = '' 
    267       cltxt2 = '' 
    268       clnam  = ''   
    269272      cxios_context = 'nemo' 
    270273      ! 
    271       !                             ! Open reference namelist and configuration namelist files 
    272       CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    273       CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    274       ! 
    275       REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
    276       READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
    277 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. ) 
    278       REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
    279       READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
    280 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. ) 
    281       ! 
    282       REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
    283       READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
    284 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. ) 
    285       REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
    286       READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
    287 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. )    
    288  
    289       !                             !--------------------------! 
    290       !                             !  Set global domain size  !   (control print return in cltxt2) 
    291       !                             !--------------------------! 
    292       IF( ln_read_cfg ) THEN              ! Read sizes in domain configuration file 
    293          CALL domain_cfg ( cltxt2,        cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
    294          ! 
    295       ELSE                                ! user-defined namelist 
    296          CALL usr_def_nam( cltxt2, clnam, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
    297       ENDIF 
    298       ! 
    299       ! 
    300       !                             !--------------------------------------------! 
    301       !                             !  set communicator & select the local node  ! 
    302       !                             !  NB: mynode also opens output.namelist.dyn ! 
    303       !                             !      on unit number numond on first proc   ! 
    304       !                             !--------------------------------------------! 
     274      !                             !-------------------------------------------------! 
     275      !                             !     set communicator & select the local rank    ! 
     276      !                             !  must be done as soon as possible to get narea  ! 
     277      !                             !-------------------------------------------------! 
     278      ! 
    305279#if defined key_iomput 
    306280      IF( Agrif_Root() ) THEN 
    307281         IF( lk_oasis ) THEN 
    308282            CALL cpl_init( "oceanx", ilocal_comm )                               ! nemo local communicator given by oasis 
    309             CALL xios_initialize( "not used"       ,local_comm= ilocal_comm )    ! send nemo communicator to xios 
     283            CALL xios_initialize( "not used"       , local_comm =ilocal_comm )   ! send nemo communicator to xios 
    310284         ELSE 
    311             CALL xios_initialize( "for_xios_mpi_id",return_comm=ilocal_comm )    ! nemo local communicator given by xios 
     285            CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm )   ! nemo local communicator given by xios 
    312286         ENDIF 
    313287      ENDIF 
    314       ! Nodes selection (control print return in cltxt) 
    315       narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 
     288      CALL mpp_start( ilocal_comm ) 
    316289#else 
    317290      IF( lk_oasis ) THEN 
     
    319292            CALL cpl_init( "oceanx", ilocal_comm )          ! nemo local communicator given by oasis 
    320293         ENDIF 
    321          ! Nodes selection (control print return in cltxt) 
    322          narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 
     294         CALL mpp_start( ilocal_comm ) 
    323295      ELSE 
    324          ilocal_comm = 0                                    ! Nodes selection (control print return in cltxt) 
    325          narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop ) 
    326       ENDIF 
    327 #endif 
    328  
    329       narea = narea + 1                                     ! mynode return the rank of proc (0 --> jpnij -1 ) 
    330  
    331       IF( sn_cfctl%l_config ) THEN 
    332          ! Activate finer control of report outputs 
    333          ! optionally switch off output from selected areas (note this only 
    334          ! applies to output which does not involve global communications) 
    335          IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
    336            & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
    337            &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
    338       ELSE 
    339          ! Use ln_ctl to turn on or off all options. 
    340          CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 
    341       ENDIF 
    342  
    343       lwm = (narea == 1)                                    ! control of output namelists 
    344       lwp = (narea == 1) .OR. ln_ctl                        ! control of all listing output print 
    345  
    346       IF(lwm) THEN               ! write merged namelists from earlier to output namelist  
    347          !                       ! now that the file has been opened in call to mynode.  
    348          !                       ! NB: nammpp has already been written in mynode (if lk_mpp_mpi) 
    349          WRITE( numond, namctl ) 
    350          WRITE( numond, namcfg ) 
    351          IF( .NOT.ln_read_cfg ) THEN 
    352             DO ji = 1, SIZE(clnam) 
    353                IF( TRIM(clnam(ji)) /= '' )   WRITE(numond, * ) clnam(ji)     ! namusr_def print 
    354             END DO 
    355          ENDIF 
    356       ENDIF 
    357  
    358       IF(lwp) THEN                            ! open listing units 
    359          ! 
    360          CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) 
     296         CALL mpp_start( ) 
     297      ENDIF 
     298#endif 
     299      ! 
     300      narea = mpprank + 1               ! mpprank: the rank of proc (0 --> mppsize -1 ) 
     301      lwm = (narea == 1)                ! control of output namelists 
     302      ! 
     303      !                             !---------------------------------------------------------------! 
     304      !                             ! Open output files, reference and configuration namelist files ! 
     305      !                             !---------------------------------------------------------------! 
     306      ! 
     307      ! open ocean.output as soon as possible to get all output prints (including errors messages) 
     308      IF( lwm )   CALL ctl_opn(     numout,        'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     309      ! open reference and configuration namelist files 
     310                  CALL ctl_opn( numnam_ref,        'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     311                  CALL ctl_opn( numnam_cfg,        'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     312      IF( lwm )   CALL ctl_opn(     numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     313      ! open /dev/null file to be able to supress output write easily 
     314                  CALL ctl_opn(     numnul,           '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     315      ! 
     316      !                             !--------------------! 
     317      !                             ! Open listing units !  -> need ln_ctl from namctl to define lwp 
     318      !                             !--------------------! 
     319      ! 
     320      REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
     321      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
     322901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' ) 
     323      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
     324      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
     325902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 
     326      ! 
     327      lwp = (narea == 1) .OR. ln_ctl    ! control of all listing output print 
     328      ! 
     329      IF(lwp) THEN                      ! open listing units 
     330         ! 
     331         IF( .NOT. lwm )   &            ! alreay opened for narea == 1 
     332            &            CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) 
    361333         ! 
    362334         WRITE(numout,*) 
    363          WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC' 
     335         WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' 
    364336         WRITE(numout,*) '                       NEMO team' 
    365337         WRITE(numout,*) '            Ocean General Circulation Model' 
     
    380352         WRITE(numout,*) "     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " 
    381353         WRITE(numout,*) 
    382           
    383          DO ji = 1, SIZE(cltxt) 
    384             IF( TRIM(cltxt (ji)) /= '' )   WRITE(numout,*) TRIM(cltxt(ji))    ! control print of mynode 
    385          END DO 
    386          WRITE(numout,*) 
    387          WRITE(numout,*) 
    388          DO ji = 1, SIZE(cltxt2) 
    389             IF( TRIM(cltxt2(ji)) /= '' )   WRITE(numout,*) TRIM(cltxt2(ji))   ! control print of domain size 
    390          END DO 
    391354         ! 
    392355         WRITE(numout,cform_aaa)                                        ! Flag AAAAAAA 
    393356         ! 
    394357      ENDIF 
    395       ! open /dev/null file to be able to supress output write easily 
    396       CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    397       ! 
    398       !                                      ! Domain decomposition 
    399       CALL mpp_init                          ! MPP 
     358      ! 
     359      ! finalize the definition of namctl variables 
     360      IF( sn_cfctl%l_config ) THEN 
     361         ! Activate finer control of report outputs 
     362         ! optionally switch off output from selected areas (note this only 
     363         ! applies to output which does not involve global communications) 
     364         IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
     365           & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
     366           &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
     367      ELSE 
     368         ! Use ln_ctl to turn on or off all options. 
     369         CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 
     370      ENDIF 
     371      ! 
     372      IF(lwm) WRITE( numond, namctl ) 
     373      ! 
     374      !                             !------------------------------------! 
     375      !                             !  Set global domain size parameters ! 
     376      !                             !------------------------------------! 
     377      ! 
     378      REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
     379      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
     380903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 
     381      REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
     382      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
     383904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )    
     384      ! 
     385      IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file 
     386         CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
     387      ELSE                              ! user-defined namelist 
     388         CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
     389      ENDIF 
     390      ! 
     391      IF(lwm)   WRITE( numond, namcfg ) 
     392      ! 
     393      !                             !-----------------------------------------! 
     394      !                             ! mpp parameters and domain decomposition ! 
     395      !                             !-----------------------------------------! 
     396      CALL mpp_init 
    400397 
    401398      ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays 
     
    485482      
    486483      !                                      ! Diagnostics 
    487       IF( lk_floats    )   CALL     flo_init    ! drifting Floats 
     484                           CALL     flo_init    ! drifting Floats 
    488485      IF( ln_diacfl    )   CALL dia_cfl_init    ! Initialise CFL diagnostics 
    489486                           CALL dia_ptr_init    ! Poleward TRansports initialization 
    490       IF( lk_diadct    )   CALL dia_dct_init    ! Sections tranports 
     487                           CALL dia_dct_init    ! Sections tranports 
    491488                           CALL dia_hsb_init    ! heat content, salt content and volume budgets 
    492489                           CALL     trd_init    ! Mixed-layer/Vorticity/Integral constraints trends 
     
    494491                           CALL dia_tmb_init    ! TMB outputs 
    495492                           CALL dia_25h_init    ! 25h mean  outputs 
    496       IF( ln_diaobs    )   CALL dia_obs( nit000-1 )   ! Observation operator for restart 
     493                           CALL dia_harm_init   ! tidal harmonics outputs 
     494     IF( ln_diaobs    )    CALL dia_obs( nit000-1 )   ! Observation operator for restart 
    497495 
    498496      !                                      ! Assimilation increments 
     
    512510      !! ** Purpose :   control print setting 
    513511      !! 
    514       !! ** Method  : - print namctl information and check some consistencies 
     512      !! ** Method  : - print namctl and namcfg information and check some consistencies 
    515513      !!---------------------------------------------------------------------- 
    516514      ! 
     
    655653      USE trc_oce   , ONLY : trc_oce_alloc 
    656654      USE bdy_oce   , ONLY : bdy_oce_alloc 
    657 #if defined key_diadct  
    658       USE diadct    , ONLY : diadct_alloc  
    659 #endif  
    660655      ! 
    661656      INTEGER :: ierr 
     
    669664      ierr = ierr + bdy_oce_alloc()    ! bdy masks (incl. initialization) 
    670665      ! 
    671 #if defined key_diadct  
    672       ierr = ierr + diadct_alloc ()    !  
    673 #endif  
    674       ! 
    675666      CALL mpp_sum( 'nemogcm', ierr ) 
    676667      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' ) 
     
    678669   END SUBROUTINE nemo_alloc 
    679670 
     671    
    680672   SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all ) 
    681673      !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.