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 5972 for branches/2014/dev_r4650_UKMO14.5_SST_BIAS_CORRECTION/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90 – NEMO

Ignore:
Timestamp:
2015-12-02T09:52:20+01:00 (8 years ago)
Author:
timgraham
Message:

Upgraded to head of trunk (r5936)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4650_UKMO14.5_SST_BIAS_CORRECTION/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90

    r5967 r5972  
    2828   !!             -   ! 2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase 
    2929   !!            3.3.1! 2011-01  (A. R. Porter, STFC Daresbury) dynamical allocation 
    30    !!            3.4  ! 2011-11  (C. Harris) decomposition changes for running with CICE 
    31    !!                 ! 2012-05  (C. Calone, J. Simeon, G. Madec, C. Ethe) Add grid coarsening  
     30   !!            3.4  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE) add nemo_northcomms 
     31   !!             -   ! 2011-11  (C. Harris) decomposition changes for running with CICE 
     32   !!            3.6  ! 2012-05  (C. Calone, J. Simeon, G. Madec, C. Ethe) Add grid coarsening  
     33   !!             -   ! 2013-06  (I. Epicoco, S. Mocavero, CMCC) nemo_northcomms: setup avoiding MPI communication  
     34   !!             -   ! 2014-12  (G. Madec) remove KPP scheme and cross-land advection (cla) 
    3235   !!---------------------------------------------------------------------- 
    3336 
     
    4144   !!   factorise      : calculate the factors of the no. of MPI processes 
    4245   !!---------------------------------------------------------------------- 
    43    USE step_oce        ! module used in the ocean time stepping module 
    44    USE cla             ! cross land advection               (tra_cla routine) 
     46   USE step_oce        ! module used in the ocean time stepping module (step.F90) 
    4547   USE domcfg          ! domain configuration               (dom_cfg routine) 
    4648   USE mppini          ! shared/distributed memory setting (mpp_init routine) 
     
    7779   USE lib_mpp         ! distributed memory computing 
    7880#if defined key_iomput 
    79    USE xios 
    80 #endif 
    81    USE sbctide, ONLY: lk_tide 
     81   USE xios            ! xIOserver 
     82#endif 
     83   USE sbctide, ONLY   : lk_tide 
    8284   USE crsini          ! initialise grid coarsening utility 
    83    USE lbcnfd, ONLY: isendto, nsndto, nfsloop, nfeloop ! Setup of north fold exchanges  
    84    USE sbc_oce, ONLY: lk_oasis 
     85   USE lbcnfd , ONLY   : isendto, nsndto, nfsloop, nfeloop  ! Setup of north fold exchanges  
     86   USE sbc_oce, ONLY   : lk_oasis 
    8587   USE stopar 
    8688   USE stopts 
     
    9698 
    9799   !!---------------------------------------------------------------------- 
    98    !! NEMO/OPA 4.0 , NEMO Consortium (2011) 
     100   !! NEMO/OPA 3.7 , NEMO Consortium (2015) 
    99101   !! $Id$ 
    100102   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    161163          ENDIF 
    162164 
     165#if defined key_agrif 
     166          CALL Agrif_Regrid() 
     167#endif 
     168 
    163169         DO WHILE ( istp <= nitend .AND. nstop == 0 ) 
    164170#if defined key_agrif 
    165             CALL Agrif_Step( stp )           ! AGRIF: time stepping 
     171            CALL stp                         ! AGRIF: time stepping 
    166172#else 
    167173            CALL stp( istp )                 ! standard time stepping 
     
    187193      ! 
    188194#if defined key_agrif 
    189       CALL Agrif_ParentGrid_To_ChildGrid() 
    190       IF( lk_diaobs ) CALL dia_obs_wri 
     195      IF(.NOT.Agrif_Root() ) THEN 
     196                                CALL Agrif_ParentGrid_To_ChildGrid() 
     197         IF( lk_diaobs )        CALL dia_obs_wri 
     198         IF( nn_timing == 1 )   CALL timing_finalize 
     199                                CALL Agrif_ChildGrid_To_ParentGrid() 
     200      ENDIF 
     201#endif 
    191202      IF( nn_timing == 1 )   CALL timing_finalize 
    192       CALL Agrif_ChildGrid_To_ParentGrid() 
    193 #endif 
    194       IF( nn_timing == 1 )   CALL timing_finalize 
    195203      ! 
    196204      CALL nemo_closefile 
    197205      ! 
    198206#if defined key_iomput 
    199       CALL xios_finalize                ! end mpp communications with xios 
    200       IF( lk_oasis ) CALL cpl_finalize    ! end coupling and mpp communications with OASIS 
     207      CALL xios_finalize                  ! end mpp communications with xios 
     208      IF( lk_oasis )   CALL cpl_finalize  ! end coupling and mpp communications with OASIS 
    201209#else 
    202210      IF( lk_oasis ) THEN  
     
    313321      ! If dimensions of processor grid weren't specified in the namelist file 
    314322      ! then we calculate them here now that we have our communicator size 
    315       IF( (jpni < 1) .OR. (jpnj < 1) )THEN 
     323      IF( jpni < 1 .OR. jpnj < 1 ) THEN 
    316324#if   defined key_mpp_mpi 
    317          IF( Agrif_Root() ) CALL nemo_partition(mppsize) 
     325         IF( Agrif_Root() )   CALL nemo_partition( mppsize ) 
    318326#else 
    319327         jpni  = 1 
     
    321329         jpnij = jpni*jpnj 
    322330#endif 
    323       END IF 
     331      ENDIF 
    324332 
    325333      ! Calculate domain dimensions given calculated jpni and jpnj 
    326       ! This used to be done in par_oce.F90 when they were parameters rather 
    327       ! than variables 
     334      ! This used to be done in par_oce.F90 when they were parameters rather than variables 
    328335      IF( Agrif_Root() ) THEN 
    329336#if defined key_nemocice_decomp 
    330          jpi = ( nx_global+2-2*jpreci + (jpni-1) ) / jpni + 2*jpreci ! first  dim. 
    331          jpj = ( ny_global+2-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj ! second dim.  
     337         jpi = ( nx_global+2-2*jpreci + (jpni-1) ) / jpni + 2*jpreci    ! first  dim. 
     338         jpj = ( ny_global+2-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj    ! second dim.  
    332339#else 
    333          jpi = ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci   ! first  dim. 
    334          jpj = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj   ! second dim. 
    335 #endif 
    336       ENDIF 
     340         jpi = ( jpiglo     -2*jpreci + (jpni-1) ) / jpni + 2*jpreci    ! first  dim. 
     341         jpj = ( jpjglo     -2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj    ! second dim. 
     342#endif 
     343      ENDIF          
    337344         jpk = jpkdta                                             ! third dim 
     345#if defined key_agrif 
     346         ! simple trick to use same vertical grid as parent but different number of levels:  
     347         ! Save maximum number of levels in jpkdta, then define all vertical grids with this number. 
     348         ! Suppress once vertical online interpolation is ok 
     349         IF(.NOT.Agrif_Root())   jpkdta = Agrif_Parent( jpkdta ) 
     350#endif 
    338351         jpim1 = jpi-1                                            ! inner domain indices 
    339352         jpjm1 = jpj-1                                            !   "           " 
     
    349362         WRITE(numout,*) '                       NEMO team' 
    350363         WRITE(numout,*) '            Ocean General Circulation Model' 
    351          WRITE(numout,*) '                  version 3.6  (2015) ' 
     364         WRITE(numout,*) '                  version 3.7  (2015) ' 
    352365         WRITE(numout,*) 
    353366         WRITE(numout,*) 
     
    382395                            CALL     dom_cfg    ! Domain configuration 
    383396                            CALL     dom_init   ! Domain 
    384  
    385       IF( ln_nnogather )    CALL nemo_northcomms   ! Initialise the northfold neighbour lists (must be done after the masks are defined) 
    386  
     397      IF( ln_crs        )   CALL     crs_init   ! coarsened grid: domain initialization  
     398      IF( ln_nnogather )    CALL nemo_northcomms! northfold neighbour lists (must be done after the masks are defined) 
    387399      IF( ln_ctl        )   CALL prt_ctl_init   ! Print control 
    388  
    389400                            CALL  istate_init   ! ocean initial state (Dynamics and tracers) 
    390401 
    391       IF( lk_tide       )   CALL    tide_init( nit000 )    ! Initialisation of the tidal harmonics 
    392  
    393                             CALL     sbc_init   ! Forcings : surface module (clem: moved here for bdy purpose) 
    394  
     402      !                                      ! external forcing  
     403!!gm to be added : creation and call of sbc_apr_init 
     404      IF( lk_tide       )   CALL    tide_init( nit000 )    ! tidal harmonics 
     405                            CALL     sbc_init   ! surface boundary conditions (including sea-ice) 
     406!!gm ==>> bdy_init should call bdy_dta_init and bdytide_init  NOT in nemogcm !!! 
    395407      IF( lk_bdy        )   CALL     bdy_init   ! Open boundaries initialisation 
    396408      IF( lk_bdy        )   CALL bdy_dta_init   ! Open boundaries initialisation of external data arrays 
    397409      IF( lk_bdy .AND. lk_tide )   & 
    398410         &                  CALL bdytide_init   ! Open boundaries initialisation of tidal harmonic forcing 
    399  
    400                             CALL dyn_nept_init  ! simplified form of Neptune effect 
    401       !      
    402       IF( ln_crs        )   CALL     crs_init   ! Domain initialization of coarsened grid 
    403       ! 
    404                                 ! Ocean physics 
     411          
     412      !                                      ! Ocean physics 
    405413      !                                         ! Vertical physics 
    406414                            CALL     zdf_init      ! namelist read 
     
    409417      IF( lk_zdftke     )   CALL zdf_tke_init      ! TKE closure scheme 
    410418      IF( lk_zdfgls     )   CALL zdf_gls_init      ! GLS closure scheme 
    411       IF( lk_zdfkpp     )   CALL zdf_kpp_init      ! KPP closure scheme 
    412419      IF( lk_zdftmx     )   CALL zdf_tmx_init      ! tidal vertical mixing 
    413       IF( lk_zdfddm .AND. .NOT. lk_zdfkpp )   & 
    414          &                  CALL zdf_ddm_init      ! double diffusive mixing 
     420      IF( lk_zdfddm     )   CALL zdf_ddm_init      ! double diffusive mixing 
     421          
    415422      !                                         ! Lateral physics 
    416423                            CALL ldf_tra_init      ! Lateral ocean tracer physics 
     424                            CALL ldf_eiv_init      ! eddy induced velocity param. 
    417425                            CALL ldf_dyn_init      ! Lateral ocean momentum physics 
    418       IF( lk_ldfslp     )   CALL ldf_slp_init      ! slope of lateral mixing 
    419  
    420       !                                     ! Active tracers 
    421                             CALL tra_qsr_init   ! penetrative solar radiation qsr 
    422                             CALL tra_bbc_init   ! bottom heat flux 
    423       IF( lk_trabbl     )   CALL tra_bbl_init   ! advective (and/or diffusive) bottom boundary layer scheme 
    424                             CALL tra_dmp_init   ! internal damping trends- tracers 
    425                             CALL tra_adv_init   ! horizontal & vertical advection 
    426                             CALL tra_ldf_init   ! lateral mixing 
    427                             CALL tra_zdf_init   ! vertical mixing and after tracer fields 
    428  
    429       !                                     ! Dynamics 
    430       IF( lk_c1d        )   CALL dyn_dmp_init   ! internal damping trends- momentum 
    431                             CALL dyn_adv_init   ! advection (vector or flux form) 
    432                             CALL dyn_vor_init   ! vorticity term including Coriolis 
    433                             CALL dyn_ldf_init   ! lateral mixing 
    434                             CALL dyn_hpg_init   ! horizontal gradient of Hydrostatic pressure 
    435                             CALL dyn_zdf_init   ! vertical diffusion 
    436                             CALL dyn_spg_init   ! surface pressure gradient 
    437  
    438       !                                     ! Misc. options 
    439       IF( nn_cla == 1 .AND. cp_cfg == 'orca' .AND. jp_cfg == 2 )   CALL cla_init       ! Cross Land Advection 
     426 
     427      !                                         ! Active tracers 
     428                            CALL tra_qsr_init      ! penetrative solar radiation qsr 
     429                            CALL tra_bbc_init      ! bottom heat flux 
     430      IF( lk_trabbl     )   CALL tra_bbl_init      ! advective (and/or diffusive) bottom boundary layer scheme 
     431                            CALL tra_dmp_init      ! internal tracer damping 
     432                            CALL tra_adv_init      ! horizontal & vertical advection 
     433                            CALL tra_ldf_init      ! lateral mixing 
     434                            CALL tra_zdf_init      ! vertical mixing and after tracer fields 
     435 
     436      !                                         ! Dynamics 
     437      IF( lk_c1d        )   CALL dyn_dmp_init      ! internal momentum damping 
     438                            CALL dyn_adv_init      ! advection (vector or flux form) 
     439                            CALL dyn_vor_init      ! vorticity term including Coriolis 
     440                            CALL dyn_ldf_init      ! lateral mixing 
     441                            CALL dyn_hpg_init      ! horizontal gradient of Hydrostatic pressure 
     442                            CALL dyn_zdf_init      ! vertical diffusion 
     443                            CALL dyn_spg_init      ! surface pressure gradient 
     444 
     445#if defined key_top 
     446      !                                      ! Passive tracers 
     447                            CALL     trc_init 
     448#endif 
     449      IF( l_ldfslp      )   CALL ldf_slp_init   ! slope of lateral mixing 
     450 
     451      !                                      ! Icebergs 
    440452                            CALL icb_init( rdt, nit000)   ! initialise icebergs instance 
     453 
     454      !                                      ! Misc. options 
    441455                            CALL sto_par_init   ! Stochastic parametrization 
    442456      IF( ln_sto_eos     )  CALL sto_pts_init   ! RRandom T/S fluctuations 
    443457      
    444 #if defined key_top 
    445       !                                     ! Passive tracers 
    446                             CALL     trc_init 
    447 #endif 
    448       !                                     ! Diagnostics 
     458      !                                      ! Diagnostics 
    449459      IF( lk_floats     )   CALL     flo_init   ! drifting Floats 
    450460      IF( lk_diaar5     )   CALL dia_ar5_init   ! ar5 diag 
     
    457467                            CALL dia_obs( nit000 - 1 )   ! Observation operator for restart 
    458468      ENDIF 
    459  
    460       !                                     ! Assimilation increments 
     469      !                                      ! Assimilation increments 
    461470      IF( lk_asminc     )   CALL asm_inc_init   ! Initialize assimilation increments 
    462471      IF(lwp) WRITE(numout,*) 'Euler time step switch is ', neuler 
     
    505514         WRITE(numout,*) '~~~~~~~ ' 
    506515         WRITE(numout,*) '   Namelist namcfg' 
    507          WRITE(numout,*) '      configuration name              cp_cfg      = ', TRIM(cp_cfg) 
    508          WRITE(numout,*) '      configuration zoom name         cp_cfz      = ', TRIM(cp_cfz) 
    509          WRITE(numout,*) '      configuration resolution        jp_cfg      = ', jp_cfg 
    510          WRITE(numout,*) '      1st lateral dimension ( >= jpi ) jpidta     = ', jpidta 
    511          WRITE(numout,*) '      2nd    "         "    ( >= jpj ) jpjdta     = ', jpjdta 
    512          WRITE(numout,*) '      3nd    "         "               jpkdta     = ', jpkdta 
    513          WRITE(numout,*) '      1st dimension of global domain in i jpiglo  = ', jpiglo 
    514          WRITE(numout,*) '      2nd    -                  -    in j jpjglo  = ', jpjglo 
     516         WRITE(numout,*) '      configuration name                               cp_cfg  = ', TRIM(cp_cfg) 
     517         WRITE(numout,*) '      configuration zoom name                          cp_cfz  = ', TRIM(cp_cfz) 
     518         WRITE(numout,*) '      configuration resolution                         jp_cfg  = ', jp_cfg 
     519         WRITE(numout,*) '      1st lateral dimension ( >= jpiglo )              jpidta  = ', jpidta 
     520         WRITE(numout,*) '      2nd    "         "    ( >= jpjglo )              jpjdta  = ', jpjdta 
     521         WRITE(numout,*) '      3nd    "         "                               jpkdta  = ', jpkdta 
     522         WRITE(numout,*) '      1st dimension of global domain in i              jpiglo  = ', jpiglo 
     523         WRITE(numout,*) '      2nd    -                  -    in j              jpjglo  = ', jpjglo 
    515524         WRITE(numout,*) '      left bottom i index of the zoom (in data domain) jpizoom = ', jpizoom 
    516525         WRITE(numout,*) '      left bottom j index of the zoom (in data domain) jpizoom = ', jpjzoom 
    517          WRITE(numout,*) '      lateral cond. type (between 0 and 6) jperio = ', jperio    
     526         WRITE(numout,*) '      lateral cond. type (between 0 and 6)             jperio = ', jperio    
    518527         WRITE(numout,*) '      use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr 
    519528      ENDIF 
     
    596605      IF( numdct_heat     /= -1 )   CLOSE( numdct_heat     )   ! heat transports 
    597606      IF( numdct_salt     /= -1 )   CLOSE( numdct_salt     )   ! salt transports 
    598  
    599607      ! 
    600608      numout = 6                                     ! redefine numout in case it is used after this point... 
     
    613621      USE diawri    , ONLY: dia_wri_alloc 
    614622      USE dom_oce   , ONLY: dom_oce_alloc 
    615       USE ldfdyn_oce, ONLY: ldfdyn_oce_alloc 
    616       USE ldftra_oce, ONLY: ldftra_oce_alloc 
    617623      USE trc_oce   , ONLY: trc_oce_alloc 
    618624#if defined key_diadct  
     
    629635      ierr = ierr + dia_wri_alloc   () 
    630636      ierr = ierr + dom_oce_alloc   ()          ! ocean domain 
    631       ierr = ierr + ldfdyn_oce_alloc()          ! ocean lateral  physics : dynamics 
    632       ierr = ierr + ldftra_oce_alloc()          ! ocean lateral  physics : tracers 
    633637      ierr = ierr + zdf_oce_alloc   ()          ! ocean vertical physics 
    634638      ! 
     
    710714      INTEGER :: ifac, jl, inu 
    711715      INTEGER, PARAMETER :: ntest = 14 
    712       INTEGER :: ilfax(ntest) 
     716      INTEGER, DIMENSION(ntest) ::   ilfax 
     717      !!---------------------------------------------------------------------- 
    713718      ! 
    714719      ! lfax contains the set of allowed factors. 
    715       data (ilfax(jl),jl=1,ntest) / 16384, 8192, 4096, 2048, 1024, 512, 256,  & 
    716          &                            128,   64,   32,   16,    8,   4,   2  / 
    717       !!---------------------------------------------------------------------- 
    718  
     720      ilfax(:) = (/(2**jl,jl=ntest,1,-1)/) 
     721      ! 
    719722      ! Clear the error flag and initialise output vars 
    720       kerr = 0 
    721       kfax = 1 
     723      kerr  = 0 
     724      kfax  = 1 
    722725      knfax = 0 
    723  
     726      ! 
    724727      ! Find the factors of n. 
    725728      IF( kn == 1 )   GOTO 20 
     
    729732      ! l points to the allowed factor list. 
    730733      ! ifac holds the current factor. 
    731  
     734      ! 
    732735      inu   = kn 
    733736      knfax = 0 
    734  
     737      ! 
    735738      DO jl = ntest, 1, -1 
    736739         ! 
     
    756759         ! 
    757760      END DO 
    758  
     761      ! 
    759762   20 CONTINUE      ! Label 20 is the exit point from the factor search loop. 
    760763      ! 
     
    764767 
    765768   SUBROUTINE nemo_northcomms 
    766       !!====================================================================== 
     769      !!---------------------------------------------------------------------- 
    767770      !!                     ***  ROUTINE  nemo_northcomms  *** 
    768       !! nemo_northcomms    :  Setup for north fold exchanges with explicit  
    769       !!                       point-to-point messaging 
    770       !!===================================================================== 
    771       !!---------------------------------------------------------------------- 
    772       !! 
    773       !! ** Purpose :   Initialization of the northern neighbours lists. 
     771      !! ** Purpose :   Setup for north fold exchanges with explicit  
     772      !!                point-to-point messaging 
     773      !! 
     774      !! ** Method :   Initialization of the northern neighbours lists. 
    774775      !!---------------------------------------------------------------------- 
    775776      !!    1.0  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE) 
    776777      !!    2.0  ! 2013-06 Setup avoiding MPI communication (I. Epicoco, S. Mocavero, CMCC)  
    777778      !!---------------------------------------------------------------------- 
    778  
    779779      INTEGER  ::   sxM, dxM, sxT, dxT, jn 
    780780      INTEGER  ::   njmppmax 
    781  
     781      !!---------------------------------------------------------------------- 
     782      ! 
    782783      njmppmax = MAXVAL( njmppt ) 
    783      
     784      ! 
    784785      !initializes the north-fold communication variables 
    785786      isendto(:) = 0 
    786       nsndto = 0 
    787  
     787      nsndto     = 0 
     788      ! 
    788789      !if I am a process in the north 
    789790      IF ( njmpp == njmppmax ) THEN 
     
    832833      l_north_nogather = .TRUE. 
    833834   END SUBROUTINE nemo_northcomms 
     835 
    834836#else 
    835837   SUBROUTINE nemo_northcomms      ! Dummy routine 
     
    841843END MODULE nemogcm 
    842844 
    843  
Note: See TracChangeset for help on using the changeset viewer.