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 13463 for NEMO/branches/2019/dev_r11351_fldread_with_XIOS/src/OCE/nemogcm.F90 – NEMO

Ignore:
Timestamp:
2020-09-14T17:40:34+02:00 (4 years ago)
Author:
andmirek
Message:

Ticket #2195:update to trunk 13461

Location:
NEMO/branches/2019/dev_r11351_fldread_with_XIOS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11351_fldread_with_XIOS

    • 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 
         8 
         9# SETTE 
         10^/utils/CI/sette@13382        sette 
  • NEMO/branches/2019/dev_r11351_fldread_with_XIOS/src/OCE/nemogcm.F90

    r10588 r13463  
    4646   USE closea         ! treatment of closed seas (for ln_closea) 
    4747   USE usrdef_nam     ! user defined configuration 
    48    USE tideini        ! tidal components initialization   (tide_ini routine) 
    49    USE bdy_oce,  ONLY : ln_bdy 
     48   USE tide_mod, ONLY : tide_init ! tidal components initialization   (tide_init routine) 
    5049   USE bdyini         ! open boundary cond. setting       (bdy_init routine) 
    5150   USE istate         ! initial state setting          (istate_init routine) 
     
    5958   USE diaobs         ! Observation diagnostics       (dia_obs_init routine) 
    6059   USE diacfl         ! CFL diagnostics               (dia_cfl_init routine) 
     60   USE diamlr         ! IOM context management for multiple-linear-regression analysis 
     61#if defined key_qco 
     62   USE stepMLF        ! NEMO time-stepping               (stp_MLF   routine) 
     63#else 
    6164   USE step           ! NEMO time-stepping                 (stp     routine) 
     65#endif 
     66   USE isfstp         ! ice shelf                     (isf_stp_init routine) 
    6267   USE icbini         ! handle bergs, initialisation 
    6368   USE icbstp         ! handle bergs, calving, themodynamics and transport 
     
    6873   USE stopar         ! Stochastic param.: ??? 
    6974   USE stopts         ! Stochastic param.: ??? 
    70    USE diurnal_bulk   ! diurnal bulk SST  
     75   USE diu_layers     ! diurnal bulk SST and coolskin 
    7176   USE step_diu       ! diurnal bulk SST timestepping (called from here if run offline) 
    7277   USE crsini         ! initialise grid coarsening utility 
    73    USE diatmb         ! Top,middle,bottom output 
    7478   USE dia25h         ! 25h mean output 
     79   USE diadetide      ! Weights computation for daily detiding of model diagnostics 
    7580   USE sbc_oce , ONLY : lk_oasis 
    7681   USE wet_dry        ! Wetting and drying setting   (wad_init routine) 
     
    8287#endif 
    8388   ! 
     89   USE prtctl         ! Print control 
     90   USE in_out_manager ! I/O manager 
    8491   USE lib_mpp        ! distributed memory computing 
    8592   USE mppini         ! shared/distributed memory setting (mpp_init routine) 
    86    USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop   ! Setup of north fold exchanges  
     93   USE lbcnfd  , ONLY : isendto, nsndto  ! Setup of north fold exchanges  
    8794   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
    8895#if defined key_iomput 
     
    9299   USE agrif_all_update   ! Master Agrif update 
    93100#endif 
     101   USE halo_mng 
    94102 
    95103   IMPLICIT NONE 
     
    103111 
    104112#if defined key_mpp_mpi 
     113   ! need MPI_Wtime 
    105114   INCLUDE 'mpif.h' 
    106115#endif 
     
    128137      !!---------------------------------------------------------------------- 
    129138      INTEGER ::   istp   ! time step index 
     139      REAL(wp)::   zstptiming   ! elapsed time for 1 time step 
    130140      !!---------------------------------------------------------------------- 
    131141      ! 
     
    137147      !                            !-----------------------! 
    138148#if defined key_agrif 
    139       CALL Agrif_Declare_Var_dom   ! AGRIF: set the meshes for DOM 
    140       CALL Agrif_Declare_Var       !  "      "   "   "      "  DYN/TRA  
     149      Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs   ! agrif_oce module copies of time level indices 
     150      CALL Agrif_Declare_Var       !  "      "   "   "      "  DYN/TRA 
    141151# if defined key_top 
    142152      CALL Agrif_Declare_Var_top   !  "      "   "   "      "  TOP 
    143153# endif 
    144 # if defined key_si3 
    145       CALL Agrif_Declare_Var_ice   !  "      "   "   "      "  Sea ice 
    146 # endif 
    147154#endif 
    148155      ! check that all process are still there... If some process have an error, 
     
    155162      !                            !==   time stepping   ==! 
    156163      !                            !-----------------------! 
     164      ! 
     165      !                                               !== set the model time-step  ==! 
     166      ! 
    157167      istp = nit000 
    158168      ! 
     
    169179      ! 
    170180      ! Recursive update from highest nested level to lowest: 
     181      Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs   ! agrif_oce module copies of time level indices 
    171182      CALL Agrif_step_child_adj(Agrif_Update_All) 
    172183      ! 
    173184      DO WHILE( istp <= nitend .AND. nstop == 0 ) 
     185#if defined key_qco 
     186         CALL stp_MLF 
     187#else 
    174188         CALL stp 
     189#endif 
    175190         istp = istp + 1 
    176191      END DO 
    177192      ! 
    178       IF( .NOT. Agrif_Root() ) THEN 
    179          CALL Agrif_ParentGrid_To_ChildGrid() 
    180          IF( ln_diaobs )   CALL dia_obs_wri 
    181          IF( ln_timing )   CALL timing_finalize 
    182          CALL Agrif_ChildGrid_To_ParentGrid() 
    183       ENDIF 
    184       ! 
    185193# else 
    186194      ! 
     
    188196         ! 
    189197         DO WHILE( istp <= nitend .AND. nstop == 0 ) 
    190 #if defined key_mpp_mpi 
     198 
    191199            ncom_stp = istp 
    192             IF ( istp == ( nit000 + 1 ) ) elapsed_time = MPI_Wtime() 
    193             IF ( istp ==         nitend ) elapsed_time = MPI_Wtime() - elapsed_time 
    194 #endif 
     200            IF( ln_timing ) THEN 
     201               zstptiming = MPI_Wtime() 
     202               IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming 
     203               IF ( istp ==         nitend ) elapsed_time = zstptiming - elapsed_time 
     204            ENDIF 
     205             
     206#if defined key_qco 
     207            CALL stp_MLF      ( istp ) 
     208#else 
    195209            CALL stp        ( istp )  
     210#endif 
    196211            istp = istp + 1 
     212 
     213            IF( lwp .AND. ln_timing )   WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming 
     214 
    197215         END DO 
    198216         ! 
     
    220238      ! 
    221239      IF( nstop /= 0 .AND. lwp ) THEN        ! error print 
    222          WRITE(numout,cform_err) 
    223          WRITE(numout,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found' 
    224          WRITE(numout,*) 
     240         WRITE(ctmp1,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found' 
     241         IF( ngrdstop > 0 ) THEN 
     242            WRITE(ctmp9,'(i2)') ngrdstop 
     243            WRITE(ctmp2,*) '           E R R O R detected in Agrif grid '//TRIM(ctmp9) 
     244            WRITE(ctmp3,*) '           Look for "E R R O R" messages in all existing '//TRIM(ctmp9)//'_ocean_output* files' 
     245            CALL ctl_stop( ' ', ctmp1, ' ', ctmp2, ' ', ctmp3 ) 
     246         ELSE 
     247            WRITE(ctmp2,*) '           Look for "E R R O R" messages in all existing ocean_output* files' 
     248            CALL ctl_stop( ' ', ctmp1, ' ', ctmp2 ) 
     249         ENDIF 
    225250      ENDIF 
    226251      ! 
     
    234259#else 
    235260      IF    ( lk_oasis ) THEN   ;   CALL cpl_finalize   ! end coupling and mpp communications with OASIS 
    236       ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop( ldfinal = .TRUE. )   ! end mpp communications 
     261      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop        ! end mpp communications 
    237262      ENDIF 
    238263#endif 
     
    240265      IF(lwm) THEN 
    241266         IF( nstop == 0 ) THEN   ;   STOP 0 
    242          ELSE                    ;   STOP 999 
     267         ELSE                    ;   STOP 123 
    243268         ENDIF 
    244269      ENDIF 
     
    253278      !! ** Purpose :   initialization of the NEMO GCM 
    254279      !!---------------------------------------------------------------------- 
    255       INTEGER  ::   ji                 ! dummy loop indices 
    256       INTEGER  ::   ios, ilocal_comm   ! local integers 
    257       CHARACTER(len=120), DIMENSION(60) ::   cltxt, cltxt2, clnam 
    258       !! 
    259       NAMELIST/namctl/ ln_ctl   , sn_cfctl, nn_print, nn_ictls, nn_ictle,   & 
    260          &             nn_isplt , nn_jsplt, nn_jctls, nn_jctle,             & 
    261          &             ln_timing, ln_diacfl 
     280      INTEGER ::   ios, ilocal_comm   ! local integers 
     281      !! 
     282      NAMELIST/namctl/ sn_cfctl, ln_timing, ln_diacfl,                                & 
     283         &             nn_isplt,  nn_jsplt,  nn_ictls, nn_ictle, nn_jctls, nn_jctle             
    262284      NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr 
    263285      !!---------------------------------------------------------------------- 
    264286      ! 
    265       cltxt  = '' 
    266       cltxt2 = '' 
    267       clnam  = ''   
    268287      cxios_context = 'nemo' 
    269288      ! 
    270       !                             ! Open reference namelist and configuration namelist files 
    271       CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    272       CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    273       ! 
    274       REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
    275       READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
    276 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. ) 
    277       REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
    278       READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
    279 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. ) 
    280       ! 
    281       REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
    282       READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
    283 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. ) 
    284       REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
    285       READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
    286 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. )    
    287  
    288       !                             !--------------------------! 
    289       !                             !  Set global domain size  !   (control print return in cltxt2) 
    290       !                             !--------------------------! 
    291       IF( ln_read_cfg ) THEN              ! Read sizes in domain configuration file 
    292          CALL domain_cfg ( cltxt2,        cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
    293          ! 
    294       ELSE                                ! user-defined namelist 
    295          CALL usr_def_nam( cltxt2, clnam, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
    296       ENDIF 
    297       ! 
    298       ! 
    299       !                             !--------------------------------------------! 
    300       !                             !  set communicator & select the local node  ! 
    301       !                             !  NB: mynode also opens output.namelist.dyn ! 
    302       !                             !      on unit number numond on first proc   ! 
    303       !                             !--------------------------------------------! 
     289      !                             !-------------------------------------------------! 
     290      !                             !     set communicator & select the local rank    ! 
     291      !                             !  must be done as soon as possible to get narea  ! 
     292      !                             !-------------------------------------------------! 
     293      ! 
    304294#if defined key_iomput 
    305295      IF( Agrif_Root() ) THEN 
    306296         IF( lk_oasis ) THEN 
    307297            CALL cpl_init( "oceanx", ilocal_comm )                               ! nemo local communicator given by oasis 
    308             CALL xios_initialize( "not used"       ,local_comm= ilocal_comm )    ! send nemo communicator to xios 
     298            CALL xios_initialize( "not used"       , local_comm =ilocal_comm )   ! send nemo communicator to xios 
    309299         ELSE 
    310             CALL xios_initialize( "for_xios_mpi_id",return_comm=ilocal_comm )    ! nemo local communicator given by xios 
     300            CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm )   ! nemo local communicator given by xios 
    311301         ENDIF 
    312302      ENDIF 
    313       ! Nodes selection (control print return in cltxt) 
    314       narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 
     303      CALL mpp_start( ilocal_comm ) 
    315304#else 
    316305      IF( lk_oasis ) THEN 
     
    318307            CALL cpl_init( "oceanx", ilocal_comm )          ! nemo local communicator given by oasis 
    319308         ENDIF 
    320          ! Nodes selection (control print return in cltxt) 
    321          narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 
     309         CALL mpp_start( ilocal_comm ) 
    322310      ELSE 
    323          ilocal_comm = 0                                    ! Nodes selection (control print return in cltxt) 
    324          narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop ) 
    325       ENDIF 
    326 #endif 
    327  
    328       narea = narea + 1                                     ! mynode return the rank of proc (0 --> jpnij -1 ) 
    329  
    330       IF( sn_cfctl%l_config ) THEN 
    331          ! Activate finer control of report outputs 
    332          ! optionally switch off output from selected areas (note this only 
    333          ! applies to output which does not involve global communications) 
    334          IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
    335            & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
    336            &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
     311         CALL mpp_start( ) 
     312      ENDIF 
     313#endif 
     314      ! 
     315      narea = mpprank + 1               ! mpprank: the rank of proc (0 --> mppsize -1 ) 
     316      lwm = (narea == 1)                ! control of output namelists 
     317      ! 
     318      !                             !---------------------------------------------------------------! 
     319      !                             ! Open output files, reference and configuration namelist files ! 
     320      !                             !---------------------------------------------------------------! 
     321      ! 
     322      ! open ocean.output as soon as possible to get all output prints (including errors messages) 
     323      IF( lwm )   CALL ctl_opn(     numout,        'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     324      ! open reference and configuration namelist files 
     325                  CALL load_nml( numnam_ref,        'namelist_ref',                                           -1, lwm ) 
     326                  CALL load_nml( numnam_cfg,        'namelist_cfg',                                           -1, lwm ) 
     327      IF( lwm )   CALL ctl_opn(     numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     328      ! open /dev/null file to be able to supress output write easily 
     329      IF( Agrif_Root() ) THEN 
     330                  CALL ctl_opn(     numnul,           '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     331#ifdef key_agrif 
    337332      ELSE 
    338          ! Use ln_ctl to turn on or off all options. 
    339          CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 
    340       ENDIF 
    341  
    342       lwm = (narea == 1)                                    ! control of output namelists 
    343       lwp = (narea == 1) .OR. ln_ctl                        ! control of all listing output print 
    344  
    345       IF(lwm) THEN               ! write merged namelists from earlier to output namelist  
    346          !                       ! now that the file has been opened in call to mynode.  
    347          !                       ! NB: nammpp has already been written in mynode (if lk_mpp_mpi) 
    348          WRITE( numond, namctl ) 
    349          WRITE( numond, namcfg ) 
    350          IF( .NOT.ln_read_cfg ) THEN 
    351             DO ji = 1, SIZE(clnam) 
    352                IF( TRIM(clnam(ji)) /= '' )   WRITE(numond, * ) clnam(ji)     ! namusr_def print 
    353             END DO 
    354          ENDIF 
    355       ENDIF 
    356  
    357       IF(lwp) THEN                            ! open listing units 
    358          ! 
    359          CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) 
     333                  numnul = Agrif_Parent(numnul)    
     334#endif 
     335      ENDIF 
     336      !                             !--------------------! 
     337      !                             ! Open listing units !  -> need sn_cfctl from namctl to define lwp 
     338      !                             !--------------------! 
     339      ! 
     340      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
     341901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' ) 
     342      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
     343902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 
     344      ! 
     345      ! finalize the definition of namctl variables 
     346      IF( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax .OR. MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 )   & 
     347         &   CALL nemo_set_cfctl( sn_cfctl, .FALSE. ) 
     348      ! 
     349      lwp = (narea == 1) .OR. sn_cfctl%l_oceout    ! control of all listing output print 
     350      ! 
     351      IF(lwp) THEN                      ! open listing units 
     352         ! 
     353         IF( .NOT. lwm )   &            ! alreay opened for narea == 1 
     354            &            CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) 
    360355         ! 
    361356         WRITE(numout,*) 
    362          WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC' 
     357         WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' 
    363358         WRITE(numout,*) '                       NEMO team' 
    364359         WRITE(numout,*) '            Ocean General Circulation Model' 
     
    380375         WRITE(numout,*) 
    381376          
    382          DO ji = 1, SIZE(cltxt) 
    383             IF( TRIM(cltxt (ji)) /= '' )   WRITE(numout,*) TRIM(cltxt(ji))    ! control print of mynode 
    384          END DO 
     377         ! Print the working precision to ocean.output 
     378         IF (wp == dp) THEN 
     379            WRITE(numout,*) "Working precision = double-precision" 
     380         ELSE 
     381            WRITE(numout,*) "Working precision = single-precision" 
     382         ENDIF 
    385383         WRITE(numout,*) 
    386          WRITE(numout,*) 
    387          DO ji = 1, SIZE(cltxt2) 
    388             IF( TRIM(cltxt2(ji)) /= '' )   WRITE(numout,*) TRIM(cltxt2(ji))   ! control print of domain size 
    389          END DO 
    390384         ! 
    391385         WRITE(numout,cform_aaa)                                        ! Flag AAAAAAA 
    392386         ! 
    393387      ENDIF 
    394       ! open /dev/null file to be able to supress output write easily 
    395       CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    396       ! 
    397       !                                      ! Domain decomposition 
    398       CALL mpp_init                          ! MPP 
    399  
     388      ! 
     389      IF(lwm) WRITE( numond, namctl ) 
     390      ! 
     391      !                             !------------------------------------! 
     392      !                             !  Set global domain size parameters ! 
     393      !                             !------------------------------------! 
     394      ! 
     395      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
     396903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 
     397      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
     398904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )    
     399      ! 
     400      IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file 
     401         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) 
     402      ELSE                              ! user-defined namelist 
     403         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio ) 
     404      ENDIF 
     405      ! 
     406      IF(lwm)   WRITE( numond, namcfg ) 
     407      ! 
     408      !                             !-----------------------------------------! 
     409      !                             ! mpp parameters and domain decomposition ! 
     410      !                             !-----------------------------------------! 
     411      CALL mpp_init 
     412 
     413      CALL halo_mng_init() 
    400414      ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays 
    401415      CALL nemo_alloc() 
    402416 
     417      ! Initialise time level indices 
     418      Nbb = 1; Nnn = 2; Naa = 3; Nrhs = Naa 
     419#if defined key_agrif 
     420      Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs   ! agrif_oce module copies of time level indices 
     421#endif  
    403422      !                             !-------------------------------! 
    404423      !                             !  NEMO general initialization  ! 
     
    415434      IF( lk_c1d       )   CALL     c1d_init        ! 1D column configuration 
    416435                           CALL     wad_init        ! Wetting and drying options 
    417                            CALL     dom_init("OPA") ! Domain 
    418       IF( ln_crs       )   CALL     crs_init        ! coarsened grid: domain initialization  
    419       IF( ln_ctl       )   CALL prt_ctl_init        ! Print control 
     436 
     437#if defined key_agrif 
     438     CALL Agrif_Declare_Var_ini   !  "      "   "   "      "  DOM 
     439#endif 
     440                           CALL     dom_init( Nbb, Nnn, Naa, "OPA") ! Domain 
     441      IF( ln_crs       )   CALL     crs_init(      Nnn )       ! coarsened grid: domain initialization  
     442      IF( sn_cfctl%l_prtctl )   & 
     443         &                 CALL prt_ctl_init        ! Print control 
    420444       
    421       CALL diurnal_sst_bulk_init                ! diurnal sst 
     445                           CALL diurnal_sst_bulk_init       ! diurnal sst 
    422446      IF( ln_diurnal   )   CALL diurnal_sst_coolskin_init   ! cool skin    
    423447      !                             
    424       IF( ln_diurnal_only ) THEN                   ! diurnal only: a subset of the initialisation routines 
    425          CALL  istate_init                            ! ocean initial state (Dynamics and tracers) 
    426          CALL     sbc_init                            ! Forcings : surface module 
    427          CALL tra_qsr_init                            ! penetrative solar radiation qsr 
    428          IF( ln_diaobs ) THEN                         ! Observation & model comparison 
    429             CALL dia_obs_init                            ! Initialize observational data 
    430             CALL dia_obs( nit000 - 1 )                   ! Observation operator for restart 
     448      IF( ln_diurnal_only ) THEN                    ! diurnal only: a subset of the initialisation routines 
     449         CALL  istate_init( Nbb, Nnn, Naa )         ! ocean initial state (Dynamics and tracers) 
     450         CALL     sbc_init( Nbb, Nnn, Naa )         ! Forcings : surface module 
     451         CALL tra_qsr_init                          ! penetrative solar radiation qsr 
     452         IF( ln_diaobs ) THEN                       ! Observation & model comparison 
     453            CALL dia_obs_init( Nnn )                ! Initialize observational data 
     454            CALL dia_obs( nit000 - 1, Nnn )         ! Observation operator for restart 
    431455         ENDIF      
    432          IF( lk_asminc )   CALL asm_inc_init          ! Assimilation increments 
     456         IF( lk_asminc )   CALL asm_inc_init( Nbb, Nnn, Nrhs )   ! Assimilation increments 
    433457         ! 
    434458         RETURN                                       ! end of initialization 
    435459      ENDIF 
    436        
    437                            CALL  istate_init    ! ocean initial state (Dynamics and tracers) 
     460      ! 
     461 
     462                           CALL  istate_init( Nbb, Nnn, Naa )    ! ocean initial state (Dynamics and tracers) 
    438463 
    439464      !                                      ! external forcing  
    440                            CALL    tide_init    ! tidal harmonics 
    441                            CALL     sbc_init    ! surface boundary conditions (including sea-ice) 
    442                            CALL     bdy_init    ! Open boundaries initialisation 
     465                           CALL    tide_init                     ! tidal harmonics 
     466                           CALL     sbc_init( Nbb, Nnn, Naa )    ! surface boundary conditions (including sea-ice) 
     467                           CALL     bdy_init                     ! Open boundaries initialisation 
    443468 
    444469      !                                      ! Ocean physics 
    445                            CALL zdf_phy_init    ! Vertical physics 
     470                           CALL zdf_phy_init( Nnn )    ! Vertical physics 
    446471                                      
    447472      !                                         ! Lateral physics 
     
    459484 
    460485      !                                      ! Dynamics 
    461       IF( lk_c1d       )   CALL dyn_dmp_init      ! internal momentum damping 
    462                            CALL dyn_adv_init      ! advection (vector or flux form) 
    463                            CALL dyn_vor_init      ! vorticity term including Coriolis 
    464                            CALL dyn_ldf_init      ! lateral mixing 
    465                            CALL dyn_hpg_init      ! horizontal gradient of Hydrostatic pressure 
    466                            CALL dyn_spg_init      ! surface pressure gradient 
     486      IF( lk_c1d       )   CALL dyn_dmp_init         ! internal momentum damping 
     487                           CALL dyn_adv_init         ! advection (vector or flux form) 
     488                           CALL dyn_vor_init         ! vorticity term including Coriolis 
     489                           CALL dyn_ldf_init         ! lateral mixing 
     490                           CALL dyn_hpg_init( Nnn )  ! horizontal gradient of Hydrostatic pressure 
     491                           CALL dyn_spg_init         ! surface pressure gradient 
    467492 
    468493#if defined key_top 
    469494      !                                      ! Passive tracers 
    470                            CALL     trc_init 
     495                           CALL     trc_init( Nbb, Nnn, Naa ) 
    471496#endif 
    472497      IF( l_ldfslp     )   CALL ldf_slp_init    ! slope of lateral mixing 
    473498 
    474499      !                                      ! Icebergs 
    475                            CALL icb_init( rdt, nit000)   ! initialise icebergs instance 
     500                           CALL icb_init( rn_Dt, nit000)   ! initialise icebergs instance 
     501 
     502                                                ! ice shelf 
     503                           CALL isf_init( Nbb, Nnn, Naa ) 
    476504 
    477505      !                                      ! Misc. options 
     
    480508      
    481509      !                                      ! Diagnostics 
    482       IF( lk_floats    )   CALL     flo_init    ! drifting Floats 
     510                           CALL     flo_init( Nnn )    ! drifting Floats 
    483511      IF( ln_diacfl    )   CALL dia_cfl_init    ! Initialise CFL diagnostics 
    484                            CALL dia_ptr_init    ! Poleward TRansports initialization 
    485       IF( lk_diadct    )   CALL dia_dct_init    ! Sections tranports 
    486                            CALL dia_hsb_init    ! heat content, salt content and volume budgets 
    487                            CALL     trd_init    ! Mixed-layer/Vorticity/Integral constraints trends 
    488                            CALL dia_obs_init    ! Initialize observational data 
    489                            CALL dia_tmb_init    ! TMB outputs 
    490                            CALL dia_25h_init    ! 25h mean  outputs 
    491       IF( ln_diaobs    )   CALL dia_obs( nit000-1 )   ! Observation operator for restart 
     512!                           CALL dia_ptr_init    ! Poleward TRansports initialization 
     513                           CALL dia_dct_init    ! Sections tranports 
     514                           CALL dia_hsb_init( Nnn )    ! heat content, salt content and volume budgets 
     515                           CALL     trd_init( Nnn )    ! Mixed-layer/Vorticity/Integral constraints trends 
     516                           CALL dia_obs_init( Nnn )    ! Initialize observational data 
     517                           CALL dia_25h_init( Nbb )    ! 25h mean  outputs 
     518                           CALL dia_detide_init ! Weights computation for daily detiding of model diagnostics 
     519      IF( ln_diaobs    )   CALL dia_obs( nit000-1, Nnn )   ! Observation operator for restart 
     520                           CALL dia_mlr_init    ! Initialisation of IOM context management for multiple-linear-regression analysis 
    492521 
    493522      !                                      ! Assimilation increments 
    494       IF( lk_asminc    )   CALL asm_inc_init    ! Initialize assimilation increments 
     523      IF( lk_asminc    )   CALL asm_inc_init( Nbb, Nnn, Nrhs )   ! Initialize assimilation increments 
    495524      ! 
    496525      IF(lwp) WRITE(numout,cform_aaa)           ! Flag AAAAAAA 
     
    507536      !! ** Purpose :   control print setting 
    508537      !! 
    509       !! ** Method  : - print namctl information and check some consistencies 
     538      !! ** Method  : - print namctl and namcfg information and check some consistencies 
    510539      !!---------------------------------------------------------------------- 
    511540      ! 
     
    515544         WRITE(numout,*) '~~~~~~~~' 
    516545         WRITE(numout,*) '   Namelist namctl' 
    517          WRITE(numout,*) '      run control (for debugging)     ln_ctl     = ', ln_ctl 
    518          WRITE(numout,*) '       finer control over o/p sn_cfctl%l_config  = ', sn_cfctl%l_config 
    519546         WRITE(numout,*) '                              sn_cfctl%l_runstat = ', sn_cfctl%l_runstat 
    520547         WRITE(numout,*) '                              sn_cfctl%l_trcstat = ', sn_cfctl%l_trcstat 
    521548         WRITE(numout,*) '                              sn_cfctl%l_oceout  = ', sn_cfctl%l_oceout 
    522549         WRITE(numout,*) '                              sn_cfctl%l_layout  = ', sn_cfctl%l_layout 
    523          WRITE(numout,*) '                              sn_cfctl%l_mppout  = ', sn_cfctl%l_mppout 
    524          WRITE(numout,*) '                              sn_cfctl%l_mpptop  = ', sn_cfctl%l_mpptop 
     550         WRITE(numout,*) '                              sn_cfctl%l_prtctl  = ', sn_cfctl%l_prtctl 
     551         WRITE(numout,*) '                              sn_cfctl%l_prttrc  = ', sn_cfctl%l_prttrc 
     552         WRITE(numout,*) '                              sn_cfctl%l_oasout  = ', sn_cfctl%l_oasout 
    525553         WRITE(numout,*) '                              sn_cfctl%procmin   = ', sn_cfctl%procmin   
    526554         WRITE(numout,*) '                              sn_cfctl%procmax   = ', sn_cfctl%procmax   
    527555         WRITE(numout,*) '                              sn_cfctl%procincr  = ', sn_cfctl%procincr  
    528556         WRITE(numout,*) '                              sn_cfctl%ptimincr  = ', sn_cfctl%ptimincr  
    529          WRITE(numout,*) '      level of print                  nn_print   = ', nn_print 
    530          WRITE(numout,*) '      Start i indice for SUM control  nn_ictls   = ', nn_ictls 
    531          WRITE(numout,*) '      End i indice for SUM control    nn_ictle   = ', nn_ictle 
    532          WRITE(numout,*) '      Start j indice for SUM control  nn_jctls   = ', nn_jctls 
    533          WRITE(numout,*) '      End j indice for SUM control    nn_jctle   = ', nn_jctle 
    534          WRITE(numout,*) '      number of proc. following i     nn_isplt   = ', nn_isplt 
    535          WRITE(numout,*) '      number of proc. following j     nn_jsplt   = ', nn_jsplt 
    536557         WRITE(numout,*) '      timing by routine               ln_timing  = ', ln_timing 
    537558         WRITE(numout,*) '      CFL diagnostics                 ln_diacfl  = ', ln_diacfl 
    538559      ENDIF 
    539560      ! 
    540       nprint    = nn_print          ! convert DOCTOR namelist names into OLD names 
    541       nictls    = nn_ictls 
    542       nictle    = nn_ictle 
    543       njctls    = nn_jctls 
    544       njctle    = nn_jctle 
    545       isplt     = nn_isplt 
    546       jsplt     = nn_jsplt 
    547  
     561      IF( .NOT.ln_read_cfg )   ln_closea = .false.   ! dealing possible only with a domcfg file 
    548562      IF(lwp) THEN                  ! control print 
    549563         WRITE(numout,*) 
     
    556570         WRITE(numout,*) '      use file attribute if exists as i/p j-start   ln_use_jattr     = ', ln_use_jattr 
    557571      ENDIF 
    558       IF( .NOT.ln_read_cfg )   ln_closea = .false.   ! dealing possible only with a domcfg file 
    559       ! 
    560       !                             ! Parameter control 
    561       ! 
    562       IF( ln_ctl ) THEN                 ! sub-domain area indices for the control prints 
    563          IF( lk_mpp .AND. jpnij > 1 ) THEN 
    564             isplt = jpni   ;   jsplt = jpnj   ;   ijsplt = jpni*jpnj   ! the domain is forced to the real split domain 
    565          ELSE 
    566             IF( isplt == 1 .AND. jsplt == 1  ) THEN 
    567                CALL ctl_warn( ' - isplt & jsplt are equal to 1',   & 
    568                   &           ' - the print control will be done over the whole domain' ) 
    569             ENDIF 
    570             ijsplt = isplt * jsplt            ! total number of processors ijsplt 
    571          ENDIF 
    572          IF(lwp) WRITE(numout,*)'          - The total number of processors over which the' 
    573          IF(lwp) WRITE(numout,*)'            print control will be done is ijsplt : ', ijsplt 
    574          ! 
    575          !                              ! indices used for the SUM control 
    576          IF( nictls+nictle+njctls+njctle == 0 )   THEN    ! print control done over the default area 
    577             lsp_area = .FALSE. 
    578          ELSE                                             ! print control done over a specific  area 
    579             lsp_area = .TRUE. 
    580             IF( nictls < 1 .OR. nictls > jpiglo )   THEN 
    581                CALL ctl_warn( '          - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) 
    582                nictls = 1 
    583             ENDIF 
    584             IF( nictle < 1 .OR. nictle > jpiglo )   THEN 
    585                CALL ctl_warn( '          - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) 
    586                nictle = jpiglo 
    587             ENDIF 
    588             IF( njctls < 1 .OR. njctls > jpjglo )   THEN 
    589                CALL ctl_warn( '          - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) 
    590                njctls = 1 
    591             ENDIF 
    592             IF( njctle < 1 .OR. njctle > jpjglo )   THEN 
    593                CALL ctl_warn( '          - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) 
    594                njctle = jpjglo 
    595             ENDIF 
    596          ENDIF 
    597       ENDIF 
    598572      ! 
    599573      IF( 1._wp /= SIGN(1._wp,-0._wp)  )   CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.',  & 
     
    621595      IF( numstp          /= -1 )   CLOSE( numstp          )   ! time-step file 
    622596      IF( numrun          /= -1 )   CLOSE( numrun          )   ! run statistics file 
    623       IF( numnam_ref      /= -1 )   CLOSE( numnam_ref      )   ! oce reference namelist 
    624       IF( numnam_cfg      /= -1 )   CLOSE( numnam_cfg      )   ! oce configuration namelist 
    625597      IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist 
    626       IF( numnam_ice_ref  /= -1 )   CLOSE( numnam_ice_ref  )   ! ice reference namelist 
    627       IF( numnam_ice_cfg  /= -1 )   CLOSE( numnam_ice_cfg  )   ! ice configuration namelist 
    628598      IF( lwm.AND.numoni  /= -1 )   CLOSE( numoni          )   ! ice output namelist 
    629599      IF( numevo_ice      /= -1 )   CLOSE( numevo_ice      )   ! ice variables (temp. evolution) 
     
    650620      USE trc_oce   , ONLY : trc_oce_alloc 
    651621      USE bdy_oce   , ONLY : bdy_oce_alloc 
    652 #if defined key_diadct  
    653       USE diadct    , ONLY : diadct_alloc  
    654 #endif  
    655622      ! 
    656623      INTEGER :: ierr 
     
    664631      ierr = ierr + bdy_oce_alloc()    ! bdy masks (incl. initialization) 
    665632      ! 
    666 #if defined key_diadct  
    667       ierr = ierr + diadct_alloc ()    !  
    668 #endif  
    669       ! 
    670633      CALL mpp_sum( 'nemogcm', ierr ) 
    671634      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' ) 
     
    673636   END SUBROUTINE nemo_alloc 
    674637 
    675    SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all ) 
     638    
     639   SUBROUTINE nemo_set_cfctl(sn_cfctl, setto ) 
    676640      !!---------------------------------------------------------------------- 
    677641      !!                     ***  ROUTINE nemo_set_cfctl  *** 
    678642      !! 
    679643      !! ** Purpose :   Set elements of the output control structure to setto. 
    680       !!                for_all should be .false. unless all areas are to be 
    681       !!                treated identically. 
    682644      !! 
    683645      !! ** Method  :   Note this routine can be used to switch on/off some 
    684       !!                types of output for selected areas but any output types 
    685       !!                that involve global communications (e.g. mpp_max, glob_sum) 
    686       !!                should be protected from selective switching by the 
    687       !!                for_all argument 
    688       !!---------------------------------------------------------------------- 
    689       LOGICAL :: setto, for_all 
    690       TYPE(sn_ctl) :: sn_cfctl 
    691       !!---------------------------------------------------------------------- 
    692       IF( for_all ) THEN 
    693          sn_cfctl%l_runstat = setto 
    694          sn_cfctl%l_trcstat = setto 
    695       ENDIF 
     646      !!                types of output for selected areas. 
     647      !!---------------------------------------------------------------------- 
     648      TYPE(sn_ctl), INTENT(inout) :: sn_cfctl 
     649      LOGICAL     , INTENT(in   ) :: setto 
     650      !!---------------------------------------------------------------------- 
     651      sn_cfctl%l_runstat = setto 
     652      sn_cfctl%l_trcstat = setto 
    696653      sn_cfctl%l_oceout  = setto 
    697654      sn_cfctl%l_layout  = setto 
    698       sn_cfctl%l_mppout  = setto 
    699       sn_cfctl%l_mpptop  = setto 
     655      sn_cfctl%l_prtctl  = setto 
     656      sn_cfctl%l_prttrc  = setto 
     657      sn_cfctl%l_oasout  = setto 
    700658   END SUBROUTINE nemo_set_cfctl 
    701659 
    702660   !!====================================================================== 
    703661END MODULE nemogcm 
    704  
Note: See TracChangeset for help on using the changeset viewer.