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 11822 for NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OCE/nemogcm.F90 – NEMO

Ignore:
Timestamp:
2019-10-29T11:41:36+01:00 (4 years ago)
Author:
acc
Message:

Branch 2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps. Sette tested updates to branch to align with trunk changes between 10721 and 11740. Sette tests are passing but results differ from branch before these changes (except for GYRE_PISCES and VORTEX) and branch results already differed from trunk because of algorithmic fixes. Will need more checks to confirm correctness.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OCE/nemogcm.F90

    r11758 r11822  
    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 icbini         ! handle bergs, initialisation 
     
    103104 
    104105#if defined key_mpp_mpi 
     106   ! need MPI_Wtime 
    105107   INCLUDE 'mpif.h' 
    106108#endif 
     
    128130      !!---------------------------------------------------------------------- 
    129131      INTEGER ::   istp   ! time step index 
     132      REAL(wp)::   zstptiming   ! elapsed time for 1 time step 
    130133      !!---------------------------------------------------------------------- 
    131134      ! 
     
    190193         ! 
    191194         DO WHILE( istp <= nitend .AND. nstop == 0 ) 
    192 #if defined key_mpp_mpi 
     195 
    193196            ncom_stp = istp 
    194             IF ( istp == ( nit000 + 1 ) ) elapsed_time = MPI_Wtime() 
    195             IF ( istp ==         nitend ) elapsed_time = MPI_Wtime() - elapsed_time 
    196 #endif 
     197            IF( ln_timing ) THEN 
     198               zstptiming = MPI_Wtime() 
     199               IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming 
     200               IF ( istp ==         nitend ) elapsed_time = zstptiming - elapsed_time 
     201            ENDIF 
     202             
    197203            CALL stp        ( istp )  
    198204            istp = istp + 1 
     205 
     206            IF( lwp .AND. ln_timing )   WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming 
     207 
    199208         END DO 
    200209         ! 
     
    222231      ! 
    223232      IF( nstop /= 0 .AND. lwp ) THEN        ! error print 
    224          WRITE(numout,cform_err) 
    225          WRITE(numout,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found' 
    226          WRITE(numout,*) 
     233         WRITE(ctmp1,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found' 
     234         CALL ctl_stop( ctmp1 ) 
    227235      ENDIF 
    228236      ! 
     
    236244#else 
    237245      IF    ( lk_oasis ) THEN   ;   CALL cpl_finalize   ! end coupling and mpp communications with OASIS 
    238       ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop( ldfinal = .TRUE. )   ! end mpp communications 
     246      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop      ! end mpp communications 
    239247      ENDIF 
    240248#endif 
     
    242250      IF(lwm) THEN 
    243251         IF( nstop == 0 ) THEN   ;   STOP 0 
    244          ELSE                    ;   STOP 999 
     252         ELSE                    ;   STOP 123 
    245253         ENDIF 
    246254      ENDIF 
     
    255263      !! ** Purpose :   initialization of the NEMO GCM 
    256264      !!---------------------------------------------------------------------- 
    257       INTEGER  ::   ji                 ! dummy loop indices 
    258       INTEGER  ::   ios, ilocal_comm   ! local integers 
    259       CHARACTER(len=120), DIMENSION(60) ::   cltxt, cltxt2, clnam 
     265      INTEGER ::   ios, ilocal_comm   ! local integers 
    260266      !! 
    261267      NAMELIST/namctl/ ln_ctl   , sn_cfctl, nn_print, nn_ictls, nn_ictle,   & 
     
    265271      !!---------------------------------------------------------------------- 
    266272      ! 
    267       cltxt  = '' 
    268       cltxt2 = '' 
    269       clnam  = ''   
    270273      cxios_context = 'nemo' 
    271274      ! 
    272       !                             ! Open reference namelist and configuration namelist files 
    273       CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    274       CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    275       ! 
    276       REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
    277       READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
    278 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. ) 
    279       REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
    280       READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
    281 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. ) 
    282       ! 
    283       REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
    284       READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
    285 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. ) 
    286       REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
    287       READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
    288 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. )    
    289  
    290       !                             !--------------------------! 
    291       !                             !  Set global domain size  !   (control print return in cltxt2) 
    292       !                             !--------------------------! 
    293       IF( ln_read_cfg ) THEN              ! Read sizes in domain configuration file 
    294          CALL domain_cfg ( cltxt2,        cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
    295          ! 
    296       ELSE                                ! user-defined namelist 
    297          CALL usr_def_nam( cltxt2, clnam, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
    298       ENDIF 
    299       ! 
    300       ! 
    301       !                             !--------------------------------------------! 
    302       !                             !  set communicator & select the local node  ! 
    303       !                             !  NB: mynode also opens output.namelist.dyn ! 
    304       !                             !      on unit number numond on first proc   ! 
    305       !                             !--------------------------------------------! 
     275      !                             !-------------------------------------------------! 
     276      !                             !     set communicator & select the local rank    ! 
     277      !                             !  must be done as soon as possible to get narea  ! 
     278      !                             !-------------------------------------------------! 
     279      ! 
    306280#if defined key_iomput 
    307281      IF( Agrif_Root() ) THEN 
    308282         IF( lk_oasis ) THEN 
    309283            CALL cpl_init( "oceanx", ilocal_comm )                               ! nemo local communicator given by oasis 
    310             CALL xios_initialize( "not used"       ,local_comm= ilocal_comm )    ! send nemo communicator to xios 
     284            CALL xios_initialize( "not used"       , local_comm =ilocal_comm )   ! send nemo communicator to xios 
    311285         ELSE 
    312             CALL xios_initialize( "for_xios_mpi_id",return_comm=ilocal_comm )    ! nemo local communicator given by xios 
     286            CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm )   ! nemo local communicator given by xios 
    313287         ENDIF 
    314288      ENDIF 
    315       ! Nodes selection (control print return in cltxt) 
    316       narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 
     289      CALL mpp_start( ilocal_comm ) 
    317290#else 
    318291      IF( lk_oasis ) THEN 
     
    320293            CALL cpl_init( "oceanx", ilocal_comm )          ! nemo local communicator given by oasis 
    321294         ENDIF 
    322          ! Nodes selection (control print return in cltxt) 
    323          narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 
     295         CALL mpp_start( ilocal_comm ) 
    324296      ELSE 
    325          ilocal_comm = 0                                    ! Nodes selection (control print return in cltxt) 
    326          narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop ) 
    327       ENDIF 
    328 #endif 
    329  
    330       narea = narea + 1                                     ! mynode return the rank of proc (0 --> jpnij -1 ) 
    331  
    332       IF( sn_cfctl%l_config ) THEN 
    333          ! Activate finer control of report outputs 
    334          ! optionally switch off output from selected areas (note this only 
    335          ! applies to output which does not involve global communications) 
    336          IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
    337            & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
    338            &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
    339       ELSE 
    340          ! Use ln_ctl to turn on or off all options. 
    341          CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 
    342       ENDIF 
    343  
    344       lwm = (narea == 1)                                    ! control of output namelists 
    345       lwp = (narea == 1) .OR. ln_ctl                        ! control of all listing output print 
    346  
    347       IF(lwm) THEN               ! write merged namelists from earlier to output namelist  
    348          !                       ! now that the file has been opened in call to mynode.  
    349          !                       ! NB: nammpp has already been written in mynode (if lk_mpp_mpi) 
    350          WRITE( numond, namctl ) 
    351          WRITE( numond, namcfg ) 
    352          IF( .NOT.ln_read_cfg ) THEN 
    353             DO ji = 1, SIZE(clnam) 
    354                IF( TRIM(clnam(ji)) /= '' )   WRITE(numond, * ) clnam(ji)     ! namusr_def print 
    355             END DO 
    356          ENDIF 
    357       ENDIF 
    358  
    359       IF(lwp) THEN                            ! open listing units 
    360          ! 
    361          CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) 
     297         CALL mpp_start( ) 
     298      ENDIF 
     299#endif 
     300      ! 
     301      narea = mpprank + 1               ! mpprank: the rank of proc (0 --> mppsize -1 ) 
     302      lwm = (narea == 1)                ! control of output namelists 
     303      ! 
     304      !                             !---------------------------------------------------------------! 
     305      !                             ! Open output files, reference and configuration namelist files ! 
     306      !                             !---------------------------------------------------------------! 
     307      ! 
     308      ! open ocean.output as soon as possible to get all output prints (including errors messages) 
     309      IF( lwm )   CALL ctl_opn(     numout,        'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     310      ! open reference and configuration namelist files 
     311                  CALL ctl_opn( numnam_ref,        'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     312                  CALL ctl_opn( numnam_cfg,        'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     313      IF( lwm )   CALL ctl_opn(     numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     314      ! open /dev/null file to be able to supress output write easily 
     315                  CALL ctl_opn(     numnul,           '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     316      ! 
     317      !                             !--------------------! 
     318      !                             ! Open listing units !  -> need ln_ctl from namctl to define lwp 
     319      !                             !--------------------! 
     320      ! 
     321      REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
     322      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
     323901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' ) 
     324      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
     325      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
     326902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 
     327      ! 
     328      lwp = (narea == 1) .OR. ln_ctl    ! control of all listing output print 
     329      ! 
     330      IF(lwp) THEN                      ! open listing units 
     331         ! 
     332         IF( .NOT. lwm )   &            ! alreay opened for narea == 1 
     333            &            CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) 
    362334         ! 
    363335         WRITE(numout,*) 
    364          WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC' 
     336         WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' 
    365337         WRITE(numout,*) '                       NEMO team' 
    366338         WRITE(numout,*) '            Ocean General Circulation Model' 
     
    381353         WRITE(numout,*) "     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " 
    382354         WRITE(numout,*) 
    383           
    384          DO ji = 1, SIZE(cltxt) 
    385             IF( TRIM(cltxt (ji)) /= '' )   WRITE(numout,*) TRIM(cltxt(ji))    ! control print of mynode 
    386          END DO 
    387          WRITE(numout,*) 
    388          WRITE(numout,*) 
    389          DO ji = 1, SIZE(cltxt2) 
    390             IF( TRIM(cltxt2(ji)) /= '' )   WRITE(numout,*) TRIM(cltxt2(ji))   ! control print of domain size 
    391          END DO 
    392355         ! 
    393356         WRITE(numout,cform_aaa)                                        ! Flag AAAAAAA 
    394357         ! 
    395358      ENDIF 
    396       ! open /dev/null file to be able to supress output write easily 
    397       CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    398       ! 
    399       !                                      ! Domain decomposition 
    400       CALL mpp_init                          ! MPP 
     359      ! 
     360      ! finalize the definition of namctl variables 
     361      IF( sn_cfctl%l_config ) THEN 
     362         ! Activate finer control of report outputs 
     363         ! optionally switch off output from selected areas (note this only 
     364         ! applies to output which does not involve global communications) 
     365         IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
     366           & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
     367           &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
     368      ELSE 
     369         ! Use ln_ctl to turn on or off all options. 
     370         CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 
     371      ENDIF 
     372      ! 
     373      IF(lwm) WRITE( numond, namctl ) 
     374      ! 
     375      !                             !------------------------------------! 
     376      !                             !  Set global domain size parameters ! 
     377      !                             !------------------------------------! 
     378      ! 
     379      REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
     380      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
     381903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 
     382      REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
     383      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
     384904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )    
     385      ! 
     386      IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file 
     387         CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
     388      ELSE                              ! user-defined namelist 
     389         CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
     390      ENDIF 
     391      ! 
     392      IF(lwm)   WRITE( numond, namcfg ) 
     393      ! 
     394      !                             !-----------------------------------------! 
     395      !                             ! mpp parameters and domain decomposition ! 
     396      !                             !-----------------------------------------! 
     397      CALL mpp_init 
    401398 
    402399      ! 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( Nnn )    ! drifting Floats 
     484                           CALL     flo_init( Nnn )    ! 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( Nnn )    ! heat content, salt content and volume budgets 
    492489                           CALL     trd_init( Nnn )    ! Mixed-layer/Vorticity/Integral constraints trends 
     
    494491                           CALL dia_tmb_init    ! TMB outputs 
    495492                           CALL dia_25h_init( Nbb )    ! 25h mean  outputs 
     493                           CALL dia_harm_init   ! tidal harmonics outputs 
    496494      IF( ln_diaobs    )   CALL dia_obs( nit000-1, Nnn )   ! Observation operator for restart 
    497495 
     
    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.