- Timestamp:
- 2019-12-10T12:57:49+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/nemogcm.F90
r11553 r12143 59 59 USE diaobs ! Observation diagnostics (dia_obs_init routine) 60 60 USE diacfl ! CFL diagnostics (dia_cfl_init routine) 61 USE diaharm ! tidal harmonics diagnostics (dia_harm_init routine) 61 62 USE step ! NEMO time-stepping (stp routine) 62 63 USE isfstp ! ice shelf (isf_stp_init routine) … … 104 105 105 106 #if defined key_mpp_mpi 107 ! need MPI_Wtime 106 108 INCLUDE 'mpif.h' 107 109 #endif … … 129 131 !!---------------------------------------------------------------------- 130 132 INTEGER :: istp ! time step index 133 REAL(wp):: zstptiming ! elapsed time for 1 time step 131 134 !!---------------------------------------------------------------------- 132 135 ! … … 189 192 ! 190 193 DO WHILE( istp <= nitend .AND. nstop == 0 ) 191 #if defined key_mpp_mpi 194 192 195 ncom_stp = istp 193 IF ( istp == ( nit000 + 1 ) ) elapsed_time = MPI_Wtime() 194 IF ( istp == nitend ) elapsed_time = MPI_Wtime() - elapsed_time 195 #endif 196 IF( ln_timing ) THEN 197 zstptiming = MPI_Wtime() 198 IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming 199 IF ( istp == nitend ) elapsed_time = zstptiming - elapsed_time 200 ENDIF 201 196 202 CALL stp ( istp ) 197 203 istp = istp + 1 204 205 IF( lwp .AND. ln_timing ) WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming 206 198 207 END DO 199 208 ! … … 221 230 ! 222 231 IF( nstop /= 0 .AND. lwp ) THEN ! error print 223 WRITE(numout,cform_err) 224 WRITE(numout,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' 225 WRITE(numout,*) 232 WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' 233 CALL ctl_stop( ctmp1 ) 226 234 ENDIF 227 235 ! … … 235 243 #else 236 244 IF ( lk_oasis ) THEN ; CALL cpl_finalize ! end coupling and mpp communications with OASIS 237 ELSEIF( lk_mpp ) THEN ; CALL mppstop ( ldfinal = .TRUE. )! end mpp communications245 ELSEIF( lk_mpp ) THEN ; CALL mppstop ! end mpp communications 238 246 ENDIF 239 247 #endif … … 241 249 IF(lwm) THEN 242 250 IF( nstop == 0 ) THEN ; STOP 0 243 ELSE ; STOP 999251 ELSE ; STOP 123 244 252 ENDIF 245 253 ENDIF … … 254 262 !! ** Purpose : initialization of the NEMO GCM 255 263 !!---------------------------------------------------------------------- 256 INTEGER :: ji ! dummy loop indices 257 INTEGER :: ios, ilocal_comm ! local integers 258 CHARACTER(len=120), DIMENSION(60) :: cltxt, cltxt2, clnam 264 INTEGER :: ios, ilocal_comm ! local integers 259 265 !! 260 266 NAMELIST/namctl/ ln_ctl , sn_cfctl, nn_print, nn_ictls, nn_ictle, & … … 264 270 !!---------------------------------------------------------------------- 265 271 ! 266 cltxt = ''267 cltxt2 = ''268 clnam = ''269 272 cxios_context = 'nemo' 270 273 ! 271 ! ! Open reference namelist and configuration namelist files 272 CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 273 CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 274 ! 275 REWIND( numnam_ref ) ! Namelist namctl in reference namelist 276 READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 277 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. ) 278 REWIND( numnam_cfg ) ! Namelist namctl in confguration namelist 279 READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 280 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. ) 281 ! 282 REWIND( numnam_ref ) ! Namelist namcfg in reference namelist 283 READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 284 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. ) 285 REWIND( numnam_cfg ) ! Namelist namcfg in confguration namelist 286 READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 287 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. ) 288 289 ! !--------------------------! 290 ! ! Set global domain size ! (control print return in cltxt2) 291 ! !--------------------------! 292 IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file 293 CALL domain_cfg ( cltxt2, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 294 ! 295 ELSE ! user-defined namelist 296 CALL usr_def_nam( cltxt2, clnam, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 297 ENDIF 298 ! 299 ! 300 ! !--------------------------------------------! 301 ! ! set communicator & select the local node ! 302 ! ! NB: mynode also opens output.namelist.dyn ! 303 ! ! on unit number numond on first proc ! 304 ! !--------------------------------------------! 274 ! !-------------------------------------------------! 275 ! ! set communicator & select the local rank ! 276 ! ! must be done as soon as possible to get narea ! 277 ! !-------------------------------------------------! 278 ! 305 279 #if defined key_iomput 306 280 IF( Agrif_Root() ) THEN 307 281 IF( lk_oasis ) THEN 308 282 CALL cpl_init( "oceanx", ilocal_comm ) ! nemo local communicator given by oasis 309 CALL xios_initialize( "not used" , local_comm= ilocal_comm )! send nemo communicator to xios283 CALL xios_initialize( "not used" , local_comm =ilocal_comm ) ! send nemo communicator to xios 310 284 ELSE 311 CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm )! nemo local communicator given by xios285 CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm ) ! nemo local communicator given by xios 312 286 ENDIF 313 287 ENDIF 314 ! Nodes selection (control print return in cltxt) 315 narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 288 CALL mpp_start( ilocal_comm ) 316 289 #else 317 290 IF( lk_oasis ) THEN … … 319 292 CALL cpl_init( "oceanx", ilocal_comm ) ! nemo local communicator given by oasis 320 293 ENDIF 321 ! Nodes selection (control print return in cltxt) 322 narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 294 CALL mpp_start( ilocal_comm ) 323 295 ELSE 324 ilocal_comm = 0 ! Nodes selection (control print return in cltxt)325 narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop )326 ENDIF 327 #endif 328 329 narea = narea + 1 ! mynode return the rank of proc (0 --> jpnij -1 )330 331 IF( sn_cfctl%l_config ) THEN332 ! Activate finer control of report outputs333 ! optionally switch off output from selected areas (note this only334 ! applies to output which does not involve global communications)335 IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax ) .OR. &336 & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) ) &337 & CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. )338 ELSE339 ! Use ln_ctl to turn on or off all options.340 CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. )341 ENDIF342 343 lwm = (narea == 1) ! control of output namelists344 lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print345 346 IF(lwm) THEN ! write merged namelists from earlier to output namelist347 ! ! now that the file has been opened in call to mynode.348 ! ! NB: nammpp has already been written in mynode (if lk_mpp_mpi)349 WRITE( numond, namctl)350 WRITE( numond, namcfg)351 IF( .NOT.ln_read_cfg ) THEN352 DO ji = 1, SIZE(clnam)353 IF( TRIM(clnam(ji)) /= '' ) WRITE(numond, * ) clnam(ji) ! namusr_def print 354 END DO355 ENDIF356 ENDIF357 358 IF(lwp) THEN ! open listing units359 !360 CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )296 CALL mpp_start( ) 297 ENDIF 298 #endif 299 ! 300 narea = mpprank + 1 ! mpprank: the rank of proc (0 --> mppsize -1 ) 301 lwm = (narea == 1) ! control of output namelists 302 ! 303 ! !---------------------------------------------------------------! 304 ! ! Open output files, reference and configuration namelist files ! 305 ! !---------------------------------------------------------------! 306 ! 307 ! open ocean.output as soon as possible to get all output prints (including errors messages) 308 IF( lwm ) CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 309 ! open reference and configuration namelist files 310 CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 311 CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 312 IF( lwm ) CALL ctl_opn( numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 313 ! open /dev/null file to be able to supress output write easily 314 CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 315 ! 316 ! !--------------------! 317 ! ! Open listing units ! -> need ln_ctl from namctl to define lwp 318 ! !--------------------! 319 ! 320 REWIND( numnam_ref ) ! Namelist namctl in reference namelist 321 READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 322 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist' ) 323 REWIND( numnam_cfg ) ! Namelist namctl in confguration namelist 324 READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 325 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 326 ! 327 lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print 328 ! 329 IF(lwp) THEN ! open listing units 330 ! 331 IF( .NOT. lwm ) & ! alreay opened for narea == 1 332 & CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) 361 333 ! 362 334 WRITE(numout,*) 363 WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV -CMCC'335 WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' 364 336 WRITE(numout,*) ' NEMO team' 365 337 WRITE(numout,*) ' Ocean General Circulation Model' … … 380 352 WRITE(numout,*) " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " 381 353 WRITE(numout,*) 382 383 DO ji = 1, SIZE(cltxt)384 IF( TRIM(cltxt (ji)) /= '' ) WRITE(numout,*) TRIM(cltxt(ji)) ! control print of mynode385 END DO386 WRITE(numout,*)387 WRITE(numout,*)388 DO ji = 1, SIZE(cltxt2)389 IF( TRIM(cltxt2(ji)) /= '' ) WRITE(numout,*) TRIM(cltxt2(ji)) ! control print of domain size390 END DO391 354 ! 392 355 WRITE(numout,cform_aaa) ! Flag AAAAAAA 393 356 ! 394 357 ENDIF 395 ! open /dev/null file to be able to supress output write easily 396 CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 397 ! 398 ! ! Domain decomposition 399 CALL mpp_init ! MPP 358 ! 359 ! finalize the definition of namctl variables 360 IF( sn_cfctl%l_config ) THEN 361 ! Activate finer control of report outputs 362 ! optionally switch off output from selected areas (note this only 363 ! applies to output which does not involve global communications) 364 IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax ) .OR. & 365 & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) ) & 366 & CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 367 ELSE 368 ! Use ln_ctl to turn on or off all options. 369 CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 370 ENDIF 371 ! 372 IF(lwm) WRITE( numond, namctl ) 373 ! 374 ! !------------------------------------! 375 ! ! Set global domain size parameters ! 376 ! !------------------------------------! 377 ! 378 REWIND( numnam_ref ) ! Namelist namcfg in reference namelist 379 READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 380 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 381 REWIND( numnam_cfg ) ! Namelist namcfg in confguration namelist 382 READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 383 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist' ) 384 ! 385 IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file 386 CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 387 ELSE ! user-defined namelist 388 CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 389 ENDIF 390 ! 391 IF(lwm) WRITE( numond, namcfg ) 392 ! 393 ! !-----------------------------------------! 394 ! ! mpp parameters and domain decomposition ! 395 ! !-----------------------------------------! 396 CALL mpp_init 400 397 401 398 ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays … … 485 482 486 483 ! ! Diagnostics 487 IF( lk_floats )CALL flo_init ! drifting Floats484 CALL flo_init ! drifting Floats 488 485 IF( ln_diacfl ) CALL dia_cfl_init ! Initialise CFL diagnostics 489 486 CALL dia_ptr_init ! Poleward TRansports initialization 490 IF( lk_diadct )CALL dia_dct_init ! Sections tranports487 CALL dia_dct_init ! Sections tranports 491 488 CALL dia_hsb_init ! heat content, salt content and volume budgets 492 489 CALL trd_init ! Mixed-layer/Vorticity/Integral constraints trends … … 494 491 CALL dia_tmb_init ! TMB outputs 495 492 CALL dia_25h_init ! 25h mean outputs 496 IF( ln_diaobs ) CALL dia_obs( nit000-1 ) ! Observation operator for restart 493 CALL dia_harm_init ! tidal harmonics outputs 494 IF( ln_diaobs ) CALL dia_obs( nit000-1 ) ! Observation operator for restart 497 495 498 496 ! ! Assimilation increments … … 512 510 !! ** Purpose : control print setting 513 511 !! 514 !! ** Method : - print namctl information and check some consistencies512 !! ** Method : - print namctl and namcfg information and check some consistencies 515 513 !!---------------------------------------------------------------------- 516 514 ! … … 655 653 USE trc_oce , ONLY : trc_oce_alloc 656 654 USE bdy_oce , ONLY : bdy_oce_alloc 657 #if defined key_diadct658 USE diadct , ONLY : diadct_alloc659 #endif660 655 ! 661 656 INTEGER :: ierr … … 669 664 ierr = ierr + bdy_oce_alloc() ! bdy masks (incl. initialization) 670 665 ! 671 #if defined key_diadct672 ierr = ierr + diadct_alloc () !673 #endif674 !675 666 CALL mpp_sum( 'nemogcm', ierr ) 676 667 IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' ) … … 678 669 END SUBROUTINE nemo_alloc 679 670 671 680 672 SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all ) 681 673 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.