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 5837 for branches/2014/dev_r4650_UKMO14.4_OBS_GENERAL_VINTERP/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90 – NEMO

Ignore:
Timestamp:
2015-10-26T15:59:39+01:00 (9 years ago)
Author:
timgraham
Message:

Upgraded to r5518 of trunk (NEMO 3.6 stable)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4650_UKMO14.4_OBS_GENERAL_VINTERP/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90

    r4645 r5837  
    4242   !!---------------------------------------------------------------------- 
    4343   USE step_oce        ! module used in the ocean time stepping module 
    44    USE sbc_oce         ! surface boundary condition: ocean 
    4544   USE cla             ! cross land advection               (tra_cla routine) 
    4645   USE domcfg          ! domain configuration               (dom_cfg routine) 
     
    5150#endif 
    5251   USE tideini         ! tidal components initialization   (tide_ini routine) 
    53    USE bdyini          ! open boundary cond. initialization (bdy_init routine) 
    54    USE bdydta          ! open boundary cond. initialization (bdy_dta_init routine) 
    55    USE bdytides        ! open boundary cond. initialization (bdytide_init routine) 
     52   USE bdyini          ! open boundary cond. setting      (bdy_init routine) 
     53   USE bdydta          ! open boundary cond. setting  (bdy_dta_init routine) 
     54   USE bdytides        ! open boundary cond. setting  (bdytide_init routine) 
    5655   USE istate          ! initial state setting          (istate_init routine) 
    5756   USE ldfdyn          ! lateral viscosity setting      (ldfdyn_init routine) 
     
    5958   USE zdfini          ! vertical physics setting          (zdf_init routine) 
    6059   USE phycst          ! physical constant                  (par_cst routine) 
    61    USE trdmod          ! momentum/tracers trends       (trd_mod_init routine) 
     60   USE trdini          ! dyn/tra trends initialization     (trd_init routine) 
    6261   USE asminc          ! assimilation increments      
    6362   USE asmbkg          ! writing out state trajectory 
     
    6968   USE icbini          ! handle bergs, initialisation 
    7069   USE icbstp          ! handle bergs, calving, themodynamics and transport 
    71 #if defined key_oasis3 
    7270   USE cpl_oasis3      ! OASIS3 coupling 
    73 #elif defined key_oasis4 
    74    USE cpl_oasis4      ! OASIS4 coupling (not working) 
    75 #endif 
    7671   USE c1d             ! 1D configuration 
    7772   USE step_c1d        ! Time stepping loop for the 1D configuration 
     
    8681   USE sbctide, ONLY: lk_tide 
    8782   USE crsini          ! initialise grid coarsening utility 
    88    USE lbcnfd, ONLY: isendto, nsndto ! Setup of north fold exchanges  
     83   USE lbcnfd, ONLY: isendto, nsndto, nfsloop, nfeloop ! Setup of north fold exchanges  
     84   USE sbc_oce, ONLY: lk_oasis 
     85   USE stopar 
     86   USE stopts 
    8987 
    9088   IMPLICIT NONE 
     
    121119      !!---------------------------------------------------------------------- 
    122120      ! 
    123  
    124121#if defined key_agrif 
    125122      CALL Agrif_Init_Grids()      ! AGRIF: set the meshes 
     
    139136# endif 
    140137#endif 
    141  
    142138      ! check that all process are still there... If some process have an error, 
    143139      ! they will never enter in step and other processes will wait until the end of the cpu time! 
     
    166162 
    167163         DO WHILE ( istp <= nitend .AND. nstop == 0 ) 
    168  
    169164#if defined key_agrif 
    170165            CALL Agrif_Step( stp )           ! AGRIF: time stepping 
     
    172167            CALL stp( istp )                 ! standard time stepping 
    173168#endif 
    174  
    175169            istp = istp + 1 
    176170            IF( lk_mpp )   CALL mpp_max( nstop ) 
     
    201195      ! 
    202196      CALL nemo_closefile 
     197      ! 
    203198#if defined key_iomput 
    204199      CALL xios_finalize                ! end mpp communications with xios 
    205 # if defined key_oasis3 || defined key_oasis4 
    206       CALL cpl_prism_finalize           ! end coupling and mpp communications with OASIS 
    207 # endif 
     200      IF( lk_oasis ) CALL cpl_finalize    ! end coupling and mpp communications with OASIS 
    208201#else 
    209 # if defined key_oasis3 || defined key_oasis4 
    210       CALL cpl_prism_finalize           ! end coupling and mpp communications with OASIS 
    211 # else 
    212       IF( lk_mpp )   CALL mppstop       ! end mpp communications 
    213 # endif 
     202      IF( lk_oasis ) THEN  
     203         CALL cpl_finalize              ! end coupling and mpp communications with OASIS 
     204      ELSE 
     205         IF( lk_mpp )   CALL mppstop    ! end mpp communications 
     206      ENDIF 
    214207#endif 
    215208      ! 
     
    227220      INTEGER ::   ios 
    228221      CHARACTER(len=80), DIMENSION(16) ::   cltxt 
    229       !! 
    230       NAMELIST/namctl/ ln_ctl, nn_print, nn_ictls, nn_ictle,   & 
     222      ! 
     223      NAMELIST/namctl/ ln_ctl  , nn_print, nn_ictls, nn_ictle,   & 
    231224         &             nn_isplt, nn_jsplt, nn_jctls, nn_jctle,   & 
    232225         &             nn_bench, nn_timing 
    233226      NAMELIST/namcfg/ cp_cfg, cp_cfz, jp_cfg, jpidta, jpjdta, jpkdta, jpiglo, jpjglo, & 
    234          &             jpizoom, jpjzoom, jperio 
     227         &             jpizoom, jpjzoom, jperio, ln_use_jattr 
    235228      !!---------------------------------------------------------------------- 
    236229      ! 
    237230      cltxt = '' 
     231      cxios_context = 'nemo' 
    238232      ! 
    239233      !                             ! Open reference namelist and configuration namelist files 
     
    271265      nperio  = 0 
    272266      jperio  = 0 
     267      ln_use_jattr = .false. 
    273268   ENDIF 
    274269#endif 
     
    281276#if defined key_iomput 
    282277      IF( Agrif_Root() ) THEN 
    283 # if defined key_oasis3 || defined key_oasis4 
    284          CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis 
    285          CALL xios_initialize( "oceanx",local_comm=ilocal_comm ) 
    286 # else 
    287          CALL  xios_initialize( "nemo",return_comm=ilocal_comm ) 
    288 # endif 
    289       ENDIF 
    290       narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection 
     278         IF( lk_oasis ) THEN 
     279            CALL cpl_init( "oceanx", ilocal_comm )                     ! nemo local communicator given by oasis 
     280            CALL xios_initialize( "not used",local_comm=ilocal_comm )    ! send nemo communicator to xios 
     281         ELSE 
     282            CALL  xios_initialize( "for_xios_mpi_id",return_comm=ilocal_comm )    ! nemo local communicator given by xios 
     283         ENDIF 
     284      ENDIF 
     285      ! Nodes selection (control print return in cltxt) 
     286      narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 
    291287#else 
    292 # if defined key_oasis3 || defined key_oasis4 
    293       IF( Agrif_Root() ) THEN 
    294          CALL cpl_prism_init( ilocal_comm )                 ! nemo local communicator given by oasis 
    295       ENDIF 
    296       narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection (control print return in cltxt) 
    297 # else 
    298       ilocal_comm = 0 
    299       narea = mynode( cltxt, numnam_ref, numnam_cfg, numond , nstop )                 ! Nodes selection (control print return in cltxt) 
    300 # endif 
     288      IF( lk_oasis ) THEN 
     289         IF( Agrif_Root() ) THEN 
     290            CALL cpl_init( "oceanx", ilocal_comm )                      ! nemo local communicator given by oasis 
     291         ENDIF 
     292         ! Nodes selection (control print return in cltxt) 
     293         narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 
     294      ELSE 
     295         ilocal_comm = 0 
     296         ! Nodes selection (control print return in cltxt) 
     297         narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop ) 
     298      ENDIF 
    301299#endif 
    302300      narea = narea + 1                                     ! mynode return the rank of proc (0 --> jpnij -1 ) 
     
    351349         WRITE(numout,*) '                       NEMO team' 
    352350         WRITE(numout,*) '            Ocean General Circulation Model' 
    353          WRITE(numout,*) '                  version 3.4  (2011) ' 
     351         WRITE(numout,*) '                  version 3.6  (2015) ' 
    354352         WRITE(numout,*) 
    355353         WRITE(numout,*) 
     
    393391      IF( lk_tide       )   CALL    tide_init( nit000 )    ! Initialisation of the tidal harmonics 
    394392 
    395       IF( lk_bdy        )   CALL      bdy_init  ! Open boundaries initialisation 
    396       IF( lk_bdy        )   CALL  bdy_dta_init  ! Open boundaries initialisation of external data arrays 
     393                            CALL     sbc_init   ! Forcings : surface module (clem: moved here for bdy purpose) 
     394 
     395      IF( lk_bdy        )   CALL     bdy_init   ! Open boundaries initialisation 
     396      IF( lk_bdy        )   CALL bdy_dta_init   ! Open boundaries initialisation of external data arrays 
    397397      IF( lk_bdy .AND. lk_tide )   & 
    398          &                  CALL  bdytide_init  ! Open boundaries initialisation of tidal harmonic forcing 
     398         &                  CALL bdytide_init   ! Open boundaries initialisation of tidal harmonic forcing 
    399399 
    400400                            CALL dyn_nept_init  ! simplified form of Neptune effect 
    401  
    402401      !      
    403402      IF( ln_crs        )   CALL     crs_init   ! Domain initialization of coarsened grid 
    404403      ! 
    405404                                ! Ocean physics 
    406                             CALL     sbc_init   ! Forcings : surface module 
    407405      !                                         ! Vertical physics 
    408  
    409406                            CALL     zdf_init      ! namelist read 
    410  
    411407                            CALL zdf_bfr_init      ! bottom friction 
    412  
    413408      IF( lk_zdfric     )   CALL zdf_ric_init      ! Richardson number dependent Kz 
    414409      IF( lk_zdftke     )   CALL zdf_tke_init      ! TKE closure scheme 
     
    444439      IF( nn_cla == 1 .AND. cp_cfg == 'orca' .AND. jp_cfg == 2 )   CALL cla_init       ! Cross Land Advection 
    445440                            CALL icb_init( rdt, nit000)   ! initialise icebergs instance 
     441                            CALL sto_par_init   ! Stochastic parametrization 
     442      IF( ln_sto_eos     )  CALL sto_pts_init   ! RRandom T/S fluctuations 
    446443      
    447444#if defined key_top 
     
    449446                            CALL     trc_init 
    450447#endif 
    451       ! 
    452   
    453                                             ! Diagnostics 
     448      !                                     ! Diagnostics 
    454449      IF( lk_floats     )   CALL     flo_init   ! drifting Floats 
    455450      IF( lk_diaar5     )   CALL dia_ar5_init   ! ar5 diag 
     
    457452      IF( lk_diadct     )   CALL dia_dct_init   ! Sections tranports 
    458453                            CALL dia_hsb_init   ! heat content, salt content and volume budgets 
    459                             CALL trd_mod_init   ! Mixed-layer/Vorticity/Integral constraints trends 
     454                            CALL     trd_init   ! Mixed-layer/Vorticity/Integral constraints trends 
    460455      IF( lk_diaobs     ) THEN                  ! Observation & model comparison 
    461456                            CALL dia_obs_init            ! Initialize observational data 
    462457                            CALL dia_obs( nit000 - 1 )   ! Observation operator for restart 
    463458      ENDIF 
     459 
    464460      !                                     ! Assimilation increments 
    465461      IF( lk_asminc     )   CALL asm_inc_init   ! Initialize assimilation increments 
     
    520516         WRITE(numout,*) '      left bottom j index of the zoom (in data domain) jpizoom = ', jpjzoom 
    521517         WRITE(numout,*) '      lateral cond. type (between 0 and 6) jperio = ', jperio    
     518         WRITE(numout,*) '      use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr 
    522519      ENDIF 
    523520      !                             ! Parameter control 
     
    568565      ENDIF 
    569566      ! 
    570       IF( lk_c1d .AND. .NOT.lk_iomput )   CALL ctl_stop( 'nemo_ctl: The 1D configuration must be used ',   & 
    571          &                                               'with the IOM Input/Output manager. '         ,   & 
    572          &                                               'Compile with key_iomput enabled' ) 
    573       ! 
    574567      IF( 1_wp /= SIGN(1._wp,-0._wp)  )   CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows ',  & 
    575568         &                                               'f2003 standard. '                              ,  & 
     
    663656      !! ** Method  : 
    664657      !!---------------------------------------------------------------------- 
    665       INTEGER, INTENT(in) :: num_pes ! The number of MPI processes we have 
     658      INTEGER, INTENT(in) ::   num_pes  ! The number of MPI processes we have 
    666659      ! 
    667660      INTEGER, PARAMETER :: nfactmax = 20 
     
    672665      INTEGER, DIMENSION(nfactmax) :: ifact ! Array of factors 
    673666      !!---------------------------------------------------------------------- 
    674  
     667      ! 
    675668      ierr = 0 
    676  
     669      ! 
    677670      CALL factorise( ifact, nfactmax, nfact, num_pes, ierr ) 
    678  
     671      ! 
    679672      IF( nfact <= 1 ) THEN 
    680673         WRITE (numout, *) 'WARNING: factorisation of number of PEs failed' 
     
    718711      INTEGER, PARAMETER :: ntest = 14 
    719712      INTEGER :: ilfax(ntest) 
    720  
     713      ! 
    721714      ! lfax contains the set of allowed factors. 
    722715      data (ilfax(jl),jl=1,ntest) / 16384, 8192, 4096, 2048, 1024, 512, 256,  & 
     
    769762 
    770763#if defined key_mpp_mpi 
     764 
    771765   SUBROUTINE nemo_northcomms 
    772766      !!====================================================================== 
     
    803797          !loop over the other north-fold processes to find the processes 
    804798          !managing the points belonging to the sxT-dxT range 
    805           DO jn = jpnij - jpni +1, jpnij 
    806              IF ( njmppt(jn) == njmppmax ) THEN 
     799   
     800          DO jn = 1, jpni 
    807801                !sxT is the first point (in the global domain) of the jn 
    808802                !process 
    809                 sxT = nimppt(jn) 
     803                sxT = nfiimpp(jn, jpnj) 
    810804                !dxT is the last point (in the global domain) of the jn 
    811805                !process 
    812                 dxT = nimppt(jn) + nlcit(jn) - 1 
     806                dxT = nfiimpp(jn, jpnj) + nfilcit(jn, jpnj) - 1 
    813807                IF ((sxM .gt. sxT) .AND. (sxM .lt. dxT)) THEN 
    814808                   nsndto = nsndto + 1 
    815                    isendto(nsndto) = jn 
     809                     isendto(nsndto) = jn 
    816810                ELSEIF ((sxM .le. sxT) .AND. (dxM .ge. dxT)) THEN 
    817811                   nsndto = nsndto + 1 
    818                    isendto(nsndto) = jn 
     812                     isendto(nsndto) = jn 
    819813                ELSEIF ((dxM .lt. dxT) .AND. (sxT .lt. dxM)) THEN 
    820814                   nsndto = nsndto + 1 
    821                    isendto(nsndto) = jn 
     815                     isendto(nsndto) = jn 
    822816                END IF 
    823              END IF 
    824817          END DO 
     818          nfsloop = 1 
     819          nfeloop = nlci 
     820          DO jn = 2,jpni-1 
     821           IF(nfipproc(jn,jpnj) .eq. (narea - 1)) THEN 
     822              IF (nfipproc(jn - 1 ,jpnj) .eq. -1) THEN 
     823                 nfsloop = nldi 
     824              ENDIF 
     825              IF (nfipproc(jn + 1,jpnj) .eq. -1) THEN 
     826                 nfeloop = nlei 
     827              ENDIF 
     828           ENDIF 
     829        END DO 
     830 
    825831      ENDIF 
    826832      l_north_nogather = .TRUE. 
     
    831837   END SUBROUTINE nemo_northcomms 
    832838#endif 
     839 
    833840   !!====================================================================== 
    834841END MODULE nemogcm 
Note: See TracChangeset for help on using the changeset viewer.