Changeset 15289
- Timestamp:
- 2021-09-24T18:02:10+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/trunk/src/OCE/BDY/bdyini.F90
r15014 r15289 549 549 ! 550 550 icount = icount + 1 551 idx_bdy(ib_bdy)%nbi(icount,igrd) = nbidta(ib,igrd,ib_bdy) - mig(1)+1 ! global to local indexes552 idx_bdy(ib_bdy)%nbj(icount,igrd) = nbjdta(ib,igrd,ib_bdy) - mjg(1)+1 ! global to local indexes551 idx_bdy(ib_bdy)%nbi(icount,igrd) = nbidta(ib,igrd,ib_bdy) - mig(1) + 1 ! global to local indexes 552 idx_bdy(ib_bdy)%nbj(icount,igrd) = nbjdta(ib,igrd,ib_bdy) - mjg(1) + 1 ! global to local indexes 553 553 idx_bdy(ib_bdy)%nbr(icount,igrd) = nbrdta(ib,igrd,ib_bdy) 554 554 idx_bdy(ib_bdy)%nbmap(icount,igrd) = ib … … 577 577 ! check if point has to be sent to a neighbour 578 578 ! W neighbour and on the inner left side 579 IF( ii == 2.AND. mpiSnei(nn_hls,jpwe) > -1 ) lsend_bdy(ib_bdy,igrd,jpwe,ir) = .TRUE.579 IF( ii >= Nis0 .AND. ii < Nis0 + nn_hls .AND. mpiSnei(nn_hls,jpwe) > -1 ) lsend_bdy(ib_bdy,igrd,jpwe,ir) = .TRUE. 580 580 ! E neighbour and on the inner right side 581 IF( ii == jpi-1.AND. mpiSnei(nn_hls,jpea) > -1 ) lsend_bdy(ib_bdy,igrd,jpea,ir) = .TRUE.581 IF( ii <= Nie0 .AND. ii > Nie0 - nn_hls .AND. mpiSnei(nn_hls,jpea) > -1 ) lsend_bdy(ib_bdy,igrd,jpea,ir) = .TRUE. 582 582 ! S neighbour and on the inner down side 583 IF( ij == 2.AND. mpiSnei(nn_hls,jpso) > -1 ) lsend_bdy(ib_bdy,igrd,jpso,ir) = .TRUE.583 IF( ij >= Njs0 .AND. ij < Njs0 + nn_hls .AND. mpiSnei(nn_hls,jpso) > -1 ) lsend_bdy(ib_bdy,igrd,jpso,ir) = .TRUE. 584 584 ! N neighbour and on the inner up side 585 IF( ij == jpj-1.AND. mpiSnei(nn_hls,jpno) > -1 ) lsend_bdy(ib_bdy,igrd,jpno,ir) = .TRUE.585 IF( ij <= Nje0 .AND. ij > Nje0 - nn_hls .AND. mpiSnei(nn_hls,jpno) > -1 ) lsend_bdy(ib_bdy,igrd,jpno,ir) = .TRUE. 586 586 ! 587 587 ! check if point has to be received from a neighbour 588 588 ! W neighbour and on the outter left side 589 IF( ii == 1.AND. mpiRnei(nn_hls,jpwe) > -1 ) lrecv_bdy(ib_bdy,igrd,jpwe,ir) = .TRUE.589 IF( ii < Nis0 .AND. mpiRnei(nn_hls,jpwe) > -1 ) lrecv_bdy(ib_bdy,igrd,jpwe,ir) = .TRUE. 590 590 ! E neighbour and on the outter right side 591 IF( ii == jpi.AND. mpiRnei(nn_hls,jpea) > -1 ) lrecv_bdy(ib_bdy,igrd,jpea,ir) = .TRUE.591 IF( ii > Nie0 .AND. mpiRnei(nn_hls,jpea) > -1 ) lrecv_bdy(ib_bdy,igrd,jpea,ir) = .TRUE. 592 592 ! S neighbour and on the outter down side 593 IF( ij == 1.AND. mpiRnei(nn_hls,jpso) > -1 ) lrecv_bdy(ib_bdy,igrd,jpso,ir) = .TRUE.593 IF( ij < Njs0 .AND. mpiRnei(nn_hls,jpso) > -1 ) lrecv_bdy(ib_bdy,igrd,jpso,ir) = .TRUE. 594 594 ! N neighbour and on the outter up side 595 IF( ij == jpj.AND. mpiRnei(nn_hls,jpno) > -1 ) lrecv_bdy(ib_bdy,igrd,jpno,ir) = .TRUE.595 IF( ij > Nje0 .AND. mpiRnei(nn_hls,jpno) > -1 ) lrecv_bdy(ib_bdy,igrd,jpno,ir) = .TRUE. 596 596 ! 597 597 END DO … … 642 642 ! Read global 2D mask at T-points: bdytmask 643 643 ! ----------------------------------------- 644 ! bdytmask = 1 on the computational domain ANDon open boundaries644 ! bdytmask = 1 on the computational domain but not on open boundaries 645 645 ! = 0 elsewhere 646 646 … … 732 732 ! 733 733 ! search neighbour in the west/east direction 734 ! Rim is on the halo and computed ocean is towards exterior of mpi domain 734 ! 735 ! Rim is on the halo and computed ocean is towards exterior of mpi domain : 735 736 ! <-- (o exterior) --> 736 737 ! (1) o|x OR (2) x|o 737 738 ! |___ ___| 739 ! ==> cannot compute the point x -> need to receive it 738 740 IF( iibi==0 .OR. ii1==0 .OR. ii2==0 .OR. ii3==0 ) lrecv_bdyint(ib_bdy,igrd,jpwe,ir) = .TRUE. 739 741 IF( iibi==jpi+1 .OR. ii1==jpi+1 .OR. ii2==jpi+1 .OR. ii3==jpi+1 ) lrecv_bdyint(ib_bdy,igrd,jpea,ir) = .TRUE. 740 742 IF( iibe==0 ) lrecv_bdyext(ib_bdy,igrd,jpwe,ir) = .TRUE. 741 743 IF( iibe==jpi+1 ) lrecv_bdyext(ib_bdy,igrd,jpea,ir) = .TRUE. 742 ! Check if neighbour has its rim parallel to its mpi subdomain border and located next to its halo 744 ! Check if neighbour has its rim parallel to its mpi subdomain border and located next to its halo. 743 745 ! :¨¨¨¨¨|¨¨--> | | <--¨¨|¨¨¨¨¨: 744 746 ! : | x:o | neighbour limited by ... would need o | o:x | : 745 747 ! :.....|_._:_____| (1) W neighbour E neighbour (2) |_____:_._|.....: 746 IF( ii==2 .AND. mpiSnei(nn_hls,jpwe) > -1 .AND. & 747 & ( iibi==3 .OR. ii1==3 .OR. ii2==3 .OR. ii3==3 ) ) lsend_bdyint(ib_bdy,igrd,jpwe,ir) = .TRUE. 748 IF( ii==jpi-1 .AND. mpiSnei(nn_hls,jpea) > -1 .AND. & 749 & ( iibi==jpi-2 .OR. ii1==jpi-2 .OR. ii2==jpi-2 .OR. ii3==jpi-2) ) lsend_bdyint(ib_bdy,igrd,jpea,ir) = .TRUE. 750 IF( ii==2 .AND. mpiSnei(nn_hls,jpwe) > -1 .AND. iibe==3 ) lsend_bdyext(ib_bdy,igrd,jpwe,ir) = .TRUE. 751 IF( ii==jpi-1 .AND. mpiSnei(nn_hls,jpea) > -1 .AND. iibe==jpi-2 ) lsend_bdyext(ib_bdy,igrd,jpea,ir) = .TRUE. 748 ! ==> the neighbour cannot compute the point x -> need to send it 749 IF( ii==nn_hls+1 .AND. mpiSnei(nn_hls,jpwe) > -1 .AND. & 750 & ( iibi==ii+1 .OR. ii1==ii+1 .OR. ii2==ii+1 .OR. ii3==ii+1) ) lsend_bdyint(ib_bdy,igrd,jpwe,ir) = .TRUE. 751 IF( ii==jpi-nn_hls .AND. mpiSnei(nn_hls,jpea) > -1 .AND. & 752 & ( iibi==ii-1 .OR. ii1==ii-1 .OR. ii2==ii-1 .OR. ii3==ii-1) ) lsend_bdyint(ib_bdy,igrd,jpea,ir) = .TRUE. 753 IF( ii==nn_hls+1 .AND. mpiSnei(nn_hls,jpwe) > -1 .AND. iibe==ii+1 ) lsend_bdyext(ib_bdy,igrd,jpwe,ir) = .TRUE. 754 IF( ii==jpi-nn_hls .AND. mpiSnei(nn_hls,jpea) > -1 .AND. iibe==ii-1 ) lsend_bdyext(ib_bdy,igrd,jpea,ir) = .TRUE. 752 755 ! 753 756 ! search neighbour in the north/south direction 757 ! 754 758 ! Rim is on the halo and computed ocean is towards exterior of mpi domain 759 ! ==> cannot compute the point x -> need to receive it 755 760 !(3) | | ^ ___o___ 756 761 ! | |___x___| OR | | x | … … 764 769 ! | |¨¨¨¨x¨¨¨¨| neighbour limited by ... would need o | |....x....| 765 770 ! :_________: (3) S neighbour N neighbour (4) v | o | 766 IF( ij==2 .AND. mpiSnei(nn_hls,jpso) > -1 .AND. & 767 & ( ijbi==3 .OR. ij1==3 .OR. ij2==3 .OR. ij3==3 ) ) lsend_bdyint(ib_bdy,igrd,jpso,ir) = .TRUE. 768 IF( ij==jpj-1 .AND. mpiSnei(nn_hls,jpno) > -1 .AND. & 769 & ( ijbi==jpj-2 .OR. ij1==jpj-2 .OR. ij2==jpj-2 .OR. ij3==jpj-2) ) lsend_bdyint(ib_bdy,igrd,jpno,ir) = .TRUE. 770 IF( ij==2 .AND. mpiSnei(nn_hls,jpso) > -1 .AND. ijbe==3 ) lsend_bdyext(ib_bdy,igrd,jpso,ir) = .TRUE. 771 IF( ij==jpj-1 .AND. mpiSnei(nn_hls,jpno) > -1 .AND. ijbe==jpj-2 ) lsend_bdyext(ib_bdy,igrd,jpno,ir) = .TRUE. 771 ! ==> the neighbour cannot compute the point x -> need to send it 772 IF( ij==nn_hls+1 .AND. mpiSnei(nn_hls,jpso) > -1 .AND. & 773 & ( ijbi==ij+1 .OR. ij1==ij+1 .OR. ij2==ij+1 .OR. ij3==ij+1) ) lsend_bdyint(ib_bdy,igrd,jpso,ir) = .TRUE. 774 IF( ij==jpj-nn_hls .AND. mpiSnei(nn_hls,jpno) > -1 .AND. & 775 & ( ijbi==ij-1 .OR. ij1==ij-1 .OR. ij2==ij-1 .OR. ij3==ij-1) ) lsend_bdyint(ib_bdy,igrd,jpno,ir) = .TRUE. 776 IF( ij==nn_hls+1 .AND. mpiSnei(nn_hls,jpso) > -1 .AND. ijbe==ij+1 ) lsend_bdyext(ib_bdy,igrd,jpso,ir) = .TRUE. 777 IF( ij==jpj-nn_hls .AND. mpiSnei(nn_hls,jpno) > -1 .AND. ijbe==ij-1 ) lsend_bdyext(ib_bdy,igrd,jpno,ir) = .TRUE. 772 778 END DO 773 779 END DO … … 813 819 !! - and look at the ocean neighbours to compute ntreat 814 820 !!---------------------------------------------------------------------- 815 REAL(wp), TARGET, DIMENSION(jpi,jpj), INTENT (in ) :: p fmask ! temporary fmask excluding coastal boundary condition (shlat)816 REAL(wp), TARGET, DIMENSION(jpi,jpj), INTENT (in ) :: p umask, pvmask ! temporary t/u/v mask array817 LOGICAL , INTENT (in ) :: lrim0 ! .true. -> rim 0 .false. -> rim 1821 REAL(wp), TARGET, DIMENSION(jpi,jpj), INTENT (in ) :: pumask, pvmask ! temporary u/v mask array 822 REAL(wp), TARGET, DIMENSION(jpi,jpj), INTENT (in ) :: pfmask ! temporary fmask excluding coastal boundary condition (shlat) 823 LOGICAL , INTENT (in ) :: lrim0 ! .true. -> rim 0 .false. -> rim 1 818 824 INTEGER :: ib_bdy, ii, ij, igrd, ib, icount ! dummy loop indices 819 825 INTEGER :: i_offset, j_offset, inn ! local integer … … 830 836 DO ib_bdy = 1, nb_bdy ! Indices and directions of rim velocity components 831 837 832 ! Calculate relationship of U direction to the local orientation of the boundary 833 ! flagu = -1 : u component is normal to the dynamical boundary and its direction is outward 834 ! flagu = 0 : u is tangential 835 ! flagu = 1 : u is normal to the boundary and is direction is inward 836 DO igrd = 1, jpbgrd 837 SELECT CASE( igrd ) 838 CASE( 1 ) ; zmask => pumask ; i_offset = 0 839 CASE( 2 ) ; zmask => bdytmask ; i_offset = 1 840 CASE( 3 ) ; zmask => pfmask ; i_offset = 0 841 END SELECT 842 icount = 0 843 ztmp(:,:) = -999._wp 838 DO igrd = 1, jpbgrd 839 844 840 IF( lrim0 ) THEN ! extent of rim 0 845 841 ibeg = 1 ; iend = idx_bdy(ib_bdy)%nblenrim0(igrd) … … 847 843 ibeg = idx_bdy(ib_bdy)%nblenrim0(igrd) + 1 ; iend = idx_bdy(ib_bdy)%nblenrim(igrd) 848 844 END IF 845 846 ! Calculate relationship of U direction to the local orientation of the boundary 847 ! flagu = -1 : u component is normal to the dynamical boundary and its direction is outward 848 ! flagu = 0 : u is tangential 849 ! flagu = 1 : u is normal to the boundary and is direction is inward 850 SELECT CASE( igrd ) 851 CASE( 1 ) ; zmask => pumask ; i_offset = 0 ! U(i-1) T(i) U(i ) 852 CASE( 2 ) ; zmask => bdytmask ; i_offset = 1 ! T(i ) U(i) T(i+1) 853 CASE( 3 ) ; zmask => pfmask ; i_offset = 0 ! F(i-1) V(i) F(i ) 854 END SELECT 855 icount = 0 856 ztmp(:,:) = -999._wp 849 857 DO ib = ibeg, iend 850 858 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 851 859 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 852 IF( ii == 1 .OR. ii == jpi .OR. ij == 1 .OR. ij == jpj ) CYCLE860 IF( ii < Nis0 .OR. ii > Nie0 .OR. ij < Njs0 .OR. ij > Nje0 ) CYCLE ! call lbc_lnk -> no need to compute these pts 853 861 zwfl = zmask(ii+i_offset-1,ij) 854 862 zefl = zmask(ii+i_offset ,ij) 855 ! This error check only works if you are using the bdyXmask arrays 856 IF( i_offset == 1 .and. zefl + zwfl == 2. ) THEN863 ! This error check only works if you are using the bdyXmask arrays (which are set to 0 on rims) 864 IF( i_offset == 1 .and. zefl + zwfl == 2._wp ) THEN 857 865 icount = icount + 1 858 866 IF(lwp) WRITE(numout,*) 'Problem with igrd = ',igrd,' at (global) nbi, nbj : ',mig(ii),mjg(ij) … … 876 884 idx_bdy(ib_bdy)%flagu(ib,igrd) = ztmp(ii,ij) 877 885 END DO 878 END DO 879 880 ! Calculate relationship of V direction to the local orientation of the boundary 881 ! flagv = -1 : v component is normal to the dynamical boundary but its direction is outward 882 ! flagv = 0 : v is tangential 883 ! flagv = 1 : v is normal to the boundary and is direction is inward 884 DO igrd = 1, jpbgrd 886 887 ! Calculate relationship of V direction to the local orientation of the boundary 888 ! flagv = -1 : v component is normal to the dynamical boundary but its direction is outward 889 ! flagv = 0 : v is tangential 890 ! flagv = 1 : v is normal to the boundary and is direction is inward 885 891 SELECT CASE( igrd ) 886 892 CASE( 1 ) ; zmask => pvmask ; j_offset = 0 … … 890 896 icount = 0 891 897 ztmp(:,:) = -999._wp 892 IF( lrim0 ) THEN ! extent of rim 0893 ibeg = 1 ; iend = idx_bdy(ib_bdy)%nblenrim0(igrd)894 ELSE ! extent of rim 1895 ibeg = idx_bdy(ib_bdy)%nblenrim0(igrd) + 1 ; iend = idx_bdy(ib_bdy)%nblenrim(igrd)896 END IF897 898 DO ib = ibeg, iend 898 899 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 899 900 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 900 IF( ii == 1 .OR. ii == jpi .OR. ij == 1 .OR. ij == jpj ) CYCLE901 IF( ii < Nis0 .OR. ii > Nie0 .OR. ij < Njs0 .OR. ij > Nje0 ) CYCLE ! call lbc_lnk -> no need to compute these pts 901 902 zsfl = zmask(ii,ij+j_offset-1) 902 903 znfl = zmask(ii,ij+j_offset ) 903 ! This error check only works if you are using the bdyXmask arrays 904 IF( j_offset == 1 .and. znfl + zsfl == 2. ) THEN904 ! This error check only works if you are using the bdyXmask arrays (which are set to 0 on rims) 905 IF( j_offset == 1 .and. znfl + zsfl == 2._wp ) THEN 905 906 IF(lwp) WRITE(numout,*) 'Problem with igrd = ',igrd,' at (global) nbi, nbj : ',mig(ii),mjg(ij) 906 907 icount = icount + 1 … … 924 925 idx_bdy(ib_bdy)%flagv(ib,igrd) = ztmp(ii,ij) 925 926 END DO 926 END DO927 !928 END DO ! ib_bdy929 927 930 DO ib_bdy = 1, nb_bdy 931 DO igrd = 1, jpbgrd 928 ! Calculate ntreat 932 929 SELECT CASE( igrd ) 933 930 CASE( 1 ) ; zmask => bdytmask … … 936 933 END SELECT 937 934 ztmp(:,:) = -999._wp 938 IF( lrim0 ) THEN ! extent of rim 0939 ibeg = 1 ; iend = idx_bdy(ib_bdy)%nblenrim0(igrd)940 ELSE ! extent of rim 1941 ibeg = idx_bdy(ib_bdy)%nblenrim0(igrd) + 1 ; iend = idx_bdy(ib_bdy)%nblenrim(igrd)942 END IF943 935 DO ib = ibeg, iend 944 936 ii = idx_bdy(ib_bdy)%nbi(ib,igrd) 945 937 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 946 IF( ii == 1 .OR. ii == jpi .OR. ij == 1 .OR. ij == jpj ) CYCLE947 llnon = zmask(ii ,ij+1) == 1. 948 llson = zmask(ii ,ij-1) == 1. 949 llean = zmask(ii+1,ij ) == 1. 950 llwen = zmask(ii-1,ij ) == 1. 938 IF( ii < Nis0 .OR. ii > Nie0 .OR. ij < Njs0 .OR. ij > Nje0 ) CYCLE ! call lbc_lnk -> no need to compute these pts 939 llnon = zmask(ii ,ij+1) == 1._wp 940 llson = zmask(ii ,ij-1) == 1._wp 941 llean = zmask(ii+1,ij ) == 1._wp 942 llwen = zmask(ii-1,ij ) == 1._wp 951 943 inn = COUNT( (/ llnon, llson, llean, llwen /) ) 952 944 IF( inn == 0 ) THEN ! no neighbours -> interior of a corner or cluster of rim points … … 954 946 ! 1 | o ! 2 o | ! 3 | x ! 4 x | ! | | -> error 955 947 ! |_x_ _ ! _ _x_| ! | o ! o | ! |x_x| 956 IF( zmask(ii+1,ij+1) == 1. ) THEN ; ztmp(ii,ij) = 1.957 ELSEIF( zmask(ii-1,ij+1) == 1. ) THEN ; ztmp(ii,ij) = 2.958 ELSEIF( zmask(ii+1,ij-1) == 1. ) THEN ; ztmp(ii,ij) = 3.959 ELSEIF( zmask(ii-1,ij-1) == 1. ) THEN ; ztmp(ii,ij) = 4.960 ELSE ; ztmp(ii,ij) = -1.948 IF( zmask(ii+1,ij+1) == 1._wp ) THEN ; ztmp(ii,ij) = 1._wp 949 ELSEIF( zmask(ii-1,ij+1) == 1._wp ) THEN ; ztmp(ii,ij) = 2._wp 950 ELSEIF( zmask(ii+1,ij-1) == 1._wp ) THEN ; ztmp(ii,ij) = 3._wp 951 ELSEIF( zmask(ii-1,ij-1) == 1._wp ) THEN ; ztmp(ii,ij) = 4._wp 952 ELSE ; ztmp(ii,ij) = -1._wp 961 953 WRITE(ctmp1,*) 'Problem with ',cgrid(igrd) ,' grid point', ii, ij, & 962 954 ' on boundary set ', ib_bdy, ' has no free ocean neighbour' … … 973 965 ! 5 | x o ! 6 o x | ! 7 __x__ ! 8 x 974 966 ! | ! | ! ! o 975 IF( llean ) ztmp(ii,ij) = 5. 976 IF( llwen ) ztmp(ii,ij) = 6. 977 IF( llnon ) ztmp(ii,ij) = 7. 978 IF( llson ) ztmp(ii,ij) = 8. 967 IF( llean ) ztmp(ii,ij) = 5._wp 968 IF( llwen ) ztmp(ii,ij) = 6._wp 969 IF( llnon ) ztmp(ii,ij) = 7._wp 970 IF( llson ) ztmp(ii,ij) = 8._wp 979 971 END IF 980 972 IF( inn == 2 ) THEN ! exterior of a corner … … 982 974 ! 9 ____x o ! 10 o x___ ! 11 x o ! 12 o x 983 975 ! | ! | ! o ! o 984 IF( llnon .AND. llean ) ztmp(ii,ij) = 9. 985 IF( llnon .AND. llwen ) ztmp(ii,ij) = 10. 986 IF( llson .AND. llean ) ztmp(ii,ij) = 11. 987 IF( llson .AND. llwen ) ztmp(ii,ij) = 12. 976 IF( llnon .AND. llean ) ztmp(ii,ij) = 9._wp 977 IF( llnon .AND. llwen ) ztmp(ii,ij) = 10._wp 978 IF( llson .AND. llean ) ztmp(ii,ij) = 11._wp 979 IF( llson .AND. llwen ) ztmp(ii,ij) = 12._wp 988 980 END IF 989 981 IF( inn == 3 ) THEN ! 3 neighbours __ __ … … 991 983 ! 13 _| x o ! 14 o x |_ ! 15 o x o ! 16 o x o 992 984 ! | o ! o | ! o ! __|¨|__ 993 IF( llnon .AND. llean .AND. llson ) ztmp(ii,ij) = 13. 994 IF( llnon .AND. llwen .AND. llson ) ztmp(ii,ij) = 14. 995 IF( llwen .AND. llson .AND. llean ) ztmp(ii,ij) = 15. 996 IF( llwen .AND. llnon .AND. llean ) ztmp(ii,ij) = 16. 985 IF( llnon .AND. llean .AND. llson ) ztmp(ii,ij) = 13._wp 986 IF( llnon .AND. llwen .AND. llson ) ztmp(ii,ij) = 14._wp 987 IF( llwen .AND. llson .AND. llean ) ztmp(ii,ij) = 15._wp 988 IF( llwen .AND. llnon .AND. llean ) ztmp(ii,ij) = 16._wp 997 989 END IF 998 990 IF( inn == 4 ) THEN … … 1012 1004 idx_bdy(ib_bdy)%ntreat(ib,igrd) = NINT(ztmp(ii,ij)) 1013 1005 END DO 1014 END DO 1015 END DO 1006 ! 1007 END DO ! jpbgrd 1008 ! 1009 END DO ! ib_bdy 1016 1010 1017 1011 END SUBROUTINE bdy_rim_treat
Note: See TracChangeset
for help on using the changeset viewer.