Skip to content

Commit

Permalink
OUTBLOCK: test GPU ready version for all 87 output parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
awnawab committed Oct 10, 2024
1 parent 8ef50b1 commit 2fad889
Showing 1 changed file with 75 additions and 75 deletions.
150 changes: 75 additions & 75 deletions src/ecwam/outblock.F90
Original file line number Diff line number Diff line change
Expand Up @@ -409,176 +409,176 @@ SUBROUTINE OUTBLOCK (KIJS, KIJL, MIJ, &
ENDIF

DO ITR=1,NTRAIN
IF (IPFGTBL(42) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(42))=4._JWRB*SQRT(MAX(EMTRAIN(KIJS:KIJL,ITR),0._JWRB))
IF (IPFGTBL(42 + (ITR-1)*3) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(42 + (ITR-1)*3))=4._JWRB*SQRT(MAX(EMTRAIN(KIJS:KIJL,ITR),0._JWRB))
ENDIF

IF (IPFGTBL(43) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(43))=MOD(DEG*THTRAIN(KIJS:KIJL,ITR)+180._JWRB,360._JWRB)
IF (IPFGTBL(43 + (ITR-1)*3) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(43 + (ITR-1)*3))=MOD(DEG*THTRAIN(KIJS:KIJL,ITR)+180._JWRB,360._JWRB)
ENDIF

IF (IPFGTBL(44) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(44))=PMTRAIN(KIJS:KIJL,ITR)
IF (IPFGTBL(44 + (ITR-1)*3) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(44 + (ITR-1)*3))=PMTRAIN(KIJS:KIJL,ITR)
ENDIF
ENDDO

IF (IPFGTBL(45) /= 0) THEN
IF (IPFGTBL(42 + 3*NTRAIN) /= 0) THEN
IF (LWNEMOCOUSTRN) THEN
BOUT(KIJS:KIJL,ITOBOUT(45))=STRNMS(KIJS:KIJL)
BOUT(KIJS:KIJL,ITOBOUT(42 + 3*NTRAIN))=STRNMS(KIJS:KIJL)
ELSE
CALL CIMSSTRN (KIJS, KIJL, FL1, WAVNUM, DEPTH, CITHICK, BOUT(:,ITOBOUT(45)))
CALL CIMSSTRN (KIJS, KIJL, FL1, WAVNUM, DEPTH, CITHICK, BOUT(:,ITOBOUT(42 + 3*NTRAIN)))
ENDIF
ENDIF

IF (IPFGTBL(46) /= 0) THEN
IF (IPFGTBL(43 + 3*NTRAIN) /= 0) THEN
CALL SE10MEAN (KIJS, KIJL, FL2ND, FLD1)
BOUT(KIJS:KIJL,ITOBOUT(46))=4._JWRB*SQRT(MAX(FLD1(KIJS:KIJL),0._JWRB))
BOUT(KIJS:KIJL,ITOBOUT(43 + 3*NTRAIN))=4._JWRB*SQRT(MAX(FLD1(KIJS:KIJL),0._JWRB))
ENDIF

IF (IPFGTBL(47) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(47))=AIRD(KIJS:KIJL)
IF (IPFGTBL(44 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(44 + 3*NTRAIN))=AIRD(KIJS:KIJL)
ENDIF

IF (IPFGTBL(48) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(48))=WSTAR(KIJS:KIJL)
IF (IPFGTBL(45 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(45 + 3*NTRAIN))=WSTAR(KIJS:KIJL)
ENDIF

IF (IPFGTBL(49) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(49))=CICOVER(KIJS:KIJL)
IF (IPFGTBL(46 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(46 + 3*NTRAIN))=CICOVER(KIJS:KIJL)
ENDIF

IF (IPFGTBL(50) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(50))=CITHICK(KIJS:KIJL)
IF (IPFGTBL(47 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(47 + 3*NTRAIN))=CITHICK(KIJS:KIJL)
ENDIF

IF (IPFGTBL(51) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(51))=C3(KIJS:KIJL)
IF (IPFGTBL(48 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(48 + 3*NTRAIN))=C3(KIJS:KIJL)
ENDIF

IF (IPFGTBL(52) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(52))=NEMOSST(KIJS:KIJL)
IF (IPFGTBL(49 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(49 + 3*NTRAIN))=NEMOSST(KIJS:KIJL)
ENDIF

IF (IPFGTBL(53) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(53))=NEMOCICOVER(KIJS:KIJL)
IF (IPFGTBL(50 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(50 + 3*NTRAIN))=NEMOCICOVER(KIJS:KIJL)
ENDIF

IF (IPFGTBL(54) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(54))=NEMOCITHICK(KIJS:KIJL)
IF (IPFGTBL(51 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(51 + 3*NTRAIN))=NEMOCITHICK(KIJS:KIJL)
ENDIF

IF (IPFGTBL(55) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(55))=NEMOUCUR(KIJS:KIJL)
IF (IPFGTBL(52 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(52 + 3*NTRAIN))=NEMOUCUR(KIJS:KIJL)
ENDIF

IF (IPFGTBL(56) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(56))=NEMOVCUR(KIJS:KIJL)
IF (IPFGTBL(53 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(53 + 3*NTRAIN))=NEMOVCUR(KIJS:KIJL)
ENDIF

IF (IPFGTBL(57) /= 0 .OR. IPFGTBL(58) /= 0) THEN
IF (IPFGTBL(54 + 3*NTRAIN) /= 0 .OR. IPFGTBL(55 + 3*NTRAIN) /= 0) THEN
CALL WEFLUX (KIJS, KIJL, FL1, CGROUP, &
& NFRE, NANG, DFIM, DELTH, &
& COSTH, SINTH, &
& FLD1, FLD2)
ENDIF
IF (IPFGTBL(57) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(57))=FLD1(KIJS:KIJL)
IF (IPFGTBL(54 + 3*NTRAIN) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(54 + 3*NTRAIN))=FLD1(KIJS:KIJL)
ENDIF

IF (IPFGTBL(58) /= 0) THEN
IF (IPFGTBL(55 + 3*NTRAIN) /= 0) THEN
! CONVERT DIRECTIONS TO DEGREES AND METEOROLOGICAL CONVENTION
BOUT(KIJS:KIJL,ITOBOUT(58))=MOD(DEG*FLD2(KIJS:KIJL)+180._JWRB,360._JWRB)
BOUT(KIJS:KIJL,ITOBOUT(55 + 3*NTRAIN))=MOD(DEG*FLD2(KIJS:KIJL)+180._JWRB,360._JWRB)
ENDIF

DO IH=1,NTEWH
IF (IPFGTBL(59) /= 0) THEN
IF (IPFGTBL(55 + 3*NTRAIN + IH) /= 0) THEN
!$loki inline
CALL SEBTMEAN (KIJS, KIJL, FL2ND, TEWH(IH-1), TEWH(IH), BOUT(:,ITOBOUT(59)))
CALL SEBTMEAN (KIJS, KIJL, FL2ND, TEWH(IH-1), TEWH(IH), BOUT(:,ITOBOUT(55 + 3*NTRAIN + IH)))
! SIGNIFICANT WAVE HEIGHT CONVERSION
BOUT(KIJS:KIJL,ITOBOUT(59))=4._JWRB*SQRT(MAX(BOUT(KIJS:KIJL,ITOBOUT(59)),0._JWRB))
BOUT(KIJS:KIJL,ITOBOUT(55 + 3*NTRAIN + IH))=4._JWRB*SQRT(MAX(BOUT(KIJS:KIJL,ITOBOUT(55 + 3*NTRAIN + IH)),0._JWRB))
ENDIF
ENDDO

IF (IPFGTBL(60) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(60))=ETA_M(KIJS:KIJL)
IF (IPFGTBL(56 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(56 + 3*NTRAIN + NTEWH))=ETA_M(KIJS:KIJL)
ENDIF

IF (IPFGTBL(61) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(61))=R(KIJS:KIJL)
IF (IPFGTBL(57 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(57 + 3*NTRAIN + NTEWH))=R(KIJS:KIJL)
ENDIF

IF (IPFGTBL(62) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(62))=XNSLC(KIJS:KIJL)
IF (IPFGTBL(58 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(58 + 3*NTRAIN + NTEWH))=XNSLC(KIJS:KIJL)
ENDIF

IF (IPFGTBL(63) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(63))=TAUXD(KIJS:KIJL)
IF (IPFGTBL(59 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(59 + 3*NTRAIN + NTEWH))=TAUXD(KIJS:KIJL)
ENDIF

IF (IPFGTBL(64) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(64))=TAUYD(KIJS:KIJL)
IF (IPFGTBL(60 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(60 + 3*NTRAIN + NTEWH))=TAUYD(KIJS:KIJL)
ENDIF

IF (IPFGTBL(65) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(65))=TAUOCXD(KIJS:KIJL)
IF (IPFGTBL(61 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(61 + 3*NTRAIN + NTEWH))=TAUOCXD(KIJS:KIJL)
ENDIF

IF (IPFGTBL(66) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(66))=TAUOCYD(KIJS:KIJL)
IF (IPFGTBL(62 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(62 + 3*NTRAIN + NTEWH))=TAUOCYD(KIJS:KIJL)
ENDIF

IF (IPFGTBL(67) /= 0) THEN
IF (IPFGTBL(63 + 3*NTRAIN + NTEWH) /= 0) THEN
! !!! make the energy flux positive
BOUT(KIJS:KIJL,ITOBOUT(67))=MAX(-PHIOCD(KIJS:KIJL),0.0_JWRB)
BOUT(KIJS:KIJL,ITOBOUT(63 + 3*NTRAIN + NTEWH))=MAX(-PHIOCD(KIJS:KIJL),0.0_JWRB)
ENDIF

!! alternative ways to determine wave height extremes
IF (IPFGTBL(67) /= 0 .OR. IPFGTBL(68) /= 0 .OR. &
& IPFGTBL(69) /= 0 .OR. IPFGTBL(70) /= 0 ) THEN
IF (IPFGTBL(63 + 3*NTRAIN + NTEWH) /= 0 .OR. IPFGTBL(64 + 3*NTRAIN + NTEWH) /= 0 .OR. &
& IPFGTBL(65 + 3*NTRAIN + NTEWH) /= 0 .OR. IPFGTBL(66 + 3*NTRAIN + NTEWH) /= 0 ) THEN
CALL W_MAXH (KIJS, KIJL, FL1, DEPTH, WAVNUM, &
& CMAX_F, HMAX_N, CMAX_ST, HMAX_ST, PHIST)
ENDIF

IF (IPFGTBL(68) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(68))=CMAX_F(KIJS:KIJL)
IF (IPFGTBL(64 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(64 + 3*NTRAIN + NTEWH))=CMAX_F(KIJS:KIJL)
ENDIF

IF (IPFGTBL(69) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(69))=HMAX_N(KIJS:KIJL)
IF (IPFGTBL(65 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(65 + 3*NTRAIN + NTEWH))=HMAX_N(KIJS:KIJL)
ENDIF

IF (IPFGTBL(70) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(70))=CMAX_ST(KIJS:KIJL)
IF (IPFGTBL(66 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(66 + 3*NTRAIN + NTEWH))=CMAX_ST(KIJS:KIJL)
ENDIF

IF (IPFGTBL(71) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(71))=HMAX_ST(KIJS:KIJL)
IF (IPFGTBL(67 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(67 + 3*NTRAIN + NTEWH))=HMAX_ST(KIJS:KIJL)
ENDIF
!!


! COMPUTE OUTPUT EXTRA FIELDS
! add necessary code to compute the extra output fields
!!!for testing
IF (IPFGTBL(72) /= 0) THEN
CALL CTCOR (KIJS, KIJL, FL1, BOUT(:,ITOBOUT(72)))
IF (IPFGTBL(68 + 3*NTRAIN + NTEWH) /= 0) THEN
CALL CTCOR (KIJS, KIJL, FL1, BOUT(:,ITOBOUT(68 + 3*NTRAIN + NTEWH)))
ENDIF

IF (IPFGTBL(73) /= 0) THEN
IF (IPFGTBL(69 + 3*NTRAIN + NTEWH) /= 0) THEN
XMODEL_CUTOFF=(ZPI*FR(NFRE))**2/G
CALL MEANSQS (XMODEL_CUTOFF, KIJS, KIJL, FL1, WAVNUM, UFRIC, COSWDIF, BOUT(:,ITOBOUT(73)))
CALL MEANSQS (XMODEL_CUTOFF, KIJS, KIJL, FL1, WAVNUM, UFRIC, COSWDIF, BOUT(:,ITOBOUT(69 + 3*NTRAIN + NTEWH)))
ENDIF

IF (IPFGTBL(74) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(74))=0._JWRB
IF (IPFGTBL(70 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(70 + 3*NTRAIN + NTEWH))=0._JWRB
ENDIF

IF (IPFGTBL(75) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(75))=0._JWRB
IF (IPFGTBL(71 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(71 + 3*NTRAIN + NTEWH))=0._JWRB
ENDIF

IF (IPFGTBL(76) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(76))=0._JWRB
IF (IPFGTBL(72 + 3*NTRAIN + NTEWH) /= 0) THEN
BOUT(KIJS:KIJL,ITOBOUT(72 + 3*NTRAIN + NTEWH))=0._JWRB
ENDIF


Expand Down

0 comments on commit 2fad889

Please sign in to comment.