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 13766 for NEMO/branches/2020/dev_12905_xios_ancil/src/OFF/nemogcm.F90 – NEMO

Ignore:
Timestamp:
2020-11-10T12:57:08+01:00 (4 years ago)
Author:
andmirek
Message:

Ticket #2475: merge with trunk rev 13688

Location:
NEMO/branches/2020/dev_12905_xios_ancil
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_12905_xios_ancil

    • Property svn:externals
      •  

        old new  
        33^/utils/build/mk@HEAD         mk 
        44^/utils/tools@HEAD            tools 
        5 ^/vendors/AGRIF/dev@HEAD      ext/AGRIF 
         5^/vendors/AGRIF/dev_r12970_AGRIF_CMEMS      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
        88 
        99# SETTE 
        10 ^/utils/CI/sette@HEAD         sette 
         10^/utils/CI/sette@13559        sette 
  • NEMO/branches/2020/dev_12905_xios_ancil/src/OFF/nemogcm.F90

    r13040 r13766  
    2828   USE usrdef_nam     ! user defined configuration 
    2929   USE eosbn2         ! equation of state            (eos bn2 routine) 
    30    USE bdy_oce,  ONLY : ln_bdy 
    31    USE bdyini         ! open boundary cond. setting       (bdy_init routine) 
     30#if defined key_qco 
     31   USE domqco         ! tools for scale factor         (dom_qco_r3c  routine) 
     32#endif 
     33   USE bdyini         ! open boundary cond. setting        (bdy_init routine) 
    3234   !              ! ocean physics 
    3335   USE ldftra         ! lateral diffusivity setting    (ldf_tra_init routine) 
     
    3840   USE sbcmod         ! surface boundary condition     (sbc_init     routine) 
    3941   USE phycst         ! physical constant                   (par_cst routine) 
     42   USE zdfphy         ! vertical physics manager       (zdf_phy_init routine) 
    4043   USE dtadyn         ! Lecture and Interpolation of the dynamical fields 
    4144   USE trcini         ! Initilization of the passive tracers 
     
    4750   USE trcnam         ! passive tracer : namelist 
    4851   USE trcrst         ! passive tracer restart 
    49    USE diaptr         ! Need to initialise this as some variables are used in if statements later 
    5052   USE sbc_oce , ONLY : ln_rnf 
    5153   USE sbcrnf         ! surface boundary condition : runoffs 
     
    6163   USE timing         ! Timing 
    6264   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
    63    USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop   ! Setup of north fold exchanges 
     65   USE lbcnfd  , ONLY : isendto, nsndto   ! Setup of north fold exchanges 
    6466   USE step, ONLY : Nbb, Nnn, Naa, Nrhs   ! time level indices 
     67   USE halo_mng 
    6568 
    6669   IMPLICIT NONE 
     
    7073 
    7174   CHARACTER (len=64) ::   cform_aaa="( /, 'AAAAAAAA', / ) "   ! flag for output listing 
     75#if defined key_mpp_mpi 
     76   ! need MPI_Wtime 
     77   INCLUDE 'mpif.h' 
     78#endif 
    7279 
    7380   !!---------------------------------------------------------------------- 
     
    9299      !!              Madec, 2008, internal report, IPSL. 
    93100      !!---------------------------------------------------------------------- 
    94       INTEGER :: istp, indic       ! time step index 
     101      INTEGER :: istp       ! time step index 
     102      REAL(wp)::   zstptiming   ! elapsed time for 1 time step 
    95103      !!---------------------------------------------------------------------- 
    96104 
     
    111119      !  
    112120      DO WHILE ( istp <= nitend .AND. nstop == 0 )    !==  OFF time-stepping  ==! 
     121 
     122         IF( ln_timing ) THEN 
     123            zstptiming = MPI_Wtime() 
     124            IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming 
     125            IF ( istp ==         nitend ) elapsed_time = zstptiming - elapsed_time 
     126         ENDIF 
    113127         ! 
    114128         IF( istp /= nit000 )   CALL day        ( istp )         ! Calendar (day was already called at nit000 in day_init) 
     
    119133                                CALL dta_dyn    ( istp, Nbb, Nnn, Naa )       ! Interpolation of the dynamical fields 
    120134#endif 
     135#if ! defined key_sed_off 
     136         IF( .NOT.ln_linssh ) THEN 
     137                                CALL dta_dyn_atf( istp, Nbb, Nnn, Naa )       ! time filter of sea  surface height and vertical scale factors 
     138# if defined key_qco 
     139                                CALL dom_qco_r3c( ssh(:,:,Kmm), r3t_f, r3u_f, r3v_f ) 
     140# endif 
     141         ENDIF 
    121142                                CALL trc_stp    ( istp, Nbb, Nnn, Nrhs, Naa ) ! time-stepping 
    122 #if ! defined key_sed_off 
    123          IF( .NOT.ln_linssh )   CALL dta_dyn_atf( istp, Nbb, Nnn, Naa )       ! time filter of sea  surface height and vertical scale factors 
     143# if defined key_qco 
     144                                !r3t(:,:,Kmm) = r3t_f(:,:)                     ! update ssh to h0 ratio 
     145                                !r3u(:,:,Kmm) = r3u_f(:,:) 
     146                                !r3v(:,:,Kmm) = r3v_f(:,:) 
     147# endif 
    124148#endif 
    125149         ! Swap time levels 
     
    129153         Naa = Nrhs 
    130154         ! 
     155#if ! defined key_qco 
    131156#if ! defined key_sed_off 
    132157         IF( .NOT.ln_linssh )   CALL dta_dyn_sf_interp( istp, Nnn )  ! calculate now grid parameters 
    133158#endif 
    134                                 CALL stp_ctl    ( istp, indic )  ! Time loop: control and print 
     159#endif          
     160         CALL stp_ctl    ( istp )             ! Time loop: control and print 
    135161         istp = istp + 1 
     162 
     163         IF( lwp .AND. ln_timing )   WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming 
     164 
    136165      END DO 
    137166      ! 
     
    147176      IF( nstop /= 0 .AND. lwp ) THEN                 ! error print 
    148177         WRITE(ctmp1,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found' 
    149          CALL ctl_stop( ctmp1 ) 
     178         WRITE(ctmp2,*) '           Look for "E R R O R" messages in all existing ocean_output* files' 
     179         CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 ) 
    150180      ENDIF 
    151181      ! 
     
    177207      INTEGER ::   ios, ilocal_comm   ! local integers 
    178208      !! 
    179       NAMELIST/namctl/ sn_cfctl, nn_print, nn_ictls, nn_ictle,              & 
    180          &             nn_isplt , nn_jsplt, nn_jctls, nn_jctle,             & 
    181          &             ln_timing, ln_diacfl 
     209      NAMELIST/namctl/ sn_cfctl, ln_timing, ln_diacfl,                                & 
     210         &             nn_isplt,  nn_jsplt,  nn_ictls, nn_ictle, nn_jctls, nn_jctle 
    182211      NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr, ln_xios_cfg 
    183212      !!---------------------------------------------------------------------- 
    184213      ! 
    185214      cxios_context = 'nemo' 
     215      nn_hls = 1 
    186216      ! 
    187217      !                             !-------------------------------------------------! 
     
    229259      ! 
    230260      ! finalize the definition of namctl variables 
    231       IF( sn_cfctl%l_allon ) THEN 
    232          ! Turn on all options. 
    233          CALL nemo_set_cfctl( sn_cfctl, .TRUE., .TRUE. ) 
    234          ! Ensure all processors are active 
    235          sn_cfctl%procmin = 0 ; sn_cfctl%procmax = 1000000 ; sn_cfctl%procincr = 1 
    236       ELSEIF( sn_cfctl%l_config ) THEN 
    237          ! Activate finer control of report outputs 
    238          ! optionally switch off output from selected areas (note this only 
    239          ! applies to output which does not involve global communications) 
    240          IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
    241            & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
    242            &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
    243       ELSE 
    244          ! turn off all options. 
    245          CALL nemo_set_cfctl( sn_cfctl, .FALSE., .TRUE. ) 
    246       ENDIF 
     261      IF( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax .OR. MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 )   & 
     262         &   CALL nemo_set_cfctl( sn_cfctl, .FALSE. ) 
    247263      ! 
    248264      lwp = (narea == 1) .OR. sn_cfctl%l_oceout    ! control of all listing output print 
     
    290306      ! 
    291307      IF( ln_read_cfg ) THEN              ! Read sizes in domain configuration file 
    292          CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
     308         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) 
    293309      ELSE                                ! user-defined namelist 
    294          CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
     310         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) 
    295311      ENDIF 
    296312      ! 
     
    304320      CALL mpp_init 
    305321 
     322      CALL halo_mng_init() 
    306323      ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays 
    307324      CALL nemo_alloc() 
     
    330347 
    331348                           CALL     sbc_init( Nbb, Nnn, Naa )    ! Forcings : surface module 
    332                            CALL     bdy_init    ! Open boundaries initialisation     
     349                           CALL     bdy_init    ! Open boundaries initialisation 
     350                            
     351                           CALL zdf_phy_init( Nnn )    ! Vertical physics 
    333352 
    334353      !                                      ! Tracer physics 
    335354                           CALL ldf_tra_init    ! Lateral ocean tracer physics 
    336                            CALL ldf_eiv_init    ! Eddy induced velocity param 
     355                           CALL ldf_eiv_init    ! Eddy induced velocity param. must be done after ldf_tra_init 
    337356                           CALL tra_ldf_init    ! lateral mixing 
    338357      IF( l_ldfslp     )   CALL ldf_slp_init    ! slope of lateral mixing 
     
    348367                           CALL dta_dyn_init( Nbb, Nnn, Naa )        ! Initialization for the dynamics 
    349368#endif 
    350  
    351369                           CALL     trc_init( Nbb, Nnn, Naa )        ! Passive tracers initialization 
    352                            CALL dia_ptr_init   ! Poleward TRansports initialization 
    353370                            
    354371      IF(lwp) WRITE(numout,cform_aaa)           ! Flag AAAAAAA 
     
    373390         WRITE(numout,*) '~~~~~~~~' 
    374391         WRITE(numout,*) '   Namelist namctl' 
    375          WRITE(numout,*) '                              sn_cfctl%l_glochk  = ', sn_cfctl%l_glochk 
    376          WRITE(numout,*) '                              sn_cfctl%l_allon   = ', sn_cfctl%l_allon 
    377          WRITE(numout,*) '       finer control over o/p sn_cfctl%l_config  = ', sn_cfctl%l_config 
    378392         WRITE(numout,*) '                              sn_cfctl%l_runstat = ', sn_cfctl%l_runstat 
    379393         WRITE(numout,*) '                              sn_cfctl%l_trcstat = ', sn_cfctl%l_trcstat 
     
    387401         WRITE(numout,*) '                              sn_cfctl%procincr  = ', sn_cfctl%procincr  
    388402         WRITE(numout,*) '                              sn_cfctl%ptimincr  = ', sn_cfctl%ptimincr  
    389          WRITE(numout,*) '      level of print                  nn_print   = ', nn_print 
    390          WRITE(numout,*) '      Start i indice for SUM control  nn_ictls   = ', nn_ictls 
    391          WRITE(numout,*) '      End i indice for SUM control    nn_ictle   = ', nn_ictle 
    392          WRITE(numout,*) '      Start j indice for SUM control  nn_jctls   = ', nn_jctls 
    393          WRITE(numout,*) '      End j indice for SUM control    nn_jctle   = ', nn_jctle 
    394          WRITE(numout,*) '      number of proc. following i     nn_isplt   = ', nn_isplt 
    395          WRITE(numout,*) '      number of proc. following j     nn_jsplt   = ', nn_jsplt 
    396403         WRITE(numout,*) '      timing by routine               ln_timing  = ', ln_timing 
    397404         WRITE(numout,*) '      CFL diagnostics                 ln_diacfl  = ', ln_diacfl 
    398405      ENDIF 
    399       ! 
    400       nprint    = nn_print          ! convert DOCTOR namelist names into OLD names 
    401       nictls    = nn_ictls 
    402       nictle    = nn_ictle 
    403       njctls    = nn_jctls 
    404       njctle    = nn_jctle 
    405       isplt     = nn_isplt 
    406       jsplt     = nn_jsplt 
    407  
     406 
     407      IF( .NOT.ln_read_cfg )   ln_closea = .false.   ! dealing possible only with a domcfg file 
    408408      IF(lwp) THEN                  ! control print 
    409409         WRITE(numout,*) 
     
    416416         WRITE(numout,*) '      use file attribute if exists as i/p j-start ln_use_jattr     = ', ln_use_jattr 
    417417      ENDIF 
    418       IF( .NOT.ln_read_cfg )   ln_closea = .false.   ! dealing possible only with a domcfg file 
    419       ! 
    420       !                             ! Parameter control 
    421       ! 
    422       IF( sn_cfctl%l_prtctl .OR. sn_cfctl%l_prttrc ) THEN              ! sub-domain area indices for the control prints 
    423          IF( lk_mpp .AND. jpnij > 1 ) THEN 
    424             isplt = jpni   ;   jsplt = jpnj   ;   ijsplt = jpni*jpnj   ! the domain is forced to the real split domain 
    425          ELSE 
    426             IF( isplt == 1 .AND. jsplt == 1  ) THEN 
    427                CALL ctl_warn( ' - isplt & jsplt are equal to 1',   & 
    428                   &           ' - the print control will be done over the whole domain' ) 
    429             ENDIF 
    430             ijsplt = isplt * jsplt            ! total number of processors ijsplt 
    431          ENDIF 
    432          IF(lwp) WRITE(numout,*)'          - The total number of processors over which the' 
    433          IF(lwp) WRITE(numout,*)'            print control will be done is ijsplt : ', ijsplt 
    434          ! 
    435          !                              ! indices used for the SUM control 
    436          IF( nictls+nictle+njctls+njctle == 0 )   THEN    ! print control done over the default area 
    437             lsp_area = .FALSE. 
    438          ELSE                                             ! print control done over a specific  area 
    439             lsp_area = .TRUE. 
    440             IF( nictls < 1 .OR. nictls > jpiglo )   THEN 
    441                CALL ctl_warn( '          - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) 
    442                nictls = 1 
    443             ENDIF 
    444             IF( nictle < 1 .OR. nictle > jpiglo )   THEN 
    445                CALL ctl_warn( '          - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) 
    446                nictle = jpiglo 
    447             ENDIF 
    448             IF( njctls < 1 .OR. njctls > jpjglo )   THEN 
    449                CALL ctl_warn( '          - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) 
    450                njctls = 1 
    451             ENDIF 
    452             IF( njctle < 1 .OR. njctle > jpjglo )   THEN 
    453                CALL ctl_warn( '          - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) 
    454                njctle = jpjglo 
    455             ENDIF 
    456          ENDIF 
    457       ENDIF 
    458418      ! 
    459419      IF( 1._wp /= SIGN(1._wp,-0._wp)  )   CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.',  & 
     
    511471   END SUBROUTINE nemo_alloc 
    512472 
    513    SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all ) 
     473   SUBROUTINE nemo_set_cfctl(sn_cfctl, setto ) 
    514474      !!---------------------------------------------------------------------- 
    515475      !!                     ***  ROUTINE nemo_set_cfctl  *** 
    516476      !! 
    517477      !! ** Purpose :   Set elements of the output control structure to setto. 
    518       !!                for_all should be .false. unless all areas are to be 
    519       !!                treated identically. 
    520       !! 
     478     !! 
    521479      !! ** Method  :   Note this routine can be used to switch on/off some 
    522       !!                types of output for selected areas but any output types 
    523       !!                that involve global communications (e.g. mpp_max, glob_sum) 
    524       !!                should be protected from selective switching by the 
    525       !!                for_all argument 
    526       !!---------------------------------------------------------------------- 
    527       LOGICAL :: setto, for_all 
    528       TYPE(sn_ctl) :: sn_cfctl 
    529       !!---------------------------------------------------------------------- 
    530       IF( for_all ) THEN 
    531          sn_cfctl%l_runstat = setto 
    532          sn_cfctl%l_trcstat = setto 
    533       ENDIF 
     480      !!                types of output for selected areas. 
     481      !!---------------------------------------------------------------------- 
     482      TYPE(sn_ctl), INTENT(inout) :: sn_cfctl 
     483      LOGICAL     , INTENT(in   ) :: setto 
     484      !!---------------------------------------------------------------------- 
     485      sn_cfctl%l_runstat = setto 
     486      sn_cfctl%l_trcstat = setto 
    534487      sn_cfctl%l_oceout  = setto 
    535488      sn_cfctl%l_layout  = setto 
     
    561514 
    562515 
    563    SUBROUTINE stp_ctl( kt, kindic ) 
     516   SUBROUTINE stp_ctl( kt ) 
    564517      !!---------------------------------------------------------------------- 
    565518      !!                    ***  ROUTINE stp_ctl  *** 
     
    572525      !!---------------------------------------------------------------------- 
    573526      INTEGER, INTENT(in   ) ::   kt      ! ocean time-step index 
    574       INTEGER, INTENT(inout) ::   kindic  ! indicator of solver convergence 
    575527      !!---------------------------------------------------------------------- 
    576528      ! 
Note: See TracChangeset for help on using the changeset viewer.