Changeset 11822 for NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OCE/nemogcm.F90
- Timestamp:
- 2019-10-29T11:41:36+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OCE/nemogcm.F90
r11758 r11822 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 icbini ! handle bergs, initialisation … … 103 104 104 105 #if defined key_mpp_mpi 106 ! need MPI_Wtime 105 107 INCLUDE 'mpif.h' 106 108 #endif … … 128 130 !!---------------------------------------------------------------------- 129 131 INTEGER :: istp ! time step index 132 REAL(wp):: zstptiming ! elapsed time for 1 time step 130 133 !!---------------------------------------------------------------------- 131 134 ! … … 190 193 ! 191 194 DO WHILE( istp <= nitend .AND. nstop == 0 ) 192 #if defined key_mpp_mpi 195 193 196 ncom_stp = istp 194 IF ( istp == ( nit000 + 1 ) ) elapsed_time = MPI_Wtime() 195 IF ( istp == nitend ) elapsed_time = MPI_Wtime() - elapsed_time 196 #endif 197 IF( ln_timing ) THEN 198 zstptiming = MPI_Wtime() 199 IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming 200 IF ( istp == nitend ) elapsed_time = zstptiming - elapsed_time 201 ENDIF 202 197 203 CALL stp ( istp ) 198 204 istp = istp + 1 205 206 IF( lwp .AND. ln_timing ) WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming 207 199 208 END DO 200 209 ! … … 222 231 ! 223 232 IF( nstop /= 0 .AND. lwp ) THEN ! error print 224 WRITE(numout,cform_err) 225 WRITE(numout,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' 226 WRITE(numout,*) 233 WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' 234 CALL ctl_stop( ctmp1 ) 227 235 ENDIF 228 236 ! … … 236 244 #else 237 245 IF ( lk_oasis ) THEN ; CALL cpl_finalize ! end coupling and mpp communications with OASIS 238 ELSEIF( lk_mpp ) THEN ; CALL mppstop ( ldfinal = .TRUE. )! end mpp communications246 ELSEIF( lk_mpp ) THEN ; CALL mppstop ! end mpp communications 239 247 ENDIF 240 248 #endif … … 242 250 IF(lwm) THEN 243 251 IF( nstop == 0 ) THEN ; STOP 0 244 ELSE ; STOP 999252 ELSE ; STOP 123 245 253 ENDIF 246 254 ENDIF … … 255 263 !! ** Purpose : initialization of the NEMO GCM 256 264 !!---------------------------------------------------------------------- 257 INTEGER :: ji ! dummy loop indices 258 INTEGER :: ios, ilocal_comm ! local integers 259 CHARACTER(len=120), DIMENSION(60) :: cltxt, cltxt2, clnam 265 INTEGER :: ios, ilocal_comm ! local integers 260 266 !! 261 267 NAMELIST/namctl/ ln_ctl , sn_cfctl, nn_print, nn_ictls, nn_ictle, & … … 265 271 !!---------------------------------------------------------------------- 266 272 ! 267 cltxt = ''268 cltxt2 = ''269 clnam = ''270 273 cxios_context = 'nemo' 271 274 ! 272 ! ! Open reference namelist and configuration namelist files 273 CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 274 CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 275 ! 276 REWIND( numnam_ref ) ! Namelist namctl in reference namelist 277 READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 278 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. ) 279 REWIND( numnam_cfg ) ! Namelist namctl in confguration namelist 280 READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 281 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. ) 282 ! 283 REWIND( numnam_ref ) ! Namelist namcfg in reference namelist 284 READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 285 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. ) 286 REWIND( numnam_cfg ) ! Namelist namcfg in confguration namelist 287 READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 288 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. ) 289 290 ! !--------------------------! 291 ! ! Set global domain size ! (control print return in cltxt2) 292 ! !--------------------------! 293 IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file 294 CALL domain_cfg ( cltxt2, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 295 ! 296 ELSE ! user-defined namelist 297 CALL usr_def_nam( cltxt2, clnam, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 298 ENDIF 299 ! 300 ! 301 ! !--------------------------------------------! 302 ! ! set communicator & select the local node ! 303 ! ! NB: mynode also opens output.namelist.dyn ! 304 ! ! on unit number numond on first proc ! 305 ! !--------------------------------------------! 275 ! !-------------------------------------------------! 276 ! ! set communicator & select the local rank ! 277 ! ! must be done as soon as possible to get narea ! 278 ! !-------------------------------------------------! 279 ! 306 280 #if defined key_iomput 307 281 IF( Agrif_Root() ) THEN 308 282 IF( lk_oasis ) THEN 309 283 CALL cpl_init( "oceanx", ilocal_comm ) ! nemo local communicator given by oasis 310 CALL xios_initialize( "not used" , local_comm= ilocal_comm )! send nemo communicator to xios284 CALL xios_initialize( "not used" , local_comm =ilocal_comm ) ! send nemo communicator to xios 311 285 ELSE 312 CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm )! nemo local communicator given by xios286 CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm ) ! nemo local communicator given by xios 313 287 ENDIF 314 288 ENDIF 315 ! Nodes selection (control print return in cltxt) 316 narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 289 CALL mpp_start( ilocal_comm ) 317 290 #else 318 291 IF( lk_oasis ) THEN … … 320 293 CALL cpl_init( "oceanx", ilocal_comm ) ! nemo local communicator given by oasis 321 294 ENDIF 322 ! Nodes selection (control print return in cltxt) 323 narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) 295 CALL mpp_start( ilocal_comm ) 324 296 ELSE 325 ilocal_comm = 0 ! Nodes selection (control print return in cltxt)326 narea = mynode( cltxt, 'output.namelist.dyn', numnam_ref, numnam_cfg, numond , nstop )327 ENDIF 328 #endif 329 330 narea = narea + 1 ! mynode return the rank of proc (0 --> jpnij -1 )331 332 IF( sn_cfctl%l_config ) THEN333 ! Activate finer control of report outputs334 ! optionally switch off output from selected areas (note this only335 ! applies to output which does not involve global communications)336 IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax ) .OR. &337 & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) ) &338 & CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. )339 ELSE340 ! Use ln_ctl to turn on or off all options.341 CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. )342 ENDIF343 344 lwm = (narea == 1) ! control of output namelists345 lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print346 347 IF(lwm) THEN ! write merged namelists from earlier to output namelist348 ! ! now that the file has been opened in call to mynode.349 ! ! NB: nammpp has already been written in mynode (if lk_mpp_mpi)350 WRITE( numond, namctl)351 WRITE( numond, namcfg)352 IF( .NOT.ln_read_cfg ) THEN353 DO ji = 1, SIZE(clnam)354 IF( TRIM(clnam(ji)) /= '' ) WRITE(numond, * ) clnam(ji) ! namusr_def print 355 END DO356 ENDIF357 ENDIF358 359 IF(lwp) THEN ! open listing units360 !361 CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )297 CALL mpp_start( ) 298 ENDIF 299 #endif 300 ! 301 narea = mpprank + 1 ! mpprank: the rank of proc (0 --> mppsize -1 ) 302 lwm = (narea == 1) ! control of output namelists 303 ! 304 ! !---------------------------------------------------------------! 305 ! ! Open output files, reference and configuration namelist files ! 306 ! !---------------------------------------------------------------! 307 ! 308 ! open ocean.output as soon as possible to get all output prints (including errors messages) 309 IF( lwm ) CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 310 ! open reference and configuration namelist files 311 CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 312 CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 313 IF( lwm ) CALL ctl_opn( numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 314 ! open /dev/null file to be able to supress output write easily 315 CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 316 ! 317 ! !--------------------! 318 ! ! Open listing units ! -> need ln_ctl from namctl to define lwp 319 ! !--------------------! 320 ! 321 REWIND( numnam_ref ) ! Namelist namctl in reference namelist 322 READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 323 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist' ) 324 REWIND( numnam_cfg ) ! Namelist namctl in confguration namelist 325 READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 326 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 327 ! 328 lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print 329 ! 330 IF(lwp) THEN ! open listing units 331 ! 332 IF( .NOT. lwm ) & ! alreay opened for narea == 1 333 & CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) 362 334 ! 363 335 WRITE(numout,*) 364 WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV -CMCC'336 WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' 365 337 WRITE(numout,*) ' NEMO team' 366 338 WRITE(numout,*) ' Ocean General Circulation Model' … … 381 353 WRITE(numout,*) " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " 382 354 WRITE(numout,*) 383 384 DO ji = 1, SIZE(cltxt)385 IF( TRIM(cltxt (ji)) /= '' ) WRITE(numout,*) TRIM(cltxt(ji)) ! control print of mynode386 END DO387 WRITE(numout,*)388 WRITE(numout,*)389 DO ji = 1, SIZE(cltxt2)390 IF( TRIM(cltxt2(ji)) /= '' ) WRITE(numout,*) TRIM(cltxt2(ji)) ! control print of domain size391 END DO392 355 ! 393 356 WRITE(numout,cform_aaa) ! Flag AAAAAAA 394 357 ! 395 358 ENDIF 396 ! open /dev/null file to be able to supress output write easily 397 CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 398 ! 399 ! ! Domain decomposition 400 CALL mpp_init ! MPP 359 ! 360 ! finalize the definition of namctl variables 361 IF( sn_cfctl%l_config ) THEN 362 ! Activate finer control of report outputs 363 ! optionally switch off output from selected areas (note this only 364 ! applies to output which does not involve global communications) 365 IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax ) .OR. & 366 & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) ) & 367 & CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 368 ELSE 369 ! Use ln_ctl to turn on or off all options. 370 CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 371 ENDIF 372 ! 373 IF(lwm) WRITE( numond, namctl ) 374 ! 375 ! !------------------------------------! 376 ! ! Set global domain size parameters ! 377 ! !------------------------------------! 378 ! 379 REWIND( numnam_ref ) ! Namelist namcfg in reference namelist 380 READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 381 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 382 REWIND( numnam_cfg ) ! Namelist namcfg in confguration namelist 383 READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 384 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist' ) 385 ! 386 IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file 387 CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 388 ELSE ! user-defined namelist 389 CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 390 ENDIF 391 ! 392 IF(lwm) WRITE( numond, namcfg ) 393 ! 394 ! !-----------------------------------------! 395 ! ! mpp parameters and domain decomposition ! 396 ! !-----------------------------------------! 397 CALL mpp_init 401 398 402 399 ! 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( Nnn ) ! drifting Floats484 CALL flo_init( Nnn ) ! 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( Nnn ) ! heat content, salt content and volume budgets 492 489 CALL trd_init( Nnn ) ! Mixed-layer/Vorticity/Integral constraints trends … … 494 491 CALL dia_tmb_init ! TMB outputs 495 492 CALL dia_25h_init( Nbb ) ! 25h mean outputs 493 CALL dia_harm_init ! tidal harmonics outputs 496 494 IF( ln_diaobs ) CALL dia_obs( nit000-1, Nnn ) ! Observation operator for restart 497 495 … … 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.