Changeset 11317 for NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/nemogcm.F90
- Timestamp:
- 2019-07-22T10:32:59+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/nemogcm.F90
r10588 r11317 103 103 104 104 #if defined key_mpp_mpi 105 ! need MPI_Wtime 105 106 INCLUDE 'mpif.h' 106 107 #endif … … 220 221 ! 221 222 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,*) 223 WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' 224 CALL ctl_stop( ctmp1 ) 225 225 ENDIF 226 226 ! … … 240 240 IF(lwm) THEN 241 241 IF( nstop == 0 ) THEN ; STOP 0 242 ELSE ; STOP 999242 ELSE ; STOP 123 243 243 ENDIF 244 244 ENDIF … … 253 253 !! ** Purpose : initialization of the NEMO GCM 254 254 !!---------------------------------------------------------------------- 255 INTEGER :: ji ! dummy loop indices 256 INTEGER :: ios, ilocal_comm ! local integers 257 CHARACTER(len=120), DIMENSION(60) :: cltxt, cltxt2, clnam 255 INTEGER :: ios, ilocal_comm ! local integers 258 256 !! 259 257 NAMELIST/namctl/ ln_ctl , sn_cfctl, nn_print, nn_ictls, nn_ictle, & … … 263 261 !!---------------------------------------------------------------------- 264 262 ! 265 cltxt = ''266 cltxt2 = ''267 clnam = ''268 263 cxios_context = 'nemo' 269 264 ! 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 ! !--------------------------------------------! 265 ! !-------------------------------------------------! 266 ! ! set communicator & select the local rank ! 267 ! ! must be done as soon as possible to get narea ! 268 ! !-------------------------------------------------! 269 ! 304 270 #if defined key_iomput 305 271 IF( Agrif_Root() ) THEN 306 272 IF( lk_oasis ) THEN 307 273 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 xios274 CALL xios_initialize( "not used" , local_comm =ilocal_comm ) ! send nemo communicator to xios 309 275 ELSE 310 CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm )! nemo local communicator given by xios276 CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm ) ! nemo local communicator given by xios 311 277 ENDIF 312 278 ENDIF 313 ! Nodes selection (control print return in cltxt) 314 narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 279 CALL mpp_start( ilocal_comm ) 315 280 #else 316 281 IF( lk_oasis ) THEN … … 318 283 CALL cpl_init( "oceanx", ilocal_comm ) ! nemo local communicator given by oasis 319 284 ENDIF 320 ! Nodes selection (control print return in cltxt) 321 narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 285 CALL mpp_start( ilocal_comm ) 322 286 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 ) THEN331 ! Activate finer control of report outputs332 ! optionally switch off output from selected areas (note this only333 ! 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. )337 ELSE338 ! Use ln_ctl to turn on or off all options.339 CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. )340 ENDIF341 342 lwm = (narea == 1) ! control of output namelists343 lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print344 345 IF(lwm) THEN ! write merged namelists from earlier to output namelist346 ! ! 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 ) THEN351 DO ji = 1, SIZE(clnam)352 IF( TRIM(clnam(ji)) /= '' ) WRITE(numond, * ) clnam(ji) ! namusr_def print 353 END DO354 ENDIF355 ENDIF356 357 IF(lwp) THEN ! open listing units358 !359 CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )287 CALL mpp_start( ) 288 ENDIF 289 #endif 290 ! 291 narea = mpprank + 1 ! mpprank: the rank of proc (0 --> mppsize -1 ) 292 lwm = (narea == 1) ! control of output namelists 293 ! 294 ! !---------------------------------------------------------------! 295 ! ! Open output files, reference and configuration namelist files ! 296 ! !---------------------------------------------------------------! 297 ! 298 ! open ocean.output as soon as possible to get all output prints (including errors messages) 299 IF( lwm ) CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 300 ! open reference and configuration namelist files 301 CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 302 CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 303 IF( lwm ) CALL ctl_opn( numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 304 ! open /dev/null file to be able to supress output write easily 305 CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 306 ! 307 ! !--------------------! 308 ! ! Open listing units ! -> need ln_ctl from namctl to define lwp 309 ! !--------------------! 310 ! 311 REWIND( numnam_ref ) ! Namelist namctl in reference namelist 312 READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 313 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist' ) 314 REWIND( numnam_cfg ) ! Namelist namctl in confguration namelist 315 READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 316 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 317 ! 318 lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print 319 ! 320 IF(lwp) THEN ! open listing units 321 ! 322 IF( .NOT. lwm ) & ! alreay opened for narea == 1 323 & CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) 360 324 ! 361 325 WRITE(numout,*) 362 WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV -CMCC'326 WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' 363 327 WRITE(numout,*) ' NEMO team' 364 328 WRITE(numout,*) ' Ocean General Circulation Model' … … 379 343 WRITE(numout,*) " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " 380 344 WRITE(numout,*) 381 382 DO ji = 1, SIZE(cltxt)383 IF( TRIM(cltxt (ji)) /= '' ) WRITE(numout,*) TRIM(cltxt(ji)) ! control print of mynode384 END DO385 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 size389 END DO390 345 ! 391 346 WRITE(numout,cform_aaa) ! Flag AAAAAAA 392 347 ! 393 348 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 349 ! 350 ! finalize the definition of namctl variables 351 IF( sn_cfctl%l_config ) THEN 352 ! Activate finer control of report outputs 353 ! optionally switch off output from selected areas (note this only 354 ! applies to output which does not involve global communications) 355 IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax ) .OR. & 356 & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) ) & 357 & CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 358 ELSE 359 ! Use ln_ctl to turn on or off all options. 360 CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 361 ENDIF 362 ! 363 IF(lwm) WRITE( numond, namctl ) 364 ! 365 ! !------------------------------------! 366 ! ! Set global domain size parameters ! 367 ! !------------------------------------! 368 ! 369 REWIND( numnam_ref ) ! Namelist namcfg in reference namelist 370 READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 371 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 372 REWIND( numnam_cfg ) ! Namelist namcfg in confguration namelist 373 READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 374 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist' ) 375 ! 376 IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file 377 CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 378 ELSE ! user-defined namelist 379 CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 380 ENDIF 381 ! 382 IF(lwm) WRITE( numond, namcfg ) 383 ! 384 ! !-----------------------------------------! 385 ! ! mpp parameters and domain decomposition ! 386 ! !-----------------------------------------! 387 CALL mpp_init 399 388 400 389 ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays … … 507 496 !! ** Purpose : control print setting 508 497 !! 509 !! ** Method : - print namctl information and check some consistencies498 !! ** Method : - print namctl and namcfg information and check some consistencies 510 499 !!---------------------------------------------------------------------- 511 500 ! … … 673 662 END SUBROUTINE nemo_alloc 674 663 664 675 665 SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all ) 676 666 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.