Skip to content

Commit

Permalink
ACCV6
Browse files Browse the repository at this point in the history
  • Loading branch information
fdisante authored and Fabio Di Sante committed Nov 17, 2023
1 parent 4981725 commit ae322e0
Show file tree
Hide file tree
Showing 14 changed files with 586 additions and 172 deletions.
297 changes: 207 additions & 90 deletions src/ecwam/ctuw.F90

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion src/ecwam/ctuwdrv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ SUBROUTINE CTUWDRV (DELPRO, MSTART, MEND, &
USE PARKIND_WAVE, ONLY : JWIM, JWRB, JWRU
USE YOWDRVTYPE , ONLY : WVGRIDGLO


USE YOWCURR , ONLY : LLCFLCUROFF
USE YOWGRID , ONLY : NPROMA_WAM
USE YOWMPP , ONLY : IRANK
USE YOWPARAM , ONLY : NIBLO ,NANG ,NFRE_RED
USE YOWSTAT , ONLY : IREFRA
USE YOWTEST , ONLY : IU06
USE YOWUBUF , ONLY : WLATN ,WLONN ,WCORN
USE YOWFRED , ONLY : FR ,DELTH, COSTH ,SINTH
USE YOWPCONS , ONLY : ZPI



USE YOMHOOK , ONLY : LHOOK, DR_HOOK, JPHOOK

Expand Down Expand Up @@ -73,12 +79,15 @@ SUBROUTINE CTUWDRV (DELPRO, MSTART, MEND, &

IF (LHOOK) CALL DR_HOOK('CTUWDRV',0,ZHOOK_HANDLE)

!! NPROMA=NPROMA_WAM
!! =NPROMA_WAM
MTHREADS=1
!$ MTHREADS=OMP_GET_MAX_THREADS()
NPROMA=(IJL-IJS+1)/MTHREADS + 1


#ifndef _OPENACC
!$OMP PARALLEL DO SCHEDULE(DYNAMIC,1) PRIVATE(JKGLO, KIJS, KIJL, ICALL, IJ, LL2NDCALL)
#endif /*_OPENACC*/
DO JKGLO = IJS, IJL, NPROMA
KIJS=JKGLO
KIJL=MIN(KIJS+NPROMA-1,IJL)
Expand All @@ -91,6 +100,7 @@ SUBROUTINE CTUWDRV (DELPRO, MSTART, MEND, &
& COSPHM1_EXT, DEPTH_EXT, U_EXT, V_EXT )



! WHEN SURFACE CURRENTS ARE USED AND LLCFLCUROFF IS TRUE
! THEN TRY TO SATISFY THE CFL CONDITION WITHOUT THE CURRENTS
! IF IT WAS VIOLATED IN THE FIRST PLACE
Expand All @@ -112,8 +122,12 @@ SUBROUTINE CTUWDRV (DELPRO, MSTART, MEND, &
& COSPHM1_EXT, DEPTH_EXT, U_EXT, V_EXT )
ENDIF
ENDIF


ENDDO
#ifndef _OPENACC
!$OMP END PARALLEL DO
#endif /*_OPENACC*/

DO IJ=IJS,IJL
IF (LCFLFAIL(IJ)) THEN
Expand Down
36 changes: 28 additions & 8 deletions src/ecwam/ctuwini.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
! granted to it by virtue of its status as an intergovernmental organisation
! nor does it submit to any jurisdiction.
!
!MODULE CTUWINI_MOD
! CONTAINS

SUBROUTINE CTUWINI (KIJS, KIJL, NINF, NSUP, BLK2GLO, COSPHM1_EXT, &
& WLATM1, WCORM1, DP)
Expand Down Expand Up @@ -44,18 +46,20 @@ SUBROUTINE CTUWINI (KIJS, KIJL, NINF, NSUP, BLK2GLO, COSPHM1_EXT, &
REAL(KIND=JWRB), DIMENSION(NINF:NSUP,4), INTENT(OUT) :: WCORM1 ! 1 - WCOR
REAL(KIND=JWRB), DIMENSION(NINF:NSUP,2), INTENT(OUT) :: DP ! COS PHI FACTOR


INTEGER(KIND=JWIM) :: IJ, K, M, IC, ICR, ICL, KY, KK, KKM
INTEGER(KIND=JWIM) :: NLAND

REAL(KIND=JPHOOK) :: ZHOOK_HANDLE
!REAL(KIND=JPHOOK) :: ZHOOK_HANDLE

!!$acc routine vector

! ----------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('CTUWINI',0,ZHOOK_HANDLE)
!IF (LHOOK) CALL DR_HOOK('CTUWINI',0,ZHOOK_HANDLE)

NLAND = NSUP+1


!$acc parallel loop independent collapse(2)
DO IC=1,2
DO IJ = KIJS,KIJL
IF (KLAT(IJ,IC,1) < NLAND .AND. KLAT(IJ,IC,2) < NLAND) THEN
Expand All @@ -74,7 +78,9 @@ SUBROUTINE CTUWINI (KIJS, KIJL, NINF, NSUP, BLK2GLO, COSPHM1_EXT, &
ENDIF
ENDDO
ENDDO

!$acc end parallel

!$acc parallel loop independent collapse(2)
DO ICR=1,4
DO IJ = KIJS,KIJL
IF (KCOR(IJ,ICR,1) < NLAND .AND. KCOR(IJ,ICR,2) < NLAND) THEN
Expand All @@ -88,15 +94,17 @@ SUBROUTINE CTUWINI (KIJS, KIJL, NINF, NSUP, BLK2GLO, COSPHM1_EXT, &
ELSE
! ADAPT CORNER POINT INTERPOLATION WEIGHT IF LAND IS PRESENT
! SECOND CLOSEST CORNER POINT IS OVER LAND
IF (WCOR(IJ,ICR) > 0.5_JWRB) WCOR(IJ,ICR)=1.0_JWRB
IF (WCOR(IJ,ICR) > 0.5_JWRB) WCOR(IJ,ICR)=1.0_JWRB
WCORM1(IJ,ICR) = 1.0_JWRB - WCOR(IJ,ICR)
ENDIF
ENDDO
ENDDO
!$acc end parallel


! INITIALISATION

!$acc parallel loop independent collapse(5)
DO ICL=1,2
DO IC=1,2
DO M=1,NFRE_RED
Expand All @@ -108,7 +116,10 @@ SUBROUTINE CTUWINI (KIJS, KIJL, NINF, NSUP, BLK2GLO, COSPHM1_EXT, &
ENDDO
ENDDO
ENDDO
!$acc end parallel


!$acc parallel loop independent collapse(4)
DO IC=1,2
DO M=1,NFRE_RED
DO K=1,NANG
Expand All @@ -118,7 +129,10 @@ SUBROUTINE CTUWINI (KIJS, KIJL, NINF, NSUP, BLK2GLO, COSPHM1_EXT, &
ENDDO
ENDDO
ENDDO
!$acc end parallel


!$acc parallel loop independent collapse(5)
DO ICL=1,2
DO ICR=1,4
DO M=1,NFRE_RED
Expand All @@ -130,26 +144,32 @@ SUBROUTINE CTUWINI (KIJS, KIJL, NINF, NSUP, BLK2GLO, COSPHM1_EXT, &
ENDDO
ENDDO
ENDDO
!$acc end parallel



IF (ICASE == 1) THEN

!* SPHERICAL GRID.
! ---------------

!
!* COMPUTE COS PHI FACTOR FOR ADJOINING GRID POINT.
! (for all grid points)
!$acc parallel loop independent collapse(2) private(KY,KK,KKM)
DO IC=1,2
! !!!$acc loop private(KY,KK,KKM)
DO IJ = KIJS,KIJL
KY=BLK2GLO%KXLT(IJ)
KK=KY+2*IC-3
KKM=MAX(1,MIN(KK,NGY))
DP(IJ,IC) = COSPH(KKM)*COSPHM1_EXT(IJ)
ENDDO
ENDDO
!$acc end parallel
ENDIF

IF (LHOOK) CALL DR_HOOK('CTUWINI',1,ZHOOK_HANDLE)

!IF (LHOOK) CALL DR_HOOK('CTUWINI',1,ZHOOK_HANDLE)

END SUBROUTINE CTUWINI
!END MODULE CTUWINI_MOD
Loading

0 comments on commit ae322e0

Please sign in to comment.