- Timestamp:
- 2020-05-14T21:46:00+02:00 (4 years ago)
- Location:
- NEMO/branches/2019/dev_r11078_OSMOSIS_IMMERSE_Nurser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2019/dev_r11078_OSMOSIS_IMMERSE_Nurser
- Property svn:externals
-
old new 6 6 ^/vendors/FCM@HEAD ext/FCM 7 7 ^/vendors/IOIPSL@HEAD ext/IOIPSL 8 9 # SETTE 10 ^/utils/CI/sette@HEAD sette
-
- Property svn:externals
-
NEMO/branches/2019/dev_r11078_OSMOSIS_IMMERSE_Nurser/src/OCE/LBC/lib_mpp.F90
r12178 r12928 32 32 !! ctl_opn : Open file and check if required file is available. 33 33 !! ctl_nam : Prints informations when an error occurs while reading a namelist 34 !! load_nml : Read, condense and buffer namelist file into character array for use as an internal file 34 35 !!---------------------------------------------------------------------- 35 36 !!---------------------------------------------------------------------- … … 50 51 !! mpp_ini_north : initialisation of north fold 51 52 !! mpp_lbc_north_icb : alternative to mpp_nfd for extra outer halo with icebergs 53 !! mpp_bcast_nml : broadcast/receive namelist character buffer from reading process to all others 52 54 !!---------------------------------------------------------------------- 53 55 USE dom_oce ! ocean space and time domain … … 57 59 PRIVATE 58 60 ! 59 PUBLIC ctl_stop, ctl_warn, ctl_opn, ctl_nam 61 PUBLIC ctl_stop, ctl_warn, ctl_opn, ctl_nam, load_nml 60 62 PUBLIC mpp_start, mppstop, mppsync, mpp_comm_free 61 63 PUBLIC mpp_ini_north … … 66 68 PUBLIC mppsend, mpprecv ! needed by TAM and ICB routines 67 69 PUBLIC mpp_report 70 PUBLIC mpp_bcast_nml 68 71 PUBLIC tic_tac 69 72 #if ! defined key_mpp_mpi … … 139 142 INTEGER, PUBLIC :: ncom_stp = 0 !: copy of time step # istp 140 143 INTEGER, PUBLIC :: ncom_fsbc = 1 !: copy of sbc time step # nn_fsbc 141 INTEGER, PUBLIC :: ncom_dttrc = 1 !: copy of top time step # nn_dttrc142 144 INTEGER, PUBLIC :: ncom_freq !: frequency of comm diagnostic 143 145 INTEGER, PUBLIC , DIMENSION(:,:), ALLOCATABLE :: ncomm_sequence !: size of communicated arrays (halos) … … 170 172 LOGICAL, PUBLIC :: l_north_nogather = .FALSE. !: internal control of northfold comms 171 173 174 !! * Substitutions 175 # include "do_loop_substitute.h90" 172 176 !!---------------------------------------------------------------------- 173 177 !! NEMO/OCE 4.0 , NEMO Consortium (2018) … … 398 402 # if defined key_mpi2 399 403 IF( ln_timing ) CALL tic_tac( .TRUE., ld_global = .TRUE.) 400 CALL mpi_allreduce( y_in(:), todelay(idvar)%y1d(:), isz, MPI_DOUBLE_COMPLEX, mpi_sumdd, ilocalcomm, ndelayid(idvar), ierr ) 404 CALL mpi_allreduce( y_in(:), todelay(idvar)%y1d(:), isz, MPI_DOUBLE_COMPLEX, mpi_sumdd, ilocalcomm, ierr ) 405 ndelayid(idvar) = 1 401 406 IF( ln_timing ) CALL tic_tac(.FALSE., ld_global = .TRUE.) 402 407 # else … … 465 470 # if defined key_mpi2 466 471 IF( ln_timing ) CALL tic_tac( .TRUE., ld_global = .TRUE.) 467 CALL mpi_allreduce( p_in(:), todelay(idvar)%z1d(:), isz, MPI_DOUBLE_PRECISION, mpi_max, ilocalcomm, ndelayid(idvar), ierr ) 472 CALL mpi_allreduce( p_in(:), todelay(idvar)%z1d(:), isz, MPI_DOUBLE_PRECISION, mpi_max, ilocalcomm, ierr ) 473 ndelayid(idvar) = 1 468 474 IF( ln_timing ) CALL tic_tac(.FALSE., ld_global = .TRUE.) 469 475 # else … … 499 505 #endif 500 506 END SUBROUTINE mpp_delay_rcv 507 508 SUBROUTINE mpp_bcast_nml( cdnambuff , kleng ) 509 CHARACTER(LEN=:) , ALLOCATABLE, INTENT(INOUT) :: cdnambuff 510 INTEGER , INTENT(INOUT) :: kleng 511 !!---------------------------------------------------------------------- 512 !! *** routine mpp_bcast_nml *** 513 !! 514 !! ** Purpose : broadcast namelist character buffer 515 !! 516 !!---------------------------------------------------------------------- 517 !! 518 INTEGER :: iflag 519 !!---------------------------------------------------------------------- 520 ! 521 #if defined key_mpp_mpi 522 call MPI_BCAST(kleng, 1, MPI_INT, 0, mpi_comm_oce, iflag) 523 call MPI_BARRIER(mpi_comm_oce, iflag) 524 !$AGRIF_DO_NOT_TREAT 525 IF ( .NOT. ALLOCATED(cdnambuff) ) ALLOCATE( CHARACTER(LEN=kleng) :: cdnambuff ) 526 !$AGRIF_END_DO_NOT_TREAT 527 call MPI_BCAST(cdnambuff, kleng, MPI_CHARACTER, 0, mpi_comm_oce, iflag) 528 call MPI_BARRIER(mpi_comm_oce, iflag) 529 #endif 530 ! 531 END SUBROUTINE mpp_bcast_nml 501 532 502 533 … … 921 952 ! 922 953 ! find the smallest common frequency: default = frequency product, if multiple, choose the larger of the 2 frequency 923 IF( ncom_dttrc /= 1 ) CALL ctl_stop( 'STOP', 'mpp_report, ncom_dttrc /= 1 not coded...' )924 954 ncom_freq = ncom_fsbc 925 955 ! … … 1068 1098 1069 1099 !!---------------------------------------------------------------------- 1070 !! ctl_stop, ctl_warn, get_unit, ctl_opn, ctl_nam routines1100 !! ctl_stop, ctl_warn, get_unit, ctl_opn, ctl_nam, load_nml routines 1071 1101 !!---------------------------------------------------------------------- 1072 1102 … … 1204 1234 & OPEN(UNIT=knum,FILE='NUL', FORM=cdform, ACCESS=cdacce, STATUS=cdstat , ERR=100, IOSTAT=iost ) 1205 1235 IF( iost == 0 ) THEN 1206 IF(ldwp ) THEN1236 IF(ldwp .AND. kout > 0) THEN 1207 1237 WRITE(kout,*) ' file : ', TRIM(clfile),' open ok' 1208 1238 WRITE(kout,*) ' unit = ', knum … … 1279 1309 END FUNCTION get_unit 1280 1310 1311 SUBROUTINE load_nml( cdnambuff , cdnamfile, kout, ldwp) 1312 CHARACTER(LEN=:) , ALLOCATABLE, INTENT(INOUT) :: cdnambuff 1313 CHARACTER(LEN=*), INTENT(IN ) :: cdnamfile 1314 CHARACTER(LEN=256) :: chline 1315 CHARACTER(LEN=1) :: csp 1316 INTEGER, INTENT(IN) :: kout 1317 LOGICAL, INTENT(IN) :: ldwp !: .true. only for the root broadcaster 1318 INTEGER :: itot, iun, iltc, inl, ios, itotsav 1319 ! 1320 !csp = NEW_LINE('A') 1321 ! a new line character is the best seperator but some systems (e.g.Cray) 1322 ! seem to terminate namelist reads from internal files early if they 1323 ! encounter new-lines. Use a single space for safety. 1324 csp = ' ' 1325 ! 1326 ! Check if the namelist buffer has already been allocated. Return if it has. 1327 ! 1328 IF ( ALLOCATED( cdnambuff ) ) RETURN 1329 IF( ldwp ) THEN 1330 ! 1331 ! Open namelist file 1332 ! 1333 CALL ctl_opn( iun, cdnamfile, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, kout, ldwp ) 1334 ! 1335 ! First pass: count characters excluding comments and trimable white space 1336 ! 1337 itot=0 1338 10 READ(iun,'(A256)',END=20,ERR=20) chline 1339 iltc = LEN_TRIM(chline) 1340 IF ( iltc.GT.0 ) THEN 1341 inl = INDEX(chline, '!') 1342 IF( inl.eq.0 ) THEN 1343 itot = itot + iltc + 1 ! +1 for the newline character 1344 ELSEIF( inl.GT.0 .AND. LEN_TRIM( chline(1:inl-1) ).GT.0 ) THEN 1345 itot = itot + inl ! includes +1 for the newline character 1346 ENDIF 1347 ENDIF 1348 GOTO 10 1349 20 CONTINUE 1350 ! 1351 ! Allocate text cdnambuff for condensed namelist 1352 ! 1353 !$AGRIF_DO_NOT_TREAT 1354 ALLOCATE( CHARACTER(LEN=itot) :: cdnambuff ) 1355 !$AGRIF_END_DO_NOT_TREAT 1356 itotsav = itot 1357 ! 1358 ! Second pass: read and transfer pruned characters into cdnambuff 1359 ! 1360 REWIND(iun) 1361 itot=1 1362 30 READ(iun,'(A256)',END=40,ERR=40) chline 1363 iltc = LEN_TRIM(chline) 1364 IF ( iltc.GT.0 ) THEN 1365 inl = INDEX(chline, '!') 1366 IF( inl.eq.0 ) THEN 1367 inl = iltc 1368 ELSE 1369 inl = inl - 1 1370 ENDIF 1371 IF( inl.GT.0 .AND. LEN_TRIM( chline(1:inl) ).GT.0 ) THEN 1372 cdnambuff(itot:itot+inl-1) = chline(1:inl) 1373 WRITE( cdnambuff(itot+inl:itot+inl), '(a)' ) csp 1374 itot = itot + inl + 1 1375 ENDIF 1376 ENDIF 1377 GOTO 30 1378 40 CONTINUE 1379 itot = itot - 1 1380 IF( itotsav .NE. itot ) WRITE(*,*) 'WARNING in load_nml. Allocated ',itotsav,' for read buffer; but used ',itot 1381 ! 1382 ! Close namelist file 1383 ! 1384 CLOSE(iun) 1385 !write(*,'(32A)') cdnambuff 1386 ENDIF 1387 #if defined key_mpp_mpi 1388 CALL mpp_bcast_nml( cdnambuff, itot ) 1389 #endif 1390 END SUBROUTINE load_nml 1391 1392 1281 1393 !!---------------------------------------------------------------------- 1282 1394 END MODULE lib_mpp
Note: See TracChangeset
for help on using the changeset viewer.