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 3294 for trunk/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90 – NEMO

Ignore:
Timestamp:
2012-01-28T17:44:18+01:00 (12 years ago)
Author:
rblod
Message:

Merge of 3.4beta into the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90

    r2715 r3294  
    2727   !!            3.3  ! 2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface  
    2828   !!             -   ! 2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase 
    29    !!            4.0  ! 2011-01  (A. R. Porter, STFC Daresbury) dynamical allocation 
     29   !!            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 
    3031   !!---------------------------------------------------------------------- 
    3132 
     
    4647   USE domain          ! domain initialization             (dom_init routine) 
    4748   USE obcini          ! open boundary cond. initialization (obc_ini routine) 
    48    USE bdyini          ! unstructured open boundary cond. initialization (bdy_init routine) 
     49   USE bdyini          ! open boundary cond. initialization (bdy_init routine) 
     50   USE bdydta          ! open boundary cond. initialization (bdy_dta_init routine) 
     51   USE bdytides        ! open boundary cond. initialization (tide_init routine) 
    4952   USE istate          ! initial state setting          (istate_init routine) 
    5053   USE ldfdyn          ! lateral viscosity setting      (ldfdyn_init routine) 
     
    5356   USE phycst          ! physical constant                  (par_cst routine) 
    5457   USE trdmod          ! momentum/tracers trends       (trd_mod_init routine) 
    55    USE asminc          ! assimilation increments       (asm_inc_init routine) 
    5658   USE asmtrj          ! writing out state trajectory 
    57    USE sshwzv          ! vertical velocity used in asm 
    5859   USE diaptr          ! poleward transports           (dia_ptr_init routine) 
     60   USE diadct          ! sections transports           (dia_dct_init routine) 
    5961   USE diaobs          ! Observation diagnostics       (dia_obs_init routine) 
    6062   USE step            ! NEMO time-stepping                 (stp     routine) 
     
    171173      ENDIF 
    172174      ! 
     175#if defined key_agrif 
     176      CALL Agrif_ParentGrid_To_ChildGrid() 
     177      IF( lk_diaobs ) CALL dia_obs_wri 
     178      IF( nn_timing == 1 )   CALL timing_finalize 
     179      CALL Agrif_ChildGrid_To_ParentGrid() 
     180#endif 
     181      IF( nn_timing == 1 )   CALL timing_finalize 
     182      ! 
    173183      CALL nemo_closefile 
    174184#if defined key_oasis3 || defined key_oasis4 
     
    192202      !! 
    193203      NAMELIST/namctl/ ln_ctl  , nn_print, nn_ictls, nn_ictle,   & 
    194          &             nn_isplt, nn_jsplt, nn_jctls, nn_jctle, nn_bench 
     204         &             nn_isplt, nn_jsplt, nn_jctls, nn_jctle,   & 
     205         &             nn_bench, nn_timing 
    195206      !!---------------------------------------------------------------------- 
    196207      ! 
     
    245256      IF( Agrif_Root() ) THEN 
    246257         jpi = ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci   ! first  dim. 
     258#if defined key_nemocice_decomp 
     259         jpj = ( jpjglo+1-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj ! second dim.  
     260#else 
    247261         jpj = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj   ! second dim. 
     262#endif 
    248263         jpk = jpkdta                                             ! third dim 
    249264         jpim1 = jpi-1                                            ! inner domain indices 
     
    258273         ! 
    259274         WRITE(numout,*) 
    260          WRITE(numout,*) '         CNRS - NERC - Met OFFICE - MERCATOR-ocean' 
     275         WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC' 
    261276         WRITE(numout,*) '                       NEMO team' 
    262277         WRITE(numout,*) '            Ocean General Circulation Model' 
    263          WRITE(numout,*) '                  version 3.3  (2010) ' 
     278         WRITE(numout,*) '                  version 3.4  (2011) ' 
    264279         WRITE(numout,*) 
    265280         WRITE(numout,*) 
     
    286301      ENDIF 
    287302      ! 
     303      IF( nn_timing == 1 )  CALL timing_init 
     304      ! 
    288305      !                                      ! General initialization 
    289306                            CALL     phy_cst    ! Physical constants 
     
    292309                            CALL     dom_init   ! Domain 
    293310 
     311      IF( ln_nnogather )    CALL nemo_northcomms   ! Initialise the northfold neighbour lists (must be done after the masks are defined) 
     312 
    294313      IF( ln_ctl        )   CALL prt_ctl_init   ! Print control 
    295314 
    296315      IF( lk_obc        )   CALL     obc_init   ! Open boundaries  
    297       IF( lk_bdy        )   CALL     bdy_init   ! Unstructured open boundaries 
     316      IF( lk_bdy        )   CALL     bdy_init       ! Open boundaries initialisation 
     317      IF( lk_bdy        )   CALL     bdy_dta_init   ! Open boundaries initialisation of external data arrays 
     318      IF( lk_bdy        )   CALL     tide_init      ! Open boundaries initialisation of tidal harmonic forcing 
     319 
     320                            CALL flush(numout) 
     321                            CALL dyn_nept_init  ! simplified form of Neptune effect 
     322                            CALL flush(numout) 
    298323 
    299324                            CALL  istate_init   ! ocean initial state (Dynamics and tracers) 
     
    320345                            CALL tra_bbc_init   ! bottom heat flux 
    321346      IF( lk_trabbl     )   CALL tra_bbl_init   ! advective (and/or diffusive) bottom boundary layer scheme 
    322       IF( lk_tradmp     )   CALL tra_dmp_init   ! internal damping trends 
     347      IF( ln_tradmp     )   CALL tra_dmp_init   ! internal damping trends 
    323348                            CALL tra_adv_init   ! horizontal & vertical advection 
    324349                            CALL tra_ldf_init   ! lateral mixing 
     
    341366#endif 
    342367      !                                     ! Diagnostics 
     368      IF( lk_floats     )   CALL     flo_init   ! drifting Floats 
    343369                            CALL     iom_init   ! iom_put initialization 
    344       IF( lk_floats     )   CALL     flo_init   ! drifting Floats 
    345370      IF( lk_diaar5     )   CALL dia_ar5_init   ! ar5 diag 
    346371                            CALL dia_ptr_init   ! Poleward TRansports initialization 
     372      IF( lk_diadct     )   CALL dia_dct_init   ! Sections tranports 
    347373                            CALL dia_hsb_init   ! heat content, salt content and volume budgets 
    348374                            CALL trd_mod_init   ! Mixed-layer/Vorticity/Integral constraints trends 
     
    394420      ! 
    395421      IF( ln_ctl ) THEN                 ! sub-domain area indices for the control prints 
    396          IF( lk_mpp ) THEN 
     422         IF( lk_mpp .AND. jpnij > 1 ) THEN 
    397423            isplt = jpni   ;   jsplt = jpnj   ;   ijsplt = jpni*jpnj   ! the domain is forced to the real split domain 
    398424         ELSE 
     
    456482      CALL iom_close                                 ! close all input/output files managed by iom_* 
    457483      ! 
    458       IF( numstp     /= -1 )   CLOSE( numstp     )   ! time-step file 
    459       IF( numsol     /= -1 )   CLOSE( numsol     )   ! solver file 
    460       IF( numnam     /= -1 )   CLOSE( numnam     )   ! oce namelist 
    461       IF( numnam_ice /= -1 )   CLOSE( numnam_ice )   ! ice namelist 
    462       IF( numevo_ice /= -1 )   CLOSE( numevo_ice )   ! ice variables (temp. evolution) 
    463       IF( numout     /=  6 )   CLOSE( numout     )   ! standard model output file 
     484      IF( numstp      /= -1 )   CLOSE( numstp      )   ! time-step file 
     485      IF( numsol      /= -1 )   CLOSE( numsol      )   ! solver file 
     486      IF( numnam      /= -1 )   CLOSE( numnam      )   ! oce namelist 
     487      IF( numnam_ice  /= -1 )   CLOSE( numnam_ice  )   ! ice namelist 
     488      IF( numevo_ice  /= -1 )   CLOSE( numevo_ice  )   ! ice variables (temp. evolution) 
     489      IF( numout      /=  6 )   CLOSE( numout      )   ! standard model output file 
     490      IF( numdct_vol  /= -1 )   CLOSE( numdct_vol  )   ! volume transports 
     491      IF( numdct_heat /= -1 )   CLOSE( numdct_heat )   ! heat transports 
     492      IF( numdct_salt /= -1 )   CLOSE( numdct_salt )   ! salt transports 
     493 
    464494      ! 
    465495      numout = 6                                     ! redefine numout in case it is used after this point... 
     
    481511      USE ldftra_oce, ONLY: ldftra_oce_alloc 
    482512      USE trc_oce   , ONLY: trc_oce_alloc 
    483       USE wrk_nemo  , ONLY: wrk_alloc 
    484513      ! 
    485514      INTEGER :: ierr 
     
    495524      ierr = ierr + lib_mpp_alloc   (numout)    ! mpp exchanges 
    496525      ierr = ierr + trc_oce_alloc   ()          ! shared TRC / TRA arrays 
    497       ! 
    498       ierr = ierr + wrk_alloc(numout, lwp)      ! workspace 
    499526      ! 
    500527      IF( lk_mpp    )   CALL mpp_sum( ierr ) 
     
    617644   END SUBROUTINE factorise 
    618645 
     646#if defined key_mpp_mpi 
     647   SUBROUTINE nemo_northcomms 
     648      !!====================================================================== 
     649      !!                     ***  ROUTINE  nemo_northcomms  *** 
     650      !! nemo_northcomms    :  Setup for north fold exchanges with explicit peer to peer messaging 
     651      !!===================================================================== 
     652      !!---------------------------------------------------------------------- 
     653      !!  
     654      !! ** Purpose :   Initialization of the northern neighbours lists. 
     655      !!---------------------------------------------------------------------- 
     656      !!    1.0  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE)  
     657      !!---------------------------------------------------------------------- 
     658 
     659      INTEGER ::   ji, jj, jk, ij, jtyp    ! dummy loop indices 
     660      INTEGER ::   ijpj                    ! number of rows involved in north-fold exchange 
     661      INTEGER ::   northcomms_alloc        ! allocate return status 
     662      REAL(wp), ALLOCATABLE, DIMENSION ( :,: ) ::   znnbrs     ! workspace 
     663      LOGICAL,  ALLOCATABLE, DIMENSION ( : )   ::   lrankset   ! workspace 
     664 
     665      IF(lwp) WRITE(numout,*) 
     666      IF(lwp) WRITE(numout,*) 'nemo_northcomms : Initialization of the northern neighbours lists' 
     667      IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
     668 
     669      !!---------------------------------------------------------------------- 
     670      ALLOCATE( znnbrs(jpi,jpj), stat = northcomms_alloc ) 
     671      ALLOCATE( lrankset(jpnij), stat = northcomms_alloc ) 
     672      IF( northcomms_alloc /= 0 ) THEN 
     673         WRITE(numout,cform_war) 
     674         WRITE(numout,*) 'northcomms_alloc : failed to allocate arrays' 
     675         CALL ctl_stop( 'STOP', 'nemo_northcomms : unable to allocate temporary arrays' ) 
     676      ENDIF 
     677      nsndto = 0 
     678      isendto = -1 
     679      ijpj   = 4 
     680      ! 
     681      ! This routine has been called because ln_nnogather has been set true ( nammpp ) 
     682      ! However, these first few exchanges have to use the mpi_allgather method to 
     683      ! establish the neighbour lists to use in subsequent peer to peer exchanges. 
     684      ! Consequently, set l_north_nogather to be false here and set it true only after 
     685      ! the lists have been established. 
     686      ! 
     687      l_north_nogather = .FALSE. 
     688      ! 
     689      ! Exchange and store ranks on northern rows 
     690 
     691      DO jtyp = 1,4 
     692 
     693         lrankset = .FALSE. 
     694         znnbrs = narea 
     695         SELECT CASE (jtyp) 
     696            CASE(1) 
     697               CALL lbc_lnk( znnbrs, 'T', 1. )      ! Type 1: T,W-points 
     698            CASE(2) 
     699               CALL lbc_lnk( znnbrs, 'U', 1. )      ! Type 2: U-point 
     700            CASE(3) 
     701               CALL lbc_lnk( znnbrs, 'V', 1. )      ! Type 3: V-point 
     702            CASE(4) 
     703               CALL lbc_lnk( znnbrs, 'F', 1. )      ! Type 4: F-point 
     704         END SELECT 
     705 
     706         IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN 
     707            DO jj = nlcj-ijpj+1, nlcj 
     708               ij = jj - nlcj + ijpj 
     709               DO ji = 1,jpi 
     710                  IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) & 
     711               &     lrankset(INT(znnbrs(ji,jj))) = .true. 
     712               END DO 
     713            END DO 
     714 
     715            DO jj = 1,jpnij 
     716               IF ( lrankset(jj) ) THEN 
     717                  nsndto(jtyp) = nsndto(jtyp) + 1 
     718                  IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN 
     719                     CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', & 
     720                  &                 ' jpmaxngh will need to be increased ') 
     721                  ENDIF 
     722                  isendto(nsndto(jtyp),jtyp) = jj-1   ! narea converted to MPI rank 
     723               ENDIF 
     724            END DO 
     725         ENDIF 
     726 
     727      END DO 
     728 
     729      ! 
     730      ! Type 5: I-point 
     731      ! 
     732      ! ICE point exchanges may involve some averaging. The neighbours list is 
     733      ! built up using two exchanges to ensure that the whole stencil is covered. 
     734      ! lrankset should not be reset between these 'J' and 'K' point exchanges 
     735 
     736      jtyp = 5 
     737      lrankset = .FALSE. 
     738      znnbrs = narea  
     739      CALL lbc_lnk( znnbrs, 'J', 1. ) ! first ice U-V point 
     740 
     741      IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN 
     742         DO jj = nlcj-ijpj+1, nlcj 
     743            ij = jj - nlcj + ijpj 
     744            DO ji = 1,jpi 
     745               IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) & 
     746            &     lrankset(INT(znnbrs(ji,jj))) = .true. 
     747         END DO 
     748        END DO 
     749      ENDIF 
     750 
     751      znnbrs = narea  
     752      CALL lbc_lnk( znnbrs, 'K', 1. ) ! second ice U-V point 
     753 
     754      IF ( njmppt(narea) .EQ. MAXVAL( njmppt )) THEN 
     755         DO jj = nlcj-ijpj+1, nlcj 
     756            ij = jj - nlcj + ijpj 
     757            DO ji = 1,jpi 
     758               IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND.  INT(znnbrs(ji,jj)) .NE. narea ) & 
     759            &       lrankset( INT(znnbrs(ji,jj))) = .true. 
     760            END DO 
     761         END DO 
     762 
     763         DO jj = 1,jpnij 
     764            IF ( lrankset(jj) ) THEN 
     765               nsndto(jtyp) = nsndto(jtyp) + 1 
     766               IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN 
     767                  CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', & 
     768               &                 ' jpmaxngh will need to be increased ') 
     769               ENDIF 
     770               isendto(nsndto(jtyp),jtyp) = jj-1   ! narea converted to MPI rank 
     771            ENDIF 
     772         END DO 
     773         ! 
     774         ! For northern row areas, set l_north_nogather so that all subsequent exchanges  
     775         ! can use peer to peer communications at the north fold 
     776         ! 
     777         l_north_nogather = .TRUE. 
     778         ! 
     779      ENDIF 
     780      DEALLOCATE( znnbrs ) 
     781      DEALLOCATE( lrankset ) 
     782 
     783   END SUBROUTINE nemo_northcomms 
     784#else 
     785   SUBROUTINE nemo_northcomms      ! Dummy routine 
     786      WRITE(*,*) 'nemo_northcomms: You should not have seen this print! error?' 
     787   END SUBROUTINE nemo_northcomms 
     788#endif 
    619789   !!====================================================================== 
    620790END MODULE nemogcm 
Note: See TracChangeset for help on using the changeset viewer.