Changeset 3163
- Timestamp:
- 2011-11-21T11:59:56+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90
r3154 r3163 43 43 USE mod_ioclient 44 44 #endif 45 USE prtctl ! Print control (prt_ctl_init routine) 45 USE prtctl ! Print control (prt_ctl_init routine) 46 USE timing ! Timing 46 47 47 48 IMPLICIT NONE … … 504 505 END SUBROUTINE factorise 505 506 507 #if defined key_mpp_mpi 508 SUBROUTINE nemo_northcomms 509 !!====================================================================== 510 !! *** ROUTINE nemo_northcomms *** 511 !! nemo_northcomms : Setup for north fold exchanges with explicit peer to peer messaging 512 !!===================================================================== 513 !!---------------------------------------------------------------------- 514 !! 515 !! ** Purpose : Initialization of the northern neighbours lists. 516 !!---------------------------------------------------------------------- 517 !! 1.0 ! 2011-10 (A. C. Coward, NOCS & J. Donners, PRACE) 518 !!---------------------------------------------------------------------- 519 520 INTEGER :: ji, jj, jk, ij, jtyp ! dummy loop indices 521 INTEGER :: ijpj ! number of rows involved in north-fold exchange 522 INTEGER :: northcomms_alloc ! allocate return status 523 REAL(wp), ALLOCATABLE, DIMENSION ( :,: ) :: znnbrs ! workspace 524 LOGICAL, ALLOCATABLE, DIMENSION ( : ) :: lrankset ! workspace 525 526 IF(lwp) WRITE(numout,*) 527 IF(lwp) WRITE(numout,*) 'nemo_northcomms : Initialization of the northern neighbours lists' 528 IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 529 530 !!---------------------------------------------------------------------- 531 ALLOCATE( znnbrs(jpi,jpj), stat = northcomms_alloc ) 532 ALLOCATE( lrankset(jpnij), stat = northcomms_alloc ) 533 IF( northcomms_alloc /= 0 ) THEN 534 WRITE(numout,cform_war) 535 WRITE(numout,*) 'northcomms_alloc : failed to allocate arrays' 536 CALL ctl_stop( 'STOP', 'nemo_northcomms : unable to allocate temporary arrays' ) 537 ENDIF 538 nsndto = 0 539 isendto = -1 540 ijpj = 4 541 ! 542 ! This routine has been called because ln_nnogather has been set true ( nammpp ) 543 ! However, these first few exchanges have to use the mpi_allgather method to 544 ! establish the neighbour lists to use in subsequent peer to peer exchanges. 545 ! Consequently, set l_north_nogather to be false here and set it true only after 546 ! the lists have been established. 547 ! 548 l_north_nogather = .FALSE. 549 ! 550 ! Exchange and store ranks on northern rows 551 552 DO jtyp = 1,4 553 554 lrankset = .FALSE. 555 znnbrs = narea 556 SELECT CASE (jtyp) 557 CASE(1) 558 CALL lbc_lnk( znnbrs, 'T', 1. ) ! Type 1: T,W-points 559 CASE(2) 560 CALL lbc_lnk( znnbrs, 'U', 1. ) ! Type 2: U-point 561 CASE(3) 562 CALL lbc_lnk( znnbrs, 'V', 1. ) ! Type 3: V-point 563 CASE(4) 564 CALL lbc_lnk( znnbrs, 'F', 1. ) ! Type 4: F-point 565 END SELECT 566 567 IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN 568 DO jj = nlcj-ijpj+1, nlcj 569 ij = jj - nlcj + ijpj 570 DO ji = 1,jpi 571 IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) & 572 & lrankset(INT(znnbrs(ji,jj))) = .true. 573 END DO 574 END DO 575 576 DO jj = 1,jpnij 577 IF ( lrankset(jj) ) THEN 578 nsndto(jtyp) = nsndto(jtyp) + 1 579 IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN 580 CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', & 581 & ' jpmaxngh will need to be increased ') 582 ENDIF 583 isendto(nsndto(jtyp),jtyp) = jj-1 ! narea converted to MPI rank 584 ENDIF 585 END DO 586 ENDIF 587 588 END DO 589 590 ! 591 ! Type 5: I-point 592 ! 593 ! ICE point exchanges may involve some averaging. The neighbours list is 594 ! built up using two exchanges to ensure that the whole stencil is covered. 595 ! lrankset should not be reset between these 'J' and 'K' point exchanges 596 597 jtyp = 5 598 lrankset = .FALSE. 599 znnbrs = narea 600 CALL lbc_lnk( znnbrs, 'J', 1. ) ! first ice U-V point 601 602 IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN 603 DO jj = nlcj-ijpj+1, nlcj 604 ij = jj - nlcj + ijpj 605 DO ji = 1,jpi 606 IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) & 607 & lrankset(INT(znnbrs(ji,jj))) = .true. 608 END DO 609 END DO 610 ENDIF 611 612 znnbrs = narea 613 CALL lbc_lnk( znnbrs, 'K', 1. ) ! second ice U-V point 614 615 IF ( njmppt(narea) .EQ. MAXVAL( njmppt )) THEN 616 DO jj = nlcj-ijpj+1, nlcj 617 ij = jj - nlcj + ijpj 618 DO ji = 1,jpi 619 IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) & 620 & lrankset( INT(znnbrs(ji,jj))) = .true. 621 END DO 622 END DO 623 624 DO jj = 1,jpnij 625 IF ( lrankset(jj) ) THEN 626 nsndto(jtyp) = nsndto(jtyp) + 1 627 IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN 628 CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', & 629 & ' jpmaxngh will need to be increased ') 630 ENDIF 631 isendto(nsndto(jtyp),jtyp) = jj-1 ! narea converted to MPI rank 632 ENDIF 633 END DO 634 ! 635 ! For northern row areas, set l_north_nogather so that all subsequent exchanges 636 ! can use peer to peer communications at the north fold 637 ! 638 l_north_nogather = .TRUE. 639 ! 640 ENDIF 641 DEALLOCATE( znnbrs ) 642 DEALLOCATE( lrankset ) 643 644 END SUBROUTINE nemo_northcomms 645 #else 646 SUBROUTINE nemo_northcomms ! Dummy routine 647 WRITE(*,*) 'nemo_northcomms: You should not have seen this print! error?' 648 END SUBROUTINE nemo_northcomms 649 #endif 506 650 !!====================================================================== 507 651 END MODULE nemogcm
Note: See TracChangeset
for help on using the changeset viewer.