From 8bb1442583c2084fa51009dc87c6d7ae2ed04c55 Mon Sep 17 00:00:00 2001 From: heloisemichaud Date: Wed, 9 Oct 2024 13:31:11 +0000 Subject: [PATCH] last Shom dev on output --- model/src/pdlib_field_vec.F90 | 19 +++++++++++++---- model/src/w3adatmd.F90 | 22 ++++++++++++++++---- model/src/w3gdatmd.F90 | 5 +++-- model/src/w3gridmd.F90 | 21 ++++++++++++++----- model/src/w3initmd.F90 | 7 ++++--- model/src/w3iogomd.F90 | 16 ++++++++++++-- model/src/w3iogrmd.F90 | 10 ++++----- model/src/w3oacpmd.F90 | 16 +++++++------- model/src/w3sdb1md.F90 | 28 ++++++++++++++++++------- model/src/w3str1md.F90 | 12 ++++++++++- model/src/w3wavemd.F90 | 27 ++++++++++++++++++++++-- model/src/ww3_gint.F90 | 12 ++++++++++- model/src/ww3_ounf.F90 | 6 +++++- model/src/ww3_ounp.F90 | 39 +++++++++++++++++++++-------------- model/src/ww3_outf.F90 | 13 +++++++++++- 15 files changed, 190 insertions(+), 63 deletions(-) diff --git a/model/src/pdlib_field_vec.F90 b/model/src/pdlib_field_vec.F90 index b386b8786..43b7c8b94 100644 --- a/model/src/pdlib_field_vec.F90 +++ b/model/src/pdlib_field_vec.F90 @@ -168,6 +168,9 @@ SUBROUTINE GET_ARRAY_SIZE(TheSize) END IF IF ( FLGRDALL( 2, 19) ) THEN IH = IH + 1 + END IF + IF ( FLGRDALL( 2, 20) ) THEN + IH = IH + 1 END IF IF ( FLGRDALL( 3, 1) ) THEN DO IK=E3DF(2,1),E3DF(3,1) @@ -830,7 +833,7 @@ SUBROUTINE DO_OUTPUT_EXCHANGES(IMOD) STH2M, HSIG, TAUICE, PHICE, PTHP0, PQP,& PPE, PGW, PSW, PTM1, PT1, PT2, PEP, & QP, MSSD, MSCD, STMAXE, STMAXD, HMAXE, & - HCMAXE, HMAXD, HCMAXD, WBT, USSP + HCMAXE, HMAXD, HCMAXD, WBT, USSP, BRCOEF USE W3GDATMD, ONLY: NK, NSEAL USE W3ODATMD, ONLY: NDST, IAPROC, NAPROC, NTPROC, FLOUT, & NAPFLD, NAPPNT, NAPRST, NAPBPT, NAPTRK,& @@ -968,6 +971,10 @@ SUBROUTINE DO_OUTPUT_EXCHANGES(IMOD) IH = IH + 1 Arrexch(IH,JSEA)=WNMEAN(JSEA) END IF + IF ( FLGRDALL( 2, 20) ) THEN + IH = IH + 1 + Arrexch(IH,JSEA)=BRCOEF(JSEA) + END IF IF ( FLGRDALL( 3, 1) ) THEN DO IK=E3DF(2,1),E3DF(3,1) IH = IH + 1 @@ -1098,11 +1105,11 @@ SUBROUTINE DO_OUTPUT_EXCHANGES(IMOD) END IF IF ( FLGRDALL( 5, 1) ) THEN IH = IH + 1 - Arrexch(IH,JSEA)=UST(ISEA) + Arrexch(IH,JSEA)=UST(JSEA) IH = IH + 1 - Arrexch(IH,JSEA)=USTDIR(ISEA) + Arrexch(IH,JSEA)=USTDIR(JSEA) IH = IH + 1 - Arrexch(IH,JSEA)=ASF(ISEA) + Arrexch(IH,JSEA)=ASF(JSEA) END IF IF ( FLGRDALL( 5, 2) ) THEN IH = IH + 1 @@ -1411,6 +1418,10 @@ SUBROUTINE DO_OUTPUT_EXCHANGES(IMOD) IH = IH + 1 WNMEAN(1:NSEA) = ARRtotal(IH,:) END IF + IF ( FLGRDALL( 2, 20) ) THEN + IH = IH + 1 + BRCOEF(1:NSEA) = ARRtotal(IH,:) + END IF IF ( FLGRDALL( 3, 1) ) THEN DO IK=E3DF(2,1),E3DF(3,1) IH = IH + 1 diff --git a/model/src/w3adatmd.F90 b/model/src/w3adatmd.F90 index 2daee3609..47b330961 100644 --- a/model/src/w3adatmd.F90 +++ b/model/src/w3adatmd.F90 @@ -407,14 +407,15 @@ MODULE W3ADATMD THS(:), THP0(:), & HSIG(:), STMAXE(:), STMAXD(:), & HMAXE(:), HCMAXE(:), HMAXD(:), & - HCMAXD(:), QP(:), WBT(:), WNMEAN(:) + HCMAXD(:), QP(:), WBT(:), WNMEAN(:),& + BRCOEF(:) REAL, POINTER :: XHS(:), XWLM(:), XT02(:), XT0M1(:), & XT01 (:), XFP0(:), XTHM(:), & XTHS(:), XTHP0(:), & XHSIG(:), XSTMAXE(:), XSTMAXD(:), & XHMAXE(:), XHCMAXE(:), XHMAXD(:), & XHCMAXD(:), XQP(:), XWBT(:), & - XWNMEAN(:) + XWNMEAN(:), XBRCOEF(:) ! ! Output fields group 3) ! @@ -589,7 +590,7 @@ MODULE W3ADATMD THP0(:), HSIG(:), & STMAXE(:), STMAXD(:), HMAXE(:), & HCMAXE(:), HMAXD(:), HCMAXD(:), & - QP(:), WBT(:), WNMEAN(:) + QP(:), WBT(:), WNMEAN(:), BRCOEF(:) ! REAL, POINTER :: EF(:,:), TH1M(:,:), STH1M(:,:), & TH2M(:,:), STH2M(:,:) @@ -1050,6 +1051,7 @@ SUBROUTINE W3DIMA ( IMOD, NDSE, NDST, D_ONLY ) WADATS(IMOD)%HCMAXD(NSEALM), WADATS(IMOD)%QP(NSEALM), & WADATS(IMOD)%WBT(NSEALM), & WADATS(IMOD)%WNMEAN(NSEALM), & + WADATS(IMOD)%BRCOEF(NSEALM), & STAT=ISTAT ) CHECK_ALLOC_STATUS ( ISTAT ) ! @@ -1072,6 +1074,7 @@ SUBROUTINE W3DIMA ( IMOD, NDSE, NDST, D_ONLY ) WADATS(IMOD)%QP = UNDEF WADATS(IMOD)%WBT = UNDEF WADATS(IMOD)%WNMEAN = UNDEF + WADATS(IMOD)%BRCOEF = UNDEF call print_memcheck(memunit, 'memcheck_____:'//' W3DIMA 3') ! @@ -1732,7 +1735,15 @@ SUBROUTINE W3XDMA ( IMOD, NDSE, NDST, OUTFLAGS ) ALLOCATE ( WADATS(IMOD)%XWNMEAN(1), STAT=ISTAT ) CHECK_ALLOC_STATUS ( ISTAT ) END IF - ! +! + IF ( OUTFLAGS( 2, 20) ) THEN + ALLOCATE ( WADATS(IMOD)%XBRCOEF(NXXX), STAT=ISTAT ) + CHECK_ALLOC_STATUS ( ISTAT ) + ELSE + ALLOCATE ( WADATS(IMOD)%XBRCOEF(1), STAT=ISTAT ) + CHECK_ALLOC_STATUS ( ISTAT ) + END IF +! WADATS(IMOD)%XHS = UNDEF WADATS(IMOD)%XWLM = UNDEF WADATS(IMOD)%XT02 = UNDEF @@ -1751,6 +1762,7 @@ SUBROUTINE W3XDMA ( IMOD, NDSE, NDST, OUTFLAGS ) WADATS(IMOD)%XHCMAXD= UNDEF WADATS(IMOD)%XWBT = UNDEF WADATS(IMOD)%XWNMEAN= UNDEF + WADATS(IMOD)%XBRCOEF= UNDEF ! IF ( OUTFLAGS( 3, 1) ) THEN ALLOCATE ( WADATS(IMOD)%XEF(NXXX,E3DF(2,1):E3DF(3,1)), STAT=ISTAT ) @@ -2860,6 +2872,7 @@ SUBROUTINE W3SETA ( IMOD, NDSE, NDST ) QP => WADATS(IMOD)%QP WBT => WADATS(IMOD)%WBT WNMEAN => WADATS(IMOD)%WNMEAN + BRCOEF => WADATS(IMOD)%BRCOEF ! EF => WADATS(IMOD)%EF TH1M => WADATS(IMOD)%TH1M @@ -3203,6 +3216,7 @@ SUBROUTINE W3XETA ( IMOD, NDSE, NDST ) QP => WADATS(IMOD)%XQP WBT => WADATS(IMOD)%XWBT WNMEAN => WADATS(IMOD)%XWNMEAN + BRCOEF => WADATS(IMOD)%XBRCOEF ! EF => WADATS(IMOD)%XEF TH1M => WADATS(IMOD)%XTH1M diff --git a/model/src/w3gdatmd.F90 b/model/src/w3gdatmd.F90 index e66ab59da..c0ba8b7bf 100644 --- a/model/src/w3gdatmd.F90 +++ b/model/src/w3gdatmd.F90 @@ -989,7 +989,7 @@ MODULE W3GDATMD #endif #ifdef W3_DB1 REAL :: SDBC1, SDBC2 - LOGICAL :: FDONLY + LOGICAL :: FDONLY, FSLOPE REAL :: SDBSC #endif END TYPE SDBP @@ -1392,7 +1392,7 @@ MODULE W3GDATMD !/ #ifdef W3_DB1 REAL, POINTER :: SDBC1, SDBC2 - LOGICAL, POINTER :: FDONLY + LOGICAL, POINTER :: FDONLY, FSLOPE REAL, POINTER :: SDBSC #endif !/ @@ -2816,6 +2816,7 @@ SUBROUTINE W3SETG ( IMOD, NDSE, NDST ) SDBC1 => MPARS(IMOD)%SDBPS%SDBC1 SDBC2 => MPARS(IMOD)%SDBPS%SDBC2 FDONLY => MPARS(IMOD)%SDBPS%FDONLY + FSLOPE => MPARS(IMOD)%SDBPS%FSLOPE SDBSC => MPARS(IMOD)%SDBPS%SDBSC #endif ! diff --git a/model/src/w3gridmd.F90 b/model/src/w3gridmd.F90 index 042771777..12fdad77d 100644 --- a/model/src/w3gridmd.F90 +++ b/model/src/w3gridmd.F90 @@ -896,6 +896,7 @@ MODULE W3GRIDMD #ifdef W3_DB1 REAL :: BJALFA, BJGAM LOGICAL :: BJFLAG + LOGICAL :: BRFLAG #endif #ifdef W3_PR2 REAL :: DTIME @@ -1067,7 +1068,7 @@ MODULE W3GRIDMD BOTROUGHMIN, BOTROUGHFAC #endif #ifdef W3_DB1 - NAMELIST /SDB1/ BJALFA, BJGAM, BJFLAG + NAMELIST /SDB1/ BJALFA, BJGAM, BJFLAG, BRFLAG #endif #ifdef W3_UOST NAMELIST /UOST/ UOSTFILELOCAL, UOSTFILESHADOW, & @@ -2359,6 +2360,7 @@ SUBROUTINE W3GRID() BJALFA = 1. BJGAM = 0.73 BJFLAG = .TRUE. + BRFLAG = .FALSE. CALL READNL ( NDSS, 'SDB1', STATUS ) WRITE (NDSO,928) STATUS BJALFA = MAX ( 0. , BJALFA ) @@ -2374,6 +2376,7 @@ SUBROUTINE W3GRID() SDBC1 = BJALFA SDBC2 = BJGAM FDONLY = BJFLAG + FSLOPE = BRFLAG #endif ! ! @@ -3317,9 +3320,17 @@ SUBROUTINE W3GRID() #endif #ifdef W3_DB1 IF ( BJFLAG ) THEN - WRITE (NDSO,2928) BJALFA, BJGAM, '.TRUE.' + IF (BRFLAG) THEN + WRITE (NDSO,2928) BJALFA, BJGAM, '.TRUE.', '.TRUE.' + ELSE + WRITE (NDSO,2928) BJALFA, BJGAM, '.TRUE.', '.FALSE.' + END IF ELSE - WRITE (NDSO,2928) BJALFA, BJGAM, '.FALSE.' + IF (BRFLAG) THEN + WRITE (NDSO,2928) BJALFA, BJGAM, '.FALSE.', '.TRUE.' + ELSE + WRITE (NDSO,2928) BJALFA, BJGAM, '.FALSE.', '.FALSE.' + END IF END IF #endif #ifdef W3_PR1 @@ -3336,7 +3347,7 @@ SUBROUTINE W3GRID() WRITE (NDSO,2953) CFLTM, WDTHCG, WDTHTH #endif ! - WRITE (NDSO,2956) UGBCCFL, UGOBCAUTO, UGOBCDEPTH,TRIM(UGOBCFILE), & + WRITE (NDSO,*) UGBCCFL, UGOBCAUTO, UGOBCDEPTH,TRIM(UGOBCFILE), & EXPFSN, EXPFSPSI, EXPFSFCT, IMPFSN, EXPTOTAL,& IMPTOTAL, IMPREFRACTION, IMPFREQSHIFT, & IMPSOURCE, LREAD2DM, SETUP_APPLY_WLV, & @@ -6527,7 +6538,7 @@ SUBROUTINE W3GRID() 929 FORMAT ( ' alpha :',F8.3/ & ' gamma :',F8.3) 2928 FORMAT ( ' &SDB1 BJALFA =',F7.3,', BJGAM =',F7.3, & - ', BJFLAG = ',A,' /') + ', BJFLAG = ',A, ', BRFLAG = ',A,' /') #endif ! #ifdef W3_TR0 diff --git a/model/src/w3initmd.F90 b/model/src/w3initmd.F90 index 91df0951e..44ced26b6 100644 --- a/model/src/w3initmd.F90 +++ b/model/src/w3initmd.F90 @@ -1595,8 +1595,8 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, 985 FORMAT & (/' point | X | Y | name '/ & ' --------|-------------|-------------|----------------') -980 FORMAT ( 5X,I5,' |',2(F10.2,' |'),2X,A) -986 FORMAT ( 5X,I5,' |',2(F8.1,'E3 |'),2X,A) +980 FORMAT ( 5X,I5,' |',2(F15.10,' |'),2X,A) +986 FORMAT ( 5X,I5,' |',2(F15.10,'E3 |'),2X,A) ! 981 FORMAT (/' Initial time : ',A) 982 FORMAT ( ' Water level time : ',A) @@ -2150,7 +2150,8 @@ SUBROUTINE W3MPIO ( IMOD ) STMAXE, STMAXD, HMAXE, HCMAXE, HMAXD, & HCMAXD, QP, PTHP0, PQP, PPE, PGW, PSW, & PTM1, PT1, PT2, PEP, WBT, CX, CY, & - TAUOCX, TAUOCY, WNMEAN, QKK, SKEW, EMBIA1, EMBIA2 + TAUOCX, TAUOCY, WNMEAN, & + QKK, SKEW, EMBIA1, EMBIA2,BRCOEF #endif #ifdef W3_MPI diff --git a/model/src/w3iogomd.F90 b/model/src/w3iogomd.F90 index d93f6c43c..41bd0bfa5 100644 --- a/model/src/w3iogomd.F90 +++ b/model/src/w3iogomd.F90 @@ -917,10 +917,13 @@ SUBROUTINE W3FLDTOIJ(FLD, I, J, IAPROC, NAPOUT, NDSEN) CASE('WNM') I = 2 J = 19 + CASE('BRCOEF') + I = 2 + J = 20 #ifdef W3_OASOCM CASE('THM') I = 2 - J = 20 + J = 21 #endif ! ! Group 3 @@ -2522,7 +2525,7 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD & USE W3ADATMD, ONLY: AINIT, DW, UA, UD, AS, CX, CY, WN, & TAUA, TAUADIR USE W3ADATMD, ONLY: HS, WLM, T02, T0M1, T01, FP0, THM, THS, THP0,& - WBT, WNMEAN + WBT, WNMEAN, BRCOEF USE W3ADATMD, ONLY: DTDYN, FCUT, ABA, ABD, UBA, UBD, SXX, SYY, SXY,& PHS, PTP, PLP, PDIR, PSI, PWS, PWST, PNR, & PTHP0, PQP, PPE, PGW, PSW, PTM1, PT1, PT2, & @@ -2846,6 +2849,7 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD & IF ( FLOGRD( 2,16) ) HCMAXD(ISEA) = UNDEF IF ( FLOGRD( 2,17) ) WBT (ISEA) = UNDEF IF ( FLOGRD( 2,19) ) WNMEAN(ISEA) = UNDEF + IF ( FLOGRD( 2,20) ) BRCOEF(ISEA) = UNDEF ! IF ( FLOGRD( 3, 1) ) EF (ISEA,:) = UNDEF IF ( FLOGRD( 3, 2) ) TH1M (ISEA,:) = UNDEF @@ -3215,6 +3219,11 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD & WRITE ( NDSOG ) WNMEAN(1:NSEA) #ifdef W3_ASCII WRITE ( NDSOA,* ) 'WNMEAN:', WNMEAN(1:NSEA) +#endif + ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 20 ) THEN + WRITE ( NDSOG ) BRCOEF(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'BRCOEF:', BRCOEF(1:NSEA) #endif ! ! Section 3) @@ -3784,6 +3793,9 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD & ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 19 ) THEN READ (NDSOG,END=801,ERR=802,IOSTAT=IERR) & WNMEAN(1:NSEA) + ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 20 ) THEN + READ (NDSOG,END=801,ERR=802,IOSTAT=IERR) & + BRCOEF(1:NSEA) ! ! Section 3) ! diff --git a/model/src/w3iogrmd.F90 b/model/src/w3iogrmd.F90 index 9f9e8c8db..9f4109525 100644 --- a/model/src/w3iogrmd.F90 +++ b/model/src/w3iogrmd.F90 @@ -1809,18 +1809,18 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT & #ifdef W3_DB1 IF ( WRITE ) THEN WRITE (NDSM) & - SDBC1, SDBC2, FDONLY + SDBC1, SDBC2, FDONLY, FSLOPE #ifdef W3_ASCII WRITE (NDSA,*) & - 'SDBC1, SDBC2, FDONLY:', & - SDBC1, SDBC2, FDONLY + 'SDBC1, SDBC2, FDONLY, FSLOPE:', & + SDBC1, SDBC2, FDONLY, FSLOPE #endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & - SDBC1, SDBC2, FDONLY + SDBC1, SDBC2, FDONLY, FSLOPE END IF ! - IF ( FLTEST ) WRITE (NDST,9053) SDBC1, SDBC2, FDONLY + IF ( FLTEST ) WRITE (NDST,9053) SDBC1, SDBC2, FDONLY, FSLOPE #endif #ifdef W3_UOST diff --git a/model/src/w3oacpmd.F90 b/model/src/w3oacpmd.F90 index ce071ab33..8b5a13b0f 100644 --- a/model/src/w3oacpmd.F90 +++ b/model/src/w3oacpmd.F90 @@ -926,14 +926,14 @@ SUBROUTINE GET_LIST_EXCH_FIELD(NDSO, RCV, SND, ID_NB_RCV, ID_NB_SND, RCV_STR, SN ID_NB_RCV=ID_NB_RCV+1 RCV(ID_NB_RCV)%CL_FIELD_NAME='WW3__SSH' ! -! CASE('CUR') -! ! uz : sea surface zonal currents (m.s-1) -! ID_NB_RCV=ID_NB_RCV+1 -! RCV(ID_NB_RCV)%CL_FIELD_NAME='WW3_OSSU' -! ! -! ! vz : sea surface meridional currents (m.s-1) -! ID_NB_RCV=ID_NB_RCV+1 -! RCV(ID_NB_RCV)%CL_FIELD_NAME='WW3_OSSV' + CASE('CUR') + ! uz : sea surface zonal currents (m.s-1) + ID_NB_RCV=ID_NB_RCV+1 + RCV(ID_NB_RCV)%CL_FIELD_NAME='WW3_OSSU' + ! + ! vz : sea surface meridional currents (m.s-1) + ID_NB_RCV=ID_NB_RCV+1 + RCV(ID_NB_RCV)%CL_FIELD_NAME='WW3_OSSV' #endif ! ! diff --git a/model/src/w3sdb1md.F90 b/model/src/w3sdb1md.F90 index 4b6797592..5001f0d99 100644 --- a/model/src/w3sdb1md.F90 +++ b/model/src/w3sdb1md.F90 @@ -91,7 +91,8 @@ MODULE W3SDB1MD !> @author J. H. Alves !> @author H. L. Tolman !> @author A. Roland - !> @date 08-Jun-2018 + !> @author M. Pezerat + !> @date 23-Jul-2024 !> SUBROUTINE W3SDB1 (IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D ) !/ @@ -183,7 +184,8 @@ SUBROUTINE W3SDB1 (IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D ) !/ ------------------------------------------------------------------- / !/ USE CONSTANTS - USE W3GDATMD, ONLY: NK, NTH, NSPEC, SDBC1, SDBC2, FDONLY, FSSOURCE, DDEN + USE W3ADATMD, ONLY: BRCOEF + USE W3GDATMD, ONLY: NK, NTH, NSPEC, SDBC1, SDBC2, FDONLY, FSLOPE, FSSOURCE, DDEN USE W3ODATMD, ONLY: NDST USE W3GDATMD, ONLY: SIG USE W3ODATMD, only : IAPROC @@ -221,6 +223,7 @@ SUBROUTINE W3SDB1 (IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D ) REAL*8 :: HM, BB, ARG, Q0, QB, B, CBJ, HRMS, EB(NK) REAL*8 :: AUX, CBJ2, RATIO, S0, S1, BR1, BR2, FAK REAL :: ETOT, FMEAN2 + REAL :: BRCOEF_LOC #ifdef W3_T0 REAL :: DOUT(NK,NTH) #endif @@ -313,15 +316,24 @@ SUBROUTINE W3SDB1 (IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D ) QB = 1.0 - THR END IF ! - ! 3. Estimate the breaking coefficient ------------------------------- / + ! 3. Breaking coefficient + ! + IF (FSLOPE) THEN +! BRCOEF_LOC = BRCOEF(IX) + BRCOEF_LOC = MAX(0.,BRCOEF(IX)*DBLE(SDBC1)) + ELSE + BRCOEF_LOC = DBLE(SDBC1) + END IF + ! + ! 4. Estimate the breaking coefficient ------------------------------- / ! CBJ = 0 IF (IWB == 1) THEN IF ( ( BB .GT. THR) .AND. ( ABS ( BB - QB ) .GT. THR) ) THEN IF ( BB .LT. 1.0) THEN - CBJ = 2 * DBLE(SDBC1) * QB * DBLE(FMEAN) / BB + CBJ = 2 * BRCOEF_LOC * QB * DBLE(FMEAN) / BB ELSE - CBJ = 2 * DBLE(SDBC1) * DBLE(FMEAN) * BB ! AR: degenerative regime, all waves must be .le. Hmax, we just smoothly let the excessive energy vanish by * BB. + CBJ = 2 * BRCOEF_LOC * DBLE(FMEAN) * BB ! AR: degenerative regime, all waves must be .le. Hmax, we just smoothly let the excessive energy vanish by * BB. END IF ELSE CBJ = 0.d0 @@ -332,7 +344,7 @@ SUBROUTINE W3SDB1 (IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D ) IF (ETOT .GT. THR) THEN HRMS = SQRT(8*EMEAN) FAK = (1+4./SQRT(PI)*(B*BB+1.5*B)*exp(-BB)-ERF(B)) - CBJ = -SDBC1*SQRT(PI)/16.*FMEAN*HRMS**3/DEPTH/ETOT + CBJ = -BRCOEF_LOC*SQRT(PI)/16.*FMEAN*HRMS**3/DEPTH/ETOT ELSE CBJ = 0. ENDIF @@ -348,8 +360,8 @@ SUBROUTINE W3SDB1 (IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D ) #ifdef W3_DEBUGRUN IF (IX == DEBUG_NODE) THEN - WRITE(*,'(A200)') 'IX, DEPTH, CBJ, BB, QB, SDBC1, SDBC2, FMEAN, FMEAN2, HS' - WRITE(*,'(I10,20F20.10)') IX, DEPTH, CBJ, BB, QB, SDBC1, SDBC2, FMEAN, FMEAN2, 4*SQRT(ETOT) + WRITE(*,'(A200)') 'IX, DEPTH, CBJ, BB, QB, BRCOEF_LOC, SDBC2, FMEAN, FMEAN2, HS' + WRITE(*,'(I10,20F20.10)') IX, DEPTH, CBJ, BB, QB, BRCOEF_LOC, SDBC2, FMEAN, FMEAN2, 4*SQRT(ETOT) ENDIF #endif ! diff --git a/model/src/w3str1md.F90 b/model/src/w3str1md.F90 index 03cad7aeb..518794959 100644 --- a/model/src/w3str1md.F90 +++ b/model/src/w3str1md.F90 @@ -259,6 +259,7 @@ SUBROUTINE W3STR1 (A, CG, WN, DEPTH, IX, S, D) ! CG R.A. I Group velocities. ! WN R.A. I Wavenumbers. ! DEPTH Real I Mean water depth. + ! EMEAN Real I Mean wave energy. ! FMEAN Real I Mean wave frequency. ! S R.A. O Source term (1-D version). ! D R.A. O Diagonal term of derivative (1-D version). @@ -308,6 +309,9 @@ SUBROUTINE W3STR1 (A, CG, WN, DEPTH, IX, S, D) !/ ------------------------------------------------------------------- / USE CONSTANTS, ONLY: GRAV, PI, TPI USE W3GDATMD, ONLY: NK, NTH, NSPEC, DTH, SIG, DDEN, FTE, FTF +!#ifdef W3_DB1 !modification HM +! USE W3GDATMD, ONLY: FDONLY,SDBC2 +!#endif USE W3ODATMD, ONLY: NDSE USE W3SERVMD, ONLY: EXTCDE #ifdef W3_S @@ -404,7 +408,13 @@ SUBROUTINE W3STR1 (A, CG, WN, DEPTH, IX, S, D) JACEPS = 1E-12 HMAX = DEPTH * 0.73 - +#ifdef W3_DB1 !modification HM +! IF ( FDONLY ) THEN +! HMAX = DBLE(SDBC2) * DBLE(DEPTH) +! ELSE +! HMAX = DBLE(SDBC2) / DBLE(WNMEAN) * TANH ( DBLE(WNMEAN) * MAX(DEPTH,0.) ) +! END IF +#endif DO IK=1, NK EB(IK) = 0. ED(IK) = 0. diff --git a/model/src/w3wavemd.F90 b/model/src/w3wavemd.F90 index 83d3be9e5..e082bcca8 100644 --- a/model/src/w3wavemd.F90 +++ b/model/src/w3wavemd.F90 @@ -543,7 +543,7 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT & DTGA, DTG, DTGpre, DTRES, & FAC, VGX, VGY, FACK, FACTH, & FACX, XXX, REFLEC(4), & - DELX, DELY, DELA, DEPTH, D50, PSIC + DELX, DELY, DELA, DEPTH, D50, PSIC, TANBETA REAL :: VSioDummy(NSPEC), VDioDummy(NSPEC), VAoldDummy(NSPEC) LOGICAL :: SHAVETOTioDummy #ifdef W3_SEC1 @@ -1681,7 +1681,30 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT & END IF END IF #endif - + ! + ! Compute slope-dependant depth-induced breaking coefficient + ! + CALL W3OUTG ( VA, .FALSE., .FALSE., .FALSE. ) + DO JSEA=1, NSEAL + CALL INIT_GET_ISEA(ISEA, JSEA) + IX = MAPSF(ISEA,1) + IY = MAPSF(ISEA,2) + IF (LPDLIB) THEN + TANBETA = DDDX(1,JSEA)*COS(THP0(JSEA)) + DDDY(1,JSEA)*SIN(THP0(JSEA)) + IF (TANBETA .LT. 0.) THEN + BRCOEF(JSEA) = 0.1 + ELSE + BRCOEF(JSEA) = MIN(40*TANBETA,1.2) + ENDIF + ELSE + TANBETA = DDDX(IY,IX)*COS(THP0(JSEA)) + DDDY(IY,IX)*SIN(THP0(JSEA)) + IF (TANBETA .LT. 0.) THEN + BRCOEF(JSEA) = 0.1 + ELSE + BRCOEF(JSEA) = MIN(40*TANBETA,1.2) + ENDIF + ENDIF + END DO ! ! 3.6 Perform Propagation = = = = = = = = = = = = = = = = = = = = = = = ! 3.6.1 Preparations diff --git a/model/src/ww3_gint.F90 b/model/src/ww3_gint.F90 index bfd2dd467..2a329bf28 100644 --- a/model/src/ww3_gint.F90 +++ b/model/src/ww3_gint.F90 @@ -1093,7 +1093,7 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & FP0AUX, THMAUX1, THMAUX2, THSAUX, THP0AUX1, & THP0AUX2, HSIGAUX, STMAXEAUX,STMAXDAUX, & HMAXEAUX, HCMAXEAUX, HMAXDAUX, HCMAXDAUX, & - WBTAUX, WNMEANAUX, SUMWT2(NOGE(2)) + WBTAUX, WNMEANAUX, BRCOEFAUX, SUMWT2(NOGE(2)) ! Local group 3 variables REAL :: EFAUX(E3DF(2,1):E3DF(3,1)), & TH1MAUX(E3DF(2,2):E3DF(3,2)), & @@ -1198,6 +1198,7 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & HCMAXD = UNDEF WBT = UNDEF WNMEAN = UNDEF + BRCOEF = UNDEF ! ! Group 3 variables ! @@ -1434,6 +1435,7 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & HCMAXDAUX = UNDEF WBTAUX = UNDEF WNMEANAUX = UNDEF + BRCOEFAUX = UNDEF SUMWT2 = 0 ! ! Group 3 variables @@ -1888,6 +1890,14 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & END IF END IF ! + IF ( FLOGRD(2,20) .AND. ACTIVE ) THEN + IF ( WADATS(IGRID)%BRCOEF(GSEA) .NE. UNDEF ) THEN + SUMWT2(20) = SUMWT2(20) + WT + IF ( BRCOEFAUX .EQ. UNDEF ) BRCOEFAUX = 0. + BRCOEFAUX = BRCOEFAUX + WADATS(IGRID)%BRCOEF(GSEA)*WT + END IF + END IF + ! ! Group 3 variables ! IF ( FLOGRD(3,1) .AND. ACTIVE ) THEN diff --git a/model/src/ww3_ounf.F90 b/model/src/ww3_ounf.F90 index a3aa2f631..5d4a6e744 100644 --- a/model/src/ww3_ounf.F90 +++ b/model/src/ww3_ounf.F90 @@ -194,7 +194,7 @@ PROGRAM W3OUNF CFLTHMAX, CFLXYMAX, CFLKMAX, TAUICE, PHICE, & STMAXE, STMAXD, HMAXE, HCMAXE, HMAXD, HCMAXD,& P2SMS, EF, US3D, TH1M, STH1M, TH2M, STH2M, & - WN, USSP, WBT, WNMEAN, QKK, SKEW, EMBIA1, EMBIA2 + WN, USSP, WBT, WNMEAN, QKK, SKEW, EMBIA1, EMBIA2, BRCOEF USE W3ODATMD, ONLY: NDSO, NDSE, SCREEN, NOGRP, NGRPP, IDOUT, & UNDEF, FLOGRD, FNMPRE, NOSWLL, NOGE ! @@ -1412,6 +1412,10 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & CALL W3S2XY ( NSEA, NSEA, NX+1, NY, WNMEAN, MAPSF, X1 ) END IF ! + ! Breaking coefficient + ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 20 ) THEN + CALL S2GRID(BRCOEF, X1) + ! ! Wave elevation spectrum ELSE IF ( IFI .EQ. 3 .AND. IFJ .EQ. 1 ) THEN ! Information for spectral diff --git a/model/src/ww3_ounp.F90 b/model/src/ww3_ounp.F90 index a1533c73b..f1125f64d 100644 --- a/model/src/ww3_ounp.F90 +++ b/model/src/ww3_ounp.F90 @@ -77,6 +77,7 @@ PROGRAM W3OUNP !/ 05-Jan-2022 : Added TIMESPLIT=0 (nodate) support ( version 7.14 ) !/ 21-Jul-2022 : Correct FP0 calc for peak energy in ( version 7.14 ) !/ min/max freq band (B. Pouliot, CMC) + !/ 18-Jul-2024 : Add triads (H.Michaud, Shom) ( version 7.14 ) !/ !/ Copyright 2009 National Weather Service (NWS), !/ National Oceanic and Atmospheric Administration. All rights @@ -184,7 +185,7 @@ PROGRAM W3OUNP USE W3ODATMD, ONLY: W3SETO, W3NOUT USE W3ODATMD, ONLY: IAPROC, NAPROC, NAPERR, NAPOUT, DIMP USE W3IOGRMD, ONLY: W3IOGR - USE W3IOPOMD + USE W3IOPOMD, ONLY: W3IOPO USE W3SERVMD, ONLY : ITRACE, NEXTLN, EXTCDE, STRSPLIT #ifdef W3_S USE W3SERVMD, ONLY : STRACE @@ -1578,6 +1579,9 @@ SUBROUTINE W3EXNC(I,NCID,NREQ,INDREQ,ORDER) #ifdef W3_NL4 USE W3SNL4MD #endif +#ifdef W3_TR1 + USE W3STR1MD +#endif #ifdef W3_BT1 USE W3SBT1MD #endif @@ -2456,6 +2460,9 @@ SUBROUTINE W3EXNC(I,NCID,NREQ,INDREQ,ORDER) #endif #ifdef W3_NL4 CALL W3SNL4 ( A, CG, WN, DEPTH, XNL, DIA ) +#endif +#ifdef W3_TR1 + CALL W3STR1 ( A, CG, WN, DEPTH, IX, XTR, DIA ) #endif END IF IF ( FLSRCE(4) ) THEN @@ -4763,16 +4770,16 @@ SUBROUTINE W3CRNC (ITYPE, OTYPE, NCTYPE, NCFILE, NCID, DIMID, DIMLN, VARID, ONE, !Snl / Snlst IF (ISCALE.EQ.0 .OR. ISCALE.EQ.3) THEN IRET=NF90_DEF_VAR(NCID, 'snl', NF90_FLOAT,(/DIMID(4),DIMID(TWO),DIMID(ONE)/), VARID(12)) - IRET=NF90_PUT_ATT(NCID,VARID(12),'long_name','nonlinear 4 wave source term') - IRET=NF90_PUT_ATT(NCID,VARID(12),'standard_name','nonlinear_4_wave_source_term') - IRET=NF90_PUT_ATT(NCID,VARID(12),'globwave_name','nonlinear_4_wave_source_term') + IRET=NF90_PUT_ATT(NCID,VARID(12),'long_name','nonlinear 4 and 3 wave source term') + IRET=NF90_PUT_ATT(NCID,VARID(12),'standard_name','nonlinear_4_and_3_wave_source_term') + IRET=NF90_PUT_ATT(NCID,VARID(12),'globwave_name','nonlinear_4_and_3_wave_source_term') IRET=NF90_PUT_ATT(NCID,VARID(12),'units','m2') ELSE IRET=NF90_DEF_VAR(NCID, 'snlst', NF90_FLOAT,(/DIMID(4),DIMID(TWO),DIMID(ONE)/), VARID(12)) IRET=NF90_PUT_ATT(NCID,VARID(12),'long_name', & - 'nondimensionalized using nonlinear 4 wave source term') - IRET=NF90_PUT_ATT(NCID,VARID(12),'standard_name','nonlinear_4_wave_source_term') - IRET=NF90_PUT_ATT(NCID,VARID(12),'globwave_name','nonlinear_4_wave_source_term') + 'nondimensionalized using nonlinear 4 and 3 wave source term') + IRET=NF90_PUT_ATT(NCID,VARID(12),'standard_name','nonlinear_4_and_3_wave_source_term') + IRET=NF90_PUT_ATT(NCID,VARID(12),'globwave_name','nonlinear_4_and_3_wave_source_term') IRET=NF90_PUT_ATT(NCID,VARID(12),'units','-') END IF IF (NCTYPE.EQ.4) IRET=NF90_DEF_VAR_DEFLATE(NCID, VARID(12), 1, 1, DEFLATE) @@ -5057,15 +5064,15 @@ SUBROUTINE W3CRNC (ITYPE, OTYPE, NCTYPE, NCFILE, NCID, DIMID, DIMLN, VARID, ONE, !Tnli / Tnlist IF (ISCALE.EQ.0 .OR. ISCALE.EQ.3) THEN IRET=NF90_DEF_VAR(NCID, 'tnli', NF90_FLOAT,(/DIMID(4),DIMID(TWO),DIMID(ONE)/), VARID(12)) - IRET=NF90_PUT_ATT(NCID,VARID(12),'long_name','nonlinear 4 wave source term normalised by Ef') - IRET=NF90_PUT_ATT(NCID,VARID(12),'standard_name','inverse_time_scales_nonlinear_4_wave_source_term') - IRET=NF90_PUT_ATT(NCID,VARID(12),'globwave_name','inverse_time_scales_nonlinear_4_wave_source_term') + IRET=NF90_PUT_ATT(NCID,VARID(12),'long_name','nonlinear 4 and 3 wave source term normalised by Ef') + IRET=NF90_PUT_ATT(NCID,VARID(12),'standard_name','inverse_time_scales_nonlinear_4_and_3_wave_source_term') + IRET=NF90_PUT_ATT(NCID,VARID(12),'globwave_name','inverse_time_scales_nonlinear_4_and_3_wave_source_term') IRET=NF90_PUT_ATT(NCID,VARID(12),'units','m2') ELSE IRET=NF90_DEF_VAR(NCID, 'tnlist', NF90_FLOAT,(/DIMID(4),DIMID(TWO),DIMID(ONE)/), VARID(12)) - IRET=NF90_PUT_ATT(NCID,VARID(12),'long_name','nondimensionalized using nonlinear 4 wave source term normalised by Ef') - IRET=NF90_PUT_ATT(NCID,VARID(12),'standard_name','inverse_time_scales_nonlinear_4_wave_source_term') - IRET=NF90_PUT_ATT(NCID,VARID(12),'globwave_name','inverse_time_scales_nonlinear_4_wave_source_term') + IRET=NF90_PUT_ATT(NCID,VARID(12),'long_name','nondimensionalized using nonlinear 4 and 3 wave source term normalised by Ef') + IRET=NF90_PUT_ATT(NCID,VARID(12),'standard_name','inverse_time_scales_nonlinear_4_and_3_wave_source_term') + IRET=NF90_PUT_ATT(NCID,VARID(12),'globwave_name','inverse_time_scales_nonlinear_4_and_3_wave_source_term') IRET=NF90_PUT_ATT(NCID,VARID(12),'units','-') END IF IF (NCTYPE.EQ.4) IRET=NF90_DEF_VAR_DEFLATE(NCID, VARID(12), 1, 1, DEFLATE) @@ -5444,9 +5451,9 @@ SUBROUTINE W3CRNC (ITYPE, OTYPE, NCTYPE, NCFILE, NCID, DIMID, DIMLN, VARID, ONE, IF ( FLSRCE(3) ) THEN IRET=NF90_DEF_VAR(NCID,'snl',NF90_FLOAT,(/DIMID(5),DIMID(4),DIMID(TWO),DIMID(ONE)/),VARID(18)) IF (NCTYPE.EQ.4) IRET=NF90_DEF_VAR_DEFLATE(NCID, VARID(18), 1, 1, DEFLATE) - IRET=NF90_PUT_ATT(NCID,VARID(18),'long_name','nonlinear 4 wave source term') - IRET=NF90_PUT_ATT(NCID,VARID(18),'standard_name','nonlinear_4_wave_source_term') - IRET=NF90_PUT_ATT(NCID,VARID(18),'globwave_name','nonlinear_4_wave_source_term') + IRET=NF90_PUT_ATT(NCID,VARID(18),'long_name','nonlinear 4 and 3 wave source term') + IRET=NF90_PUT_ATT(NCID,VARID(18),'standard_name','nonlinear_4_and_3_wave_source_term') + IRET=NF90_PUT_ATT(NCID,VARID(18),'globwave_name','nonlinear_4_and_3_wave_source_term') IRET=NF90_PUT_ATT(NCID,VARID(18),'units','m2 rad-1') IRET=NF90_PUT_ATT(NCID,VARID(18),'scale_factor',1.) IRET=NF90_PUT_ATT(NCID,VARID(18),'add_offset',0.) diff --git a/model/src/ww3_outf.F90 b/model/src/ww3_outf.F90 index 590518037..4949db299 100644 --- a/model/src/ww3_outf.F90 +++ b/model/src/ww3_outf.F90 @@ -168,7 +168,7 @@ PROGRAM W3OUTF CFLTHMAX, CFLKMAX, BEDFORMS, WHITECAP, T02, & CGE, T01, HSIG, STMAXE, STMAXD, HMAXE, & HCMAXE, HMAXD, HCMAXD, MSSD, MSCD, WBT, & - WNMEAN, TAUA, TAUADIR + WNMEAN, TAUA, TAUADIR, BRCOEF USE W3ODATMD, ONLY: NDSO, NDSE, NDST, NOGRP, NGRPP, IDOUT, & UNDEF, FLOGRD, FNMPRE, NOSWLL, NOGE ! @@ -1254,6 +1254,17 @@ SUBROUTINE W3EXGO ( NX, NY, NSEA ) CALL W3S2XY ( NSEA, NSEA, NX+1, NY, WNMEAN, MAPSF, X1) ENDIF ! + ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 20 ) THEN + FLONE = .TRUE. + FSC = 0.001 + UNITS = '1' + ENAME = '.br' + IF ( ITYPE .EQ. 4 ) THEN + XS1 = BRCOEF + ELSE + CALL W3S2XY ( NSEA, NSEA, NX+1, NY, BRCOEF, MAPSF, X1) + ENDIF + ! ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 1 ) THEN FLONE = .TRUE. FSC = 0.01