From 1cacc436c8c1165e8d0bf80b61ec2ba1608ccf8a Mon Sep 17 00:00:00 2001 From: Mickael Accensi <49198861+mickaelaccensi@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:38:57 +0200 Subject: [PATCH 01/25] minor bugfix for matrix grepping on keywords (#1049) --- regtests/bin/run_cmake_test | 8 +++++--- regtests/ww3_tp2.12/info | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/regtests/bin/run_cmake_test b/regtests/bin/run_cmake_test index e114cd72a..ec1503c55 100755 --- a/regtests/bin/run_cmake_test +++ b/regtests/bin/run_cmake_test @@ -491,7 +491,9 @@ then cp $path_build/install/bin/ww3_shel $path_e/ cp $path_build/install/bin/ww3_multi $path_e/ cp $path_build/install/bin/ww3_systrk $path_e/ - cp $path_build/install/bin/ww3_prtide $path_e/ + if [ -e $path_build/install/bin/ww3_prtide ]; then + cp $path_build/install/bin/ww3_prtide $path_e/ + fi fi else path_build=${path_build_root} @@ -1127,9 +1129,9 @@ then if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] then - inputs_tmp=`( ls ${path_i}/${prog}${gu}*nml)` + inputs_tmp="`ls ${path_i}/${prog}${gu}*nml 2>/dev/null`" else - inputs_tmp=`( ls ${path_i}/${prog}${gu}*inp)` + inputs_tmp="`ls ${path_i}/${prog}${gu}*inp 2>/dev/null`" fi if [ ! -z "$inputs_tmp" ];then diff --git a/regtests/ww3_tp2.12/info b/regtests/ww3_tp2.12/info index e39ade75b..622e6f523 100644 --- a/regtests/ww3_tp2.12/info +++ b/regtests/ww3_tp2.12/info @@ -29,7 +29,7 @@ # * ww3_grid.inp (dummy grid input file, with assoc .bot, .mask, .obst) # # * partition.ww3 (raw fields of partition data, 4 time steps) # # * ww3_systrk.inp (instruction file) # -# * ww3_systrk will ABORT if endianess is incompatible with binary file! # +# * ww3_systrk will stop if endianess is incompatible with binary file! # # # # Sample run_test commands : # # (Note: mpirun commands differ by local system) # From dcafc8cb21ca96b50693b50905aed009fe7f11d3 Mon Sep 17 00:00:00 2001 From: Benoit Pouliot <51411504+benoitp-cmc@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:43:46 -0400 Subject: [PATCH 02/25] Stop masking group 1 output where icec > icen (#1019) --- model/src/ww3_gint.F90 | 24 +- model/src/ww3_ounf.F90 | 720 +++++++----------- model/src/ww3_outf.F90 | 12 +- regtests/mww3_test_01/input/ww3_ounf.inp | 2 +- regtests/mww3_test_01/input/ww3_ounf.nml | 2 +- regtests/mww3_test_01/input/ww3_outf_file.inp | 2 +- regtests/mww3_test_01/input/ww3_shel.inp | 2 +- regtests/mww3_test_01/input/ww3_shel.nml | 2 +- 8 files changed, 279 insertions(+), 487 deletions(-) diff --git a/model/src/ww3_gint.F90 b/model/src/ww3_gint.F90 index ee1150485..bfd2dd467 100644 --- a/model/src/ww3_gint.F90 +++ b/model/src/ww3_gint.F90 @@ -1302,19 +1302,11 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & ! IX = MAPSF(ISEA,1) IY = MAPSF(ISEA,2) - MAPICE = MOD(MAPST2(IY,IX),2) - MAPDRY = MOD(MAPST2(IY,IX)/2,2) - MAPLND = MOD(MAPST2(IY,IX)/4,2) - MAPMSK = MOD(MAPST2(IY,IX)/8,2) MAPINT = MOD(MAPST2(IY,IX)/16,2) - MAPST2(IY,IX) = MAPST2(IY,IX) - MAPICE - 2*MAPDRY - 4*MAPLND & - - 8*MAPMSK - ACTIVE = (MAPICE .NE. 1 .AND. MAPDRY .NE. 1) ! IF ( MAPINT .EQ. 0 ) THEN ! ! Initial loop to determine status map - ! Initialize by setting it to be ice free and wet ! MAPICE = 0 MAPDRY = 0 @@ -1361,8 +1353,8 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & IF ( NMAPDRY .GT. 50 ) MAPDRYT = 1 IF ( NMAPLND .GT. 50 ) MAPLNDT = 1 IF ( NMAPMSK .GT. 50 ) MAPMSKT = 1 - ACTIVE = (MAPICET .NE. 1 .AND. MAPDRYT .NE. 1 .AND. & - MAPLNDT .NE. 1 .AND. MAPMSKT .NE. 1) + ! Allow use of grid with ice or dry point. Allow merge of group 1 output + ACTIVE = (MAPLNDT .NE. 1 .AND. MAPMSKT .NE. 1) IF ( ACTIVE ) THEN USEGRID(IG) = .TRUE. SUMGRD = SUMGRD+1 @@ -1572,7 +1564,7 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & ! ! Group 1 variables ! - IF ( FLOGRD(1,1) .AND. ACTIVE ) THEN + IF ( FLOGRD(1,1) ) THEN IF ( WADATS(IGRID)%DW(GSEA) .NE. UNDEF ) THEN SUMWT1(1) = SUMWT1(1) + WT IF ( DWAUX .EQ. UNDEF ) THEN @@ -1583,7 +1575,7 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & END IF END IF ! - IF ( FLOGRD(1,2) .AND. ACTIVE ) THEN + IF ( FLOGRD(1,2) ) THEN IF ( WADATS(IGRID)%CX(GSEA) .NE. UNDEF ) THEN SUMWT1(2) = SUMWT1(2) + WT IF ( CXAUX .EQ. UNDEF ) THEN @@ -1609,7 +1601,7 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & END IF END IF ! - IF ( FLOGRD(1,4) .AND. ACTIVE ) THEN + IF ( FLOGRD(1,4) ) THEN IF ( WADATS(IGRID)%AS(GSEA) .NE. UNDEF ) THEN SUMWT1(4) = SUMWT1(4) + WT IF ( ASAUX .EQ. UNDEF ) THEN @@ -1620,7 +1612,7 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & END IF END IF ! - IF ( FLOGRD(1,5) .AND. ACTIVE ) THEN + IF ( FLOGRD(1,5) ) THEN IF ( WDATAS(IGRID)%WLV(GSEA) .NE. UNDEF ) THEN SUMWT1(5) = SUMWT1(5) + WT IF ( WLVAUX .EQ. UNDEF ) THEN @@ -1642,7 +1634,7 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & END IF END IF ! - IF ( FLOGRD(1,7) .AND. ACTIVE ) THEN + IF ( FLOGRD(1,7) ) THEN IF ( WDATAS(IGRID)%BERG(GSEA) .NE. UNDEF ) THEN SUMWT1(7) = SUMWT1(7) + WT IF ( BERGAUX .EQ. UNDEF ) THEN @@ -1666,7 +1658,7 @@ SUBROUTINE W3EXGI ( NGRD, NSEA, NOSWLL_MIN, INTMETHOD, OUTorRESTflag, & END IF END IF ! - IF ( FLOGRD(1,9) .AND. ACTIVE ) THEN + IF ( FLOGRD(1,9) ) THEN IF ( WDATAS(IGRID)%RHOAIR(GSEA) .NE. UNDEF ) THEN SUMWT1(9) = SUMWT1(9) + WT IF ( RHOAIRAUX .EQ. UNDEF ) THEN diff --git a/model/src/ww3_ounf.F90 b/model/src/ww3_ounf.F90 index 0a2cadfca..b77f9a9f9 100644 --- a/model/src/ww3_ounf.F90 +++ b/model/src/ww3_ounf.F90 @@ -1596,7 +1596,10 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & ! ! Wave energy flux ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 3 ) THEN - CGE=CGE*0.001 ! from W / m to kW / m + DO ISEA=1, NSEA + IF ( CGE(ISEA) .NE. UNDEF ) & + CGE(ISEA) = 0.001 * CGE(ISEA) ! from W / m to kW / m + END DO CALL S2GRID(CGE(1:NSEA), X1) ! ! Wind to wave energy flux @@ -2551,39 +2554,31 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & IVAR=IVAR1+I IF (COORDTYPE.EQ.1) THEN IF (NCVARTYPE.EQ.2) THEN - IF( SMCGRD ) THEN #ifdef W3_SMC - IF( SMCOTYPE .EQ. 1 ) THEN - ! SMC Flat file - IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_SHORT, (/DIMID(2), DIMID(4+EXTRADIM)/), VARID(IVAR)) - ELSE - ! SMC Regridded file - IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_SHORT, DIMID(2:4+EXTRADIM), VARID(IVAR)) - ENDIF - CALL CHECK_ERR(IRET) + IF( SMCGRD .AND. SMCOTYPE .EQ. 1 ) THEN + ! SMC Flat file + IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_SHORT, (/DIMID(2), DIMID(4+EXTRADIM)/), VARID(IVAR)) + ELSE #endif - ELSE ! SMCGRD - IRET=NF90_DEF_VAR(NCID,META(I)%VARNM, NF90_SHORT, DIMID(2:4+EXTRADIM), VARID(IVAR)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD + IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_SHORT, DIMID(2:4+EXTRADIM), VARID(IVAR)) +#ifdef W3_SMC + ENDIF +#endif + CALL CHECK_ERR(IRET) IF (NCTYPE.EQ.4) IRET = NF90_DEF_VAR_DEFLATE(NCID, VARID(IVAR), 1, 1, DEFLATE) IF (NCTYPE.EQ.4) CALL CHECK_ERR(IRET) ELSE - IF( SMCGRD ) THEN #ifdef W3_SMC - IF( SMCOTYPE .EQ. 1 ) THEN - ! SMC Flat file - IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_FLOAT, (/DIMID(2), DIMID(4+EXTRADIM)/), VARID(IVAR)) - ELSE - ! SMC Regridded file - IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_FLOAT, DIMID(2:4+EXTRADIM), VARID(IVAR)) - ENDIF - CALL CHECK_ERR(IRET) + IF( SMCGRD .AND. SMCOTYPE .EQ. 1 ) THEN + ! SMC Flat file + IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_FLOAT, (/DIMID(2), DIMID(4+EXTRADIM)/), VARID(IVAR)) + ELSE #endif - ELSE ! SMCGRD - IRET=NF90_DEF_VAR(NCID,META(I)%VARNM, NF90_FLOAT, DIMID(2:4+EXTRADIM), VARID(IVAR)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD + IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_FLOAT, DIMID(2:4+EXTRADIM), VARID(IVAR)) +#ifdef W3_SMC + ENDIF +#endif + CALL CHECK_ERR(IRET) IF (NCTYPE.EQ.4) IRET = NF90_DEF_VAR_DEFLATE(NCID, VARID(IVAR), 1, 1, DEFLATE) IF (NCTYPE.EQ.4) CALL CHECK_ERR(IRET) END IF @@ -2648,19 +2643,16 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & ELSE ! If it is spherical coordinate IF (FLAGLL) THEN - IF(SMCGRD) THEN #ifdef W3_SMC - IF(SMCOTYPE .EQ. 1) THEN - IRET=NF90_INQ_DIMID (NCID, 'seapoint', DIMID(2)) - ELSE - IRET=NF90_INQ_DIMID (NCID, 'longitude', DIMID(2)) - IRET=NF90_INQ_DIMID (NCID, 'latitude', DIMID(3)) - ENDIF -#endif + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + IRET=NF90_INQ_DIMID (NCID, 'seapoint', DIMID(2)) ELSE +#endif IRET=NF90_INQ_DIMID (NCID, 'longitude', DIMID(2)) IRET=NF90_INQ_DIMID (NCID, 'latitude', DIMID(3)) - ENDIF ! SMCGRD +#ifdef W3_SMC + ENDIF +#endif IRET=NF90_INQ_VARID (NCID, 'longitude', VARID(1)) IRET=NF90_INQ_VARID (NCID, 'latitude', VARID(2)) ! If it is cartesian coordinate @@ -2705,36 +2697,30 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & IVAR=IVAR1+I IF (COORDTYPE.EQ.1) THEN IF (NCVARTYPE.EQ.2) THEN - IF( SMCGRD ) THEN #ifdef W3_SMC - IF( SMCOTYPE .EQ. 1 ) THEN - ! SMC Flat file - IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_SHORT, (/DIMID(2), DIMID(4+EXTRADIM)/), VARID(IVAR)) - ELSE - ! SMC Regridded file - IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_SHORT, DIMID(2:4+EXTRADIM), VARID(IVAR)) - ENDIF -#endif + IF( SMCGRD .AND. SMCOTYPE .EQ. 1 ) THEN + ! SMC Flat file + IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_SHORT, (/DIMID(2), DIMID(4+EXTRADIM)/), VARID(IVAR)) ELSE +#endif IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_SHORT, DIMID(2:4+EXTRADIM), VARID(IVAR)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD +#ifdef W3_SMC + ENDIF +#endif + CALL CHECK_ERR(IRET) IF (NCTYPE.EQ.4) IRET = NF90_DEF_VAR_DEFLATE(NCID, VARID(IVAR), 1, 1, DEFLATE) ELSE - IF( SMCGRD ) THEN #ifdef W3_SMC - IF( SMCOTYPE .EQ. 1 ) THEN - ! SMC Flat file - IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_FLOAT, (/DIMID(2), DIMID(4+EXTRADIM)/), VARID(IVAR)) - ELSE - ! SMC Regridded file - IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_FLOAT, DIMID(2:4+EXTRADIM), VARID(IVAR)) - ENDIF -#endif + IF( SMCGRD .AND. SMCOTYPE .EQ. 1 ) THEN + ! SMC Flat file + IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_FLOAT, (/DIMID(2), DIMID(4+EXTRADIM)/), VARID(IVAR)) ELSE +#endif IRET = NF90_DEF_VAR(NCID,META(I)%varnm, NF90_FLOAT, DIMID(2:4+EXTRADIM), VARID(IVAR)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD +#ifdef W3_SMC + ENDIF +#endif + CALL CHECK_ERR(IRET) IF (NCTYPE.EQ.4) IRET = NF90_DEF_VAR_DEFLATE(NCID, VARID(IVAR), 1, 1, DEFLATE) IF (NCTYPE.EQ.4) CALL CHECK_ERR(IRET) END IF @@ -2849,263 +2835,171 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & ! NFIELD=3 IF (NCVARTYPE.EQ.2) THEN IF ( NFIELD.EQ.3 ) THEN - IF (SMCGRD) THEN + DO IX=IX1, IXN + DO IY=IY1, IYN + IF ( X1(IX,IY) .EQ. UNDEF ) THEN + MXX(IX,IY) = MFILL + MYY(IX,IY) = MFILL + MXY(IX,IY) = MFILL + ELSE + MXX(IX,IY) = NINT(X1(IX,IY)/META(1)%FSC) + MYY(IX,IY) = NINT(X2(IX,IY)/META(2)%FSC) + MXY(IX,IY) = NINT(XY(IX,IY)/META(3)%FSC) + END IF + END DO + END DO +#ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MXX(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + call CHECK_ERR(IRET) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & + MYY(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + call CHECK_ERR(IRET) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & + MXY(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + call CHECK_ERR(IRET) + ELSE +#endif + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MXX(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + call CHECK_ERR(IRET) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & + MYY(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + call CHECK_ERR(IRET) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & + MXY(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + call CHECK_ERR(IRET) #ifdef W3_SMC + ENDIF +#endif + ! NFIELD=2 + ELSE IF (NFIELD.EQ.2 ) THEN + ! EXTRADIM=0 + IF (EXTRADIM.EQ.0) THEN DO IX=IX1, IXN DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( X1(IX,IY) .EQ. UNDEF ) THEN + IF ( XX(IX,IY) .EQ. UNDEF ) THEN MXX(IX,IY) = MFILL MYY(IX,IY) = MFILL - MXY(IX,IY) = MFILL ELSE - MXX(IX,IY) = NINT(X1(IX,IY)/META(1)%FSC) - MYY(IX,IY) = NINT(X2(IX,IY)/META(2)%FSC) - MXY(IX,IY) = NINT(XY(IX,IY)/META(3)%FSC) + MXX(IX,IY) = NINT(XX(IX,IY)/META(1)%FSC) + MYY(IX,IY) = NINT(XY(IX,IY)/META(2)%FSC) END IF END DO END DO - IF(SMCOTYPE .EQ. 1) THEN +#ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & MXX(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) call CHECK_ERR(IRET) IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & MYY(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & - MXY(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) - call CHECK_ERR(IRET) ELSE +#endif IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & MXX(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) call CHECK_ERR(IRET) IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & MYY(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & - MXY(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - call CHECK_ERR(IRET) +#ifdef W3_SMC ENDIF #endif - ELSE ! IF(SMCGRD) - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR. X1(IX,IY) .EQ. UNDEF ) THEN - MXX(IX,IY) = MFILL - MYY(IX,IY) = MFILL - MXY(IX,IY) = MFILL - ELSE - MXX(IX,IY) = NINT(X1(IX,IY)/META(1)%FSC) - MYY(IX,IY) = NINT(X2(IX,IY)/META(2)%FSC) - MXY(IX,IY) = NINT(XY(IX,IY)/META(3)%FSC) - END IF - END DO - END DO - - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXX(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYY(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & - MXY(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD - ! NFIELD=2 - ELSE IF (NFIELD.EQ.2 ) THEN - ! EXTRADIM=0 - IF (EXTRADIM.EQ.0) THEN - IF (SMCGRD) THEN -#ifdef W3_SMC + ! EXTRADIM=1 + ELSE + START(3+1-COORDTYPE)=0 + DO IK=I1F,I2F + START(3+1-COORDTYPE)=START(3+1-COORDTYPE)+1 DO IX=IX1, IXN DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( XX(IX,IY) .EQ. UNDEF ) THEN + IF ( XXK(IX,IY,IK) .EQ. UNDEF ) THEN MXX(IX,IY) = MFILL MYY(IX,IY) = MFILL ELSE - MXX(IX,IY) = NINT(XX(IX,IY)/META(1)%FSC) - MYY(IX,IY) = NINT(XY(IX,IY)/META(2)%FSC) + MXX(IX,IY) = NINT(XXK(IX,IY,IK)/META(1)%FSC) + MYY(IX,IY) = NINT(XYK(IX,IY,IK)/META(2)%FSC) END IF END DO END DO - IF(SMCOTYPE .EQ. 1) THEN - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXX(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) +#ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MXX(IX1:IXN,IY1:IYN),(/START(1), START(3), START(4)/), & + (/COUNT(1), COUNT(3), COUNT(4)/)) call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYY(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & + MXY(IX1:IXN,IY1:IYN),(/START(1), START(3), START(4)/), & + (/COUNT(1), COUNT(3), COUNT(4)/)) call CHECK_ERR(IRET) ELSE +#endif IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXX(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + MXX(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) call CHECK_ERR(IRET) IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYY(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + MXX(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) call CHECK_ERR(IRET) - ENDIF -#endif - ELSE ! IF(SMCGRD) - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR. XX(IX,IY) .EQ. UNDEF ) THEN - MXX(IX,IY) = MFILL - MYY(IX,IY) = MFILL - ELSE - !PRINT*,XX(IX,IY),XY(IX,IY) - !STOP - MXX(IX,IY) = NINT(XX(IX,IY)/META(1)%FSC) - MYY(IX,IY) = NINT(XY(IX,IY)/META(2)%FSC) - END IF - END DO - END DO - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXX(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYY(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD - ! EXTRADIM=1 - ELSE - START(3+1-COORDTYPE)=0 - DO IK=I1F,I2F - START(3+1-COORDTYPE)=START(3+1-COORDTYPE)+1 - - IF (SMCGRD) THEN #ifdef W3_SMC - DO IX=IX1, IXN - DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( XXK(IX,IY,IK) .EQ. UNDEF ) THEN - MXX(IX,IY) = MFILL - MYY(IX,IY) = MFILL - ELSE - MXX(IX,IY) = NINT(XXK(IX,IY,IK)/META(1)%FSC) - MYY(IX,IY) = NINT(XYK(IX,IY,IK)/META(2)%FSC) - END IF - END DO - END DO - IF(SMCOTYPE .EQ. 1) THEN - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXX(IX1:IXN,IY1:IYN),(/START(1), START(3), START(4)/), & - (/COUNT(1), COUNT(3), COUNT(4)/)) - call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MXY(IX1:IXN,IY1:IYN),(/START(1), START(3), START(4)/), & - (/COUNT(1), COUNT(3), COUNT(4)/)) - call CHECK_ERR(IRET) - ELSE - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXX(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) - call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXX(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) - call CHECK_ERR(IRET) - ENDIF + ENDIF #endif - ELSE ! IF(SMCGRD) - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR.XXK(IX,IY,IK) .EQ. UNDEF ) THEN - MXX(IX,IY) = MFILL - MYY(IX,IY) = MFILL - ELSE - MXX(IX,IY) = NINT(XXK(IX,IY,IK)/META(1)%FSC) - MYY(IX,IY) = NINT(XYK(IX,IY,IK)/META(2)%FSC) - END IF - END DO - END DO - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXX(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYY(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) - ENDIF ! SMCGRD END DO END IF ! EXTRADIM ! NFIELD=1 ELSE ! EXTRADIM=0 IF (EXTRADIM.EQ.0) THEN - IF (SMCGRD) THEN + DO IX=IX1, IXN + DO IY=IY1, IYN + IF ( X1(IX,IY) .EQ. UNDEF ) THEN + MX1(IX,IY) = MFILL + ELSE + MX1(IX,IY) = NINT(X1(IX,IY)/META(1)%FSC) + END IF + END DO + END DO #ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MX1(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + call CHECK_ERR(IRET) + ELSE +#endif + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MX1(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + call CHECK_ERR(IRET) +#ifdef W3_SMC + ENDIF +#endif + ! EXTRADIM=1 + ELSE + START(3+1-COORDTYPE)=0 + DO IK=I1F,I2F + START(3+1-COORDTYPE)=START(3+1-COORDTYPE)+1 DO IX=IX1, IXN DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( X1(IX,IY) .EQ. UNDEF ) THEN + IF ( XK(IX,IY,IK) .EQ. UNDEF ) THEN MX1(IX,IY) = MFILL ELSE - MX1(IX,IY) = NINT(X1(IX,IY)/META(1)%FSC) + MX1(IX,IY) = NINT(XK(IX,IY,IK)/META(1)%FSC) END IF END DO END DO - IF(SMCOTYPE .EQ. 1) THEN - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) +#ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MX1(IX1:IXN,IY1:IYN),(/START(1), START(3), START(4)/), & + (/COUNT(1), COUNT(3), COUNT(4)/)) call CHECK_ERR(IRET) ELSE +#endif IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + MX1(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) call CHECK_ERR(IRET) - ENDIF -#endif - ELSE ! IF(SMCGRD) - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR.X1(IX,IY) .EQ. UNDEF ) THEN - MX1(IX,IY) = MFILL - ELSE - MX1(IX,IY) = NINT(X1(IX,IY)/META(1)%FSC) - END IF - END DO - END DO - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD - ! EXTRADIM=1 - ELSE - START(3+1-COORDTYPE)=0 - DO IK=I1F,I2F - START(3+1-COORDTYPE)=START(3+1-COORDTYPE)+1 - - IF (SMCGRD) THEN #ifdef W3_SMC - DO IX=IX1, IXN - DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( XK(IX,IY,IK) .EQ. UNDEF ) THEN - MX1(IX,IY) = MFILL - ELSE - MX1(IX,IY) = NINT(XK(IX,IY,IK)/META(1)%FSC) - END IF - END DO - END DO - IF(SMCOTYPE .EQ. 1) THEN - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) - call CHECK_ERR(IRET) - ELSE - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - call CHECK_ERR(IRET) - ENDIF + ENDIF #endif - ELSE ! IF(SMCGRD) - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR.XK(IX,IY,IK) .EQ. UNDEF ) THEN - MX1(IX,IY) = MFILL - ELSE - MX1(IX,IY) = NINT(XK(IX,IY,IK)/META(1)%FSC) - END IF - END DO - END DO - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD END DO END IF ! EXTRADIM END IF ! NFIELD @@ -3114,258 +3008,171 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & ! ELSE IF ( NFIELD.EQ.3 ) THEN - IF (SMCGRD) THEN + DO IX=IX1, IXN + DO IY=IY1, IYN + IF ( X1(IX,IY) .EQ. UNDEF ) THEN + MXXR(IX,IY) = MFILLR + MYYR(IX,IY) = MFILLR + MXYR(IX,IY) = MFILLR + ELSE + MXXR(IX,IY) = X1(IX,IY) + MYYR(IX,IY) = X2(IX,IY) + MXYR(IX,IY) = XY(IX,IY) + END IF + END DO + END DO +#ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MXXR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + call CHECK_ERR(IRET) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & + MYYR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + call CHECK_ERR(IRET) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & + MXYR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + call CHECK_ERR(IRET) + ELSE +#endif + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MXXR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + call CHECK_ERR(IRET) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & + MYYR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + call CHECK_ERR(IRET) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & + MXYR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + call CHECK_ERR(IRET) #ifdef W3_SMC + ENDIF +#endif + ! NFIELD=2 + ELSE IF (NFIELD.EQ.2 ) THEN + ! EXTRADIM=0 + IF (EXTRADIM.EQ.0) THEN DO IX=IX1, IXN DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( X1(IX,IY) .EQ. UNDEF ) THEN + IF ( XX(IX,IY) .EQ. UNDEF ) THEN MXXR(IX,IY) = MFILLR MYYR(IX,IY) = MFILLR - MXYR(IX,IY) = MFILLR ELSE - MXXR(IX,IY) = X1(IX,IY) - MYYR(IX,IY) = X2(IX,IY) - MXYR(IX,IY) = XY(IX,IY) + MXXR(IX,IY) = XX(IX,IY) + MYYR(IX,IY) = XY(IX,IY) END IF END DO END DO - IF(SMCOTYPE .EQ. 1) THEN +#ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & MXXR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) call CHECK_ERR(IRET) IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & MYYR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & - MXYR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) - call CHECK_ERR(IRET) ELSE +#endif IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & MXXR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) call CHECK_ERR(IRET) IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & MYYR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & - MXYR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - call CHECK_ERR(IRET) +#ifdef W3_SMC ENDIF #endif - ELSE ! IF(SMCGRD) - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR. X1(IX,IY) .EQ. UNDEF ) THEN - MXXR(IX,IY) = MFILLR - MYYR(IX,IY) = MFILLR - MXYR(IX,IY) = MFILLR - ELSE - MXXR(IX,IY) = X1(IX,IY) - MYYR(IX,IY) = X2(IX,IY) - MXYR(IX,IY) = XY(IX,IY) - END IF - END DO - END DO - - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXXR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYYR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+3), & - MXYR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD - ! NFIELD=2 - ELSE IF (NFIELD.EQ.2 ) THEN - ! EXTRADIM=0 - IF (EXTRADIM.EQ.0) THEN - IF (SMCGRD) THEN -#ifdef W3_SMC + ! EXTRADIM=1 + ELSE + START(4-COORDTYPE)=0 + DO IK=I1F,I2F + START(4-COORDTYPE)=START(4-COORDTYPE)+1 DO IX=IX1, IXN DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( XX(IX,IY) .EQ. UNDEF ) THEN + IF ( XXK(IX,IY,IK) .EQ. UNDEF ) THEN MXXR(IX,IY) = MFILLR MYYR(IX,IY) = MFILLR ELSE - MXXR(IX,IY) = XX(IX,IY) - MYYR(IX,IY) = XY(IX,IY) + MXXR(IX,IY) = XXK(IX,IY,IK) + MYYR(IX,IY) = XYK(IX,IY,IK) END IF END DO END DO - IF(SMCOTYPE .EQ. 1) THEN - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXXR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) +#ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MXXR(IX1:IXN,IY1:IYN),(/START(1), START(3), START(4)/), & + (/COUNT(1), COUNT(3), COUNT(4)/)) call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYYR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & + MYYR(IX1:IXN,IY1:IYN),(/START(1), START(3), START(4)/), & + (/COUNT(1), COUNT(3), COUNT(4)/)) call CHECK_ERR(IRET) ELSE +#endif IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXXR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + MXXR(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) call CHECK_ERR(IRET) IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYYR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + MYYR(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) call CHECK_ERR(IRET) - ENDIF -#endif - ELSE ! IF SMCGRD - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR. XX(IX,IY) .EQ. UNDEF ) THEN - MXXR(IX,IY) = MFILLR - MYYR(IX,IY) = MFILLR - ELSE - MXXR(IX,IY) = XX(IX,IY) - MYYR(IX,IY) = XY(IX,IY) - END IF - END DO - END DO - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXXR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYYR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD - ! EXTRADIM=1 - ELSE - START(4-COORDTYPE)=0 - DO IK=I1F,I2F - START(4-COORDTYPE)=START(4-COORDTYPE)+1 - - IF (SMCGRD) THEN #ifdef W3_SMC - DO IX=IX1, IXN - DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( XXK(IX,IY,IK) .EQ. UNDEF ) THEN - MXXR(IX,IY) = MFILLR - MYYR(IX,IY) = MFILLR - ELSE - MXXR(IX,IY) = XXK(IX,IY,IK) - MYYR(IX,IY) = XYK(IX,IY,IK) - END IF - END DO - END DO - IF(SMCOTYPE .EQ. 1) THEN - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXXR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) - call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYYR(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) - call CHECK_ERR(IRET) - ELSE - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXXR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - call CHECK_ERR(IRET) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYYR(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - call CHECK_ERR(IRET) - ENDIF + ENDIF #endif - ELSE ! IF SMCGRD - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR.XXK(IX,IY,IK) .EQ. UNDEF ) THEN - MXXR(IX,IY) = MFILLR - MYYR(IX,IY) = MFILLR - ELSE - MXXR(IX,IY) = XXK(IX,IY,IK) - MYYR(IX,IY) = XYK(IX,IY,IK) - END IF - END DO - END DO - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MXXR(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+2), & - MYYR(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) - ENDIF ! SMCGRD END DO END IF ! EXTRADIM ! NFIELD=1 ELSE ! EXTRADIM=0 IF (EXTRADIM.EQ.0) THEN - IF (SMCGRD) THEN + DO IX=IX1, IXN + DO IY=IY1, IYN + IF ( X1(IX,IY) .EQ. UNDEF ) THEN + MX1R(IX,IY) = MFILLR + ELSE + MX1R(IX,IY) = X1(IX,IY) + END IF + END DO + END DO +#ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MX1R(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) + call CHECK_ERR(IRET) + ELSE +#endif + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MX1R(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + call CHECK_ERR(IRET) #ifdef W3_SMC + ENDIF +#endif + ! EXTRADIM=1 + ELSE + START(4-COORDTYPE)=0 + DO IK=I1F,I2F + START(4-COORDTYPE)=START(4-COORDTYPE)+1 DO IX=IX1, IXN DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( X1(IX,IY) .EQ. UNDEF ) THEN + IF ( XK(IX,IY,IK) .EQ. UNDEF ) THEN MX1R(IX,IY) = MFILLR ELSE - MX1R(IX,IY) = X1(IX,IY) + MX1R(IX,IY) = XK(IX,IY,IK) END IF END DO END DO - IF(SMCOTYPE .EQ. 1) THEN - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1R(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) +#ifdef W3_SMC + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & + MX1R(IX1:IXN,IY1:IYN),(/START(1), START(3), START(4)/), & + (/COUNT(1), COUNT(3), COUNT(4)/)) call CHECK_ERR(IRET) ELSE +#endif IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1R(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) + MX1R(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) call CHECK_ERR(IRET) - ENDIF -#endif - ELSE ! IF SMCGRD - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR.X1(IX,IY) .EQ. UNDEF ) THEN - MX1R(IX,IY) = MFILLR - ELSE - MX1R(IX,IY) = X1(IX,IY) - END IF - END DO - END DO - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1R(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - CALL CHECK_ERR(IRET) - ENDIF ! SMCGRD - ! EXTRADIM=1 - ELSE - START(4-COORDTYPE)=0 - DO IK=I1F,I2F - START(4-COORDTYPE)=START(4-COORDTYPE)+1 - IF (SMCGRD) THEN #ifdef W3_SMC - DO IX=IX1, IXN - DO IY=IY1, IYN - ! TODO: Find some other way to access MAPSTA - IF ( XK(IX,IY,IK) .EQ. UNDEF ) THEN - MX1R(IX,IY) = MFILLR - ELSE - MX1R(IX,IY) = XK(IX,IY,IK) - END IF - END DO - END DO - IF(SMCOTYPE .EQ. 1) THEN - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1R(IX1:IXN,IY1:IYN),(/START(1), START(3)/),(/COUNT(1), COUNT(3)/)) - call CHECK_ERR(IRET) - ELSE - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1R(IX1:IXN,IY1:IYN),(/START(1:3)/),(/COUNT(1:3)/)) - call CHECK_ERR(IRET) - ENDIF + ENDIF #endif - ELSE ! IF SMCGRD - DO IX=IX1, IXN - DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR.XK(IX,IY,IK) .EQ. UNDEF ) THEN - MX1R(IX,IY) = MFILLR - ELSE - MX1R(IX,IY) = XK(IX,IY,IK) - END IF - END DO - END DO - IRET=NF90_PUT_VAR(NCID,VARID(IVAR1+1), & - MX1R(IX1:IXN,IY1:IYN),(/START(1:4)/),(/COUNT(1:4)/)) - CALL CHECK_ERR(IRET) - END IF ! SMCGRD END DO END IF ! EXTRADIM END IF ! NFIELD @@ -3510,21 +3317,18 @@ SUBROUTINE W3CRNC (NCFILE, NCID, DIMID, DIMLN, VARID, & ! IF (GTYPE.NE.UNGTYPE) THEN IF (FLAGLL) THEN - IF (SMCGRD) THEN #ifdef W3_SMC - IF(SMCOTYPE .EQ. 1) THEN - ! Flat seapoints file - IRET = NF90_DEF_DIM(NCID, 'seapoint', dimln(2), DIMID(2)) - ELSE - ! Regular gridded file: - IRET = NF90_DEF_DIM(NCID, 'longitude', dimln(2), DIMID(2)) - IRET = NF90_DEF_DIM(NCID, 'latitude', dimln(3), DIMID(3)) - ENDIF -#endif + IF(SMCGRD .AND. SMCOTYPE .EQ. 1) THEN + ! Flat seapoints file + IRET = NF90_DEF_DIM(NCID, 'seapoint', dimln(2), DIMID(2)) ELSE - IRET = NF90_DEF_DIM(NCID, 'longitude', DIMLN(2), DIMID(2)) - IRET = NF90_DEF_DIM(NCID, 'latitude', DIMLN(3), DIMID(3)) - ENDIF ! SMCGRD +#endif + ! Regular gridded file: + IRET = NF90_DEF_DIM(NCID, 'longitude', dimln(2), DIMID(2)) + IRET = NF90_DEF_DIM(NCID, 'latitude', dimln(3), DIMID(3)) +#ifdef W3_SMC + ENDIF +#endif ELSE IRET = NF90_DEF_DIM(NCID, 'x', DIMLN(2), DIMID(2)) IRET = NF90_DEF_DIM(NCID, 'y', DIMLN(3), DIMID(3)) diff --git a/model/src/ww3_outf.F90 b/model/src/ww3_outf.F90 index e4c1affed..c055c9209 100644 --- a/model/src/ww3_outf.F90 +++ b/model/src/ww3_outf.F90 @@ -2365,8 +2365,7 @@ SUBROUTINE W3EXGO ( NX, NY, NSEA ) ! DO IX=IX1, IXN DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .GT. 0 .AND. & - X1(IX,IY) .NE. UNDEF ) THEN + IF ( X1(IX,IY) .NE. UNDEF ) THEN NINGRD = NINGRD + 1 XMIN = MIN ( XMIN , X1(IX,IY) ) XMAX = MAX ( XMAX , X1(IX,IY) ) @@ -2455,8 +2454,7 @@ SUBROUTINE W3EXGO ( NX, NY, NSEA ) IF ( FLTRI ) THEN DO IX=IX1, IXN DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR. & - XX(IX,IY) .EQ. UNDEF ) THEN + IF ( XX(IX,IY) .EQ. UNDEF ) THEN MXX(IX,IY) = MFILL MYY(IX,IY) = MFILL MXY(IX,IY) = MFILL @@ -2495,8 +2493,7 @@ SUBROUTINE W3EXGO ( NX, NY, NSEA ) IF ( FLTWO .OR. FLDIR ) THEN DO IX=IX1, IXN DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR. & - XX(IX,IY) .EQ. UNDEF ) THEN + IF ( XX(IX,IY) .EQ. UNDEF ) THEN MXX(IX,IY) = MFILL MYY(IX,IY) = MFILL ELSE @@ -2535,8 +2532,7 @@ SUBROUTINE W3EXGO ( NX, NY, NSEA ) ELSE DO IX=IX1, IXN DO IY=IY1, IYN - IF ( MAPSTA(IY,IX) .LE. 0 .OR. & - X1(IX,IY) .EQ. UNDEF ) THEN + IF ( X1(IX,IY) .EQ. UNDEF ) THEN MX1(IX,IY) = MFILL ELSE MX1(IX,IY) = NINT(X1(IX,IY)/FSC) diff --git a/regtests/mww3_test_01/input/ww3_ounf.inp b/regtests/mww3_test_01/input/ww3_ounf.inp index 55b74a100..f78b0e667 100644 --- a/regtests/mww3_test_01/input/ww3_ounf.inp +++ b/regtests/mww3_test_01/input/ww3_ounf.inp @@ -11,7 +11,7 @@ $ file for a full documentation of field output options. Namelist type $ selection is used here (for alternative F/T flags, see ww3_shel.inp). $ N - HS + HS ICE $ $--------------------------------------------------------------------- $ $ Output type 4 [3,4] (version netCDF) diff --git a/regtests/mww3_test_01/input/ww3_ounf.nml b/regtests/mww3_test_01/input/ww3_ounf.nml index 5a92a0cb5..b6a115a7f 100644 --- a/regtests/mww3_test_01/input/ww3_ounf.nml +++ b/regtests/mww3_test_01/input/ww3_ounf.nml @@ -9,7 +9,7 @@ FIELD%TIMESTART = '19680606 000000' FIELD%TIMESTRIDE = '3600' FIELD%TIMECOUNT = '999' - FIELD%LIST = 'HS' + FIELD%LIST = 'HS ICE' FIELD%PARTITION = '0 1 2' FIELD%TYPE = 4 / diff --git a/regtests/mww3_test_01/input/ww3_outf_file.inp b/regtests/mww3_test_01/input/ww3_outf_file.inp index 6d909ff53..db8c14716 100644 --- a/regtests/mww3_test_01/input/ww3_outf_file.inp +++ b/regtests/mww3_test_01/input/ww3_outf_file.inp @@ -6,7 +6,7 @@ $ 19680606 000000 3600 999 $ N - HS + HS ICE $ 3 0 1 999 1 999 1 1 diff --git a/regtests/mww3_test_01/input/ww3_shel.inp b/regtests/mww3_test_01/input/ww3_shel.inp index 1585f747e..ecc511800 100644 --- a/regtests/mww3_test_01/input/ww3_shel.inp +++ b/regtests/mww3_test_01/input/ww3_shel.inp @@ -18,7 +18,7 @@ $ 19680606 000000 450 19680607 000000 $ N - HS FP DP + HS FP DP ICE $ 19680606 000000 450 19680607 000000 100.E3 100.E3 'point_A' diff --git a/regtests/mww3_test_01/input/ww3_shel.nml b/regtests/mww3_test_01/input/ww3_shel.nml index f9a586f53..903cef0c8 100644 --- a/regtests/mww3_test_01/input/ww3_shel.nml +++ b/regtests/mww3_test_01/input/ww3_shel.nml @@ -22,7 +22,7 @@ ! Define the output types point parameters via OUTPUT_TYPE_NML namelist ! -------------------------------------------------------------------- ! &OUTPUT_TYPE_NML - TYPE%FIELD%LIST = 'HS FP DP' + TYPE%FIELD%LIST = 'HS FP DP ICE' TYPE%POINT%FILE = '../input/points.list' / From 2715a9e78d92a358dd7b7f3f5d463522615d430b Mon Sep 17 00:00:00 2001 From: Matthew Masarik <86749872+MatthewMasarik-NOAA@users.noreply.github.com> Date: Mon, 7 Aug 2023 10:33:16 -0400 Subject: [PATCH 03/25] Doxygen documentation added, 8th subset.(#1046) --- model/src/gx_outf.F90 | 42 +++ model/src/gx_outp.F90 | 28 ++ model/src/w3canomd.F90 | 608 ++++++++++++++++++++++++++++++++++------- model/src/w3parall.F90 | 162 ++++++++++- model/src/w3pro1md.F90 | 66 +++++ model/src/w3pro2md.F90 | 80 ++++++ model/src/w3pro3md.F90 | 104 +++++++ model/src/w3ref1md.F90 | 46 +++- model/src/w3sbt1md.F90 | 43 +++ model/src/w3sbt4md.F90 | 61 +++++ model/src/w3sbt8md.F90 | 58 +++- model/src/w3sbt9md.F90 | 68 +++++ model/src/w3sdb1md.F90 | 43 +++ 13 files changed, 1303 insertions(+), 106 deletions(-) diff --git a/model/src/gx_outf.F90 b/model/src/gx_outf.F90 index 4c25b4425..c8ab00e38 100644 --- a/model/src/gx_outf.F90 +++ b/model/src/gx_outf.F90 @@ -1,5 +1,37 @@ +!> @file +!> @brief Generate GrADS input files from raw WAVEWATCH data file. +!> +!> @author H. L. Tolman +!> @author A. Chawla +!> @author J.H.G.M. Alves +!> @date 22-Mar-2021 +!> #include "w3macros.h" + !/ ------------------------------------------------------------------- / +!> +!> @brief Generate GrADS input files from raw WAVEWATCH data file. +!> +!> @details +!> Data is read from the grid output file out_grd.ww3 (raw data) +!> and from the file gx_outf.inp ( NDSI, output requests ). +!> Model definition and raw data files are read using WAVEWATCH III +!> subroutines. +!> +!> Output files are ww3.ctl and ww3.grads. The output files +!> contains a land-sea map, followed by requested fields. See the +!> control file for the names of the fields. +!> +!> @author H. L. Tolman +!> @author A. Chawla +!> @author J.H.G.M. Alves +!> @date 22-Mar-2021 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> PROGRAM GXOUTF !/ !/ +-----------------------------------+ @@ -740,6 +772,16 @@ PROGRAM GXOUTF !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Perform actual output for GrADS postprocessing. + !> + !> @param[in] NX Grid dimensions. + !> @param[in] NY Grid dimensions. + !> @param[in] NSEA Number of sea points. + !> + !> @author H. L. Tolman + !> @date 22-Mar-2021 + !> SUBROUTINE GXEXGO ( NX, NY, NSEA ) !/ !/ +-----------------------------------+ diff --git a/model/src/gx_outp.F90 b/model/src/gx_outp.F90 index 63b525485..d34fdbaa7 100644 --- a/model/src/gx_outp.F90 +++ b/model/src/gx_outp.F90 @@ -1,5 +1,27 @@ +!> @file +!> @brief Post-processing of point output for GrADS post-processing. +!> +!> @author H. L. Tolman +!> @author J.H. Alves +!> @author F. Ardhuin +!> @date 27-Aug-2015 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / +!> +!> @brief Post-processing of point output for GrADS post-processing. +!> +!> @author H. L. Tolman +!> @author J.H. Alves +!> @author F. Ardhuin +!> @date 27-Aug-2015 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> PROGRAM GXOUTP !/ !/ +-----------------------------------+ @@ -539,6 +561,12 @@ PROGRAM GXOUTP !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Perform actual point output. + !> + !> @author H. L. Tolman + !> @date 16-Jul-2012 + !> SUBROUTINE GXEXPO !/ !/ +-----------------------------------+ diff --git a/model/src/w3canomd.F90 b/model/src/w3canomd.F90 index de287eb85..5395853f2 100644 --- a/model/src/w3canomd.F90 +++ b/model/src/w3canomd.F90 @@ -1,5 +1,25 @@ +!> @file +!> @brief Calculation of the second order correction to the surface +!> gravity wave spectrum. +!> +!> @author P.A.E.M. Janssen +!> @date 21-Aug-2014 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / +!> +!> @brief Calculation of the second order correction to the surface +!> gravity wave spectrum. +!> +!> @author P.A.E.M. Janssen +!> @date 21-Aug-2014 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3CANOMD !/ !/ +-----------------------------------+ @@ -117,6 +137,18 @@ MODULE W3CANOMD !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Adds second order spectrum on top of first order spectrum. + !> + !> @param[inout] E Energy density spectrum (1-D), f-theta. + !> @param[in] DEPTH Mean water depth. + !> @param[in] WN Wavenumbers. + !> @param[in] CG Group velocities. + !> @param[in] IACTION Action density spectrum (1-D). + !> + !> @author F. Ardhuin + !> @date 19-Oct-2012 + !> SUBROUTINE W3ADD2NDORDER(E,DEPTH,WN,CG,IACTION) !/ !/ +-----------------------------------+ @@ -313,6 +345,25 @@ END SUBROUTINE W3ADD2NDORDER !----------------------------------------------------------------------- ! + !> + !> @brief Determines second order spectrum. + !> + !> @param[in] F1 2-D free wave spectrum + !> @param[out] F3 2-D spectrum including 2nd-order correction + !> @param[in] NFRE number of frequencies + !> @param[in] NANG number of directions + !> @param[in] FR frequencies + !> @param[in] DFIM frequency increment + !> @param[in] TH directional array + !> @param[in] DELTH directional increment + !> @param[in] DPTH depth array + !> @param[in] SIGM mapping indicator + !> @param[in] NFREH + !> @param[in] NANGH + !> + !> @author Peter Janssen + !> @date NA + !> SUBROUTINE CAL_SEC_ORDER_SPEC(F1,F3,NFRE,NANG,FR,DFIM,TH,DELTH, & DPTH,SIGM, NFREH, NANGH) ! @@ -649,6 +700,23 @@ END SUBROUTINE CAL_SEC_ORDER_SPEC ! !-------------------------------------------------------------------- ! + !> + !> @brief Computes tables for second order spectrum in frequency space. + !> + !> @param NFRE number of frequencies + !> @param NANG number of directions + !> @param NDEPTH number of entries in the depth table + !> @param DEPTHA + !> @param OMSTART start frequency + !> @param FRAC fractional increase in frequency space + !> @param XMR inverse of thinning factor in frequency space + !> @param DFDTH product of increment in frequency and direction + !> @param OMEGA angular frequency array + !> @param TH direction array + !> + !> @author NA + !> @date NA + !> SUBROUTINE TABLES_2ND(NFRE,NANG,NDEPTH,DEPTHA,OMSTART,FRAC,XMR,& DFDTH,OMEGA,TH) ! @@ -821,6 +889,35 @@ END SUBROUTINE TABLES_2ND ! !-------------------------------------------------------------------- ! + !> + !> @brief Computes second order spectrum in frequency space. + !> + !> @param F1 2D free wave spectrum (input) + !> @param F3 bound waves spectrum (output) + !> @param NFRE number of frequencies + !> @param NANG number of directions + !> @param NMAX maximum index corresponds to twice the cut-off frequency + !> + !> @param NDEPTH number of entries in depth table + !> @param DEPTHA start value depth array + !> @param DEPTHD increment depth array + !> @param OMSTART start value angular frequency array + !> @param FRAC fractional increase in frequency space + !> @param MR thinning factor in frequency space + !> @param OMEGA angular frequency array + !> @param DEPTH depth array + !> @param AKMEAN mean wavenumber array + !> @param TA table for minus interactions + !> @param TB table for plus interactions + !> @param TC_QL table for quasi-linear interactions + !> @param TT_4M table for stokes frequency correction + !> @param TT_4P table for stokes frequency correction + !> @param IM_P table for wavenumber m2 plus + !> @param IM_M table for wavenumber m2 min + !> + !> @author NA + !> @date NA + !> SUBROUTINE SECSPOM(F1,F3,NFRE,NANG,NMAX,NDEPTH,& DEPTHA,DEPTHD,OMSTART,FRAC,MR,DFDTH,OMEGA,& DEPTH,AKMEAN,TA,TB,TC_QL,TT_4M,TT_4P,& @@ -1035,14 +1132,28 @@ SUBROUTINE SECSPOM(F1,F3,NFRE,NANG,NMAX,NDEPTH,& ! RETURN END SUBROUTINE SECSPOM + ! - ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *A(XI,XJ,THI,THJ) - ! - !----------------------------------------------------------------------- + !> + !> @brief Gives nonlinear transfer coefficient for three wave interactions + !> interactions of gravity waves in the ideal case of no current. Determines + !> the minus interaction coefficients. + !> + !> @param XI wave number + !> @param XJ wave number + !> @param THI + !> @param THJ + !> @returns A + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION A(XI,XJ,THI,THJ) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *A(XI,XJ,THI,THJ) + ! + !----------------------------------------------------------------------- ! !*** *A* DETERMINES THE MINUS INTERACTIONS. ! @@ -1100,10 +1211,24 @@ REAL FUNCTION A(XI,XJ,THI,THJ) RETURN END FUNCTION A ! - !*** *REAL FUNCTION* *B(XI,XJ,THI,THJ) - ! - !----------------------------------------------------------------------- + !> + !> @brief Gives nonlinear transfer coefficient for three wave interactions + !> interactions of gravity waves in the ideal case of no current. Determines + !> the plus interaction coefficients. + !> + !> @param XI wave number + !> @param XJ wave number + !> @param THI + !> @param THJ + !> @returns B + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION B(XI,XJ,THI,THJ) + !*** *REAL FUNCTION* *B(XI,XJ,THI,THJ) + ! + !----------------------------------------------------------------------- ! !*** *B* DETERMINES THE PLUS INTERACTION COEFFICIENTS. ! @@ -1160,12 +1285,24 @@ REAL FUNCTION B(XI,XJ,THI,THJ) RETURN END FUNCTION B ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *C_QL(XK0,XK1,TH0,TH1) - ! - !----------------------------------------------------------------------- + !> + !> @brief Determine contribution by quasi-linear terms. + !> + !> @param XK0 + !> @param XK1 + !> @param TH0 + !> @param TH1 + !> @returns C_QL + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION C_QL(XK0,XK1,TH0,TH1) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *C_QL(XK0,XK1,TH0,TH1) + ! + !----------------------------------------------------------------------- ! !*** *A* DETERMINES THE QUASI-LINEAR TERM. ! @@ -1212,12 +1349,27 @@ END FUNCTION C_QL ! ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *VPLUS(XI,XJ,XK,THI,THJ,THK) - ! - !----------------------------------------------------------------------- + !> + !> @brief Determines the second-order transfer coefficient + !> for three wave interactions of gravity waves. + !> + !> @param XI wave numbers + !> @param XJ wave numbers + !> @param XK wave numbers + !> @param THI wave direction + !> @param THJ wave direction + !> @param THK wave direction + !> @returns VPLUS + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION VPLUS(XI,XJ,XK,THI,THJ,THK) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *VPLUS(XI,XJ,XK,THI,THJ,THK) + ! + !----------------------------------------------------------------------- ! !*** *VPLUS* DETERMINES THE SECOND-ORDER TRANSFER COEFFICIENT ! FOR THREE WAVE INTERACTIONS OF GRAVITY WAVES. @@ -1288,12 +1440,27 @@ REAL FUNCTION VPLUS(XI,XJ,XK,THI,THJ,THK) RETURN END FUNCTION VPLUS ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *VMIN(XI,XJ,XK,THI,THJ,THK) - ! - !----------------------------------------------------------------------- + !> + !> @brief Determines the second-order transfer coefficient for + !> three wave interactions of gravity waves. + !> + !> @param XI wave number + !> @param XJ wave number + !> @param XK wave number + !> @param THI wave direction + !> @param THJ wave direction + !> @param THK wave direction + !> @returns VMIN + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION VMIN(XI,XJ,XK,THI,THJ,THK) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *VMIN(XI,XJ,XK,THI,THJ,THK) + ! + !----------------------------------------------------------------------- ! !*** *VMIN* DETERMINES THE SECOND-ORDER TRANSFER COEFFICIENT FOR ! THREE WAVE INTERACTIONS OF GRAVITY WAVES. @@ -1364,12 +1531,29 @@ REAL FUNCTION VMIN(XI,XJ,XK,THI,THJ,THK) RETURN END FUNCTION VMIN ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *U(XI,XJ,XK,XL,THI,THJ,THK,THL) - ! - !----------------------------------------------------------------------- + !> + !> @brief Determines the third-order transfer coefficient for four + !> wave interactions of gravity waves. + !> + !> @param XI wave number + !> @param XJ wave number + !> @param XK wave number + !> @param XL wave number + !> @param THI + !> @param THJ + !> @param THK + !> @param THL + !> @returns U + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION U(XI,XJ,XK,XL,THI,THJ,THK,THL) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *U(XI,XJ,XK,XL,THI,THJ,THK,THL) + ! + !----------------------------------------------------------------------- ! !*** *U* DETERMINES THE THIRD-ORDER TRANSFER COEFFICIENT FOR FOUR ! WAVE INTERACTIONS OF GRAVITY WAVES. @@ -1438,12 +1622,29 @@ REAL FUNCTION U(XI,XJ,XK,XL,THI,THJ,THK,THL) RETURN END FUNCTION U ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *W2(XI,XJ,XK,XL,THI,THJ,THK,THL) - ! - !----------------------------------------------------------------------- + !> + !> @brief Determines the contribution of the direct four-wave + !> interactions of gravity waves of the type A_2^*A_3A_4. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param XL Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @param THL + !> @returns W2 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION W2(XI,XJ,XK,XL,THI,THJ,THK,THL) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *W2(XI,XJ,XK,XL,THI,THJ,THK,THL) + ! + !----------------------------------------------------------------------- ! !*** *W2* DETERMINES THE CONTRIBUTION OF THE DIRECT FOUR-WAVE ! INTERACTIONS OF GRAVITY WAVES OF THE TYPE @@ -1490,12 +1691,29 @@ REAL FUNCTION W2(XI,XJ,XK,XL,THI,THJ,THK,THL) RETURN END FUNCTION W2 ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *V2(XI,XJ,XK,XL,THI,THJ,THK,THL) - ! - !----------------------------------------------------------------------- + !> + !> @brief Determines the contribution of the virtual + !> four-wave interactions of gravity waves. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param XL Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @param THL + !> @returns V2 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION V2(XI,XJ,XK,XL,THI,THJ,THK,THL) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *V2(XI,XJ,XK,XL,THI,THJ,THK,THL) + ! + !----------------------------------------------------------------------- ! !*** *V2* DETERMINES THE CONTRIBUTION OF THE VIRTUAL ! FOUR-WAVE INTERACTIONS OF GRAVITY WAVES. @@ -1624,12 +1842,29 @@ REAL FUNCTION V2(XI,XJ,XK,XL,THI,THJ,THK,THL) RETURN END FUNCTION V2 ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *W1(XI,XJ,XK,XL,THI,THJ,THK,THL) - ! - !----------------------------------------------------------------------- + !> + !> @brief Determines the nonlinear transfer coefficient for four wave + !> interactions of gravity waves of the type A_2A_3A_4. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param XL Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @param THL + !> @returns W1 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION W1(XI,XJ,XK,XL,THI,THJ,THK,THL) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *W1(XI,XJ,XK,XL,THI,THJ,THK,THL) + ! + !----------------------------------------------------------------------- ! !*** *W1* DETERMINES THE NONLINEAR TRANSFER COEFFICIENT FOR FOUR ! WAVE INTERACTIONS OF GRAVITY WAVES OF THE TYPE @@ -1683,10 +1918,29 @@ REAL FUNCTION W1(XI,XJ,XK,XL,THI,THJ,THK,THL) RETURN END FUNCTION W1 ! - !*** *REAL FUNCTION* *W4(XI,XJ,XK,XL,THI,THJ,THK,THL) - ! - !----------------------------------------------------------------------- + !> + !> @brief Determines the nonlinear transfer coefficient for four wave + !> interactions of gravity waves of the type A_^*A_3^*A_4^*. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param XL Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @param THL + !> @returns W4 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION W4(XI,XJ,XK,XL,THI,THJ,THK,THL) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *W4(XI,XJ,XK,XL,THI,THJ,THK,THL) + ! + !----------------------------------------------------------------------- ! !*** *W4* DETERMINES THE NONLINEAR TRANSFER COEFFICIENT FOR FOUR ! WAVE INTERACTIONS OF GRAVITY WAVES of the type @@ -1741,13 +1995,29 @@ REAL FUNCTION W4(XI,XJ,XK,XL,THI,THJ,THK,THL) RETURN END FUNCTION W4 - ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *B3(XI,XJ,XK,XL,THI,THJ,THK,THL) - ! - !----------------------------------------------------------------------- + + !> + !> @brief Weights of the A_2^*A_3^*A_4 part of the canonical transformation. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param XL Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @param THL + !> @returns B3 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION B3(XI,XJ,XK,XL,THI,THJ,THK,THL) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *B3(XI,XJ,XK,XL,THI,THJ,THK,THL) + ! + !----------------------------------------------------------------------- ! !*** *B3* WEIGHTS OF THE A_2^*A_3^*A_4 PART OF THE ! CANONICAL TRANSFORMATION. @@ -1858,12 +2128,29 @@ REAL FUNCTION B3(XI,XJ,XK,XL,THI,THJ,THK,THL) RETURN END FUNCTION B3 ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *B4(XI,XJ,XK,XL,THI,THJ,THK,THL) - ! - !----------------------------------------------------------------------- + !> + !> @brief Weights of the A_2^*A_3^*A_4^* part of the canonical + !> transformation. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param XL Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @param THL + !> @returns B4 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION B4(XI,XJ,XK,XL,THI,THJ,THK,THL) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *B4(XI,XJ,XK,XL,THI,THJ,THK,THL) + ! + !----------------------------------------------------------------------- ! !*** *B4* WEIGHTS OF THE A_2^*A_3^*A_4^* PART OF THE CANONICAL ! TRANSFORMATION. @@ -1954,12 +2241,29 @@ REAL FUNCTION B4(XI,XJ,XK,XL,THI,THJ,THK,THL) RETURN END FUNCTION B4 ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *B1(XI,XJ,XK,XL,THI,THJ,THK,THL) - ! - !----------------------------------------------------------------------- + !> + !> @brief Weights of the A_2A_3A_4 part of the canonical + !> transformation. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param XL Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @param THL + !> @returns B1 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION B1(XI,XJ,XK,XL,THI,THJ,THK,THL) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *B1(XI,XJ,XK,XL,THI,THJ,THK,THL) + ! + !----------------------------------------------------------------------- ! !*** *B1* WEIGHTS OF THE A_2A_3A_4 PART OF THE CANONICAL ! TRANSFORMATION. @@ -2055,15 +2359,30 @@ REAL FUNCTION B1(XI,XJ,XK,XL,THI,THJ,THK,THL) ) +W1(RI,RJ,RK,RL,THI,THJ,THK,THL) ) RETURN END FUNCTION B1 - ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *B2(XI,XJ,XK,XL,THI,THJ,THK,THL) - ! - !----------------------------------------------------------------------- + !> + !> @brief Weights of the A_2^*A_3A_4 part of the canonical + !> transformation. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param XL Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @param THL + !> @returns B2 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION B2(XI,XJ,XK,XL,THI,THJ,THK,THL) + !----------------------------------------------------------------------- ! + !*** *REAL FUNCTION* *B2(XI,XJ,XK,XL,THI,THJ,THK,THL) + ! + !----------------------------------------------------------------------- ! !*** *B2* WEIGHTS OF THE A_2^*A_3A_4 PART OF THE CANONICAL ! TRANSFORMATION. @@ -2155,12 +2474,26 @@ REAL FUNCTION B2(XI,XJ,XK,XL,THI,THJ,THK,THL) RETURN END FUNCTION B2 ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *A1(XI,XJ,XK,THI,THJ,THK) - ! - !----------------------------------------------------------------------- + !> + !> @brief Auxiliary second-order coefficient. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @returns A1 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION A1(XI,XJ,XK,THI,THJ,THK) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *A1(XI,XJ,XK,THI,THJ,THK) + ! + !----------------------------------------------------------------------- ! !*** *A1* AUXILIARY SECOND-ORDER COEFFICIENT. ! @@ -2215,12 +2548,26 @@ REAL FUNCTION A1(XI,XJ,XK,THI,THJ,THK) RETURN END FUNCTION A1 ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *A2(XI,XJ,XK,THI,THJ,THK) - ! - !----------------------------------------------------------------------- + !> + !> @brief Auxiliary second-order function. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @returns A2 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION A2(XI,XJ,XK,THI,THJ,THK) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *A2(XI,XJ,XK,THI,THJ,THK) + ! + !----------------------------------------------------------------------- ! !*** *A2* AUXILIARY SECOND-ORDER FUNCTION. ! @@ -2259,12 +2606,26 @@ REAL FUNCTION A2(XI,XJ,XK,THI,THJ,THK) RETURN END FUNCTION A2 ! - !----------------------------------------------------------------------- - ! - !*** *REAL FUNCTION* *A3(XI,XJ,XK,THI,THJ,THK) - ! - !----------------------------------------------------------------------- + !> + !> @brief Auxiliary second-order function. + !> + !> @param XI Wave number + !> @param XJ Wave number + !> @param XK Wave number + !> @param THI + !> @param THJ + !> @param THK + !> @returns A3 + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION A3(XI,XJ,XK,THI,THJ,THK) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *A3(XI,XJ,XK,THI,THJ,THK) + ! + !----------------------------------------------------------------------- ! !*** *A3* AUXILIARY SECOND-ORDER FUNCTION. ! @@ -2317,14 +2678,23 @@ REAL FUNCTION A3(XI,XJ,XK,THI,THJ,THK) END FUNCTION A3 ! - !----------------------------------------------------------------------- - ! - ! - !*** *REAL FUNCTION* *OMEG(X)* - ! - !----------------------------------------------------------------------- - ! + !> + !> @brief Determines the dispersion relation for gravity + !> waves. + !> + !> @param X Wave number + !> @returns OMEG + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION OMEG(X) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *OMEG(X)* + ! + !----------------------------------------------------------------------- + ! ! !*** *OMEG* DETERMINES THE DISPERSION RELATION FOR GRAVITY ! WAVES. @@ -2366,15 +2736,21 @@ REAL FUNCTION OMEG(X) RETURN END FUNCTION OMEG ! - ! - !----------------------------------------------------------------------- - ! - ! - !*** *REAL FUNCTION* *VG(X)* - ! - !----------------------------------------------------------------------- - ! + !> + !> @brief Determines the group velocity for gravity- waves. + !> + !> @param X Wave number + !> @returns VG + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION VG(X) + !----------------------------------------------------------------------- + ! + !*** *REAL FUNCTION* *VG(X)* + ! + !----------------------------------------------------------------------- ! !*** *VG* DETERMINES THE GROUP VELOCITY FOR GRAVITY- WAVES. ! @@ -2416,6 +2792,16 @@ REAL FUNCTION VG(X) RETURN END FUNCTION VG !--------------------------------------------------------------------- + !> + !> @brief Gives the wavenumber. + !> + !> @param OM + !> @param BETA + !> @returns AKI + !> + !> @author Peter Janssen + !> @date NA + !> REAL FUNCTION AKI(OM,BETA) ! This function gives the wavenumber ... !--------------------------------------------------------------------- @@ -2444,6 +2830,18 @@ REAL FUNCTION AKI(OM,BETA) RETURN END FUNCTION AKI ! + !> + !> @brief NA. + !> + !> @param XI + !> @param XJ + !> @param THI + !> @param THJ + !> @returns VABS + !> + !> @author NA + !> @date NA + !> REAL FUNCTION VABS(XI,XJ,THI,THJ) ! !--------------------------------------------------------------------- @@ -2462,6 +2860,18 @@ REAL FUNCTION VABS(XI,XJ,THI,THJ) RETURN END FUNCTION VABS ! + !> + !> @brief NA. + !> + !> @param XI + !> @param XJ + !> @param THI + !> @param THJ + !> @returns VDIR + !> + !> @author NA + !> @date NA + !> REAL FUNCTION VDIR(XI,XJ,THI,THJ) ! !--------------------------------------------------------------------- diff --git a/model/src/w3parall.F90 b/model/src/w3parall.F90 index 798e989cb..e2aba9b52 100644 --- a/model/src/w3parall.F90 +++ b/model/src/w3parall.F90 @@ -1,3 +1,24 @@ +!> @file +!> @brief Parallel routines for implicit solver. +!> +!> @author Aron Roland +!> @author Mathieu Dutour-Sikiric +!> @date 01-Jun-2018 +!> + +!/ ------------------------------------------------------------------- / +!> +!> @brief Parallel routines for implicit solver. +!> +!> @author Aron Roland +!> @author Mathieu Dutour-Sikiric +!> @date 01-Jun-2018 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3PARALL !/ !/ +-----------------------------------+ @@ -76,6 +97,15 @@ MODULE W3PARALL REAL, PARAMETER :: THR = TINY(1.0) CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief NA + !> + !> @param[out] eTime + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE WAV_MY_WTIME(eTime) !/ ------------------------------------------------------------------- / !/ @@ -157,6 +187,15 @@ SUBROUTINE WAV_MY_WTIME(eTime) !/ END SUBROUTINE WAV_MY_WTIME !/ ------------------------------------------------------------------- / + !> + !> @brief Print timings. + !> + !> @param[in] string + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE PRINT_MY_TIME(string) !/ !/ +-----------------------------------+ @@ -232,6 +271,17 @@ SUBROUTINE PRINT_MY_TIME(string) !/ END SUBROUTINE PRINT_MY_TIME !/ ------------------------------------------------------------------- / + !> + !> @brief Compute refraction part in matrix. + !> + !> @param[in] ISEA + !> @param[in] DTG + !> @param[out] CAD + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE PROP_REFRACTION_PR1(ISEA,DTG, CAD) !/ !/ +-----------------------------------+ @@ -382,6 +432,19 @@ SUBROUTINE PROP_REFRACTION_PR1(ISEA,DTG, CAD) END SUBROUTINE PROP_REFRACTION_PR1 !/ ------------------------------------------------------------------- / ! + !> + !> @brief Compute refraction part in matrix alternative approach. + !> + !> @param[in] IP + !> @param[in] ISEA + !> @param[in] DTG + !> @param[out] CAD + !> @param[in] DoLimiter + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE PROP_REFRACTION_PR3(IP, ISEA, DTG, CAD, DoLimiter) !/ !/ +-----------------------------------+ @@ -529,6 +592,19 @@ SUBROUTINE PROP_REFRACTION_PR3(IP, ISEA, DTG, CAD, DoLimiter) !/ END SUBROUTINE PROP_REFRACTION_PR3 !/ ------------------------------------------------------------------- / + !> + !> @brief Compute frequency shift in matrix. + !> + !> @param[in] IP + !> @param[in] ISEA + !> @param[out] CAS + !> @param[out] DMM + !> @param[in] DTG + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE PROP_FREQ_SHIFT(IP, ISEA, CAS, DMM, DTG) !/ !/ +-----------------------------------+ @@ -668,6 +744,19 @@ SUBROUTINE PROP_FREQ_SHIFT(IP, ISEA, CAS, DMM, DTG) !/ END SUBROUTINE PROP_FREQ_SHIFT !/ ------------------------------------------------------------------- / + !> + !> @brief Compute frequency shift alternative approach. + !> + !> @param[in] IP + !> @param[in] ISEA + !> @param[out] CWNB_M2 + !> @param[out] DWNI_M2 + !> @param[in] DTG + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE PROP_FREQ_SHIFT_M2(IP, ISEA, CWNB_M2, DWNI_M2, DTG) !/ !/ +-----------------------------------+ @@ -813,6 +902,16 @@ SUBROUTINE PROP_FREQ_SHIFT_M2(IP, ISEA, CWNB_M2, DWNI_M2, DTG) !/ END SUBROUTINE PROP_FREQ_SHIFT_M2 !/ ------------------------------------------------------------------- / + !> + !> @brief Sync global local arrays. + !> + !> @param[in] IMOD + !> @param[in] IsMulti + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE SYNCHRONIZE_IPGL_ETC_ARRAY(IMOD, IsMulti) !/ !/ +-----------------------------------+ @@ -927,6 +1026,16 @@ SUBROUTINE SYNCHRONIZE_IPGL_ETC_ARRAY(IMOD, IsMulti) !/ END SUBROUTINE SYNCHRONIZE_IPGL_ETC_ARRAY !/ ....................----------------------------------------------- / + !> + !> @brief Setup NSEAL, NSEALM in context of PDLIB. + !> + !> @param[out] NSEALout + !> @param[out] NSEALMout + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE SET_UP_NSEAL_NSEALM(NSEALout, NSEALMout) !/ !/ +-----------------------------------+ @@ -1039,6 +1148,17 @@ SUBROUTINE SET_UP_NSEAL_NSEALM(NSEALout, NSEALMout) !/ END SUBROUTINE SET_UP_NSEAL_NSEALM !/ ------------------------------------------------------------------- / + !> + !> @brief Set JSEA for all schemes. + !> + !> @param[in] ISEA + !> @param[out] JSEA + !> @param[out] ISPROC + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE INIT_GET_JSEA_ISPROC(ISEA, JSEA, ISPROC) !/ ------------------------------------------------------------------- / !/ @@ -1136,6 +1256,17 @@ SUBROUTINE INIT_GET_JSEA_ISPROC(ISEA, JSEA, ISPROC) !/ END SUBROUTINE INIT_GET_JSEA_ISPROC !/ ------------------------------------------------------------------- / + !> + !> @brief Set belongings of JSEA in context of PDLIB. + !> + !> @param[in] ISEA + !> @param[out] JSEA + !> @param[out] IBELONG + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE GET_JSEA_IBELONG(ISEA, JSEA, IBELONG) !/ ------------------------------------------------------------------- / !/ @@ -1253,6 +1384,16 @@ SUBROUTINE GET_JSEA_IBELONG(ISEA, JSEA, IBELONG) !/ END SUBROUTINE GET_JSEA_IBELONG !/ ------------------------------------------------------------------- / + !> + !> @brief Set ISEA for all schemes. + !> + !> @param[out] ISEA + !> @param[in] JSEA + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE INIT_GET_ISEA(ISEA, JSEA) !/ ------------------------------------------------------------------- / !/ @@ -1359,12 +1500,25 @@ SUBROUTINE INIT_GET_ISEA(ISEA, JSEA) !/ End of INIT_GET_ISEA ------------------------------------------------ / !/ END SUBROUTINE INIT_GET_ISEA - !********************************************************************** - !* An array of size (NSEA) is send but only the (1:NSEAL) values * - !* are correct. The program synchonizes everything on all nodes. * - !********************************************************************** + + !> + !> @brief Sync global array in context of PDLIB. + !> + !> @details An array of size (NSEA) is send but only the (1:NSEAL) values + !> are correct. The program synchonizes everything on all nodes. + !> + !> @param[inout] TheVar + !> + !> @author Aron Roland + !> @author Mathieu Dutour-Sikiric + !> @date 01-Jun-2018 + !> SUBROUTINE SYNCHRONIZE_GLOBAL_ARRAY(TheVar) !/ ------------------------------------------------------------------- / + !********************************************************************** + !* An array of size (NSEA) is send but only the (1:NSEAL) values * + !* are correct. The program synchonizes everything on all nodes. * + !********************************************************************** !/ !/ +-----------------------------------+ !/ | WAVEWATCH III NOAA/NCEP | diff --git a/model/src/w3pro1md.F90 b/model/src/w3pro1md.F90 index 16db90356..f8b498833 100644 --- a/model/src/w3pro1md.F90 +++ b/model/src/w3pro1md.F90 @@ -1,5 +1,25 @@ +!> @file +!> @brief Bundles routines for first order propagation scheme in single +!> module. +!> +!> @author H. L. Tolman +!> @date 05-Jun-2018 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / +!> +!> @brief Bundles routines for first order propagation scheme in single +!> module. +!> +!> @author H. L. Tolman +!> @date 05-Jun-2018 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3PRO1MD !/ !/ +-----------------------------------+ @@ -76,6 +96,14 @@ MODULE W3PRO1MD !/ ------------------------------------------------------------------- / CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Generate 'map' arrays for the first order upstream scheme. + !> + !> @param MAPSTA Status map + !> + !> @author H. L. Tolman + !> @date 06-Dec-2010 + !> SUBROUTINE W3MAP1 ( MAPSTA ) !/ !/ +-----------------------------------+ @@ -258,6 +286,19 @@ SUBROUTINE W3MAP1 ( MAPSTA ) !/ END SUBROUTINE W3MAP1 !/ ------------------------------------------------------------------- / + !> + !> @brief Propagation in physical space for a given spectral component. + !> + !> @param[in] ISP Number of spectral bin (IK-1)*NTH+ITH + !> @param[in] DTG Total time step. + !> @param[in] MAPSTA Grid point status map. + !> @param[inout] FIELD Wave action spectral densities on full grid. + !> @param[in] VGX Speed of grid. + !> @param[in] VGY Speed of grid. + !> + !> @author H. L. Tolman + !> @date 29-May-2014 + !> SUBROUTINE W3XYP1 ( ISP, DTG, MAPSTA, FIELD, VGX, VGY ) !/ !/ +-----------------------------------+ @@ -828,6 +869,31 @@ SUBROUTINE W3XYP1 ( ISP, DTG, MAPSTA, FIELD, VGX, VGY ) !/ END SUBROUTINE W3XYP1 !/ ------------------------------------------------------------------- / + !> + !> @brief Propagation in spectral space. + !> + !> @param[inout] ISEA Number of sea points. + !> @param[inout] FACTH Factor in propagation velocity. + !> @param[inout] FACK Factor in propagation velocity. + !> @param[inout] CTHG0 Factor in great circle refracftion term. + !> @param[inout] CG Local group velocities. + !> @param[inout] WN Local wavenumbers. + !> @param[inout] DEPTH Depth. + !> @param[inout] DDDX Depth gradients. + !> @param[inout] DDDY Depth gradients. + !> @param[inout] CX Local group velocities. + !> @param[inout] CY Local group velocities. + !> @param[inout] DCXDX Current gradients. + !> @param[inout] DCXDY Current gradients. + !> @param[inout] DCYDX Current gradients. + !> @param[inout] DCYDY Current gradients. + !> @param[inout] DCDX Phase speed gradients. + !> @param[inout] DCDY Phase speed gradients. + !> @param[inout] VA Spectrum. + !> + !> @author H. L. Tolman + !> @date 20-Dec-2004 + !> SUBROUTINE W3KTP1 ( ISEA, FACTH, FACK, CTHG0, CG, WN, DEPTH, & DDDX, DDDY, CX, CY, DCXDX, DCXDY, DCYDX, & DCYDY, DCDX, DCDY, VA ) diff --git a/model/src/w3pro2md.F90 b/model/src/w3pro2md.F90 index 4ae31f242..a23f893ef 100644 --- a/model/src/w3pro2md.F90 +++ b/model/src/w3pro2md.F90 @@ -1,5 +1,26 @@ +!> @file +!> @brief Bundles routines for third order porpagation scheme in single +!> module. +!> +!> @author H. L. Tolman +!> @date 29-May-2014 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / + +!> +!> @brief Bundles routines for third order porpagation scheme in single +!> module. +!> +!> @author H. L. Tolman +!> @date 29-May-2014 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3PRO2MD !/ !/ +-----------------------------------+ @@ -105,6 +126,12 @@ MODULE W3PRO2MD !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Generate 'map' arrays for the ULTIMATE QUICKEST scheme. + !> + !> @author H. L. Tolman + !> @date 09-Nov-2005 + !> SUBROUTINE W3MAP2 !/ !/ @@ -464,6 +491,20 @@ SUBROUTINE W3MAP2 !/ END SUBROUTINE W3MAP2 !/ ------------------------------------------------------------------- / + !> + !> @brief Propagation in physical space for a given spectral component. + !> + !> @param[in] ISP Number of spectral bin (IK-1)*NTH+ITH. + !> @param[in] DTG Total time step. + !> @param[in] MAPSTA Grid point status map. + !> @param[in] MAPFS Storage map. + !> @param[inout] VQ Field to propagate. + !> @param[in] VGX + !> @param[in] VGY + !> + !> @author H. L. Tolman + !> @date 29-May-2014 + !> SUBROUTINE W3XYP2 ( ISP, DTG, MAPSTA, MAPFS, VQ, VGX, VGY ) !/ !/ +-----------------------------------+ @@ -1219,6 +1260,45 @@ SUBROUTINE W3XYP2 ( ISP, DTG, MAPSTA, MAPFS, VQ, VGX, VGY ) END SUBROUTINE W3XYP2 !/ !/ ------------------------------------------------------------------- / + !> + !> @brief Propagation in spectral space. + !> + !> @details Third order QUICKEST scheme with ULTIMATE limiter. + !> + !> + !> As with the spatial propagation, the two spaces are considered + !> independently, but the propagation is performed in a 2-D space. + !> Compared to the propagation in physical space, the directions + !> represent a closed space and are therefore comparable to the + !> longitudinal or 'X' propagation. The wavenumber space has to be + !> extended to allow for boundary treatment. Using a simple first + !> order boundary treatment at both sided, two points need to + !> be added. This implies that the spectrum needs to be extended, + !> shifted and rotated, as is performed using MAPTH2 as set + !> in W3MAP3. + !> + !> @param[in] ISEA Number of sea point. + !> @param[in] FACTH Factor in propagation velocity. + !> @param[in] FACK Factor in propagation velocity. + !> @param[in] CTHG0 Factor in great circle refracftion term. + !> @param[in] CG Local group velocities. + !> @param[in] WN Local wavenumbers. + !> @param[in] DEPTH Depth. + !> @param[in] DDDX Depth gradient. + !> @param[in] DDDY Depth gradient. + !> @param[in] CX Current component. + !> @param[in] CY Current component. + !> @param[in] DCXDX Current gradients. + !> @param[in] DCXDY Current gradients. + !> @param[in] DCYDX Current gradients. + !> @param[in] DCYDY Current gradients. + !> @param[in] DCDX Phase speed gradient. + !> @param[in] DCDY Phase speed gradient. + !> @param[inout] VA Spectrum. + !> + !> @author H. L. Tolman + !> @date 01-Jul-2013 + !> SUBROUTINE W3KTP2 ( ISEA, FACTH, FACK, CTHG0, CG, WN, DEPTH, & DDDX, DDDY, CX, CY, DCXDX, DCXDY, & DCYDX, DCYDY, DCDX, DCDY, VA ) diff --git a/model/src/w3pro3md.F90 b/model/src/w3pro3md.F90 index 157b9be09..96396a7a4 100644 --- a/model/src/w3pro3md.F90 +++ b/model/src/w3pro3md.F90 @@ -1,5 +1,25 @@ +!> @file +!> @brief Bundles routines for third order propagation scheme in single +!> module. +!> +!> @author H. L. Tolman +!> @date 27-May-2014 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / +!> +!> @brief Bundles routines for third order propagation scheme in single +!> module. +!> +!> @author H. L. Tolman +!> @date 27-May-2014 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3PRO3MD !/ !/ +-----------------------------------+ @@ -110,6 +130,12 @@ MODULE W3PRO3MD !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Generate 'map' arrays for the ULTIMATE QUICKEST scheme. + !> + !> @author H. L. Tolman + !> @date 01-Apr-2008 + !> SUBROUTINE W3MAP3 !/ !/ +-----------------------------------+ @@ -488,6 +514,13 @@ SUBROUTINE W3MAP3 !/ END SUBROUTINE W3MAP3 !/ ------------------------------------------------------------------- / + !> + !> @brief Generate 'map' arrays for the ULTIMATE QUICKEST scheme to combine + !> GSE alleviation with obstructions. + !> + !> @author H. L. Tolman + !> @date 17-Dec-2004 + !> SUBROUTINE W3MAPT !/ !/ +-----------------------------------+ @@ -588,6 +621,20 @@ SUBROUTINE W3MAPT !/ END SUBROUTINE W3MAPT !/ ------------------------------------------------------------------- / + !> + !> @brief Propagation in phyiscal space for a given spectral component. + !> + !> @param[in] ISP Number of spectral bin (IK-1)*NTH+ITH. + !> @param[in] DTG Total time step. + !> @param[in] MAPSTA Grid point status map. + !> @param[in] MAPFS Storage map. + !> @param[inout] VQ Field to propagate. + !> @param[in] VGX Speed of grid. + !> @param[in] VGY Speed of grid. + !> + !> @author H. L. Tolman + !> @date 27-May-2014 + !> SUBROUTINE W3XYP3 ( ISP, DTG, MAPSTA, MAPFS, VQ, VGX, VGY ) !/ !/ +-----------------------------------+ @@ -1419,6 +1466,46 @@ SUBROUTINE W3XYP3 ( ISP, DTG, MAPSTA, MAPFS, VQ, VGX, VGY ) !/ END SUBROUTINE W3XYP3 !/ ------------------------------------------------------------------- / +!> +!> @brief Propagation in spectral space. +!> +!> @details Third order QUICKEST scheme with ULTIMATE limiter. +!> +!> As with the spatial propagation, the two spaces are considered +!> independently, but the propagation is performed in a 2-D space. +!> Compared to the propagation in physical space, the directions +!> represent a closed space and are therefore comparable to the +!> longitudinal or 'X' propagation. The wavenumber space has to be +!> extended to allow for boundary treatment. Using a simple first +!> order boundary treatment at both sided, two points need to +!> be added. This implies that the spectrum needs to be extended, +!> shifted and rotated, as is performed using MAPTH2 as set +!> in W3MAP3. +!> +!> @param[in] ISEA Number of sea point. +!> @param[in] FACTH Factor in propagation velocity. +!> @param[in] FACK Factor in propagation velocity. +!> @param[in] CTHG0 Factor in great circle refracftion term. +!> @param[in] CG Local group velocities. +!> @param[in] WN Local wavenumbers. +!> @param[in] DW Depth. +!> @param[in] DDDX Depth gradients. +!> @param[in] DDDY Depth gradients. +!> @param[in] CX Current components. +!> @param[in] CY Current components. +!> @param[in] DCXDX Current gradients. +!> @param[in] DCXDY Current gradients. +!> @param[in] DCYDX Current gradients. +!> @param[in] DCYDY Current gradients. +!> @param[in] DCDX Phase speed gradients. +!> @param[in] DCDY Phase speed gradients. +!> @param[inout] VA Spectrum. +!> @param[out] CFLTHMAX +!> @param[out] CFLKMAX +!> +!> @author H. L. Tolman +!> @date 01-Jul-2013 +!> SUBROUTINE W3KTP3 ( ISEA, FACTH, FACK, CTHG0, CG, WN, DW, & DDDX, DDDY, CX, CY, DCXDX, DCXDY, & DCYDX, DCYDY, DCDX, DCDY, VA, CFLTHMAX, CFLKMAX ) @@ -1863,6 +1950,23 @@ SUBROUTINE W3KTP3 ( ISEA, FACTH, FACK, CTHG0, CG, WN, DW, & !/ END SUBROUTINE W3KTP3 !/ ------------------------------------------------------------------- / + !> + !> @brief Computes the maximum CFL number for spatial advection. + !> + !> @details Used for diagnostic purposes (Could be used to define a + !> local time step ...). + !> + !> @param[in] ISEA Index of grid point. + !> @param[in] DTG Total time step. + !> @param[in] MAPSTA Grid point status map. + !> @param[in] MAPFS Storage map. + !> @param[inout] CFLXYMAX Maximum CFL number for XY propagation. + !> @param[in] VGX Speed of grid. + !> @param[in] VGY Speed of grid. + !> + !> @author F. Ardhuin + !> @date 31-Oct-2010 + !> SUBROUTINE W3CFLXY ( ISEA, DTG, MAPSTA, MAPFS, CFLXYMAX, VGX, VGY ) !/ !/ +-----------------------------------+ diff --git a/model/src/w3ref1md.F90 b/model/src/w3ref1md.F90 index 795bdce20..df184faf1 100644 --- a/model/src/w3ref1md.F90 +++ b/model/src/w3ref1md.F90 @@ -1,4 +1,24 @@ +!> @file +!> @brief This module computes shoreline reflection, and +!> unresolved islands and iceberg reflections. +!> +!> @author F. Ardhuin +!> @date 27-Jun-2014 +!> + !/ ------------------------------------------------------------------- / +!> +!> @brief This module computes shoreline reflection, and +!> unresolved islands and iceberg reflections. +!> +!> @author F. Ardhuin +!> @date 27-Jun-2014 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3REF1MD !/ !/ +-----------------------------------+ @@ -64,6 +84,30 @@ MODULE W3REF1MD !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Computes coastal and iceberg/island reflections and adds free IG energy. + !> + !> @param[inout] A Action density spectrum (1-D). + !> @param[in] CG Group velocities. + !> @param[in] WN Wavenumbers. + !> @param[in] EMEAN + !> @param[in] FMEAN + !> @param[in] DEPTH Mean water depth. + !> @param[in] CX1 + !> @param[in] CY1 + !> @param[in] REFLC + !> @param[in] REFLD + !> @param[in] TRNX + !> @param[in] TRNY + !> @param[in] BERG + !> @param[in] DT + !> @param[in] IX + !> @param[in] IY + !> @param[out] S Source term (1-D version). + !> + !> @author F. Ardhuin + !> @date 11-Jun-2014 + !> SUBROUTINE W3SREF(A, CG, WN, EMEAN, FMEAN, DEPTH, CX1, CY1, REFLC, REFLD, & TRNX, TRNY, BERG, DT, IX, IY, JSEA, S) !/ @@ -104,7 +148,7 @@ SUBROUTINE W3SREF(A, CG, WN, EMEAN, FMEAN, DEPTH, CX1, CY1, REFLC, REFLD, & ! ! Parameter list ! ---------------------------------------------------------------- - ! A R.A. I Action density spectrum (1-D) + ! A R.A. I Action density spectrum (1-D) ! CG R.A. I Group velocities. ! WN R.A. I Wavenumbers. ! DEPTH Real I Mean water depth. diff --git a/model/src/w3sbt1md.F90 b/model/src/w3sbt1md.F90 index fdc675ff3..bf17eafa1 100644 --- a/model/src/w3sbt1md.F90 +++ b/model/src/w3sbt1md.F90 @@ -1,5 +1,23 @@ +!> @file +!> @brief JONSWAP bottom friction routine. +!> +!> @author H. L. Tolman +!> @date 29-May-2009 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / +!> +!> @brief JONSWAP bottom friction routine. +!> +!> @author H. L. Tolman +!> @date 29-May-2009 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3SBT1MD !/ !/ +-----------------------------------+ @@ -42,6 +60,31 @@ MODULE W3SBT1MD !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Bottom friction source term according to the empirical JONSWAP + !> formulation. + !> + !> @verbatim + !> 2 GAMMA / CG \ SBTC1 / \ . + !> Sbt = ---------- | ------- - 0.5 | E = ----- | ... | E (1) + !> GRAV DEPTH \ SI/WN / DEPTH \ / + !> + !> Where GAMMA = -0.038 m2/s3 (JONSWAP) + !> = -0.067 m2/s3 (Bouws and Komen 1983) + !> + !> In the routine, the constant 2 GAMMA / GRAV = SBTC1. + !> @endverbatim + !> + !> @param[in] A Action density spectrum (1-D). + !> @param[in] CG Group velocities. + !> @param[in] WN Wavenumbers. + !> @param[in] DEPTH Mean water depth. + !> @param[out] S Source term (1-D version). + !> @param[out] D Diagonal term of derivative (1-D version). + !> + !> @author H. L. Tolman + !> @date 29-May-2009 + !> SUBROUTINE W3SBT1 (A, CG, WN, DEPTH, S, D) !/ !/ +-----------------------------------+ diff --git a/model/src/w3sbt4md.F90 b/model/src/w3sbt4md.F90 index 3291930f1..1d0e3a8d7 100644 --- a/model/src/w3sbt4md.F90 +++ b/model/src/w3sbt4md.F90 @@ -1,5 +1,27 @@ +!> @file +!> @brief SHOWEX bottom friction source term (Ardhuin et al 2003). +!> +!> @author F. Ardhuin +!> @author J. Lepesqueur +!> @date 14-Mar-2012 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / +!> +!> @brief SHOWEX bottom friction source term (Ardhuin et al. 2003). +!> +!> @details Using a subgrid depth parameterization based on Tolman (CE 1995). +!> +!> @author F. Ardhuin +!> @author J. Lepesqueur +!> @date 14-Mar-2012 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3SBT4MD !/ !/ +-----------------------------------+ @@ -114,6 +136,12 @@ MODULE W3SBT4MD !/ ------------------------------------------------------------------- / + !> + !> @brief Initialization for bottom friction source term routine. + !> + !> @author F. Ardhuin + !> @date 14-Mar-2012 + !> SUBROUTINE INSBT4 !/ !/ +-----------------------------------+ @@ -202,6 +230,15 @@ SUBROUTINE INSBT4 !/ END SUBROUTINE INSBT4 ! ---------------------------------------------------------------------- + + !> + !> @brief Tabulation of ERF function, which is used in bottom friction subgrid modeling. + !> + !> @details Initialization for source term routine. + !> + !> @author J. Lepesqueur + !> @date 14-Mar-2012 + !> SUBROUTINE TABU_ERF !/ !/ +-----------------------------------+ @@ -276,6 +313,30 @@ END SUBROUTINE TABU_ERF !/ ------------------------------------------------------------------- / !/ ------------------------------------------------------------------- / + !> + !> @brief Computes the SHOWEX bottom friction with movable bed effects. + !> + !> @details Uses a Gaussian distribution for friction factors, and estimates + !> the contribution of rippled and non-rippled fractions based on the + !> bayesian approach of Tolman (1995). + !> + !> @param[in] A Action density spectrum. + !> @param[in] CG Group velocities. + !> @param[in] WN Wavenumbers. + !> @param[in] DEPTH Water depth. + !> @param[in] D50 Median grain size. + !> @param[in] PSIC Critical Shields parameter. + !> @param[out] TAUBBL Components of stress leaking to the bottom. + !> @param[inout] BEDFORM Ripple parameters (roughness and wavelength). + !> @param[out] S Source term (1-D version). + !> @param[out] D Diagonal term of derivative. + !> @param[in] IX Spatial grid index. + !> @param[in] IY Spatial grid index. + !> + !> @author F. Ardhuin + !> @author J. Lepesqueur + !> @date 15-Mar-2012 + !> SUBROUTINE W3SBT4 (A, CG, WN, DEPTH, D50, PSIC, TAUBBL, BEDFORM, S, D, IX, IY ) !/ !/ +-----------------------------------+ diff --git a/model/src/w3sbt8md.F90 b/model/src/w3sbt8md.F90 index f598c2fbe..c56b57f0e 100644 --- a/model/src/w3sbt8md.F90 +++ b/model/src/w3sbt8md.F90 @@ -1,5 +1,27 @@ +!> @file +!> @brief Contains routines for computing dissipation by viscous fluid mud using +!> Dalrymple and Liu (1978) "Thin Model". +!> +!> @author M. Orzech +!> @author W. E. Rogers +!> @date 21-Nov-2013 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / +!> +!> @brief Contains routines for computing dissipation by viscous fluid mud using +!> Dalrymple and Liu (1978) "Thin Model". +!> +!> @author M. Orzech +!> @author W. E. Rogers +!> @date 21-Nov-2013 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3SBT8MD !/ !/ +-----------------------------------+ @@ -70,6 +92,22 @@ MODULE W3SBT8MD !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Compute dissipation by viscous fluid mud using Dalrymple and Liu (1978). + !> + !> @details "Thin Model" (adapted from Erick Rogers code by Mark Orzech, NRL). + !> + !> @param[in] AC Action density spectrum (1-D). + !> @param[in] H_WDEPTH Mean water depth. + !> @param[out] S Source term (1-D version). + !> @param[out] D Diagonal term of derivative (1-D version). + !> @param[in] IX + !> @param[in] IY + !> + !> @author M. Orzech + !> @author W. E. Rogers + !> @date 21-Nov-2013 + !> SUBROUTINE W3SBT8(AC,H_WDEPTH,S,D,IX,IY) !/ !/ +-----------------------------------+ @@ -454,7 +492,15 @@ SUBROUTINE W3SBT8(AC,H_WDEPTH,S,D,IX,IY) END SUBROUTINE W3SBT8 !/ ------------------------------------------------------------------- / - + !> + !> @brief Complex hyperbolic sin (sinh). + !> + !> @param[in] C + !> @param[out] CS + !> + !> @author NA + !> @date NA + !> SUBROUTINE CSINH(C,CS) COMPLEX, INTENT(IN) :: C COMPLEX, INTENT(OUT) :: CS @@ -465,7 +511,15 @@ SUBROUTINE CSINH(C,CS) END SUBROUTINE CSINH !/ ------------------------------------------------------------------- / - + !> + !> @brief Complex hyperbolic cos (cosh). + !> + !> @param[in] C + !> @param[out] CC + !> + !> @author NA + !> @date NA + !> SUBROUTINE CCOSH(C,CC) COMPLEX, INTENT(IN) :: C COMPLEX, INTENT(OUT) :: CC diff --git a/model/src/w3sbt9md.F90 b/model/src/w3sbt9md.F90 index 217a54977..9ad6fd345 100644 --- a/model/src/w3sbt9md.F90 +++ b/model/src/w3sbt9md.F90 @@ -1,5 +1,27 @@ +!> @file +!> @brief Contains routines for computing dissipation by viscous fluid mud using +!> Ng (2000). +!> +!> @author M. Orzech +!> @author W. E. Rogers +!> @date 21-Nov-2013 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / +!> +!> @brief Contains routines for computing dissipation by viscous fluid +!> mud using Ng (2000). +!> +!> @author M. Orzech +!> @author W. E. Rogers +!> @date 21-Nov-2013 +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3SBT9MD !/ !/ +-----------------------------------+ @@ -78,6 +100,21 @@ MODULE W3SBT9MD !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Compute dissipation by viscous fluid mud using Ng (2000) + !> (adapted from Erick Rogers code by Mark Orzech, NRL). + !> + !> @param[in] AC Action density. + !> @param[in] H_WDEPTH Mean water depth. + !> @param[out] S Source term (1-D version). + !> @param[out] D Diagonal term of derivative (1-D version). + !> @param[in] IX + !> @param[in] IY + !> + !> @author M. Orzech + !> @author W. E. Rogers + !> @date 21-Nov-2013 + !> SUBROUTINE W3SBT9(AC,H_WDEPTH,S,D,IX,IY) !/ !/ +-----------------------------------+ @@ -369,6 +406,26 @@ SUBROUTINE W3SBT9(AC,H_WDEPTH,S,D,IX,IY) END SUBROUTINE W3SBT9 !/ ------------------------------------------------------------------- / + !> + !> @brief Compute dissipation by viscous fluid mud using Ng (2000). + !> + !> @details Adapted from Erick Rogers code by Mark Orzech, NRL. + !> + !> @param[in] SIGMA Radian frequency (rad). + !> @param[in] H_WDEPTH Water depth, denoted "h" in Ng (m). + !> @param[in] DTILDE Normalized mud depth. + !> @param[in] ZETA The ratio of stokes' boundary layer. + !> @param[in] SBLTM Sbltm is what you get if you calculate sblt using + !> the viscosity of the mud + !> @param[in] GAMMA The gamma used in Ng page 238, density(water)/density(mud). + !> @param[in] WK Unmuddy wavenumber. + !> @param[out] WKDR Muddy wavenumber. + !> @param[out] DISS Dissipation rate. + !> + !> @author E. Rogers + !> @author M. Orzech + !> @date 21-Nov-2013 + !> SUBROUTINE NG(SIGMA,H_WDEPTH,DTILDE,ZETA,SBLTM,GAMMA,WK,WKDR,DISS) !/ !/ +-----------------------------------+ @@ -500,6 +557,17 @@ SUBROUTINE NG(SIGMA,H_WDEPTH,DTILDE,ZETA,SBLTM,GAMMA,WK,WKDR,DISS) END SUBROUTINE NG !/ ------------------------------------------------------------------- / + !> + !> @brief NA + !> + !> @param[in] KWAVE + !> @param[in] H_WDEPTH + !> @param[in] SND2 + !> @param[out] ND + !> + !> @author NA + !> @date NA + !> SUBROUTINE CALC_ND(KWAVE,H_WDEPTH,SND2,ND) !/ ------------------------------------------------------------------- / diff --git a/model/src/w3sdb1md.F90 b/model/src/w3sdb1md.F90 index af3e65c7a..c297e8522 100644 --- a/model/src/w3sdb1md.F90 +++ b/model/src/w3sdb1md.F90 @@ -1,5 +1,26 @@ +!> @file +!> @brief Dummy slot for bottom friction source term. +!> +!> @author J. H. Alves +!> @author H. L. Tolman +!> @date 29-May-2009 +!> + #include "w3macros.h" !/ ------------------------------------------------------------------- / +!> +!> @brief Dummy slot for bottom friction source term. +!> +!> @author J. H. Alves +!> @author H. L. Tolman +!> @date 29-May-2009 +!> +!> +!> @copyright Copyright 2009-2022 National Weather Service (NWS), +!> National Oceanic and Atmospheric Administration. All rights +!> reserved. WAVEWATCH III is a trademark of the NWS. +!> No unauthorized use without permission. +!> MODULE W3SDB1MD !/ !/ +-----------------------------------+ @@ -50,6 +71,28 @@ MODULE W3SDB1MD !/ CONTAINS !/ ------------------------------------------------------------------- / + !> + !> @brief Compute depth-induced breaking using Battjes and Janssen bore + !> model approach. + !> + !> @details Note that the Miche criterion can influence wave growth. + !> + !> @param[in] IX Local grid number + !> @param[in] A Action density spectrum (1-D). + !> @param[inout] DEPTH Mean water depth. + !> @param[inout] EMEAN Mean wave energy. + !> @param[inout] FMEAN Mean wave frequency. + !> @param[inout] WNMEAN Mean wave number. + !> @param[in] CG + !> @param[out] LBREAK + !> @param[out] S Source term (1-D version). + !> @param[out] D Diagonal term of derivative (1-D version). + !> + !> @author J. H. Alves + !> @author H. L. Tolman + !> @author A. Roland + !> @date 08-Jun-2018 + !> SUBROUTINE W3SDB1 (IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D ) !/ !/ +-----------------------------------+ From b810a89456b4befd7f225672dec216f46115aa9f Mon Sep 17 00:00:00 2001 From: Ghazal-Mohammadpour <124626872+Ghazal-Mohammadpour@users.noreply.github.com> Date: Fri, 11 Aug 2023 09:16:20 -0400 Subject: [PATCH 04/25] NC4 ,F90 ,XX0 switches removed from ww3_tp2.19 regtest (#1054) --- regtests/ww3_tp2.19/input_Case1A/switch_PDLIB | 2 +- regtests/ww3_tp2.19/input_Case1B/switch_PDLIB | 2 +- regtests/ww3_tp2.19/input_Case1C/switch_PDLIB | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/regtests/ww3_tp2.19/input_Case1A/switch_PDLIB b/regtests/ww3_tp2.19/input_Case1A/switch_PDLIB index 173947fdd..0ffd8565f 100644 --- a/regtests/ww3_tp2.19/input_Case1A/switch_PDLIB +++ b/regtests/ww3_tp2.19/input_Case1A/switch_PDLIB @@ -1 +1 @@ -F90 PDLIB METIS NOGRB NC4 DIST MPI PR3 UQ FLX0 LN0 ST0 NL0 BT0 DB1 TR1 BS0 IC0 IS0 REF0 XX0 WNT1 WNX1 CRT1 CRX1 SEC1 O0 O1 O2 O3 O4 O5 O6 O7 + PDLIB METIS NOGRB DIST MPI PR3 UQ FLX0 LN0 ST0 NL0 BT0 DB1 TR1 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 SEC1 O0 O1 O2 O3 O4 O5 O6 O7 diff --git a/regtests/ww3_tp2.19/input_Case1B/switch_PDLIB b/regtests/ww3_tp2.19/input_Case1B/switch_PDLIB index 173947fdd..0ffd8565f 100644 --- a/regtests/ww3_tp2.19/input_Case1B/switch_PDLIB +++ b/regtests/ww3_tp2.19/input_Case1B/switch_PDLIB @@ -1 +1 @@ -F90 PDLIB METIS NOGRB NC4 DIST MPI PR3 UQ FLX0 LN0 ST0 NL0 BT0 DB1 TR1 BS0 IC0 IS0 REF0 XX0 WNT1 WNX1 CRT1 CRX1 SEC1 O0 O1 O2 O3 O4 O5 O6 O7 + PDLIB METIS NOGRB DIST MPI PR3 UQ FLX0 LN0 ST0 NL0 BT0 DB1 TR1 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 SEC1 O0 O1 O2 O3 O4 O5 O6 O7 diff --git a/regtests/ww3_tp2.19/input_Case1C/switch_PDLIB b/regtests/ww3_tp2.19/input_Case1C/switch_PDLIB index ec5c35288..20fbedfed 100644 --- a/regtests/ww3_tp2.19/input_Case1C/switch_PDLIB +++ b/regtests/ww3_tp2.19/input_Case1C/switch_PDLIB @@ -1 +1 @@ -F90 PDLIB METIS NOGRB NC4 DIST MPI PR3 UQ FLX0 LN0 ST0 NL0 BT0 DB1 TR1 BS0 IC0 IS0 REF0 XX0 WNT1 WNX1 CRT1 CRX1 SEC1 O0 O1 O2 O3 O4 O5 O6 O7 + PDLIB METIS NOGRB DIST MPI PR3 UQ FLX0 LN0 ST0 NL0 BT0 DB1 TR1 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 SEC1 O0 O1 O2 O3 O4 O5 O6 O7 From 991daf8bae2966e3527122f3d0a2cc0ae616ed0d Mon Sep 17 00:00:00 2001 From: Matthew Masarik <86749872+MatthewMasarik-NOAA@users.noreply.github.com> Date: Sat, 2 Sep 2023 13:07:44 -0400 Subject: [PATCH 05/25] CI: Fix for Intel scripts. GNU scripts updated. (#1064) --- .github/workflows/gnu.yml | 12 ++++++------ .github/workflows/intel.yml | 31 ++++++++++++++++--------------- model/ci/spack_gnu.yaml | 3 ++- model/ci/spack_intel.yaml | 11 ++++++----- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/.github/workflows/gnu.yml b/.github/workflows/gnu.yml index d1aa0e967..d28d1bb5b 100644 --- a/.github/workflows/gnu.yml +++ b/.github/workflows/gnu.yml @@ -7,7 +7,7 @@ concurrency: cancel-in-progress: true env: - cache_key: gnu8 + cache_key: gnu11 CC: gcc-10 FC: gfortran-10 CXX: g++-10 @@ -24,14 +24,14 @@ jobs: steps: - name: checkout-ww3 if: steps.cache-env.outputs.cache-hit != 'true' - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ww3 # Cache spack, OASIS, and compiler # No way to flush Action cache, so key may have # appended - name: cache-env id: cache-env - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | spack @@ -45,7 +45,7 @@ jobs: run: | # Install NetCDF, ESMF, g2, etc using Spack sudo apt install cmake - git clone -c feature.manyFiles=true https://github.com/spack/spack.git + git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git source spack/share/spack/setup-env.sh spack env create ww3-gnu ww3/model/ci/spack_gnu.yaml spack env activate ww3-gnu @@ -77,13 +77,13 @@ jobs: steps: - name: checkout-ww3 - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ww3 - name: cache-env id: cache-env - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | spack diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml index c40f3265e..700553cea 100644 --- a/.github/workflows/intel.yml +++ b/.github/workflows/intel.yml @@ -8,7 +8,7 @@ concurrency: # Set I_MPI_CC/F90 so Intel MPI wrapper uses icc/ifort instead of gcc/gfortran env: - cache_key: intel7 + cache_key: intel10 CC: icc FC: ifort CXX: icpc @@ -16,18 +16,18 @@ env: I_MPI_F90: ifort # Split into a dependency build step, and a WW3 build step which -# builds multiple switches in a matrix. The setup is run once and +# builds multiple switches in a matrix. The setup is run once and # the environment is cached so each build of WW3 can share the dependencies. jobs: setup: - runs-on: ubuntu-20.04 + runs-on: ubuntu-20.04 steps: - name: checkout-ww3 if: steps.cache-env.outputs.cache-hit != 'true' - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ww3 @@ -35,7 +35,7 @@ jobs: # No way to flush Action cache, so key may have # appended - name: cache-env id: cache-env - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | spack @@ -51,7 +51,7 @@ jobs: sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list sudo apt-get update - sudo apt-get install intel-oneapi-mpi-devel intel-oneapi-openmp intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic + sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-mpi-devel intel-oneapi-openmp intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic # Build WW3 spack environment - name: install-dependencies-with-spack @@ -59,18 +59,19 @@ jobs: run: | # Install NetCDF, ESMF, g2, etc using Spack . /opt/intel/oneapi/setvars.sh - sudo mv /usr/local /usrlocal_renamed - sudo apt install cmake - git clone -c feature.manyFiles=true https://github.com/spack/spack.git + git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git source spack/share/spack/setup-env.sh ln -s $(realpath $(which gcc)) spack/lib/spack/env/intel/gcc # spack/make bug in ESMF spack env create ww3-intel ww3/model/ci/spack_intel.yaml spack env activate ww3-intel spack compiler find - spack external find cmake + sudo apt install cmake + spack external find spack add intel-oneapi-mpi + spack config add "packages:all:require:['%intel']" spack concretize spack install --dirty -v --fail-fast + spack clean --all - name: build-oasis if: steps.cache-env.outputs.cache-hit != 'true' @@ -91,17 +92,17 @@ jobs: strategy: matrix: switch: [Ifremer1, NCEP_st2, NCEP_st4, ite_pdlib, NCEP_st4sbs, NCEP_glwu, OASACM, UKMO, MULTI_ESMF] - runs-on: ubuntu-20.04 + runs-on: ubuntu-20.04 steps: - name: checkout-ww3 - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ww3 - name: cache-env id: cache-env - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | spack @@ -116,8 +117,8 @@ jobs: source spack/share/spack/setup-env.sh spack env activate ww3-intel cd ww3 - export CC=mpicc - export FC=mpif90 + export CC=mpiicc + export FC=mpiifort export OASISDIR=${GITHUB_WORKSPACE}/work_oasis3-mct mkdir build && cd build if [[ ${{ matrix.switch }} == "MULTI_ESMF" ]]; then diff --git a/model/ci/spack_gnu.yaml b/model/ci/spack_gnu.yaml index 5f1ca3a47..d2c16711a 100644 --- a/model/ci/spack_gnu.yaml +++ b/model/ci/spack_gnu.yaml @@ -13,7 +13,8 @@ spack: - g2@3.4.5 - bacio@2.4.1 - w3emc@2.9.2 - - esmf@8.1.1~pio~pnetcdf~xerces + - parallelio@2.5.9+fortran~pnetcdf + - esmf@8.4.2~debug~xerces+external-parallelio view: true concretizer: unify: when_possible diff --git a/model/ci/spack_intel.yaml b/model/ci/spack_intel.yaml index ee09d8827..c571da825 100644 --- a/model/ci/spack_intel.yaml +++ b/model/ci/spack_intel.yaml @@ -5,16 +5,17 @@ spack: providers: mpi: [intel-oneapi-mpi] specs: + - netcdf-c@4.7.4~dap + - netcdf-fortran@4.5.3 + - bacio@2.4.1 + - g2@3.4.5 - metis@5.1.0~shared - parmetis@4.0.3~shared - scotch@7.0.1+mpi+metis~shared - - netcdf-c@4.7.4~dap - - netcdf-fortran@4.5.3 - jasper@2.0.32 - - g2@3.4.5 - - bacio@2.4.1 - w3emc@2.9.2 - - esmf@8.1.1~pio~pnetcdf~xerces + - parallelio@2.5.9+fortran~pnetcdf + - esmf@8.4.2~debug~xerces+external-parallelio - intel-oneapi-mpi %intel view: true concretizer: From 6b9edfa746704ac51d94ca7a58a50fb347611a08 Mon Sep 17 00:00:00 2001 From: Mickael Accensi <49198861+mickaelaccensi@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:56:08 +0200 Subject: [PATCH 06/25] correct the computation of QP parameter, add QKK output parameter, change UST scale factor (#1050) --- manual/eqs/output.tex | 15 +++++-- manual/manual.bib | 10 +++++ model/inp/ww3_shel.inp | 9 ++-- model/nml/ww3_multi.nml | 4 +- model/nml/ww3_shel.nml | 9 ++-- model/src/w3adatmd.F90 | 19 ++++++-- model/src/w3initmd.F90 | 52 +++++++++++++++++----- model/src/w3iogomd.F90 | 37 +++++++++++---- model/src/w3iorsmd.F90 | 6 +-- model/src/w3odatmd.F90 | 3 +- model/src/w3ounfmetamd.F90 | 15 ++++++- model/src/ww3_ounf.F90 | 7 ++- model/src/ww3_outf.F90 | 15 ++++++- model/tools/bash/ww3_multi_inp2nml.sh | 4 +- model/tools/bash/ww3_shel_inp2nml.sh | 13 +++--- regtests/ww3_tp2.15/input_rho/ww3_ounf.inp | 2 +- regtests/ww3_tp2.15/input_rho/ww3_ounf.nml | 2 +- regtests/ww3_tp2.15/input_rho/ww3_outf.inp | 2 +- regtests/ww3_tp2.15/input_rho/ww3_shel.inp | 2 +- regtests/ww3_tp2.15/input_rho/ww3_shel.nml | 2 +- regtests/ww3_tp2.6/input/ww3_ounf.inp | 2 +- regtests/ww3_tp2.6/input/ww3_ounf.nml | 2 +- regtests/ww3_tp2.6/input/ww3_outf.inp | 2 +- regtests/ww3_tp2.6/input/ww3_shel.inp | 2 +- regtests/ww3_tp2.6/input/ww3_shel.nml | 2 +- 25 files changed, 173 insertions(+), 65 deletions(-) diff --git a/manual/eqs/output.tex b/manual/eqs/output.tex index 1f512b16a..bfa7e0b5a 100644 --- a/manual/eqs/output.tex +++ b/manual/eqs/output.tex @@ -12,9 +12,9 @@ \subsection{~Output parameters} \label{sub:outpars} in \para\ref{sec:ww3shel}. That input file also provides a list of flags indicating if output parameters are available in different field output file types (ASCII, grib, igrads, NetCDF). -For any details on how these parameters are computed, the user may read the code of the {\code w3iogo} routine, in the {\code w3iogomd.ftn} module. +For any details on how these parameters are computed, the user may read the code of the {\code w3iogo} routine, in the {\code w3iogomd.F90} module. -Selection of field outputs in {\code ww3\_shel.inp} is most easily performed by providing a list of the +Selection of field outputs in {\code ww3\_shel.nml} or {\code ww3\_shel.inp} is most easily performed by providing a list of the requested parameters, for example, {\textbf HS DIR SPR} will request the calculation of significant wave height, mean direction and directional spread. These will thus be stored in the {\code out\_grd.XX} file and can be post-processed, for example in NetCDF using {\code ww3\_ouf}. Examples are given in \para\ref{sec:ww3multi} and \para\ref{sec:ww3ounf}. The names for these namelists are the bold names below, for example \textbf{HS}. @@ -26,6 +26,9 @@ \subsection{~Output parameters} \label{sub:outpars} file extensions, NetCDF variable names and namelist-based selection (see also \para\ref{sec:ww3ounf}), and the long parameter name/definition. +When the result is not overly sensitive to the contribution of the unresolved part of the spectrum (for $f WADATS(IMOD)%MSCX MSCY => WADATS(IMOD)%MSCY MSCD => WADATS(IMOD)%MSCD + QKK => WADATS(IMOD)%QKK ! DTDYN => WADATS(IMOD)%DTDYN FCUT => WADATS(IMOD)%FCUT @@ -3231,6 +3241,7 @@ SUBROUTINE W3XETA ( IMOD, NDSE, NDST ) MSCX => WADATS(IMOD)%XMSCX MSCY => WADATS(IMOD)%XMSCY MSCD => WADATS(IMOD)%XMSCD + QKK => WADATS(IMOD)%XQKK ! DTDYN => WADATS(IMOD)%XDTDYN FCUT => WADATS(IMOD)%XFCUT diff --git a/model/src/w3initmd.F90 b/model/src/w3initmd.F90 index 3c6907f51..2d5eacc33 100644 --- a/model/src/w3initmd.F90 +++ b/model/src/w3initmd.F90 @@ -639,23 +639,23 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, IF (FSTOTALIMP .and. .NOT. LPDLIB) THEN WRITE(NDSE,*) 'IMPTOTAL is selected' WRITE(NDSE,*) 'But PDLIB is not' - CALL FLUSH(NDSE) - STOP + CALL FLUSH(NDSE) + STOP ELSE IF (FSTOTALEXP .and. .NOT. LPDLIB) THEN WRITE(NDSE,*) 'EXPTOTAL is selected' WRITE(NDSE,*) 'But PDLIB is not' - CALL FLUSH(NDSE) - STOP + CALL FLUSH(NDSE) + STOP END IF #ifdef W3_PDLIB IF (B_JGS_BLOCK_GAUSS_SEIDEL .AND. .NOT. B_JGS_USE_JACOBI) THEN WRITE(NDSE,*) 'B_JGS_BLOCK_GAUSS_SEIDEL is used but the Jacobi solver is not choosen' WRITE(NDSE,*) 'Please set JGS_USE_JACOBI .eqv. .true.' - CALL FLUSH(NDSE) - STOP + CALL FLUSH(NDSE) + STOP ENDIF #endif - + ! ! 1.c Open files without unpacking MDS ,,, ! @@ -1303,10 +1303,10 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, END DO !Li END DO #ifdef W3_DEBUGSTP - WRITE(740+IAPROC,*) 'w3initmd 1: max/min(WLVeff)=', max_val, min_val - FLUSH(740+IAPROC) - max_val = 0 - min_val = 0 + WRITE(740+IAPROC,*) 'w3initmd 1: max/min(WLVeff)=', max_val, min_val + FLUSH(740+IAPROC) + max_val = 0 + min_val = 0 #endif DO JSEA=1, NSEAL CALL INIT_GET_ISEA(ISEA, JSEA) @@ -2147,7 +2147,7 @@ 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 + TAUOCX, TAUOCY, WNMEAN, QKK #endif #ifdef W3_MPI @@ -3394,6 +3394,20 @@ SUBROUTINE W3MPIO ( IMOD ) #ifdef W3_MPI END IF ! + IF ( FLGRDALL( 8, 6) ) THEN + IH = IH + 1 + IT = IT + 1 + CALL MPI_SEND_INIT (QKK (1),NSEALM , MPI_REAL, IROOT, & + IT, MPI_COMM_WAVE, IRQGO(IH), IERR) +#endif +#ifdef W3_MPIT + WRITE (NDST,9011) IH, ' 8/06', IROOT, IT, IRQGO(IH), IERR +#endif +#ifdef W3_MPI + END IF +#endif + ! +#ifdef W3_MPI IF ( FLGRDALL( 9, 1) ) THEN IH = IH + 1 IT = IT + 1 @@ -4627,6 +4641,20 @@ SUBROUTINE W3MPIO ( IMOD ) #ifdef W3_MPI END IF ! + IF ( FLGRDALL( 8, 6) ) THEN + IH = IH + 1 + IT = IT + 1 + CALL MPI_RECV_INIT (QKK (I0),1,WW3_FIELD_VEC, IFROM, IT, & + MPI_COMM_WAVE, IRQGO2(IH), IERR ) +#endif +#ifdef W3_MPIT + WRITE (NDST,9011) IH, ' 8/06', IFROM, IT, IRQGO2(IH), IERR +#endif +#ifdef W3_MPI + END IF +#endif + ! +#ifdef W3_MPI IF ( FLGRDALL( 9, 1) ) THEN IH = IH + 1 IT = IT + 1 diff --git a/model/src/w3iogomd.F90 b/model/src/w3iogomd.F90 index 451192d53..a6ef03325 100644 --- a/model/src/w3iogomd.F90 +++ b/model/src/w3iogomd.F90 @@ -1123,6 +1123,9 @@ SUBROUTINE W3FLDTOIJ(FLD, I, J, IAPROC, NAPOUT, NDSEN) CASE('QP') I = 8 J = 5 + CASE('QKK') + I = 8 + J = 6 ! ! Group 9 ! @@ -1294,7 +1297,7 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) TH2M, STH2M, HSIG, STMAXE, STMAXD, & HCMAXE, HMAXE, HCMAXD, HMAXD, USSP, QP, PQP,& PTHP0, PPE, PGW, PSW, PTM1, PT1, PT2, PEP, & - WBT + WBT, QKK USE W3ODATMD, ONLY: NDST, UNDEF, IAPROC, NAPROC, NAPFLD, & ICPRT, DTPRT, WSCUT, NOSWLL, FLOGRD, FLOGR2,& NOGRP, NGRPP @@ -1353,7 +1356,8 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) STMAXDL(NSEAL), TLPHI(NSEAL), & WL02X(NSEAL), WL02Y(NSEAL), & ALPXT(NSEAL), ALPYT(NSEAL), & - ALPXY(NSEAL), SCREST(NSEAL) + ALPXY(NSEAL), SCREST(NSEAL), & + QK1(NSEAL), QK2(NSEAL) REAL USSCO, FT1 REAL, SAVE :: HSMIN = 0.01 LOGICAL :: FLOLOC(NOGRP,NGRPP) @@ -1429,6 +1433,7 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) TLPHI = 0. STMAXEL = 0. STMAXDL = 0. + QK2 = 0. ! HS = UNDEF WLM = UNDEF @@ -1445,6 +1450,7 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) ALPXY = UNDEF ALPXT = UNDEF ALPYT = UNDEF + QKK = UNDEF THMP = UNDEF T02P = UNDEF SCREST = UNDEF @@ -1481,6 +1487,7 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) ABXY = 0. ABYX = 0. ABST = 0. + QK1 = 0. ! ! 2.b Integrate energy in band ! @@ -1506,6 +1513,7 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) IF (ITH.LE.NTH/2) THEN ABST(JSEA) = ABST(JSEA) + & A(ITH,IK,JSEA)*A(ITH+NTH/2,IK,JSEA) + QK1 (JSEA) = QK1(JSEA) + (A(ITH,IK,JSEA)+A(ITH+NTH/2,IK,JSEA))**2 END IF CALL INIT_GET_ISEA(ISEA, JSEA) FACTOR = MAX ( 0.5 , CG(IK,ISEA)/SIG(IK)*WN(IK,ISEA) ) @@ -1532,8 +1540,8 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) DO JSEA=1, NSEAL CALL INIT_GET_ISEA(ISEA, JSEA) FACTOR = DDEN(IK) / CG(IK,ISEA) - EBD(IK,JSEA) = AB(JSEA) * FACTOR - ET(JSEA) = ET(JSEA) + EBD(IK,JSEA) + EBD(IK,JSEA) = AB(JSEA) * FACTOR ! this is E(f)*df + ET (JSEA) = ET (JSEA) + EBD(IK,JSEA) #ifdef W3_IG1 IF (IK.EQ.NINT(IGPARS(5))) HSIG(JSEA) = 4*SQRT(ET(JSEA)) #endif @@ -1541,7 +1549,8 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) EWN(JSEA) = EWN(JSEA) + EBD(IK,JSEA) / WN(IK,ISEA) ETR(JSEA) = ETR(JSEA) + EBD(IK,JSEA) / SIG(IK) ET1(JSEA) = ET1(JSEA) + EBD(IK,JSEA) * SIG(IK) - EET1(JSEA) = EET1(JSEA)+ EBD(IK,JSEA)**2 * SIG(IK) + ! EET1(JSEA) = EET1(JSEA)+ EBD(IK,JSEA)**2 * SIG(IK) + EET1(JSEA) = EET1(JSEA)+ EBD(IK,JSEA)**2 * SIG(IK)/DSII(IK) ET02(JSEA) = ET02(JSEA)+ EBD(IK,JSEA) * SIG(IK)**2 ETX(JSEA) = ETX(JSEA) + ABX(JSEA) * FACTOR ETY(JSEA) = ETY(JSEA) + ABY(JSEA) * FACTOR @@ -1550,6 +1559,8 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) TUSY(JSEA) = TUSY(JSEA) + ABY(JSEA)*FACTOR & *GRAV*WN(IK,ISEA)/SIG(IK) ETXX(JSEA) = ETXX(JSEA) + ABX2(JSEA) * FACTOR* WN(IK,ISEA)**2 + ! NB: QK1 (JSEA) = QK1(JSEA) + A(ITH,IK,JSEA)**2 + QK2 (JSEA) = QK2 (JSEA) + QK1(JSEA) * FACTOR* SIG(IK) /WN(IK,ISEA) ETYY(JSEA) = ETYY(JSEA) + ABY2(JSEA) * FACTOR* WN(IK,ISEA)**2 ETXY(JSEA) = ETXY(JSEA) + ABYX(JSEA) * FACTOR* WN(IK,ISEA)**2 IF (SIG(IK)*0.5*(1+XFR).LT.0.4*TPI) THEN @@ -1932,13 +1943,13 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) ! 3.b Add tail ! ( DTH * SIG absorbed in FTxx ) - EBAND = AB(JSEA) / CG(NK,ISEA) + EBAND = AB(JSEA) / CG(NK,ISEA) ! EBAND is E(sigma)/sigma for the last frequency band ET (JSEA) = ET (JSEA) + FTE * EBAND EWN(JSEA) = EWN(JSEA) + FTWL * EBAND ETF(JSEA) = ETF(JSEA) + GRAV * FTTR * EBAND ! this is the integral of CgE in deep water ETR(JSEA) = ETR(JSEA) + FTTR * EBAND ET1(JSEA) = ET1(JSEA) + FT1 * EBAND - EET1(JSEA)= ET1(JSEA) + FT1 * EBAND**2 + ! EET1(JSEA)= EET1(JSEA) + FT1 * EBAND**2 : this was not correct. Actually tail may not be needed for Qp. ET02(JSEA)= ET02(JSEA)+ EBAND* 0.5 * SIG(NK)**4 * DTH ETX(JSEA) = ETX(JSEA) + FTE * ABX(JSEA) / CG(NK,ISEA) ETY(JSEA) = ETY(JSEA) + FTE * ABY(JSEA) / CG(NK,ISEA) @@ -1980,12 +1991,15 @@ SUBROUTINE W3OUTG ( A, FLPART, FLOUTG, FLOUTG2 ) END IF #endif IF ( ET(JSEA) .GT. 1.E-7 ) THEN - QP(JSEA) = ( 2. / ET(JSEA)**2 ) * EET1(JSEA) * TPIINV**2 + QP(JSEA) = ( 2. / ET(JSEA)**2 ) * EET1(JSEA) WLM(JSEA) = EWN(JSEA) / ET(JSEA) * TPI T0M1(JSEA) = ETR(JSEA) / ET(JSEA) * TPI THS(JSEA) = RADE * SQRT ( MAX ( 0. , 2. * ( 1. - SQRT ( & MAX(0.,(ETX(JSEA)**2+ETY(JSEA)**2)/ET(JSEA)**2) ) ) ) ) IF ( THS(JSEA) .LT. 0.01*RADE*DTH ) THS(JSEA) = 0. + ! NB: QK1 (JSEA) = QK1(JSEA) + A(ITH,IK,JSEA)**2 + ! QK2 (JSEA) = QK2 (JSEA) + QK1(JSEA) * FACTOR* SIG(IK) /WN(IK,ISEA) + QKK (JSEA) = SQRT(0.5*QK2 (JSEA))/ET(JSEA) ELSE WLM(JSEA) = 0. T0M1(JSEA) = TPI / SIG(NK) @@ -2495,7 +2509,7 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) CFLXYMAX, CFLTHMAX, CFLKMAX, P2SMS, US3D, & TH1M, STH1M, TH2M, STH2M, HSIG, PHICE, TAUICE,& STMAXE, STMAXD, HMAXE, HCMAXE, HMAXD, HCMAXD,& - USSP, TAUOCX, TAUOCY + USSP, TAUOCX, TAUOCY, QKK !/ USE W3ODATMD, ONLY: NOGRP, NGRPP, IDOUT, UNDEF, NDST, NDSE, & FLOGRD, IPASS => IPASS1, WRITE => WRITE1, & @@ -2871,6 +2885,7 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) IF ( FLOGRD( 8, 3) ) MSSD (ISEA) = UNDEF IF ( FLOGRD( 8, 4) ) MSCD (ISEA) = UNDEF IF ( FLOGRD( 8, 5) ) QP (ISEA) = UNDEF + IF ( FLOGRD( 8, 6) ) QKK (ISEA) = UNDEF ! IF ( FLOGRD( 9, 1) ) DTDYN (ISEA) = UNDEF IF ( FLOGRD( 9, 2) ) FCUT (ISEA) = UNDEF @@ -3225,6 +3240,8 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) WRITE ( NDSOG ) MSCD(1:NSEA) ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) QP(1:NSEA) + ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 6 ) THEN + WRITE ( NDSOG ) QKK(1:NSEA) ! ! Section 9) ! @@ -3557,6 +3574,8 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) MSCD(1:NSEA) ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 5 ) THEN READ (NDSOG,END=801,ERR=802,IOSTAT=IERR) QP(1:NSEA) + ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 6 ) THEN + READ (NDSOG,END=801,ERR=802,IOSTAT=IERR) QKK(1:NSEA) ! ! Section 9) ! diff --git a/model/src/w3iorsmd.F90 b/model/src/w3iorsmd.F90 index 3bd2aa4ea..05f7e9163 100644 --- a/model/src/w3iorsmd.F90 +++ b/model/src/w3iorsmd.F90 @@ -628,7 +628,7 @@ SUBROUTINE W3IORS ( INXOUT, NDSR, DUMFPI, IMOD, FLRSTRT ) ! Original non-server version writing of spectra ! IF ( .NOT.IOSFLG .OR. (NAPROC.EQ.1.AND.NAPRST.EQ.1) ) THEN -#ifdef W3_MPI +#ifdef W3_MPI DO JSEA=1, NSEAL CALL INIT_GET_ISEA(ISEA, JSEA) NREC = ISEA + 2 @@ -637,7 +637,7 @@ SUBROUTINE W3IORS ( INXOUT, NDSR, DUMFPI, IMOD, FLRSTRT ) WRITEBUFF(1:NSPEC) = VA(1:NSPEC,JSEA) WRITE (NDSR,POS=RPOS,ERR=803,IOSTAT=IERR) WRITEBUFF END DO -#else +#else DO JSEA=1, NSEA ISEA = JSEA NREC = ISEA + 2 @@ -646,7 +646,7 @@ SUBROUTINE W3IORS ( INXOUT, NDSR, DUMFPI, IMOD, FLRSTRT ) WRITEBUFF(1:NSPEC) = VA(1:NSPEC,JSEA) WRITE (NDSR,POS=RPOS,ERR=803,IOSTAT=IERR) WRITEBUFF END DO -#endif +#endif ! ! I/O server version writing of spectra ( !/MPI ) ! diff --git a/model/src/w3odatmd.F90 b/model/src/w3odatmd.F90 index 408f36fe6..4fc29eab9 100644 --- a/model/src/w3odatmd.F90 +++ b/model/src/w3odatmd.F90 @@ -887,13 +887,14 @@ SUBROUTINE W3NOUT ( NDSERR, NDSTST ) ! ! 8) Spectrum parameters ! - NOGE(8) = 5 + NOGE(8) = 6 ! IDOUT( 8, 1) = 'Mean square slopes ' IDOUT( 8, 2) = 'Phillips tail const' IDOUT( 8, 3) = 'Slope direction ' IDOUT( 8, 4) = 'Tail slope direction' IDOUT( 8, 5) = 'Goda peakedness parm' + IDOUT( 8, 6) = 'kxky-peakdness ' ! IDOUT( 8, 3) = 'Lx-Ly mean wvlength' ! IDOUT( 8, 4) = 'Surf grad correl XT' ! IDOUT( 8, 5) = 'Surf grad correl YT' diff --git a/model/src/w3ounfmetamd.F90 b/model/src/w3ounfmetamd.F90 index 44704c375..a4a58d079 100644 --- a/model/src/w3ounfmetamd.F90 +++ b/model/src/w3ounfmetamd.F90 @@ -3291,7 +3291,7 @@ SUBROUTINE DEFAULT_META() ! IFI=5, IFJ=1, UST META => GROUP(5)%FIELD(1)%META ! First component - META(1)%FSC = 0.01 + META(1)%FSC = 0.001 META(1)%ENAME = '.ust' META(1)%UNITS = 'm s-1' META(1)%VARNM='uust' @@ -3956,6 +3956,19 @@ SUBROUTINE DEFAULT_META() META(1)%VARNC='Goda wave peakedness parameter' META(1)%VMIN = 0 META(1)%VMAX = 32 + ! IFI=8, IFJ=6, QKK + META => GROUP(8)%FIELD(6)%META + META(1)%FSC = 0.05 + META(1)%UNITS = 'm/rad' + META(1)%ENAME = '.qkk' + META(1)%VARNM='qkk' + META(1)%VARNL='k-peakedness' + !META(1)%VARNS='sea_surface_wave_peakedness' + META(1)%VARNS='' + META(1)%VARNG='wavenumber_peakedness' + META(1)%VARNC='2D wavenumber peakedness' + META(1)%VMIN = 0 + META(1)%VMAX = 1600 ! !---------- GROUP 9 ---------------- ! diff --git a/model/src/ww3_ounf.F90 b/model/src/ww3_ounf.F90 index b77f9a9f9..22ffd72dc 100644 --- a/model/src/ww3_ounf.F90 +++ b/model/src/ww3_ounf.F90 @@ -65,6 +65,7 @@ PROGRAM W3OUNF !/ 02-Feb-2021 : Make default global meta optional ( version 7.12 ) !/ 22-Mar-2021 : New coupling fields output ( version 7.12 ) !/ 02-Sep-2021 : Added coordinates attribute ( version 7.12 ) + !/ 14-Feb-2023 : Added QKK output ( version 7.12 ) !/ !/ Copyright 2009-2013 National Weather Service (NWS), !/ National Oceanic and Atmospheric Administration. All rights @@ -192,7 +193,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 + WN, USSP, WBT, WNMEAN, QKK USE W3ODATMD, ONLY: NDSO, NDSE, SCREEN, NOGRP, NGRPP, IDOUT, & UNDEF, FLOGRD, FNMPRE, NOSWLL, NOGE ! @@ -1958,6 +1959,10 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 5 ) THEN CALL S2GRID(QP, X1) ! + ! k bandwidth + ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 6 ) THEN + CALL S2GRID(QKK, X1) + ! ! Dynamic time step ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 1 ) THEN DO ISEA=1, NSEA diff --git a/model/src/ww3_outf.F90 b/model/src/ww3_outf.F90 index c055c9209..96f2751c8 100644 --- a/model/src/ww3_outf.F90 +++ b/model/src/ww3_outf.F90 @@ -159,7 +159,7 @@ PROGRAM W3OUTF ABA, ABD, UBA, UBD, SXX, SYY, SXY, USERO, & PHS, PTP, PLP, PDIR, PSI, PWS, PWST, PNR, & PTM1, PT1, PT2, PEP, TAUOCX, TAUOCY, & - PTHP0, PQP, PSW, PPE, PGW, QP, & + PTHP0, PQP, PSW, PPE, PGW, QP, QKK, & TAUOX, TAUOY, TAUWIX,BHD, & TAUWIY, PHIAW, PHIOC, TUSX, TUSY, PRMS, TPMS,& USSX, USSY, MSSX, MSSY, MSCX, MSCY, CHARN, & @@ -2196,7 +2196,7 @@ SUBROUTINE W3EXGO ( NX, NY, NSEA ) ! ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 5 ) THEN FLONE = .TRUE. - FSC = 0.01 + FSC = 0.001 UNITS = '1' ENAME = '.qp' IF ( ITYPE .EQ. 4 ) THEN @@ -2205,6 +2205,17 @@ SUBROUTINE W3EXGO ( NX, NY, NSEA ) CALL W3S2XY ( NSEA, NSEA, NX+1, NY, QP, MAPSF, X1 ) ENDIF ! + ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 6 ) THEN + FLONE = .TRUE. + FSC = 0.05 + UNITS = '1' + ENAME = '.qkk' + IF ( ITYPE .EQ. 4 ) THEN + XS1 = QKK + ELSE + CALL W3S2XY ( NSEA, NSEA, NX+1, NY, QKK, MAPSF, X1 ) + ENDIF + ! ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 1 ) THEN FLONE = .TRUE. FSC = 0.1 diff --git a/model/tools/bash/ww3_multi_inp2nml.sh b/model/tools/bash/ww3_multi_inp2nml.sh index aa9afd497..c616282d3 100755 --- a/model/tools/bash/ww3_multi_inp2nml.sh +++ b/model/tools/bash/ww3_multi_inp2nml.sh @@ -705,13 +705,13 @@ cat >> $nmlfile << EOF ! ! * the detailed list of field names is given in model/nml/ww3_shel.nml : ! DPT CUR WND AST WLV ICE IBG D50 IC1 IC5 -! HS LM T02 T0M1 T01 FP DIR SPR DP HIG +! HS LM T02 T0M1 T01 FP DIR SPR DP HIG MXE MXES MXH MXHC SDMH SDMHC WBT TP WNM ! EF TH1M STH1M TH2M STH2M WN ! PHS PTP PLP PDIR PSPR PWS PDP PQP PPE PGW PSW PTM10 PT01 PT02 PEP TWS PNR ! UST CHA CGE FAW TAW TWA WCC WCF WCH WCM FWS ! SXY TWO BHD FOC TUS USS P2S USF P2L TWI FIC USP TOC ! ABR UBR BED FBB TBB -! MSS MSC WL02 AXT AYT AXY +! MSS MSC MSD MCD QP QKK ! DTD FC CFX CFD CFK ! U1 U2 ! diff --git a/model/tools/bash/ww3_shel_inp2nml.sh b/model/tools/bash/ww3_shel_inp2nml.sh index 7798abf20..619002aa8 100755 --- a/model/tools/bash/ww3_shel_inp2nml.sh +++ b/model/tools/bash/ww3_shel_inp2nml.sh @@ -878,7 +878,7 @@ cat >> $nmlfile << EOF ! T T 2 1 HS HS Wave height. ! T T 2 2 WLM LM Mean wave length. ! T T 2 3 T02 T02 Mean wave period (Tm0,2). -! T T 2 4 TM10 TM10 Mean wave period (Tm-1,0). +! T T 2 4 TM10 T0M1 Mean wave period (Tm-1,0). ! T T 2 5 T01 T01 Mean wave period (Tm0,1). ! T T 2 6 FP0 FP Peak frequency. ! T T 2 7 THM DIR Mean wave direction. @@ -893,6 +893,7 @@ cat >> $nmlfile << EOF ! T T 2 16 HCMAXD SDMHC St Dev of MXHC (STE) ! F T 2 17 WBT WBT Domiant wave breaking probability bT ! F F 2 18 FP0 TP Peak period (from peak freq) +! F F 2 19 WNMEAN WNM Mean wavenumber ! ------------------------------------------------- ! 3 Spectral Parameters (first 5) ! ------------------------------------------------- @@ -912,7 +913,7 @@ cat >> $nmlfile << EOF ! T T 4 5 PSI PSPR Partitioned mean directional spread. ! T T 4 6 PWS PWS Partitioned wind sea fraction. ! T T 4 7 PTHP0 PDP Peak wave direction of partition. -! T T 4 8 PQP PQP Goda peakdedness parameter of partition. +! T T 4 8 PQP PQP Goda peakedness parameter of partition. ! T T 4 9 PPE PPE JONSWAP peak enhancement factor of partition. ! T T 4 10 PGW PGW Gaussian frequency width of partition. ! T T 4 11 PSW PSW Spectral width of partition. @@ -965,10 +966,10 @@ cat >> $nmlfile << EOF ! ------------------------------------------------- ! F F 8 1 MSS[X,Y] MSS Mean square slopes ! F F 8 2 MSC[X,Y] MSC Spectral level at high frequency tail -! F F 8 3 WL02[X,Y] WL02 East/X North/Y mean wavelength compon -! F F 8 4 ALPXT AXT Correl sea surface gradients (x,t) -! F F 8 5 ALPYT AYT Correl sea surface gradients (y,t) -! F F 8 6 ALPXY AXY Correl sea surface gradients (x,y) +! F F 8 3 MSSD MSD Slope direction +! F F 8 4 MSCD MCD Tail slope direction +! F F 8 5 QP QP Goda peakedness parameter +! F F 8 6 QKK QKK Wavenumber peakedness ! ------------------------------------------------- ! 9 Numerical diagnostics ! ------------------------------------------------- diff --git a/regtests/ww3_tp2.15/input_rho/ww3_ounf.inp b/regtests/ww3_tp2.15/input_rho/ww3_ounf.inp index 9e9b2c300..564610663 100644 --- a/regtests/ww3_tp2.15/input_rho/ww3_ounf.inp +++ b/regtests/ww3_tp2.15/input_rho/ww3_ounf.inp @@ -3,7 +3,7 @@ $ ----------------------------------------- 20140309 000000 900. 9999 $ N -HS WND RHO TAU T02 DP DIR FP MXE MXES MXH MXHC SDMH SDMHC +HS WND RHO TAU T02 DP DIR FP MXE MXES MXH MXHC SDMH SDMHC QP QKK $ $ 3 4 diff --git a/regtests/ww3_tp2.15/input_rho/ww3_ounf.nml b/regtests/ww3_tp2.15/input_rho/ww3_ounf.nml index 848d2ec92..d4e8c9151 100644 --- a/regtests/ww3_tp2.15/input_rho/ww3_ounf.nml +++ b/regtests/ww3_tp2.15/input_rho/ww3_ounf.nml @@ -9,7 +9,7 @@ FIELD%TIMESTART = '20140309 000000' FIELD%TIMESTRIDE = '900.' FIELD%TIMECOUNT = '9999' - FIELD%LIST = 'HS WND RHO TAU T02 DP DIR FP MXE MXES MXH MXHC SDMH SDMHC' + FIELD%LIST = 'HS WND RHO TAU T02 DP DIR FP MXE MXES MXH MXHC SDMH SDMHC QP QKK' FIELD%PARTITION = '0 1 2' FIELD%TYPE = 4 / diff --git a/regtests/ww3_tp2.15/input_rho/ww3_outf.inp b/regtests/ww3_tp2.15/input_rho/ww3_outf.inp index 666f36966..05e04c291 100644 --- a/regtests/ww3_tp2.15/input_rho/ww3_outf.inp +++ b/regtests/ww3_tp2.15/input_rho/ww3_outf.inp @@ -3,7 +3,7 @@ $ ----------------------------------------- 20140309 000000 3600. 37 $ N -HS DIR DP T02 FP STMAXE STMAXD HMAXE HCMAXE HMAXD HCMAXD +HS DIR DP T02 FP STMAXE STMAXD HMAXE HCMAXE HMAXD HCMAXD QP QKK $ 3 0 1 43 1 42 1 1 diff --git a/regtests/ww3_tp2.15/input_rho/ww3_shel.inp b/regtests/ww3_tp2.15/input_rho/ww3_shel.inp index c436305e8..ce4d90011 100644 --- a/regtests/ww3_tp2.15/input_rho/ww3_shel.inp +++ b/regtests/ww3_tp2.15/input_rho/ww3_shel.inp @@ -31,7 +31,7 @@ $ A A W C C C C B B E B B X W O U S S S 2 S S $ W W A C F H M R R D B B Y O C S S S C S 1 2 $ --------------------------------------------------------------- N - HS WND RHO TAU T02 DP DIR FP MXE MXES MXH MXHC SDMH SDMHC + HS WND RHO TAU T02 DP DIR FP MXE MXES MXH MXHC SDMH SDMHC QP QKK 20140310 000000 3600 20140310 060000 12.5088 45.3138 'AA ' 0.0 0.0 'STOPSTRING' diff --git a/regtests/ww3_tp2.15/input_rho/ww3_shel.nml b/regtests/ww3_tp2.15/input_rho/ww3_shel.nml index 5fb0fd0a2..fc0277a12 100644 --- a/regtests/ww3_tp2.15/input_rho/ww3_shel.nml +++ b/regtests/ww3_tp2.15/input_rho/ww3_shel.nml @@ -24,7 +24,7 @@ ! Define the output types point parameters via OUTPUT_TYPE_NML namelist ! -------------------------------------------------------------------- ! &OUTPUT_TYPE_NML - TYPE%FIELD%LIST = 'HS WND RHO TAU T02 DP DIR FP MXE MXES MXH MXHC SDMH SDMHC' + TYPE%FIELD%LIST = 'HS WND RHO TAU T02 DP DIR FP MXE MXES MXH MXHC SDMH SDMHC QP QKK' TYPE%POINT%FILE = '../input_rho/points.list' / diff --git a/regtests/ww3_tp2.6/input/ww3_ounf.inp b/regtests/ww3_tp2.6/input/ww3_ounf.inp index c4d51a66c..d2bde30b6 100644 --- a/regtests/ww3_tp2.6/input/ww3_ounf.inp +++ b/regtests/ww3_tp2.6/input/ww3_ounf.inp @@ -13,7 +13,7 @@ $ file for a full documentation of field output options. Namelist type $ selection is used here (for alternative F/T flags, see ww3_shel.inp). $ N - HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD + HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD QP QKK $ $--------------------------------------------------------------------- $ $ netCDF version [3,4] diff --git a/regtests/ww3_tp2.6/input/ww3_ounf.nml b/regtests/ww3_tp2.6/input/ww3_ounf.nml index 658dd2525..7b344cc1c 100644 --- a/regtests/ww3_tp2.6/input/ww3_ounf.nml +++ b/regtests/ww3_tp2.6/input/ww3_ounf.nml @@ -9,7 +9,7 @@ FIELD%TIMESTART = '20100801 000000' FIELD%TIMESTRIDE = '10' FIELD%TIMECOUNT = '3600' - FIELD%LIST = 'HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD' + FIELD%LIST = 'HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD QP QKK' FIELD%PARTITION = '0 1 2' FIELD%SAMEFILE = F FIELD%TYPE = 4 diff --git a/regtests/ww3_tp2.6/input/ww3_outf.inp b/regtests/ww3_tp2.6/input/ww3_outf.inp index 70dc9974c..86c1115ff 100644 --- a/regtests/ww3_tp2.6/input/ww3_outf.inp +++ b/regtests/ww3_tp2.6/input/ww3_outf.inp @@ -7,7 +7,7 @@ $ $ $ Request flags identifying fields as in ww3_shel input and section 2.4 fo the manual. N -HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD +HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD QP QKK $ $ Output type ITYPE [0,1,2,3] $ diff --git a/regtests/ww3_tp2.6/input/ww3_shel.inp b/regtests/ww3_tp2.6/input/ww3_shel.inp index ecdf1bc3a..2bd59dc2c 100644 --- a/regtests/ww3_tp2.6/input/ww3_shel.inp +++ b/regtests/ww3_tp2.6/input/ww3_shel.inp @@ -60,7 +60,7 @@ $ Output request flags identifying fields as in ww3_shel input and $ section 2.4 of the manual. $ N -HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD +HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD QP QKK $ $---------------------------------------------------------------- $ diff --git a/regtests/ww3_tp2.6/input/ww3_shel.nml b/regtests/ww3_tp2.6/input/ww3_shel.nml index f27f0b161..3518049f2 100644 --- a/regtests/ww3_tp2.6/input/ww3_shel.nml +++ b/regtests/ww3_tp2.6/input/ww3_shel.nml @@ -22,7 +22,7 @@ ! Define the output types point parameters via OUTPUT_TYPE_NML namelist ! -------------------------------------------------------------------- ! &OUTPUT_TYPE_NML - TYPE%FIELD%LIST = 'HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD' + TYPE%FIELD%LIST = 'HS LM T02 T01 T0M1 UST CHA CGE DTD FC CFX CFD QP QKK' TYPE%POINT%FILE = '../input/points.list' / From 8589d12a46c3824891fd43f372a98e2732e2c220 Mon Sep 17 00:00:00 2001 From: Mickael Accensi <49198861+mickaelaccensi@users.noreply.github.com> Date: Thu, 21 Sep 2023 14:49:08 +0200 Subject: [PATCH 07/25] correct issue with ww3_multi when requesting restart2 and using nml file instead of inp file (#1070) --- model/src/wminitmd.F90 | 157 ++++++++---------- model/src/ww3_ounf.F90 | 3 + regtests/bin/matrix.base | 2 + regtests/bin/matrix_cmake_datarmor | 1 + regtests/bin/run_cmake_test | 26 +-- regtests/ww3_tp2.3/input/namelists_GARDEN.nml | 2 +- regtests/ww3_tp2.3/input/ww3_grid.inp | 2 +- .../ww3_ufs1.1/input_unstr/namelists_a.nml | 2 +- .../ww3_ufs1.1/input_unstr/namelists_b.nml | 2 +- 9 files changed, 89 insertions(+), 108 deletions(-) diff --git a/model/src/wminitmd.F90 b/model/src/wminitmd.F90 index 293b74848..ac9d0036f 100644 --- a/model/src/wminitmd.F90 +++ b/model/src/wminitmd.F90 @@ -3499,6 +3499,7 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & !/ Add ESMF override for STIME & ETIME ( version 6.02 ) !/ (T. J. Campbell, NRL) !/ 15-May-2018 : Update namelist ( version 6.05 ) + !/ 28-Oct-2020 : Add SMCTYPE for SMC sub-grid. JGLi ( version 7.13 ) !/ 22-Mar-2021 : Add momentum and air density input ( version 7.13 ) !/ ! 1. Purpose : @@ -3518,8 +3519,8 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! IDST Int. I Unit number for test output. ! IDSE Int. I Unit number for error output. ! IFNAME Char I File name for input file. - ! MPI_COMM Int. I MPI communicator to be used. - ! PREAMB Char I File name preamble (optiona). + ! MPI_COMM Int. I MPI communicator to be used. + ! PREAMB Char I File name preamble (optional). ! ---------------------------------------------------------------- ! ! 4. Subroutines used : @@ -3726,11 +3727,11 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & #endif USE W3WDATMD, ONLY: TIME USE W3ADATMD, ONLY: WADATS - USE W3IDATMD, ONLY: INFLAGS1, INPUTS, IINIT, & - JFIRST, INFLAGS2 + USE W3IDATMD, ONLY: INFLAGS1, INFLAGS2, INPUTS, IINIT, & + JFIRST USE W3ODATMD, ONLY: NOGRP, NGRPP, FLOUT, TONEXT, FLBPI, & FLBPO, NFBPO, NBI, NDS, IAPROC, & - NAPFLD, NAPPNT, NAPTRK, NAPBPT, & + NAPFLD, NAPPNT, NAPTRK, NAPBPT, & NAPPRT, NAPROC, FNMPRE, OUTPTS, NDST, NDSE, & NOPTS, IOSTYP, UNIPTS, UPPROC, DTOUT, & TOLAST, NOTYPE @@ -4099,12 +4100,13 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & FLGRD(NOGRP,NGRPP,NRGRD), OT2(0:NRGRD), FLGD(NOGRP,NRGRD), & MDSF(-NRINP:NRGRD,JFIRST:9), IPRT(6,NRGRD), LPRT(NRGRD), & FLGR2(NOGRP,NGRPP,NRGRD),FLG2D(NOGRP,NGRPP), FLG1D(NOGRP), & - FLG2(NOGRP,NRGRD) & - ,OUTFF(7,0:NRGRD)) + FLG2(NOGRP,NRGRD),OUTFF(7,0:NRGRD)) ! MDS = -1 MDSF = -1 FLGR2 = .FALSE. + FLG2 = .FALSE. + LPRT = .FALSE. IPRT = 0 ! ! ... Fixed and recycleable unit numbers. @@ -4148,9 +4150,9 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! sources, and from communication rather than ! files. ! - ALLOCATE ( INAMES(2*NRGRD,-7:9), MNAMES(-NRINP:2*NRGRD), & - TMPRNK(2*NRGRD), TMPGRP(2*NRGRD), NINGRP(2*NRGRD), & - RP1(2*NRGRD), RPN(2*NRGRD), BCDTMP(NRGRD+1:2*NRGRD)) + ALLOCATE ( INAMES(2*NRGRD,-7:9), MNAMES(-NRINP:2*NRGRD), & + TMPRNK(2*NRGRD), TMPGRP(2*NRGRD), NINGRP(2*NRGRD), & + RP1(2*NRGRD), RPN(2*NRGRD), BCDTMP(NRGRD+1:2*NRGRD) ) ALLOCATE ( GRANK(NRGRD), GRGRP(NRGRD), USEINP(NRINP) ) ALLOCATE ( CPLINP(NRINP) ) GRANK = -1 @@ -4615,31 +4617,39 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! DO I=1, NRGRD IF ( MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) WRITE (MDSS,950) TRIM(MNAMES(NRGRD+I)) - NOTYPE = 6 - + NOTYPE = 8 + ! OTYPE 1 READ(NML_OUTPUT_DATE(I)%FIELD%START, *) ODAT(1,I), ODAT(2,I) READ(NML_OUTPUT_DATE(I)%FIELD%STRIDE, *) ODAT(3,I) READ(NML_OUTPUT_DATE(I)%FIELD%STOP, *) ODAT(4,I), ODAT(5,I) READ(NML_OUTPUT_DATE(I)%FIELD%OUTFFILE, *) OUTFF(1,I) + ! OTYPE 2 READ(NML_OUTPUT_DATE(I)%POINT%START, *) ODAT(6,I), ODAT(7,I) READ(NML_OUTPUT_DATE(I)%POINT%STRIDE, *) ODAT(8,I) READ(NML_OUTPUT_DATE(I)%POINT%STOP, *) ODAT(9,I), ODAT(10,I) READ(NML_OUTPUT_DATE(I)%POINT%OUTFFILE, *) OUTFF(2,I) + ! OTYPE 3 READ(NML_OUTPUT_DATE(I)%TRACK%START, *) ODAT(11,I), ODAT(12,I) READ(NML_OUTPUT_DATE(I)%TRACK%STRIDE, *) ODAT(13,I) READ(NML_OUTPUT_DATE(I)%TRACK%STOP, *) ODAT(14,I), ODAT(15,I) + ! OTYPE 4 READ(NML_OUTPUT_DATE(I)%RESTART%START, *) ODAT(16,I), ODAT(17,I) READ(NML_OUTPUT_DATE(I)%RESTART%STRIDE, *) ODAT(18,I) READ(NML_OUTPUT_DATE(I)%RESTART%STOP, *) ODAT(19,I), ODAT(20,I) - READ(NML_OUTPUT_DATE(I)%RESTART2%START, *) ODAT(36,I), ODAT(37,I) - READ(NML_OUTPUT_DATE(I)%RESTART2%STRIDE, *) ODAT(38,I) - READ(NML_OUTPUT_DATE(I)%RESTART2%STOP, *) ODAT(39,I), ODAT(40,I) + !OTYPE 5 READ(NML_OUTPUT_DATE(I)%BOUNDARY%START, *) ODAT(21,I), ODAT(22,I) READ(NML_OUTPUT_DATE(I)%BOUNDARY%STRIDE, *) ODAT(23,I) READ(NML_OUTPUT_DATE(I)%BOUNDARY%STOP, *) ODAT(24,I), ODAT(25,I) + !OTYPE 6 READ(NML_OUTPUT_DATE(I)%PARTITION%START, *) ODAT(26,I), ODAT(27,I) READ(NML_OUTPUT_DATE(I)%PARTITION%STRIDE, *) ODAT(28,I) READ(NML_OUTPUT_DATE(I)%PARTITION%STOP, *) ODAT(29,I), ODAT(30,I) + !OTYPE 7 + ! for coupling but not implemented yet + !OTYPE 8 + READ(NML_OUTPUT_DATE(I)%RESTART2%START, *) ODAT(36,I), ODAT(37,I) + READ(NML_OUTPUT_DATE(I)%RESTART2%STRIDE, *) ODAT(38,I) + READ(NML_OUTPUT_DATE(I)%RESTART2%STOP, *) ODAT(39,I), ODAT(40,I) ! set the time stride at 0 or more ODAT(3,I) = MAX ( 0 , ODAT(3,I) ) @@ -4852,6 +4862,10 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! ! ... End of output type selecttion ELSE IF ! + ELSE IF ( J .EQ. 8 ) THEN + ! + ! 5.i Type 8: checkpoint files (no additional data) + ! END IF ! ! ... End of IF in 5.b @@ -4861,45 +4875,6 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! ... End of loop J on NOTYPE in 5.a ! END DO - !xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - ! Checkpoint - J=8 - !OUTPTS(I)%FLOUT(8)=.FALSE. - IF ( ODAT(5*(J-1)+3,I) .NE. 0 ) THEN - !OUTPTS(I)%FLOUT(8)=.TRUE. - IF ( MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) & - WRITE (MDSS,951) J, IDOTYP(J) - TTIME(1) = ODAT(5*(J-1)+1,I) - TTIME(2) = ODAT(5*(J-1)+2,I) - CALL STME21 ( TTIME , DTME21 ) - IF ( MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) & - WRITE (MDSS,952) DTME21 - TTIME(1) = ODAT(5*(J-1)+4,I) - TTIME(2) = ODAT(5*(J-1)+5,I) - CALL STME21 ( TTIME , DTME21 ) - IF ( MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) & - WRITE (MDSS,953) DTME21 - TTIME(1) = 0 - TTIME(2) = 0 - DTTST = REAL ( ODAT(5*(J-1)+3,I) ) - CALL TICK21 ( TTIME , DTTST ) - CALL STME21 ( TTIME , DTME21 ) - IF ( ( ODAT(5*(J-1)+1,I) .NE. ODAT(5*(J-1)+4,I) .OR. & - ODAT(5*(J-1)+2,I) .NE. ODAT(5*(J-1)+5,I) ) .AND. & - MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) THEN - DO II=1, 18 - IF ( DTME21(II:II).NE.'0' .AND. & - DTME21(II:II).NE.'/' .AND. & - DTME21(II:II).NE.' ' .AND. & - DTME21(II:II).NE.':' ) EXIT - DTME21(II:II) = ' ' - END DO - WRITE (MDSS,954) DTME21(1:19) - END IF - !ELSE - !OUTPTS(I)%FLOUT(8) = .FALSE. - END IF - !xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ! ! ... End of loop I on NRGRD in 5.a ! @@ -5015,16 +4990,17 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! IF ( IOSTYP .GT. 1 ) THEN DO I=1, NRGRD + ! FIELD IF ( ODAT( 3,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1 + ! TRACK IF ( ODAT(13,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1 + ! PARTITION IF ( ODAT(28,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1 - !xxx - ! Checkpoint - IF ( ODAT(38,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1 - !xxx + ! POINT .OR. RESTART .OR. BOUNDARY IF ( ODAT( 8,I) .GT. 0 .OR. ODAT(18,I) .GT. 0 .OR. & - ODAT(23,I) .GT. 0 ) & - NDPOUT(I) = NDPOUT(I) + 1 + ODAT(23,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1 + ! RESTART2 + IF ( ODAT(38,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1 IF ( IOSTYP .EQ. 2 ) NDPOUT(I) = MIN ( 1 , NDPOUT(I) ) END DO END IF @@ -5437,11 +5413,12 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! ..... Model initialization ! IF ( MDSS.NE.MDSO .AND. NMPSC2.EQ.IMPROC ) WRITE (MDSS,982) - ! - CALL W3INIT ( I, .TRUE., MNAMES(I), MDS(:,I), NTRACE(:,I), ODAT(:,I), & + + CALL W3INIT ( I, .TRUE., MNAMES(I), MDS(:,I), NTRACE(:,I), & + ODAT(:,I), & FLGRD(:,:,I),FLGR2(:,:,I),FLGD(:,I),FLG2(:,I), & OT2(I)%NPTS, OT2(I)%X, OT2(I)%Y, OT2(I)%PNAMES, & - IPRT(:,I), LPRT(I), MPI_COMM_LOC ) + IPRT(:,I), LPRT(I), MPI_COMM_LOC) ! ! ..... Finalize I/O file hook up ! @@ -5533,6 +5510,9 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & IF ( MDSS.NE.MDSO .AND. NMPSC2.EQ.IMPROC ) WRITE (MDSS,983) CALL W3SETI ( I, MDSE, MDST ) ! + !!Li Stop modifying GTYPE from input forcing file. JGLi08Apr2021. + JJJ = GTYPE + ! ! ..... regular input files ! DO J=JFIRST, 6 @@ -5540,9 +5520,16 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & IDINP(I,J) = IDSTR(J) IF ( INPMAP(I,J) .LT. 0 ) CYCLE CALL W3FLDO ('READ', IDINP(I,J), MDSF(I,J), MDST, MDSE2,& - NX, NY, GTYPE, IERR, MNAMES(I), & + !!Li NX, NY, GTYPE, IERR, MNAMES(I), & + NX, NY, JJJ, IERR, MNAMES(I), & TRIM(FNMPRE) ) IF ( IERR .NE. 0 ) GOTO 2080 + ! + !!Li Print a warning message when GTYPE not matching forcing field one. + IF ( (JJJ .NE. GTYPE) .AND. (IMPROC .EQ. NMPSC2) ) & + WRITE (MDSE, *) ' *** Warning: grid', I, ' GTYPE=', & + GTYPE, ' not matching field', J, ' grid type', JJJ + ! IF ( MDSS.NE.MDSO .AND. NMPSC2.EQ.IMPROC ) & WRITE (MDSS,985) IDFLDS(J) ELSE @@ -5606,8 +5593,8 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & IF ( J.EQ.6 ) ALLOCATE ( WADATS(I)%RA0(NSEA) , & WADATS(I)%RAI(NSEA) ) ! - END IF - END DO + END IF ! IF ( INPMAP(I,J) .NE. 0 ) THEN + END DO ! DO J=JFIRST, 9 ! INFLAGS1 = TFLAGS CALL W3SETI ( I, MDSE, MDST ) @@ -5626,34 +5613,20 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & END IF END DO ! - ! Checkpoint - J=8 - OUTPTS(I)%FLOUT(8)=.FALSE. - IF ( ODAT(5*(J-1)+3,I) .NE. 0 ) THEN - OUTPTS(I)%FLOUT(8)=.TRUE. - ELSE - OUTPTS(I)%FLOUT(8)=.FALSE. - ENDIF - - IF ( FLOUT(J) ) THEN - IF ( TOUTP(1,I) .EQ. -1 ) THEN - TOUTP(:,I) = TONEXT(:,J) - ELSE - DTTST = DSEC21 ( TOUTP(:,I), TONEXT(:,J) ) - IF ( DTTST .LT. 0. ) TOUTP(:,I) = TONEXT(:,J) - ENDIF - END IF - ! - ! GRSTAT(I) = 0 TSYNC(:,I) = TIME(:) ! +#ifdef W3_SMC + ! Check GTYPE values after initialization + IF ( IMPROC .EQ. NMPERR ) WRITE(MDSE,*) "GRID IMPROC GTYPE", & + I, IMPROC, GRIDS(I)%GTYPE +#endif + ! #ifdef W3_T WRITE (MDST,9082) GRSTAT(I), TOUTP(:,I), TSYNC(:,I) #endif ! - END DO ! DO I=1, NRGRD - + END DO !! 8.a I-NRGRD loop ! #ifdef W3_MPI CALL MPI_BARRIER (MPI_COMM_MWAVE,IERR_MPI) @@ -5725,7 +5698,7 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & MPI_COMM_BCT, IERR_MPI ) IF ( MPI_COMM_GRD .EQ. MPI_COMM_NULL ) & GSU = W3GSUC( .FALSE., FLAGLL, ICLOSE, & - XGRD, YGRD) + XGRD, YGRD ) CALL MPI_BCAST ( DXDP, NX*NY, MPI_REAL, 0, & MPI_COMM_BCT, IERR_MPI ) CALL MPI_BCAST ( DXDQ, NX*NY, MPI_REAL, 0, & @@ -5854,7 +5827,8 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! DO I=1, NRGRD DO J=JFIRST, 9 - IF ( INPMAP(I,J) .LT. 0 ) IDINP(I,J) = IDINP( INPMAP(I,J),J) + IF ( INPMAP(I,J).LT.0 .AND. INPMAP(I,J).NE.-999) IDINP(I,J) = IDINP( INPMAP(I,J),J) + !IF ( INPMAP(I,J) .LT. 0 ) IDINP(I,J) = IDINP( INPMAP(I,J),J) IF ( INPMAP(I,J) .GT. 0 ) IDINP(I,J) = IDINP(-INPMAP(I,J),J) END DO END DO @@ -5983,7 +5957,7 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! 8.c.3 Relation to same ranked grids ! #ifdef W3_SMC - !! Check whether there is a SMC grid group. JGLi12Apr2021 + !! Check whether there is a SMC grid group. JGLi12Apr2021 NGRPSMC = 0 DO JJ=1, NRGRP J = 0 @@ -6173,7 +6147,8 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & IF ( TSTOUT ) CALL WMUDMP ( MDST, 0 ) ! DEALLOCATE ( MDS, NTRACE, ODAT, FLGRD, FLGR2, FLGD, FLG2, INAMES,& - MNAMES ) + MNAMES & + ,OUTFF ) ! #ifdef W3_MPI CALL MPI_BARRIER ( MPI_COMM_MWAVE, IERR_MPI ) diff --git a/model/src/ww3_ounf.F90 b/model/src/ww3_ounf.F90 index 22ffd72dc..f6a928e31 100644 --- a/model/src/ww3_ounf.F90 +++ b/model/src/ww3_ounf.F90 @@ -1978,14 +1978,17 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & ! ! Maximum CFL for spatial advection ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 3 ) THEN + IF (NCVARTYPEI.EQ.3) NCVARTYPE=4 CALL S2GRID(CFLXYMAX, X1) ! ! Maximum CFL for direction advection ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 4 ) THEN + IF (NCVARTYPEI.EQ.3) NCVARTYPE=4 CALL S2GRID(CFLTHMAX, X1) ! ! Maximum CFL for frequency advection ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 5 ) THEN + IF (NCVARTYPEI.EQ.3) NCVARTYPE=4 CALL S2GRID(CFLKMAX, X1) ! ! User defined... diff --git a/regtests/bin/matrix.base b/regtests/bin/matrix.base index a273372a9..88e7ee835 100755 --- a/regtests/bin/matrix.base +++ b/regtests/bin/matrix.base @@ -2152,11 +2152,13 @@ # Global unstr case # Domain Decomposition Explicit fi + if [ "$ufs" = 'y' ] && [ "$pdlib" = 'y' ] && [ "$dist" = 'y' ]; then echo "$rtst -s MPI -s PDLIB -i input_unstr -w work_unstr_a -g a -f -p $mpi -n $np $ww3 ww3_ufs1.1" >> matrix.body # Domain Decomposition Block Explicit echo "$rtst -s MPI -s PDLIB -i input_unstr -w work_unstr_b -g b -f -p $mpi -n $np $ww3 ww3_ufs1.1" >> matrix.body # Domain Decomposition Implicit echo "$rtst -s MPI -s PDLIB -i input_unstr -w work_unstr_c -g c -f -p $mpi -n $np $ww3 ww3_ufs1.1" >> matrix.body + fi #Test of UFS applications with ww3_multi_esmf and grib2 output if [ "$ufs" = 'y' ] && [ "$esmf" = 'y' ] && [ "$grib" = 'y' ] diff --git a/regtests/bin/matrix_cmake_datarmor b/regtests/bin/matrix_cmake_datarmor index f8ffaaa63..4e635f3c2 100755 --- a/regtests/bin/matrix_cmake_datarmor +++ b/regtests/bin/matrix_cmake_datarmor @@ -112,6 +112,7 @@ main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" echo " export NETCDF_CONFIG=/home/datawork-wave/NETCDF2019/${COMP}/bin/nc-config" >> matrix.head echo " export NetCDF_ROOT=/home/datawork-wave/NETCDF2019/${COMP}" >> matrix.head echo " export METIS_PATH=/home/datawork-wave/PARMETIS2019/${COMP}" >> matrix.head + echo " export SCOTCH_PATH=/home/datawork-wave/LIB/SCOTCH/v7.0.3/${COMP}" >> matrix.head echo " export WW3_PARCOMPN=4" >> matrix.head echo " export G2_LIB4=/home/datawork-wave/NCEPLIBS/${COMP}/g2-3.4.5/lib64/libg2_4.a" >> matrix.head echo " export BACIO_LIB4=/home/datawork-wave/NCEPLIBS/${COMP}/bacio-2.4.1/lib/libbacio_4.a" >> matrix.head diff --git a/regtests/bin/run_cmake_test b/regtests/bin/run_cmake_test index ec1503c55..a349240d8 100755 --- a/regtests/bin/run_cmake_test +++ b/regtests/bin/run_cmake_test @@ -628,7 +628,7 @@ then fi # link conf file - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then \rm -f $prog.nml \ln -s $ifile $prog.nml @@ -654,7 +654,7 @@ then if [ $multi -eq 2 ] then mv mod_def.ww3 mod_def.$g - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -752,7 +752,7 @@ then then mv restart.ww3 restart.$g \rm -f mod_def.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -851,7 +851,7 @@ then then mv nest.ww3 nest.$g \rm -f mod_def.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -950,7 +950,7 @@ then then mv nest.ww3 nest.$g \rm -f mod_def.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -1054,7 +1054,7 @@ then then \rm -f mod_def.ww3 mv $otype.ww3 $otype.$g - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -1178,7 +1178,7 @@ then then \rm -f mod_def.ww3 mv $otype.ww3 $otype.$g - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -1301,7 +1301,7 @@ then then \rm -f mod_def.ww3 mv $otype.ww3 $otype.$g - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -1445,7 +1445,7 @@ then \rm -f PET*.ESMF_LogFile \rm -f ww3_esmf.rc \cp -f ${path_i}/ww3_esmf.rc ww3_esmf.rc - if [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ ! -z "`basename ${ifile} | grep -o nml`" ] then echo "WAV_input_file_name: $prog.nml" >> ww3_esmf.rc fi @@ -1754,7 +1754,7 @@ do then \rm -f mod_def.ww3 \rm -f out_grd.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -1821,7 +1821,7 @@ do then \rm -f mod_def.ww3 \rm -f out_grd.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -1989,7 +1989,7 @@ do then \rm -f mod_def.ww3 \rm -f out_pnt.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi @@ -2125,7 +2125,7 @@ do if [ $multi -eq 2 ] then \rm -f track_o.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log fi diff --git a/regtests/ww3_tp2.3/input/namelists_GARDEN.nml b/regtests/ww3_tp2.3/input/namelists_GARDEN.nml index 04b929ca1..b8533ddda 100644 --- a/regtests/ww3_tp2.3/input/namelists_GARDEN.nml +++ b/regtests/ww3_tp2.3/input/namelists_GARDEN.nml @@ -1,4 +1,4 @@ -&OUTS E3D=1 / +&OUTS E3D=1, TH1MF=1, STH1MF=1 / &PRO2 DTIME=345600. / &PRO3 WDTHTH=1.50, WDTHCG=1.50 / END OF NAMELISTS diff --git a/regtests/ww3_tp2.3/input/ww3_grid.inp b/regtests/ww3_tp2.3/input/ww3_grid.inp index 9be443dbb..3a4271307 100644 --- a/regtests/ww3_tp2.3/input/ww3_grid.inp +++ b/regtests/ww3_tp2.3/input/ww3_grid.inp @@ -16,7 +16,7 @@ $ $ $ Activated up to one line per namelist !! $ - &OUTS E3D=1 / + &OUTS E3D=1, TH1MF=1, STH1MF=1 / $ &PRO2 DTIME= 0. / $ &PRO2 DTIME=172800. / &PRO2 DTIME=345600. / diff --git a/regtests/ww3_ufs1.1/input_unstr/namelists_a.nml b/regtests/ww3_ufs1.1/input_unstr/namelists_a.nml index 584405f2f..e28a03245 100644 --- a/regtests/ww3_ufs1.1/input_unstr/namelists_a.nml +++ b/regtests/ww3_ufs1.1/input_unstr/namelists_a.nml @@ -31,7 +31,7 @@ SDSHCK = 1.50, SDSBR = 0.9000E-03, SDSSTRAIN = 0.000, SDSP = 2.00, SDSISO = 2, SDSCOS =2.0, SDSDTH = 80.0, SDSBRF1 = 0.50, SDSBRFDF = 0, SDSBM0 = 1.00, SDSBM1 = 0.00, SDSBM2 = 0.00, SDSBM3 = 0.00, SDSBM4 = 0.00, -, WHITECAPWIDTH = 0.30/ +WHITECAPWIDTH = 0.30/ &SBT1 GAMMA = -0.6700E-01 / &SDB1 BJALFA = 1.000, BJGAM = 0.730, BJFLAG = .TRUE. / &PRO3 CFLTM = 0.70, WDTHCG = 1.50, WDTHTH = 1.50 / diff --git a/regtests/ww3_ufs1.1/input_unstr/namelists_b.nml b/regtests/ww3_ufs1.1/input_unstr/namelists_b.nml index 292ffc5f7..8d1c72eda 100644 --- a/regtests/ww3_ufs1.1/input_unstr/namelists_b.nml +++ b/regtests/ww3_ufs1.1/input_unstr/namelists_b.nml @@ -51,7 +51,7 @@ SDSHCK = 1.50, SDSBR = 0.9000E-03, SDSSTRAIN = 0.000, SDSP = 2.00, SDSISO = 2, SDSCOS =2.0, SDSDTH = 80.0, SDSBRF1 = 0.50, SDSBRFDF = 0, SDSBM0 = 1.00, SDSBM1 = 0.00, SDSBM2 = 0.00, SDSBM3 = 0.00, SDSBM4 = 0.00, -, WHITECAPWIDTH = 0.30/ +WHITECAPWIDTH = 0.30/ &SBT1 GAMMA = -0.6700E-01 / &SDB1 BJALFA = 1.000, BJGAM = 0.730, BJFLAG = .TRUE. / &PRO3 CFLTM = 0.70, WDTHCG = 1.50, WDTHTH = 1.50 / From 7bbdaca7f452b23a52c3a609b03e82204653dc5e Mon Sep 17 00:00:00 2001 From: Mickael Accensi <49198861+mickaelaccensi@users.noreply.github.com> Date: Fri, 22 Sep 2023 20:28:10 +0200 Subject: [PATCH 08/25] correct calendar for track netcdf output (#1079) --- model/src/ww3_trnc.F90 | 42 +++++++++++++-------- regtests/ww3_tp2.2/input/track_i.ww3 | 10 ++--- regtests/ww3_tp2.2/input/ww3_multi.inp | 14 +++---- regtests/ww3_tp2.2/input/ww3_multi.nml | 11 +++--- regtests/ww3_tp2.2/input/ww3_ounf.inp | 2 +- regtests/ww3_tp2.2/input/ww3_ounf.nml | 2 +- regtests/ww3_tp2.2/input/ww3_ounp.inp | 2 +- regtests/ww3_tp2.2/input/ww3_ounp.nml | 2 +- regtests/ww3_tp2.2/input/ww3_outf.inp | 2 +- regtests/ww3_tp2.2/input/ww3_outp_spec.inp | 2 +- regtests/ww3_tp2.2/input/ww3_outp_tab51.inp | 2 +- regtests/ww3_tp2.2/input/ww3_outp_tab52.inp | 2 +- regtests/ww3_tp2.2/input/ww3_outp_tab53.inp | 2 +- regtests/ww3_tp2.2/input/ww3_shel.inp | 24 ++++++------ regtests/ww3_tp2.2/input/ww3_shel.nml | 16 ++++---- regtests/ww3_tp2.2/input/ww3_trnc.inp | 2 +- regtests/ww3_tp2.2/input/ww3_trnc.nml | 2 +- 17 files changed, 76 insertions(+), 63 deletions(-) diff --git a/model/src/ww3_trnc.F90 b/model/src/ww3_trnc.F90 index b26d0d642..c2049751c 100644 --- a/model/src/ww3_trnc.F90 +++ b/model/src/ww3_trnc.F90 @@ -47,6 +47,7 @@ PROGRAM W3TRNC ! ---------------------------------------------------------------- ! W3NMOD Subr. W3GDATMD Set number of model. ! W3NOUT Subr. W3ODATMD Set number of model for output. + ! W3IOGR Subr. W3IOGRMD Reading/writing model definition file. ! ---------------------------------------------------------------- ! ! 5. Called by : @@ -70,13 +71,14 @@ PROGRAM W3TRNC !/ ------------------------------------------------------------------- / USE CONSTANTS - USE W3GDATMD, ONLY : W3NMOD, W3SETG, FLAGLL, XFR + USE W3GDATMD, ONLY : W3NMOD, W3SETG, FLAGLL, XFR, GNAME USE W3ODATMD, ONLY : W3NOUT, W3SETO, FNMPRE USE W3SERVMD, ONLY : ITRACE, NEXTLN, EXTCDE #ifdef W3_S USE W3SERVMD, ONLY : STRACE #endif USE W3TIMEMD + USE W3IOGRMD, ONLY: W3IOGR ! USE W3ODATMD, ONLY: NDSO, NDSE ! @@ -91,7 +93,7 @@ PROGRAM W3TRNC TYPE(NML_TRACK_T) :: NML_TRACK TYPE(NML_FILE_T) :: NML_FILE ! - INTEGER :: NDSI, NDSINP, & + INTEGER :: NDSI, NDSINP, NDSM, & NDSOUT, NDSTRC, NTRACE, & NSPEC, IERR, MK, MTH, IT, & ILOC, ISPEC, S3, IOUT, & @@ -135,6 +137,7 @@ PROGRAM W3TRNC ! 1. IO set-up. ! NDSI = 10 + NDSM = 20 NDSINP = 11 NDSOUT = 51 ! @@ -148,11 +151,16 @@ PROGRAM W3TRNC ! WRITE (NDSO,900) ! + !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ! 2. Read model definition file. + ! + CALL W3IOGR ( 'READ', NDSM ) + WRITE (NDSO,920) GNAME ! !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! 2. Read requests from input file. + ! 3. Read requests from input file. ! ! @@ -163,13 +171,13 @@ PROGRAM W3TRNC ! Read namelist CALL W3NMLTRNC (NDSI, TRIM(FNMPRE)//'ww3_trnc.nml', NML_TRACK, NML_FILE, IERR) - ! 2.1 Time setup IDTIME, DTREQ, NOUT + ! 3.1 Time setup IDTIME, DTREQ, NOUT READ(NML_TRACK%TIMESTRIDE, *) DTREQ READ(NML_TRACK%TIMECOUNT, *) NOUT READ(NML_TRACK%TIMESTART, *) TOUT(1), TOUT(2) - ! 2.2 Output type + ! 3.2 Output type NCTYPE = NML_FILE%NETCDF FILEPREFIX = NML_FILE%PREFIX S3 = NML_TRACK%TIMESPLIT @@ -189,12 +197,12 @@ PROGRAM W3TRNC WRITE (NDSO,901) COMSTR - ! 2.1 Time setup IDTIME, DTREQ, NOUT + ! 3.1 Time setup IDTIME, DTREQ, NOUT CALL NEXTLN ( COMSTR , NDSI , NDSE ) READ (NDSI,*,END=806,ERR=807) TOUT, DTREQ, NOUT - ! 2.2 Output type + ! 3.2 Output type CALL NEXTLN ( COMSTR , NDSI , NDSE ) READ (NDSI,*,END=806,ERR=807) NCTYPE CALL NEXTLN ( COMSTR , NDSI , NDSE ) @@ -208,7 +216,7 @@ PROGRAM W3TRNC - ! 2.1 Time setup IDTIME, DTREQ, NOUT + ! 3.3 Time setup IDTIME, DTREQ, NOUT DTREQ = MAX ( 0. , DTREQ ) IF ( DTREQ.EQ.0. ) NOUT = 1 NOUT = MAX ( 1 , NOUT ) @@ -227,7 +235,7 @@ PROGRAM W3TRNC WRITE (NDSO,941) IDTIME, NOUT - ! 2.2 Output type + ! 3.4 Output type IF ( NCTYPE.LT.3 .OR. NCTYPE.GT.4 ) THEN WRITE (NDSE,1010) NCTYPE CALL EXTCDE ( 1 ) @@ -239,7 +247,7 @@ PROGRAM W3TRNC ! !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! 3. Check consistency with input file and track_o.ww3 + ! 4. Check consistency with input file and track_o.ww3 ! OPEN (NDSINP,FILE=TRIM(FNMPRE)//'track_o.ww3',form='UNFORMATTED', convert=file_endian, & STATUS='OLD',ERR=800,IOSTAT=IERR) @@ -262,7 +270,7 @@ PROGRAM W3TRNC ! !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! 4. Time management. + ! 5. Time management. ! IOUT = 0 NCID = 0 @@ -271,7 +279,7 @@ PROGRAM W3TRNC BACKSPACE (NDSINP) - ! 4.1 Loops on track_o.ww3 to read the time and data + ! 5.1 Loops on track_o.ww3 to read the time and data DO DTEST = DSEC21 ( TIME , TOUT ) @@ -310,17 +318,17 @@ PROGRAM W3TRNC END IF - ! 4.1.1 Increments the global time counter IOUT + ! 5.1.1 Increments the global time counter IOUT IOUT = IOUT + 1 CALL STME21 ( TOUT , IDTIME ) WRITE (NDSO,971) IDTIME - ! 4.1.2 Processes the variable value for the time step IOUT + ! 5.1.2 Processes the variable value for the time step IOUT CALL W3EXNC ( FILEPREFIX, NCTYPE, NCID, S3, STRSTOPDATE, MK, MTH ) - ! 4.1.3 Defines the stop date + ! 5.1.3 Defines the stop date CALL T2D(TOUT,STOPDATE,IERR) WRITE(STRSTOPDATE,'(I4.4,A,4(I2.2,A),I2.2)') STOPDATE(1),'-',STOPDATE(2), & '-',STOPDATE(3),' ',STOPDATE(5),':',STOPDATE(6),':',STOPDATE(7) @@ -331,7 +339,7 @@ PROGRAM W3TRNC 444 CONTINUE - ! 4.2 Closes the netCDF file + ! 5.2 Closes the netCDF file IF (NCID.NE.0) THEN IRET = NF90_REDEF(NCID) CALL CHECK_ERR(IRET) @@ -383,6 +391,8 @@ PROGRAM W3TRNC 902 FORMAT ( ' Spectral grid size : ',I3,' by ',I3// & ' Opening file : '/ & ' -----------------------------------------------') +920 FORMAT ( ' Grid name : ',A/) + ! 940 FORMAT (/' Output time data : '/ & ' --------------------------------------------------'/ & ' First time : ',A) diff --git a/regtests/ww3_tp2.2/input/track_i.ww3 b/regtests/ww3_tp2.2/input/track_i.ww3 index ae2154a44..e4e7fbf61 100644 --- a/regtests/ww3_tp2.2/input/track_i.ww3 +++ b/regtests/ww3_tp2.2/input/track_i.ww3 @@ -1,6 +1,6 @@ WAVEWATCH III TRACK LOCATIONS DATA -19680606 000000 0 0 S1A -19680606 040000 1 0 S1B -19680606 060000 1 0 S1C -19680606 080000 2 0 S1D -19680606 120000 0.5 0 S1E +20220606 000000 0 0 S1A +20220606 040000 1 0 S1B +20220606 060000 1 0 S1C +20220606 080000 2 0 S1D +20220606 120000 0.5 0 S1E diff --git a/regtests/ww3_tp2.2/input/ww3_multi.inp b/regtests/ww3_tp2.2/input/ww3_multi.inp index 4d5d699e6..62f187b20 100644 --- a/regtests/ww3_tp2.2/input/ww3_multi.inp +++ b/regtests/ww3_tp2.2/input/ww3_multi.inp @@ -4,25 +4,25 @@ $ ------------------------------ $ 'ww3' 'no' 'no' 'no' 'no' 'no' 'no' 'no' 'no' 'no' 1 1 0.00 1.00 F $ - 19680606 000000 19680618 000000 + 20220606 000000 20220618 000000 $ T T $ - 19680606 000000 86400 19680618 000000 + 20220606 000000 86400 20220618 000000 $ N HS T0M1 DIR SPR $ - 19680606 000000 21600 19680618 000000 + 20220606 000000 21600 20220618 000000 0.0 0.0 'LEFT' 90.0 0.0 'CENTER' 180.0 0.0 'RIGHT' 0.0 0.0 'STOPSTRING' - 19680606 000000 3600 19680618 000000 + 20220606 000000 3600 20220618 000000 T - 19680612 000000 0 19680612 000000 - 19680606 000000 3600 19680618 000000 - 19680612 000000 0 19680612 000000 + 20220612 000000 0 20220612 000000 + 20220606 000000 3600 20220618 000000 + 20220612 000000 0 20220612 000000 $ 'the_end' 0 $ diff --git a/regtests/ww3_tp2.2/input/ww3_multi.nml b/regtests/ww3_tp2.2/input/ww3_multi.nml index 95c0f379c..6736ed229 100644 --- a/regtests/ww3_tp2.2/input/ww3_multi.nml +++ b/regtests/ww3_tp2.2/input/ww3_multi.nml @@ -9,7 +9,8 @@ &DOMAIN_NML DOMAIN%FLGHG1 = T DOMAIN%FLGHG2 = T - DOMAIN%STOP = '19680618 000000' + DOMAIN%START = '20220606 000000' + DOMAIN%STOP = '20220618 000000' / ! -------------------------------------------------------------------- ! @@ -37,10 +38,10 @@ ! Define output dates via OUTPUT_DATE_NML namelist ! -------------------------------------------------------------------- ! &OUTPUT_DATE_NML - ALLDATE%FIELD = '19680606 000000' '86400' '19680618 000000' - ALLDATE%POINT = '19680606 000000' '21600' '19680618 000000' - ALLDATE%TRACK = '19680606 000000' '3600' '19680618 000000' - ALLDATE%BOUNDARY = '19680606 000000' '3600' '19680618 000000' + ALLDATE%FIELD = '20220606 000000' '86400' '20220618 000000' + ALLDATE%POINT = '20220606 000000' '21600' '20220618 000000' + ALLDATE%TRACK = '20220606 000000' '3600' '20220618 000000' + ALLDATE%BOUNDARY = '20220606 000000' '3600' '20220618 000000' / ! -------------------------------------------------------------------- ! diff --git a/regtests/ww3_tp2.2/input/ww3_ounf.inp b/regtests/ww3_tp2.2/input/ww3_ounf.inp index 1d901574c..120b78d3d 100644 --- a/regtests/ww3_tp2.2/input/ww3_ounf.inp +++ b/regtests/ww3_tp2.2/input/ww3_ounf.inp @@ -4,7 +4,7 @@ $--------------------------------------------------------------------- $ $ First output time (yyyymmdd hhmmss), increment of output (s), $ and number of output times. $ - 19680606 000000 10800. 100 + 20220606 000000 10800. 100 $ $ Fields requested --------------------------------------------------- $ $ diff --git a/regtests/ww3_tp2.2/input/ww3_ounf.nml b/regtests/ww3_tp2.2/input/ww3_ounf.nml index 44db63521..07dcdd2c2 100644 --- a/regtests/ww3_tp2.2/input/ww3_ounf.nml +++ b/regtests/ww3_tp2.2/input/ww3_ounf.nml @@ -6,7 +6,7 @@ ! Define the output fields to postprocess via FIELD_NML namelist ! -------------------------------------------------------------------- ! &FIELD_NML - FIELD%TIMESTART = '19680606 000000' + FIELD%TIMESTART = '20220606 000000' FIELD%TIMESTRIDE = '10800.' FIELD%TIMECOUNT = '100' FIELD%LIST = 'HS T01 DIR SPR' diff --git a/regtests/ww3_tp2.2/input/ww3_ounp.inp b/regtests/ww3_tp2.2/input/ww3_ounp.inp index 4816a3a7e..2c6a2f8d2 100644 --- a/regtests/ww3_tp2.2/input/ww3_ounp.inp +++ b/regtests/ww3_tp2.2/input/ww3_ounp.inp @@ -4,7 +4,7 @@ $--------------------------------------------------------------------- $ $ First output time (yyyymmdd hhmmss), increment of output (s), $ and number of output times. $ - 19680606 000000 21600. 1000 + 20220606 000000 21600. 1000 $ $ Points requested --------------------------------------------------- $ $ diff --git a/regtests/ww3_tp2.2/input/ww3_ounp.nml b/regtests/ww3_tp2.2/input/ww3_ounp.nml index 29fa1897d..e97fc6b22 100644 --- a/regtests/ww3_tp2.2/input/ww3_ounp.nml +++ b/regtests/ww3_tp2.2/input/ww3_ounp.nml @@ -6,7 +6,7 @@ ! Define the output fields to postprocess via POINT_NML namelist ! -------------------------------------------------------------------- ! &POINT_NML - POINT%TIMESTART = '19680606 000000' + POINT%TIMESTART = '20220606 000000' POINT%TIMESTRIDE = '21600.' POINT%TIMECOUNT = '1000' POINT%LIST = '1 2 3' diff --git a/regtests/ww3_tp2.2/input/ww3_outf.inp b/regtests/ww3_tp2.2/input/ww3_outf.inp index 4b062a870..d49b283c9 100644 --- a/regtests/ww3_tp2.2/input/ww3_outf.inp +++ b/regtests/ww3_tp2.2/input/ww3_outf.inp @@ -1,6 +1,6 @@ $ WAVEWATCH III Grid output post-processing $ ----------------------------------------- - 19680612 000000 518400. 2 + 20220612 000000 518400. 2 $ N HS T01 DIR SPR diff --git a/regtests/ww3_tp2.2/input/ww3_outp_spec.inp b/regtests/ww3_tp2.2/input/ww3_outp_spec.inp index d4c452b1f..cb7c2ba52 100644 --- a/regtests/ww3_tp2.2/input/ww3_outp_spec.inp +++ b/regtests/ww3_tp2.2/input/ww3_outp_spec.inp @@ -1,6 +1,6 @@ $ WAVEWATCH III Point output post-processing $ ------------------------------------------ - 19680606 000000 43200. 25 + 20220606 000000 43200. 25 $ 1 2 diff --git a/regtests/ww3_tp2.2/input/ww3_outp_tab51.inp b/regtests/ww3_tp2.2/input/ww3_outp_tab51.inp index d40f4a55d..9e4c288b6 100644 --- a/regtests/ww3_tp2.2/input/ww3_outp_tab51.inp +++ b/regtests/ww3_tp2.2/input/ww3_outp_tab51.inp @@ -1,6 +1,6 @@ $ WAVEWATCH III Point output post-processing $ ------------------------------------------ - 19680606 000000 43200. 25 + 20220606 000000 43200. 25 $ 1 -1 diff --git a/regtests/ww3_tp2.2/input/ww3_outp_tab52.inp b/regtests/ww3_tp2.2/input/ww3_outp_tab52.inp index 06431db5d..3ded7db46 100644 --- a/regtests/ww3_tp2.2/input/ww3_outp_tab52.inp +++ b/regtests/ww3_tp2.2/input/ww3_outp_tab52.inp @@ -1,6 +1,6 @@ $ WAVEWATCH III Point output post-processing $ ------------------------------------------ - 19680606 000000 43200. 25 + 20220606 000000 43200. 25 $ 2 -1 diff --git a/regtests/ww3_tp2.2/input/ww3_outp_tab53.inp b/regtests/ww3_tp2.2/input/ww3_outp_tab53.inp index 209a605b0..0e57f1322 100644 --- a/regtests/ww3_tp2.2/input/ww3_outp_tab53.inp +++ b/regtests/ww3_tp2.2/input/ww3_outp_tab53.inp @@ -1,6 +1,6 @@ $ WAVEWATCH III Point output post-processing $ ------------------------------------------ - 19680606 000000 43200. 25 + 20220606 000000 43200. 25 $ 3 -1 diff --git a/regtests/ww3_tp2.2/input/ww3_shel.inp b/regtests/ww3_tp2.2/input/ww3_shel.inp index aba7af3e4..37d914fad 100644 --- a/regtests/ww3_tp2.2/input/ww3_shel.inp +++ b/regtests/ww3_tp2.2/input/ww3_shel.inp @@ -10,31 +10,31 @@ $ ------------------------------ F F $ - 19680606 000000 - 19680606 120000 + 20220606 000000 + 20220606 120000 $ 1 $ - 19680606 000000 10800 19680608 000000 + 20220606 000000 10800 20220608 000000 $ N HS EF T01 DIR SPR $ - 19680606 000000 21600 19680608 000000 + 20220606 000000 21600 20220608 000000 0.0 0.0 'LEFT' 90.0 0.0 'CENTER' 180.0 0.0 'RIGHT' 0.0 0.0 'STOPSTRING' - 19680606 000000 14400 19680608 000000 + 20220606 000000 14400 20220608 000000 T - 19680606 000000 0 19680608 000000 - 19680606 000000 0 19680608 000000 - 19680606 000000 0 19680608 000000 + 20220606 000000 0 20220608 000000 + 20220606 000000 0 20220608 000000 + 20220606 000000 0 20220608 000000 $ - 'CUR' 19680606 030000 2.0 45. - 'WND' 19680606 000000 20.0 180. 2. - 'WND' 19680606 040000 15.0 130. 1. - 'WND' 19680606 080000 25.0 90. 3. + 'CUR' 20220606 030000 2.0 45. + 'WND' 20220606 000000 20.0 180. 2. + 'WND' 20220606 040000 15.0 130. 1. + 'WND' 20220606 080000 25.0 90. 3. 'STP' $ $ -------------------------------------------------------------------- $ diff --git a/regtests/ww3_tp2.2/input/ww3_shel.nml b/regtests/ww3_tp2.2/input/ww3_shel.nml index 578f05f93..32205bc57 100644 --- a/regtests/ww3_tp2.2/input/ww3_shel.nml +++ b/regtests/ww3_tp2.2/input/ww3_shel.nml @@ -7,7 +7,8 @@ ! Define top-level model parameters via DOMAIN_NML namelist ! -------------------------------------------------------------------- ! &DOMAIN_NML - DOMAIN%STOP = '19680606 120000' + DOMAIN%START = '20220606 000000' + DOMAIN%STOP = '20220606 120000' / ! -------------------------------------------------------------------- ! @@ -30,9 +31,9 @@ ! Define output dates via OUTPUT_DATE_NML namelist ! -------------------------------------------------------------------- ! &OUTPUT_DATE_NML - DATE%FIELD = '19680606 000000' '10800' '19680608 000000' - DATE%POINT = '19680606 000000' '21600' '19680608 000000' - DATE%TRACK = '19680606 000000' '14400' '19680608 000000' + DATE%FIELD = '20220606 000000' '10800' '20220608 000000' + DATE%POINT = '20220606 000000' '21600' '20220608 000000' + DATE%TRACK = '20220606 000000' '14400' '20220608 000000' / ! -------------------------------------------------------------------- ! @@ -45,23 +46,24 @@ &HOMOG_INPUT_NML HOMOG_INPUT(1)%NAME = 'CUR' - HOMOG_INPUT(1)%DATE = '19680606 030000' + HOMOG_INPUT(1)%DATE = '20220606 030000' HOMOG_INPUT(1)%VALUE1 = 2.0 HOMOG_INPUT(1)%VALUE2 = 45. HOMOG_INPUT(2)%NAME = 'WND' + HOMOG_INPUT(2)%DATE = '20220606 000000' HOMOG_INPUT(2)%VALUE1 = 20.0 HOMOG_INPUT(2)%VALUE2 = 180. HOMOG_INPUT(2)%VALUE3 = 2. HOMOG_INPUT(3)%NAME = 'WND' - HOMOG_INPUT(3)%DATE = '19680606 040000' + HOMOG_INPUT(3)%DATE = '20220606 040000' HOMOG_INPUT(3)%VALUE1 = 15.0 HOMOG_INPUT(3)%VALUE2 = 130. HOMOG_INPUT(3)%VALUE3 = 1. HOMOG_INPUT(4)%NAME = 'WND' - HOMOG_INPUT(4)%DATE = '19680606 080000' + HOMOG_INPUT(4)%DATE = '20220606 080000' HOMOG_INPUT(4)%VALUE1 = 25.0 HOMOG_INPUT(4)%VALUE2 = 90. HOMOG_INPUT(4)%VALUE3 = 3. diff --git a/regtests/ww3_tp2.2/input/ww3_trnc.inp b/regtests/ww3_tp2.2/input/ww3_trnc.inp index df60800b8..ddfd4f403 100755 --- a/regtests/ww3_tp2.2/input/ww3_trnc.inp +++ b/regtests/ww3_tp2.2/input/ww3_trnc.inp @@ -4,7 +4,7 @@ $--------------------------------------------------------------------- $ $ First output time (yyyymmdd hhmmss), increment of output (s), $ and number of output times. $ - 19680606 000000 3600. 100000 + 20220606 000000 3600. 100000 $ $ Output type -------------------------------------------------------- $ $ netCDF version [3,4] diff --git a/regtests/ww3_tp2.2/input/ww3_trnc.nml b/regtests/ww3_tp2.2/input/ww3_trnc.nml index e4ae8ceab..e6847f529 100644 --- a/regtests/ww3_tp2.2/input/ww3_trnc.nml +++ b/regtests/ww3_tp2.2/input/ww3_trnc.nml @@ -6,7 +6,7 @@ ! Define the output fields to postprocess via TRACK_NML namelist ! -------------------------------------------------------------------- ! &TRACK_NML - TRACK%TIMESTART = '19680606 000000' + TRACK%TIMESTART = '20220606 000000' TRACK%TIMESTRIDE = '3600.' / From b1356ddb28e9e5b4cc7e4d4ecb16f43e955864d3 Mon Sep 17 00:00:00 2001 From: Chris Bunney <48915820+ukmo-ccbunney@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:39:28 +0100 Subject: [PATCH 09/25] Fix missing mod_def.ww3 file in multigrid regression tests for track output (#1091) --- regtests/bin/run_cmake_test | 6 +++++- regtests/bin/run_test | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/regtests/bin/run_cmake_test b/regtests/bin/run_cmake_test index a349240d8..206b3681d 100755 --- a/regtests/bin/run_cmake_test +++ b/regtests/bin/run_cmake_test @@ -2027,7 +2027,7 @@ done # end of loop on progs case $outopt in native) out_progs="ww3_trck" ;; netcdf) out_progs="ww3_trnc" ;; - both) out_progs="ww3_trck ww3_trnc" ;; + both|all) out_progs="ww3_trck ww3_trnc" ;; *) out_progs="" ;; esac @@ -2070,6 +2070,9 @@ do then continue fi + + \ln -s mod_def.$g mod_def.ww3 + gu="_$g" fileconf="$prog${gu}" else @@ -2124,6 +2127,7 @@ do \rm -f $prog.nml if [ $multi -eq 2 ] then + \rm -f mod_def.ww3 \rm -f track_o.ww3 if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then diff --git a/regtests/bin/run_test b/regtests/bin/run_test index 7ed5ce40e..560ab0725 100755 --- a/regtests/bin/run_test +++ b/regtests/bin/run_test @@ -2368,7 +2368,7 @@ done # end of loop on progs case $outopt in native) out_progs="ww3_trck" ;; netcdf) out_progs="ww3_trnc" ;; - both) out_progs="ww3_trck ww3_trnc" ;; + both|all) out_progs="ww3_trck ww3_trnc" ;; *) out_progs="" ;; esac @@ -2448,6 +2448,9 @@ do then continue fi + + \ln -s mod_def.$g mod_def.ww3 + gu="_$g" fileconf="$prog${gu}" else @@ -2502,6 +2505,7 @@ do \rm -f $prog.nml if [ $multi -eq 2 ] then + \rm -f mod_def.ww3 \rm -f track_o.ww3 if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] then From d22b7bb95e91528f7b1759b6112a4ad2af4bfa63 Mon Sep 17 00:00:00 2001 From: Matthew Masarik <86749872+MatthewMasarik-NOAA@users.noreply.github.com> Date: Tue, 10 Oct 2023 17:25:32 -0400 Subject: [PATCH 10/25] STAB3: fix cmake build for ST4 or ST3 (#1086) --- model/src/cmake/check_switches.cmake | 6 +++--- model/src/cmake/switches.json | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/model/src/cmake/check_switches.cmake b/model/src/cmake/check_switches.cmake index 563d529e2..d09a91c5e 100644 --- a/model/src/cmake/check_switches.cmake +++ b/model/src/cmake/check_switches.cmake @@ -52,7 +52,7 @@ function(check_switches switches switch_files) message(FATAL_ERROR "Switch '${valid_opt}' requires '${required_switch}' to be set") endif() elseif(json_type STREQUAL "ARRAY") - string(JSON n_requires_any LENGTH ${vategory} valid-options ${j_options} requries ${i_requires}) + string(JSON n_requires_any LENGTH ${category} valid-options ${j_options} requires ${i_requires}) math(EXPR n_requires_any "${n_requires_any} - 1") # Loop over array and check that one of the switches is present @@ -70,7 +70,7 @@ function(check_switches switches switch_files) if(NOT found) message(FATAL_ERROR "Switch ${valid_opt} requires one of ${possible_values} to be set") endif() - + endif() endforeach() endif() @@ -98,7 +98,7 @@ function(check_switches switches switch_files) elseif(num_switches STREQUAL "upto2" AND n_switches_in_category GREATER 2) message(FATAL_ERROR "Too many ${category_name} switches found (max 2)") endif() - + endforeach() set(${switch_files} ${files} PARENT_SCOPE) diff --git a/model/src/cmake/switches.json b/model/src/cmake/switches.json index ca01708af..ff2cdc9ad 100644 --- a/model/src/cmake/switches.json +++ b/model/src/cmake/switches.json @@ -264,7 +264,7 @@ }, { "name": "STAB3", - "requires": ["ST3", "ST4"] + "requires_any": ["ST3", "ST4"] } ] }, @@ -756,16 +756,16 @@ } ] }, - { - "name": "ddlib", + { + "name": "ddlib", "num_switches": "upto1", "description": "domain decomposition library", "valid-options": [ - { + { "name": "METIS", "requires": ["PDLIB"] - }, - { + }, + { "name": "SCOTCH", "requires": ["PDLIB"] } From eff6686d50a0e034cfe269731da05804f11f4c8b Mon Sep 17 00:00:00 2001 From: Mickael Accensi <49198861+mickaelaccensi@users.noreply.github.com> Date: Thu, 12 Oct 2023 22:25:36 +0200 Subject: [PATCH 11/25] new feature to output out_grd.ww3, out_pnt.ww3 and mod_def.ww3 both in binary and ascii format using switch ASCII. (#1089) --- model/src/cmake/switches.json | 10 + model/src/w3gridmd.F90 | 12 +- model/src/w3initmd.F90 | 3 + model/src/w3iogomd.F90 | 395 ++++++++++++++++++- model/src/w3iogrmd.F90 | 385 +++++++++++++++++- model/src/w3iopomd.F90 | 60 ++- model/src/w3odatmd.F90 | 2 +- model/src/w3wavemd.F90 | 12 +- model/src/wminitmd.F90 | 18 + model/src/wmiopomd.F90 | 9 +- model/src/wmmdatmd.F90 | 5 + regtests/bin/matrix.base | 2 + regtests/bin/run_cmake_test | 4 + regtests/mww3_test_09/input/switch_MPI_ASCII | 1 + regtests/ww3_tp2.6/input/switch_ST4_ASCII | 1 + 15 files changed, 909 insertions(+), 10 deletions(-) create mode 100644 regtests/mww3_test_09/input/switch_MPI_ASCII create mode 100644 regtests/ww3_tp2.6/input/switch_ST4_ASCII diff --git a/model/src/cmake/switches.json b/model/src/cmake/switches.json index ff2cdc9ad..30eca480c 100644 --- a/model/src/cmake/switches.json +++ b/model/src/cmake/switches.json @@ -813,5 +813,15 @@ "name": "B4B" } ] + }, + { + "name": "ascii", + "num_switches": "upto1", + "description": "ASCII output for binary .ww3 file", + "valid-options": [ + { + "name": "ASCII" + } + ] } ] diff --git a/model/src/w3gridmd.F90 b/model/src/w3gridmd.F90 index 281ed7a3f..aa618b59f 100644 --- a/model/src/w3gridmd.F90 +++ b/model/src/w3gridmd.F90 @@ -586,6 +586,9 @@ MODULE W3GRIDMD IY2, J, JJ, IXR(4), IYR(4), ISEAI(4),& IST, NKI, NTHI, NRIC, NRIS, I, IDFT, & NSTAT, NBT, NLAND, NOSW, NMAPB, IMAPB +#ifdef W3_ASCII + INTEGER :: NDSMA +#endif #ifdef W3_NL2 INTEGER :: IDEPTH #endif @@ -5907,9 +5910,16 @@ SUBROUTINE W3GRID() !10. Write model definition file. ! WRITE (NDSO,999) - CALL W3IOGR ( 'WRITE', NDSM ) + CALL W3IOGR ( 'WRITE', NDSM & +#ifdef W3_ASCII + ,NDSA=NDSMA & +#endif + ) ! CLOSE (NDSM) +#ifdef W3_ASCII + CLOSE (NDSMA) +#endif ! GOTO 2222 ! diff --git a/model/src/w3initmd.F90 b/model/src/w3initmd.F90 index 2d5eacc33..50f0680ad 100644 --- a/model/src/w3initmd.F90 +++ b/model/src/w3initmd.F90 @@ -239,6 +239,9 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, ! (first). ! 11: Track information file unit number. ! 12: Track output file unit number. + ! 13: Wave separation output file unit number. + ! 14: Grid output file unit number. + ! 15: Point output file unit number. ascii ! MTRACE I.A. I Array with subroutine tracing information. ! 1: Output unit number for trace. ! 2: Maximum number of trace prints. diff --git a/model/src/w3iogomd.F90 b/model/src/w3iogomd.F90 index a6ef03325..2ddfa77e0 100644 --- a/model/src/w3iogomd.F90 +++ b/model/src/w3iogomd.F90 @@ -2376,7 +2376,11 @@ END SUBROUTINE W3OUTG !> !> @author H. L. Tolman @date 22-Mar-2021 !> - SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) + SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD & +#ifdef W3_ASCII + ,NDSOA & +#endif + ) !/ !/ +-----------------------------------+ !/ | WAVEWATCH III NOAA/NCEP | @@ -2535,6 +2539,9 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) INTEGER, INTENT(IN), OPTIONAL :: IMOD CHARACTER, INTENT(IN) :: INXOUT*(*) CHARACTER(LEN=15) :: TIMETAG +#ifdef W3_ASCII + INTEGER, INTENT(IN), OPTIONAL :: NDSOA +#endif !/ !/ ------------------------------------------------------------------- / !/ Local parameters @@ -2610,7 +2617,11 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) #endif IF ( WRITE ) THEN OPEN (NDSOG,FILE=FNMPRE(:J)//'out_grd.'//FILEXT(:I), & - form='UNFORMATTED', convert=file_endian,ERR=800,IOSTAT=IERR) + form ='UNFORMATTED', convert=file_endian,ERR=800,IOSTAT=IERR) +#ifdef W3_ASCII + OPEN (NDSOA,FILE=FNMPRE(:J)//'out_grd.'//FILEXT(:I)//'.txt', & + form ='FORMATTED',ERR=800,IOSTAT=IERR) +#endif ELSE OPEN (NDSOG,FILE=FNMPRE(:J)//'out_grd.'//FILEXT(:I), & form='UNFORMATTED', convert=file_endian,ERR=800,IOSTAT=IERR,STATUS='OLD') @@ -2625,6 +2636,13 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) WRITE (NDSOG) & IDSTR, VEROGR, GNAME, NOGRP, NGRPP, NSEA, NX, NY, & UNDEF, NOSWLL +#ifdef W3_ASCII + WRITE (NDSOA,*) & + 'IDSTR, VEROGR, GNAME, NOGRP, NGRPP, NSEA, NX, NY, & + UNDEF, NOSWLL:', & + IDSTR, VEROGR, GNAME, NOGRP, NGRPP, NSEA, NX, NY, & + UNDEF, NOSWLL +#endif ELSE READ (NDSOG,END=801,ERR=802,IOSTAT=IERR) & IDTST, VERTST, TNAME, MOGRP, MGRPP, NSEA, NX, NY, & @@ -2685,6 +2703,10 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) IF ( WRITE ) THEN OPEN (NDSOG,FILE=FNMPRE(:J)//TIMETAG//'.out_grd.' & //FILEXT(:I),form='UNFORMATTED', convert=file_endian,ERR=800,IOSTAT=IERR) +#ifdef W3_ASCII + OPEN (NDSOA,FILE=FNMPRE(:J)//TIMETAG//'.out_grd.' & + //FILEXT(:I)//'.txt',form='FORMATTED',ERR=800,IOSTAT=IERR) +#endif ELSE OPEN (NDSOG,FILE=FNMPRE(:J)//'out_grd.'//FILEXT(:I), & form='UNFORMATTED', convert=file_endian,ERR=800,IOSTAT=IERR,STATUS='OLD') @@ -2699,6 +2721,13 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) WRITE (NDSOG) & IDSTR, VEROGR, GNAME, NOGRP, NGRPP, NSEA, NX, NY, & UNDEF, NOSWLL +#ifdef W3_ASCII + WRITE (NDSOA,*) & + 'IDSTR, VEROGR, GNAME, NOGRP, NGRPP, NSEA, NX, NY, & + UNDEF, NOSWLL:', & + IDSTR, VEROGR, GNAME, NOGRP, NGRPP, NSEA, NX, NY, & + UNDEF, NOSWLL +#endif ELSE READ (NDSOG,END=801,ERR=802,IOSTAT=IERR) & IDTST, VERTST, TNAME, MOGRP, MGRPP, NSEA, NX, NY, & @@ -2737,6 +2766,10 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) ! IF ( WRITE ) THEN WRITE (NDSOG) TIME, FLOGRD +#ifdef W3_ASCII + WRITE (NDSOA,*) 'TIME, FLOGRD:', & + TIME, FLOGRD +#endif ELSE READ (NDSOG,END=803,ERR=802,IOSTAT=IERR) TIME, FLOGRD END IF @@ -2752,6 +2785,10 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) MAPTMP = MAPSTA + 8*MAPST2 WRITE (NDSOG) & ((MAPTMP(IY,IX),IX=1,NX),IY=1,NY) +#ifdef W3_ASCII + WRITE (NDSOA,*) 'MAPSTA:', & + ((MAPTMP(IY,IX),IX=1,NX),IY=1,NY) +#endif ELSE READ (NDSOG,END=801,ERR=802,IOSTAT=IERR) & ((MAPTMP(IY,IX),IX=1,NX),IY=1,NY) @@ -2946,9 +2983,18 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) ! IF ( IFI .EQ. 1 .AND. IFJ .EQ. 1 ) THEN WRITE ( NDSOG ) DW(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'DW:', DW(1:NSEA) +#endif ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 2 ) THEN WRITE ( NDSOG ) CX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'CX:', CX(1:NSEA) +#endif WRITE ( NDSOG ) CY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'CY:', CY(1:NSEA) +#endif ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 3 ) THEN DO ISEA=1, NSEA #ifdef W3_SMC @@ -2967,15 +3013,33 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) END IF END DO WRITE ( NDSOG ) AUX1 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX1 (UA*cos(UD)):', AUX1 +#endif WRITE ( NDSOG ) AUX2 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX2 (UA*sin(UD)):', AUX2 +#endif ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 4 ) THEN WRITE ( NDSOG ) AS(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AS:', AS(1:NSEA) +#endif ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) WLV(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'WLV:', WLV(1:NSEA) +#endif ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 6 ) THEN WRITE ( NDSOG ) ICE(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'ICE:', ICE(1:NSEA) +#endif ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 7 ) THEN WRITE ( NDSOG ) BERG(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'BERG:', BERG(1:NSEA) +#endif ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 8 ) THEN DO ISEA=1, NSEA #ifdef W3_SMC @@ -2994,22 +3058,43 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) END IF END DO WRITE ( NDSOG ) AUX1 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX1 (TAUA*cos(TAUADIR)):', AUX1 +#endif WRITE ( NDSOG ) AUX2 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX2 (TAUA*sin(TAUADIR)):', AUX2 +#endif ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 9 ) THEN WRITE ( NDSOG ) RHOAIR(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'RHOAIR:', RHOAIR(1:NSEA) +#endif #ifdef W3_BT4 ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 10 ) THEN WRITE ( NDSOG ) SED_D50(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'SED_D50:', SED_D50(1:NSEA) +#endif #endif #ifdef W3_IS2 ELSE IF (IFI .EQ. 1 .AND. IFJ .EQ. 11 ) THEN WRITE (NDSOG ) ICEH(1:NSEA) +#ifdef W3_ASCII + WRITE (NDSOA,* ) 'ICEH:', ICEH(1:NSEA) +#endif ELSE IF (IFI .EQ. 1 .AND. IFJ .EQ. 12 ) THEN WRITE (NDSOG ) ICEF(1:NSEA) +#ifdef W3_ASCII + WRITE (NDSOA,* ) 'ICEF:', ICEF(1:NSEA) +#endif #endif #ifdef W3_SETUP ELSE IF ( IFI .EQ. 1 .AND. IFJ .EQ. 13 ) THEN WRITE ( NDSOG ) ZETA_SETUP(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'ZETA_SETUP:', ZETA_SETUP(1:NSEA) +#endif #endif ! @@ -3017,94 +3102,217 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) ! ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 1 ) THEN WRITE ( NDSOG ) HS(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'HS:', HS(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 2 ) THEN WRITE ( NDSOG ) WLM(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'WLM:', WLM(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 3 ) THEN WRITE ( NDSOG ) T02(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'T02:', T02(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 4 ) THEN WRITE ( NDSOG ) T0M1(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'T0M1:', T0M1(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) T01(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'T01:', T01(1:NSEA) +#endif ELSE IF ( (IFI .EQ. 2 .AND. IFJ .EQ. 6) .OR. & (IFI .EQ. 2 .AND. IFJ .EQ. 18) ) THEN ! Note: TP output is derived from FP field. WRITE ( NDSOG ) FP0(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'FP0:', FP0(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 7 ) THEN WRITE ( NDSOG ) THM(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'THM:', THM(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 8 ) THEN WRITE ( NDSOG ) THS(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'THS:', THS(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 9 ) THEN WRITE ( NDSOG ) THP0(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'THP0:', THP0(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 10 ) THEN WRITE ( NDSOG ) HSIG(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'HSIG:', HSIG(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 11 ) THEN WRITE ( NDSOG ) STMAXE(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'STMAXE:', STMAXE(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 12 ) THEN WRITE ( NDSOG ) STMAXD(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'STMAXD:', STMAXD(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 13 ) THEN WRITE ( NDSOG ) HMAXE(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'HMAXE:', HMAXE(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 14 ) THEN WRITE ( NDSOG ) HCMAXE(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'HCMAXE:', HCMAXE(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 15 ) THEN WRITE ( NDSOG ) HMAXD(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'HMAXD:', HMAXD(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 16 ) THEN WRITE ( NDSOG ) HCMAXD(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'HCMAXD:', HCMAXD(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 17 ) THEN WRITE ( NDSOG ) WBT(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'WBT:', WBT(1:NSEA) +#endif ELSE IF ( IFI .EQ. 2 .AND. IFJ .EQ. 19 ) THEN WRITE ( NDSOG ) WNMEAN(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'WNMEAN:', WNMEAN(1:NSEA) +#endif ! ! Section 3) ! ELSE IF ( IFI .EQ. 3 .AND. IFJ .EQ. 1 ) THEN WRITE ( NDSOG ) EF(1:NSEA,E3DF(2,1):E3DF(3,1)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'EF:', EF(1:NSEA,E3DF(2,1):E3DF(3,1)) +#endif ELSE IF ( IFI .EQ. 3 .AND. IFJ .EQ. 2 ) THEN WRITE ( NDSOG ) TH1M(1:NSEA,E3DF(2,2):E3DF(3,2)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TH1M:', TH1M(1:NSEA,E3DF(2,2):E3DF(3,2)) +#endif ELSE IF ( IFI .EQ. 3 .AND. IFJ .EQ. 3 ) THEN WRITE ( NDSOG ) STH1M(1:NSEA,E3DF(2,3):E3DF(3,3)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'STH1M:', STH1M(1:NSEA,E3DF(2,3):E3DF(3,3)) +#endif ELSE IF ( IFI .EQ. 3 .AND. IFJ .EQ. 4 ) THEN WRITE ( NDSOG ) TH2M(1:NSEA,E3DF(2,4):E3DF(3,4)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TH2M:', TH2M(1:NSEA,E3DF(2,4):E3DF(3,4)) +#endif ELSE IF ( IFI .EQ. 3 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) STH2M(1:NSEA,E3DF(2,5):E3DF(3,5)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'STH2M:', STH2M(1:NSEA,E3DF(2,5):E3DF(3,5)) +#endif ELSE IF ( IFI .EQ. 3 .AND. IFJ .EQ. 6) THEN WRITE ( NDSOG ) WN(1:NK,1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'WN:', WN(1:NK,1:NSEA) +#endif ! ! Section 4) ! ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 1 ) THEN WRITE ( NDSOG ) PHS(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PHS:', PHS(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 2 ) THEN WRITE ( NDSOG ) PTP(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PTP:', PTP(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 3 ) THEN WRITE ( NDSOG ) PLP(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PLP:', PLP(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 4 ) THEN WRITE ( NDSOG ) PDIR(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PDIR:', PDIR(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) PSI(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PSI:', PSI(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 6 ) THEN WRITE ( NDSOG ) PWS(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PWS:', PWS(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 7 ) THEN WRITE ( NDSOG ) PTHP0(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PTHP0:', PTHP0(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 8 ) THEN WRITE ( NDSOG ) PQP(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PQP:', PQP(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 9 ) THEN WRITE ( NDSOG ) PPE(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PPE:', PPE(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 10 ) THEN WRITE ( NDSOG ) PGW(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PGW:', PGW(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 11 ) THEN WRITE ( NDSOG ) PSW(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PSW:', PSW(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 12 ) THEN WRITE ( NDSOG ) PTM1(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PTM1:', PTM1(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 13 ) THEN WRITE ( NDSOG ) PT1(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PT1:', PT1(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 14 ) THEN WRITE ( NDSOG ) PT2(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PT2:', PT2(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 15 ) THEN WRITE ( NDSOG ) PEP(1:NSEA,0:NOSWLL) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PEP:', PEP(1:NSEA,0:NOSWLL) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 16 ) THEN WRITE ( NDSOG ) PWST(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PWST:', PWST(1:NSEA) +#endif ELSE IF ( IFI .EQ. 4 .AND. IFJ .EQ. 17 ) THEN WRITE ( NDSOG ) PNR(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PNR:', PNR(1:NSEA) +#endif ! ! Section 5) ! @@ -3123,68 +3331,179 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) END IF END DO WRITE ( NDSOG ) AUX1 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX1 (UST*ASF*cos(USTDIR)):', AUX1 +#endif WRITE ( NDSOG ) AUX2 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX2 (UST*ASF*sin(USTDIR)):', AUX2 +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 2 ) THEN WRITE ( NDSOG ) CHARN(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'CHARN:', CHARN(1:NSEA) +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 3 ) THEN WRITE ( NDSOG ) CGE(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'CGE:', CGE(1:NSEA) +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 4 ) THEN WRITE ( NDSOG ) PHIAW(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PHIAW:', PHIAW(1:NSEA) +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) TAUWIX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUWIX:', TAUWIX(1:NSEA) +#endif WRITE ( NDSOG ) TAUWIY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUWIY:', TAUWIY(1:NSEA) +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 6 ) THEN WRITE ( NDSOG ) TAUWNX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUWNX:', TAUWNX(1:NSEA) +#endif WRITE ( NDSOG ) TAUWNY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUWNY:', TAUWNY(1:NSEA) +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 7 ) THEN WRITE ( NDSOG ) WHITECAP(1:NSEA,1) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'WHITECAP(1):', WHITECAP(1:NSEA,1) +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 8 ) THEN WRITE ( NDSOG ) WHITECAP(1:NSEA,2) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'WHITECAP(2):', WHITECAP(1:NSEA,2) +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 9 ) THEN WRITE ( NDSOG ) WHITECAP(1:NSEA,3) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'WHITECAP(3):', WHITECAP(1:NSEA,3) +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 10 ) THEN WRITE ( NDSOG ) WHITECAP(1:NSEA,4) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'WHITECAP(4):', WHITECAP(1:NSEA,4) +#endif ELSE IF ( IFI .EQ. 5 .AND. IFJ .EQ. 11 ) THEN WRITE ( NDSOG ) TWS(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TWS:', TWS(1:NSEA) +#endif ! ! Section 6) ! ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 1 ) THEN WRITE ( NDSOG ) SXX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'SXX:', SXX(1:NSEA) +#endif WRITE ( NDSOG ) SYY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'SYY:', SYY(1:NSEA) +#endif WRITE ( NDSOG ) SXY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'SXY:', SXY(1:NSEA) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 2 ) THEN WRITE ( NDSOG ) TAUOX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUOX:', TAUOX(1:NSEA) +#endif WRITE ( NDSOG ) TAUOY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUOY:', TAUOY(1:NSEA) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 3 ) THEN WRITE ( NDSOG ) BHD(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'BHD:', BHD(1:NSEA) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 4 ) THEN WRITE ( NDSOG ) PHIOC(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PHIOC:', PHIOC(1:NSEA) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) TUSX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TUSX:', TUSX(1:NSEA) +#endif WRITE ( NDSOG ) TUSY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TUSY:', TUSY(1:NSEA) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 6 ) THEN WRITE ( NDSOG ) USSX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'USSX:', USSX(1:NSEA) +#endif WRITE ( NDSOG ) USSY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'USSY:', USSY(1:NSEA) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 7 ) THEN WRITE ( NDSOG ) PRMS(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PRMS:', PRMS(1:NSEA) +#endif WRITE ( NDSOG ) TPMS(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TPMS:', TPMS(1:NSEA) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 8 ) THEN WRITE ( NDSOG ) US3D(1:NSEA, US3DF(2):US3DF(3)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'US3D:', US3D(1:NSEA, US3DF(2):US3DF(3)) +#endif WRITE ( NDSOG ) US3D(1:NSEA,NK+US3DF(2):NK+US3DF(3)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'US3D+NK:', US3D(1:NSEA,NK+US3DF(2):NK+US3DF(3)) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 9 ) THEN WRITE ( NDSOG ) P2SMS(1:NSEA,P2MSF(2):P2MSF(3)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'P2SMS:', P2SMS(1:NSEA,P2MSF(2):P2MSF(3)) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 10 ) THEN WRITE ( NDSOG ) TAUICE(1:NSEA,1) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUICE(1):', TAUICE(1:NSEA,1) +#endif WRITE ( NDSOG ) TAUICE(1:NSEA,2) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUICE(2):', TAUICE(1:NSEA,2) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 11 ) THEN WRITE ( NDSOG ) PHICE(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PHICE:', PHICE(1:NSEA) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 12 ) THEN WRITE ( NDSOG ) USSP(1:NSEA, 1:USSPF(2)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'USSP:', USSP(1:NSEA, 1:USSPF(2)) +#endif WRITE ( NDSOG ) USSP(1:NSEA,NK+1:NK+USSPF(2)) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'USSP:', USSP(1:NSEA,NK+1:NK+USSPF(2)) +#endif ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 13 ) THEN WRITE ( NDSOG ) TAUOCX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUOCX:', TAUOCX(1:NSEA) +#endif WRITE ( NDSOG ) TAUOCY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUOCY:', TAUOCY(1:NSEA) +#endif ! ! Section 7) ! @@ -3199,7 +3518,13 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) END IF END DO WRITE ( NDSOG ) AUX1 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX1 (ABA*cos(ABD)):', AUX1 +#endif WRITE ( NDSOG ) AUX2 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX2 (ABA*sin(ABD)):', AUX2 +#endif !WRITE ( NDSOG ) ABA(1:NSEA) !WRITE ( NDSOG ) ABD(1:NSEA) ELSE IF ( IFI .EQ. 7 .AND. IFJ .EQ. 2 ) THEN @@ -3213,53 +3538,119 @@ SUBROUTINE W3IOGO ( INXOUT, NDSOG, IOTST, IMOD ) END IF END DO WRITE ( NDSOG ) AUX1 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX1 (UBA*cos(UBD)):', AUX1 +#endif WRITE ( NDSOG ) AUX2 +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'AUX2 (UBA*sin(UBD)):', AUX2 +#endif ! WRITE ( NDSOG ) UBA(1:NSEA) ! WRITE ( NDSOG ) UBD(1:NSEA) ELSE IF ( IFI .EQ. 7 .AND. IFJ .EQ. 3 ) THEN WRITE ( NDSOG ) BEDFORMS(1:NSEA,1) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'BEDFORMS(1):', BEDFORMS(1:NSEA,1) +#endif WRITE ( NDSOG ) BEDFORMS(1:NSEA,2) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'BEDFORMS(2):', BEDFORMS(1:NSEA,2) +#endif WRITE ( NDSOG ) BEDFORMS(1:NSEA,3) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'BEDFORMS(3):', BEDFORMS(1:NSEA,3) +#endif ELSE IF ( IFI .EQ. 7 .AND. IFJ .EQ. 4 ) THEN WRITE ( NDSOG ) PHIBBL(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'PHIBBL:', PHIBBL(1:NSEA) +#endif ELSE IF ( IFI .EQ. 7 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) TAUBBL(1:NSEA,1) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUBBL(1):', TAUBBL(1:NSEA,1) +#endif WRITE ( NDSOG ) TAUBBL(1:NSEA,2) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'TAUBBL(2):', TAUBBL(1:NSEA,2) +#endif ! ! Section 8) ! ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 1 ) THEN WRITE ( NDSOG ) MSSX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'MSSX:', MSSX(1:NSEA) +#endif WRITE ( NDSOG ) MSSY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'MSSY:', MSSY(1:NSEA) +#endif ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 2 ) THEN WRITE ( NDSOG ) MSCX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'MSCX:', MSCX(1:NSEA) +#endif WRITE ( NDSOG ) MSCY(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'MSCY:', MSCY(1:NSEA) +#endif ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 3 ) THEN WRITE ( NDSOG ) MSSD(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'MSSD:', MSSD(1:NSEA) +#endif ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 4 ) THEN WRITE ( NDSOG ) MSCD(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'MSCD:', MSCD(1:NSEA) +#endif ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) QP(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'QP:', QP(1:NSEA) +#endif ELSE IF ( IFI .EQ. 8 .AND. IFJ .EQ. 6 ) THEN WRITE ( NDSOG ) QKK(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'QKK:', QKK(1:NSEA) +#endif ! ! Section 9) ! ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 1 ) THEN WRITE ( NDSOG ) DTDYN(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'DTDYN:', DTDYN(1:NSEA) +#endif ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 2 ) THEN WRITE ( NDSOG ) FCUT(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'FCUT:', FCUT(1:NSEA) +#endif ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 3 ) THEN WRITE ( NDSOG ) CFLXYMAX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'CFLXYMAX:', CFLXYMAX(1:NSEA) +#endif ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 4 ) THEN WRITE ( NDSOG ) CFLTHMAX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'CFLTHMAX:', CFLTHMAX(1:NSEA) +#endif ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 5 ) THEN WRITE ( NDSOG ) CFLKMAX(1:NSEA) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'CFLMAX:', CFLKMAX(1:NSEA) +#endif ! ! Section 10) ! ELSE IF ( IFI .EQ. 10 ) THEN WRITE ( NDSOG ) USERO(1:NSEA,IFJ) +#ifdef W3_ASCII + WRITE ( NDSOA,* ) 'USER0:', USERO(1:NSEA,IFJ) +#endif ! END IF ! diff --git a/model/src/w3iogrmd.F90 b/model/src/w3iogrmd.F90 index 3aa2688ab..e96b7b788 100644 --- a/model/src/w3iogrmd.F90 +++ b/model/src/w3iogrmd.F90 @@ -112,7 +112,11 @@ MODULE W3IOGRMD !> @author F. Ardhuin !> @date 19-Oct-2020 - SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) + SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT & +#ifdef W3_ASCII + ,NDSA & +#endif + ) !/ !/ +-----------------------------------+ !/ | WAVEWATCH III NOAA/NCEP | @@ -209,6 +213,7 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) ! INXOUT C*(*) I Test string for read/write, valid are: ! 'READ', 'WRITE' and 'GRID'. ! NDSM Int. I File unit number. + ! NDSA Int. I File unit number. ascii ! IMOD Int. I Model number for W3GDAT etc. ! FEXT C*(*) I File extension to be used. ! ---------------------------------------------------------------- @@ -317,6 +322,9 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) INTEGER, INTENT(IN), OPTIONAL :: IMOD CHARACTER, INTENT(IN) :: INXOUT*(*) CHARACTER, INTENT(IN), OPTIONAL :: FEXT*(*) +#ifdef W3_ASCII + INTEGER, INTENT(IN), OPTIONAL :: NDSA +#endif !/ !/ ------------------------------------------------------------------- / !/ Local parameters @@ -563,6 +571,10 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN OPEN (NDSM,FILE=FNMPRE(:IPRE)//'mod_def.'//FILEXT(:IEXT), & form='UNFORMATTED', convert=file_endian,ERR=800,IOSTAT=IERR) +#ifdef W3_ASCII + OPEN (NDSA,FILE=FNMPRE(:IPRE)//'mod_def.'//FILEXT(:IEXT)//'.txt', & + form='FORMATTED',ERR=800,IOSTAT=IERR) +#endif ELSE OPEN (NDSM,FILE=FNMPRE(:IPRE)//'mod_def.'//FILEXT(:IEXT), & form='UNFORMATTED', convert=file_endian,STATUS='OLD',ERR=800,IOSTAT=IERR) @@ -578,14 +590,38 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) NBI, NFBPO, GNAME, FNAME0, FNAME1, FNAME2, FNAME3, & FNAME4, FNAME5, FNAME6, FNAMEP, FNAMEG, & FNAMEF, FNAMEI +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'IDSTR, VERGRD, NX, NY, NSEA, NTH, NK, & + NBI, NFBPO, GNAME, FNAME0, FNAME1, FNAME2, FNAME3, & + FNAME4, FNAME5, FNAME6, FNAMEP, FNAMEG, & + FNAMEF, FNAMEI:', & + IDSTR, VERGRD, NX, NY, NSEA, NTH, NK, & + NBI, NFBPO, GNAME, FNAME0, FNAME1, FNAME2, FNAME3, & + FNAME4, FNAME5, FNAME6, FNAMEP, FNAMEG, & + FNAMEF, FNAMEI +#endif ! #ifdef W3_SMC WRITE (NDSM) NCel, NUFc, NVFc, NRLv, MRFct +#ifdef W3_ASCII + WRITE (NDSA,*) 'NCel, NUFc, NVFc, NRLv, MRFct:', & + NCel, NUFc, NVFc, NRLv, MRFct +#endif WRITE (NDSM) NGLO, NARC, NBGL, NBAC, NBSMC +#ifdef W3_ASCII + WRITE (NDSA,*) 'NGLO, NARC, NBGL, NBAC, NBSMC:', & + NGLO, NARC, NBGL, NBAC, NBSMC +#endif #endif ! WRITE (NDSM) & (NBO(I),I=0,NFBPO), (NBO2(I),I=0,NFBPO) +#ifdef W3_ASCII + WRITE (NDSA,*) & + '(NBO(I),I=0,NFBPO), (NBO2(I),I=0,NFBPO):', & + (NBO(I),I=0,NFBPO), (NBO2(I),I=0,NFBPO) +#endif #ifdef W3_T WRITE (NDST,9001) IDSTR, VERGRD, NX, NY, NSEA, NTH, NK, & NBI, NFBPO, 9, GNAME, FNAME0, FNAME1, FNAME2, FNAME3, & @@ -717,6 +753,11 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) MAPTMP = MAPSTA + 8*MAPST2 WRITE (NDSM) & GTYPE, FLAGLL, ICLOSE +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'GTYPE, FLAGLL, ICLOSE:', & + GTYPE, FLAGLL, ICLOSE +#endif ! ! Writes different kind of information depending on grid type ! @@ -725,9 +766,19 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) CASE ( RLGTYPE, SMCTYPE ) WRITE (NDSM) & SX, SY, X0, Y0 +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'SX, SY, X0, Y0:', & + SX, SY, X0, Y0 +#endif CASE ( CLGTYPE ) WRITE (NDSM) & REAL(XGRD), REAL(YGRD) +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'REAL(XGRD), REAL(YGRD):', & + REAL(XGRD), REAL(YGRD) +#endif CASE (UNGTYPE) WRITE (NDSM) & FSN, FSPSI,FSFCT,FSNIMP,FSTOTALIMP,FSTOTALEXP, & @@ -746,6 +797,41 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) B_JGS_NORM_THR, & B_JGS_NLEVEL, & B_JGS_SOURCE_NONLINEAR +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'FSN, FSPSI,FSFCT,FSNIMP,FSTOTALIMP,FSTOTALEXP, & + FSBCCFL, FSREFRACTION, FSFREQSHIFT, FSSOURCE, & + DO_CHANGE_WLV, SOLVERTHR_STP, CRIT_DEP_STP, & + NTRI,COUNTOT, COUNTRI, NNZ, & + B_JGS_TERMINATE_MAXITER, & + B_JGS_TERMINATE_DIFFERENCE, & + B_JGS_TERMINATE_NORM, & + B_JGS_LIMITER, & + B_JGS_BLOCK_GAUSS_SEIDEL, & + B_JGS_USE_JACOBI, & + B_JGS_MAXITER, & + B_JGS_PMIN, & + B_JGS_DIFF_THR, & + B_JGS_NORM_THR, & + B_JGS_NLEVEL, & + B_JGS_SOURCE_NONLINEAR:', & + FSN, FSPSI,FSFCT,FSNIMP,FSTOTALIMP,FSTOTALEXP, & + FSBCCFL, FSREFRACTION, FSFREQSHIFT, FSSOURCE, & + DO_CHANGE_WLV, SOLVERTHR_STP, CRIT_DEP_STP, & + NTRI,COUNTOT, COUNTRI, NNZ, & + B_JGS_TERMINATE_MAXITER, & + B_JGS_TERMINATE_DIFFERENCE, & + B_JGS_TERMINATE_NORM, & + B_JGS_LIMITER, & + B_JGS_BLOCK_GAUSS_SEIDEL, & + B_JGS_USE_JACOBI, & + B_JGS_MAXITER, & + B_JGS_PMIN, & + B_JGS_DIFF_THR, & + B_JGS_NORM_THR, & + B_JGS_NLEVEL, & + B_JGS_SOURCE_NONLINEAR +#endif !Init COUNTCON and IOBDP to zero, it needs to be set somewhere or !removed COUNTCON=0 @@ -755,10 +841,26 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) LEN, IEN, ANGLE0, ANGLE, SI, MAXX, MAXY, & DXYMAX, INDEX_CELL, CCON, COUNTCON, IE_CELL, & POS_CELL, IOBP, IOBPA, IOBDP, IOBPD, IAA, JAA, POSI +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'X0, Y0, SX, SY, DXYMAX, XGRD, YGRD, TRIGP, TRIA, & + LEN, IEN, ANGLE0, ANGLE, SI, MAXX, MAXY, & + DXYMAX, INDEX_CELL, CCON, COUNTCON, IE_CELL, & + POS_CELL, IOBP, IOBPA, IOBDP, IOBPD, IAA, JAA, POSI:', & + X0, Y0, SX, SY, DXYMAX, XGRD, YGRD, TRIGP, TRIA, & + LEN, IEN, ANGLE0, ANGLE, SI, MAXX, MAXY, & + DXYMAX, INDEX_CELL, CCON, COUNTCON, IE_CELL, & + POS_CELL, IOBP, IOBPA, IOBDP, IOBPD, IAA, JAA, POSI +#endif END SELECT !GTYPE ! WRITE (NDSM) & ZB, MAPTMP, MAPFS, MAPSF, TRFLAG +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'ZB, MAPTMP, MAPFS, MAPSF, TRFLAG:', & + ZB, MAPTMP, MAPFS, MAPSF, TRFLAG +#endif ! #ifdef W3_SMC IF( GTYPE .EQ. SMCTYPE ) THEN @@ -767,6 +869,18 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) WRITE (NDSM) ICLBAC WRITE (NDSM) ANGARC WRITE (NDSM) CTRNX, CTRNY, CLATF +#ifdef W3_ASCII + WRITE (NDSA,*) 'NLvCel, NLvUFc, NLvVFc:', & + NLvCel, NLvUFc, NLvVFc + WRITE (NDSA,*) 'IJKCel, IJKUFc, IJKVFc, ISMCBP:', & + IJKCel, IJKUFc, IJKVFc, ISMCBP + WRITE (NDSA,*) 'ICLBAC:', & + ICLBAC + WRITE (NDSA,*) 'ANGARC:', & + ANGARC + WRITE (NDSA,*) 'CTRNX, CTRNY, CLATF:', & + CTRNX, CTRNY, CLATF +#endif IF ( FLTEST ) THEN WRITE (NDSE,"(' NRLv, MRFct and NBSMC values are',3I9)") NRLv, MRFct, NBSMC WRITE (NDSE,"(' IJKCel, IJKUFc, IJKVFc Write for',3I9)") NCel, NUFc, NVFc @@ -776,6 +890,9 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #endif ! IF ( TRFLAG .NE. 0 ) WRITE (NDSM) TRNX, TRNY +#ifdef W3_ASCII + IF ( TRFLAG .NE. 0 ) WRITE (NDSA,*) 'TRNX, TRNY:', TRNX, TRNY +#endif WRITE (NDSM) & DTCFL, DTCFLI, DTMAX, DTMIN, DMIN, CTMAX, & FICE0, FICEN, FICEL, PFMOVE, FLDRY, FLCX, FLCY, FLCTH, & @@ -784,14 +901,43 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) ICESCALES(1:4), CALTYPE, CMPRTRCK, IICEHFAC, IICEHDISP,& IICEDDISP, IICEFDISP, BTBETA, & AAIRCMIN, AAIRGB +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'DTCFL, DTCFLI, DTMAX, DTMIN, DMIN, CTMAX, & + FICE0, FICEN, FICEL, PFMOVE, FLDRY, FLCX, FLCY, FLCTH, & + FLCK, FLSOU, FLBPI, FLBPO, CLATS, CLATIS, CTHG0S, & + STEXU, STEYU, STEDU, IICEHMIN, IICEHINIT, IICEDISP, & + ICESCALES(1:4), CALTYPE, CMPRTRCK, IICEHFAC, IICEHDISP,& + IICEDDISP, IICEFDISP, BTBETA, & + AAIRCMIN, AAIRGB:', & + DTCFL, DTCFLI, DTMAX, DTMIN, DMIN, CTMAX, & + FICE0, FICEN, FICEL, PFMOVE, FLDRY, FLCX, FLCY, FLCTH, & + FLCK, FLSOU, FLBPI, FLBPO, CLATS, CLATIS, CTHG0S, & + STEXU, STEYU, STEDU, IICEHMIN, IICEHINIT, IICEDISP, & + ICESCALES(1:4), CALTYPE, CMPRTRCK, IICEHFAC, IICEHDISP,& + IICEDDISP, IICEFDISP, BTBETA, & + AAIRCMIN, AAIRGB +#endif WRITE(NDSM)GRIDSHIFT +#ifdef W3_ASCII + WRITE(NDSA,*)'GRIDSHIFT:', & + GRIDSHIFT +#endif #ifdef W3_SEC1 WRITE (NDSM) NITERSEC1 +#ifdef W3_ASCII + WRITE (NDSA,*) 'NITERSEC1:', & + NITERSEC1 +#endif #endif #ifdef W3_RTD !! Add rotated Polat/lon and AnglD to mod_def JGLi12Jun2012 WRITE (NDSM) PoLat, PoLon, AnglD, FLAGUNR +#ifdef W3_ASCII + WRITE (NDSA,*) 'PoLat, PoLon, AnglD, FLAGUNR:', & + PoLat, PoLon, AnglD, FLAGUNR +#endif #endif !! WRITE(NDSM) & @@ -977,6 +1123,15 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) MAPWN, MAPTH, DTH, TH, ESIN, ECOS, ES2, ESC, EC2, & XFR, FR1, SIG, SIG2, DSIP, DSII, DDEN, DDEN2, FTE, & FTF, FTWN, FTTR, FTWL, FACTI1, FACTI2, FACHFA, FACHFE +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'MAPWN, MAPTH, DTH, TH, ESIN, ECOS, ES2, ESC, EC2, & + XFR, FR1, SIG, SIG2, DSIP, DSII, DDEN, DDEN2, FTE, & + FTF, FTWN, FTTR, FTWL, FACTI1, FACTI2, FACHFA, FACHFE:', & + MAPWN, MAPTH, DTH, TH, ESIN, ECOS, ES2, ESC, EC2, & + XFR, FR1, SIG, SIG2, DSIP, DSII, DDEN, DDEN2, FTE, & + FTF, FTWN, FTTR, FTWL, FACTI1, FACTI2, FACHFA, FACHFE +#endif ELSE IF (.NOT.SINIT) CALL W3DIMS ( IGRD, NK, NTH, NDSE, NDST ) READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & @@ -999,6 +1154,11 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN WRITE (NDSM) & E3DF, P2MSF, US3DF,USSPF, USSP_WN +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'E3DF, P2MSF, US3DF,USSPF, USSP_WN:', & + E3DF, P2MSF, US3DF,USSPF, USSP_WN +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & E3DF, P2MSF, US3DF,USSPF, USSP_WN @@ -1015,6 +1175,11 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN WRITE (NDSM) & XBPO, YBPO, RDBPO, IPBPO, ISBPO +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'XBPO, YBPO, RDBPO, IPBPO, ISBPO:', & + XBPO, YBPO, RDBPO, IPBPO, ISBPO +#endif ELSE CALL W3DMO5 ( IGRD, NDSE, NDST, 2 ) READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & @@ -1040,6 +1205,13 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) WRITE (NDSM) & IHMAX, HSPMIN, WSMULT, WSCUT, FLCOMB, NOSWLL, & PTMETH, PTFCUT +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'IHMAX, HSPMIN, WSMULT, WSCUT, FLCOMB, NOSWLL, & + PTMETH, PTFCUT:', & + IHMAX, HSPMIN, WSMULT, WSCUT, FLCOMB, NOSWLL, & + PTMETH, PTFCUT +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & IHMAX, HSPMIN, WSMULT, WSCUT, FLCOMB, NOSWLL, & @@ -1057,37 +1229,84 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) WRITE (NDSM) & FACP, XREL, XFLT, FXFM, FXPM, XFT, XFC, FACSD, FHMAX, & FFACBERG, DELAB, FWTABLE +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'FACP, XREL, XFLT, FXFM, FXPM, XFT, XFC, FACSD, FHMAX, & + FFACBERG, DELAB, FWTABLE:', & + FACP, XREL, XFLT, FXFM, FXPM, XFT, XFC, FACSD, FHMAX, & + FFACBERG, DELAB, FWTABLE +#endif #ifdef W3_RWND WRITE (NDSM) & RWINDC +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'RWINDC:', & + RWINDC +#endif #endif #ifdef W3_WCOR WRITE (NDSM) & WWCOR +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'WWCOR:', & + WWCOR +#endif #endif #ifdef W3_REF1 WRITE (NDSM) & RREF, REFPARS, REFLC, REFLD +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'RREF, REFPARS, REFLC, REFLD:', & + RREF, REFPARS, REFLC, REFLD +#endif #endif #ifdef W3_IG1 WRITE (NDSM) & IGPARS(1:12) +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'IGPARS(1:12):', & + IGPARS(1:12) +#endif #endif #ifdef W3_IC2 WRITE (NDSM) & IC2PARS(1:8) +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'IC2PARS(1:8):', & + IC2PARS(1:8) +#endif #endif #ifdef W3_IC3 WRITE (NDSM) & IC3PARS +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'IC3PARS:', & + IC3PARS +#endif #endif #ifdef W3_IC4 WRITE (NDSM) & IC4PARS,IC4_KI,IC4_FC +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'IC4PARS,IC4_KI,IC4_FC:', & + IC4PARS,IC4_KI,IC4_FC +#endif #endif #ifdef W3_IC5 WRITE (NDSM) & IC5PARS +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'IC5PARS:', & + IC5PARS +#endif #endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & @@ -1142,6 +1361,10 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_FLX2 IF ( WRITE ) THEN WRITE (NDSM) NITTIN, CINXSI +#ifdef W3_ASCII + WRITE (NDSA,*)' NITTIN, CINXSI:', & + NITTIN, CINXSI +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) NITTIN, CINXSI END IF @@ -1152,6 +1375,11 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN WRITE (NDSM) & NITTIN, CINXSI, CD_MAX, CAP_ID +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'NITTIN, CINXSI, CD_MAX, CAP_ID:', & + NITTIN, CINXSI, CD_MAX, CAP_ID +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & NITTIN, CINXSI, CD_MAX, CAP_ID @@ -1162,6 +1390,10 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_FLX4 IF ( WRITE ) THEN WRITE (NDSM) FLX4A0 +#ifdef W3_ASCII + WRITE (NDSA,*)' FLX4A0:', & + FLX4A0 +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) FLX4A0 END IF @@ -1171,6 +1403,10 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_LN1 IF ( WRITE ) THEN WRITE (NDSM) SLNC1, FSPM, FSHF +#ifdef W3_ASCII + WRITE (NDSA,*)' SLNC1, FSPM, FSHF:', & + SLNC1, FSPM, FSHF +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) SLNC1, FSPM, FSHF END IF @@ -1180,6 +1416,10 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_ST1 IF ( WRITE ) THEN WRITE (NDSM) SINC1, SDSC1 +#ifdef W3_ASCII + WRITE (NDSA,*)' SINC1, SDSC1:', & + SINC1, SDSC1 +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) SINC1, SDSC1 END IF @@ -1193,6 +1433,17 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) SHSTAB, OFSTAB, CCNG, CCPS, FFNG, FFPS, & CDSA0, CDSA1, CDSA2, SDSALN, & CDSB0, CDSB1, CDSB2, CDSB3, FPIMIN, XFH, XF1, XF2 +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'ZWIND, FSWELL, & + SHSTAB, OFSTAB, CCNG, CCPS, FFNG, FFPS, & + CDSA0, CDSA1, CDSA2, SDSALN, & + CDSB0, CDSB1, CDSB2, CDSB3, FPIMIN, XFH, XF1, XF2:',& + ZWIND, FSWELL, & + SHSTAB, OFSTAB, CCNG, CCPS, FFNG, FFPS, & + CDSA0, CDSA1, CDSA2, SDSALN, & + CDSB0, CDSB1, CDSB2, CDSB3, FPIMIN, XFH, XF1, XF2 +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & ZWIND, FSWELL, & @@ -1216,6 +1467,19 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) SSTXFTFTAIL, SSTXFTWN, & DDELTA1, DDELTA2, SSTXFTF, SSTXFTWN, & FFXPM, FFXFM +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'ZZWND, AALPHA, ZZ0MAX, BBETA, SSINTHP, ZZALP, & + SSWELLF, SSDSC1, WWNMEANP, WWNMEANPTAIL, SSTXFTF, & + SSTXFTFTAIL, SSTXFTWN, & + DDELTA1, DDELTA2, SSTXFTF, SSTXFTWN, & + FFXPM, FFXFM:', & + ZZWND, AALPHA, ZZ0MAX, BBETA, SSINTHP, ZZALP, & + SSWELLF, SSDSC1, WWNMEANP, WWNMEANPTAIL, SSTXFTF, & + SSTXFTFTAIL, SSTXFTWN, & + DDELTA1, DDELTA2, SSTXFTF, SSTXFTWN, & + FFXPM, FFXFM +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & ZZWND, AALPHA, ZZ0MAX, BBETA, SSINTHP, ZZALP, & @@ -1246,6 +1510,33 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) DELU, DELALP, TAUT, TAUHFT, TAUHFT2, & IKTAB, DCKI, QBI, SATINDICES, SATWEIGHTS, & DIKCUMUL, CUMULW +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'ZZWND, AALPHA, ZZ0MAX, BBETA, SSINTHP, ZZALP, & + TTAUWSHELTER, SSWELLFPAR, SSWELLF, SSINBR, & + ZZ0RAT, SSDSC, & + SSDSISO, SSDSBR, SSDSBT, SSDSBM, SSDSP, & + SSDSCOS, SSDSDTH, WWNMEANP, WWNMEANPTAIL,SSTXFTF, & + SSTXFTFTAIL, SSTXFTWN, SSTXFTF, SSTXFTWN, & + SSDSBRF1, SSDSBRF2, SSDSBRFDF,SSDSBCK, SSDSABK, & + SSDSPBK, SSDSBINT, FFXPM, FFXFM, FFXFA, & + SSDSHCK, DELUST, DELTAIL, DELTAUW, & + DELU, DELALP, TAUT, TAUHFT, TAUHFT2, & + IKTAB, DCKI, QBI, SATINDICES, SATWEIGHTS, & + DIKCUMUL, CUMULW:', & + ZZWND, AALPHA, ZZ0MAX, BBETA, SSINTHP, ZZALP, & + TTAUWSHELTER, SSWELLFPAR, SSWELLF, SSINBR, & + ZZ0RAT, SSDSC, & + SSDSISO, SSDSBR, SSDSBT, SSDSBM, SSDSP, & + SSDSCOS, SSDSDTH, WWNMEANP, WWNMEANPTAIL,SSTXFTF, & + SSTXFTFTAIL, SSTXFTWN, SSTXFTF, SSTXFTWN, & + SSDSBRF1, SSDSBRF2, SSDSBRFDF,SSDSBCK, SSDSABK, & + SSDSPBK, SSDSBINT, FFXPM, FFXFM, FFXFA, & + SSDSHCK, DELUST, DELTAIL, DELTAUW, & + DELU, DELALP, TAUT, TAUHFT, TAUHFT2, & + IKTAB, DCKI, QBI, SATINDICES, SATWEIGHTS, & + DIKCUMUL, CUMULW +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & ZZWND, AALPHA, ZZ0MAX, BBETA, SSINTHP, ZZALP, & @@ -1268,6 +1559,14 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) WRITE (NDSM) SIN6A0, SDS6ET, SDS6A1, SDS6A2, & SDS6P1, SDS6P2, SWL6S6, SWL6B1, SWL6CSTB1, & SIN6WS, SIN6FC +#ifdef W3_ASCII + WRITE (NDSA,*) 'SIN6A0, SDS6ET, SDS6A1, SDS6A2, & + SDS6P1, SDS6P2, SWL6S6, SWL6B1, SWL6CSTB1, & + SIN6WS, SIN6FC:', & + SIN6A0, SDS6ET, SDS6A1, SDS6A2, & + SDS6P1, SDS6P2, SWL6S6, SWL6B1, SWL6CSTB1, & + SIN6WS, SIN6FC +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & SIN6A0, SDS6ET, SDS6A1, SDS6A2, & @@ -1282,6 +1581,11 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN WRITE (NDSM) & SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3 +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3:',& + SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3 +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3 @@ -1294,6 +1598,12 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN WRITE (NDSM) IQTPE, NLTAIL, NDPTHS WRITE (NDSM) DPTHNL +#ifdef W3_ASCII + WRITE (NDSA,*) 'IQTPE, NLTAIL, NDPTHS:', & + IQTPE, NLTAIL, NDPTHS + WRITE (NDSA,*) 'DPTHNL:', & + DPTHNL +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & IQTPE, NLTAIL, NDPTHS @@ -1312,6 +1622,16 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) WRITE (NDSM) SNLL(1:SNLNQ), SNLM(1:SNLNQ), & SNLT(1:SNLNQ), SNLCD(1:SNLNQ), & SNLCS(1:SNLNQ) +#ifdef W3_ASCII + WRITE (NDSA,*) 'SNLNQ, SNLMSC, SNLNSC, SNLSFD, SNLSFS:',& + SNLNQ, SNLMSC, SNLNSC, SNLSFD, SNLSFS + WRITE (NDSA,*) 'SNLL(1:SNLNQ), SNLM(1:SNLNQ), & + SNLT(1:SNLNQ), SNLCD(1:SNLNQ), & + SNLCS(1:SNLNQ):', & + SNLL(1:SNLNQ), SNLM(1:SNLNQ), & + SNLT(1:SNLNQ), SNLCD(1:SNLNQ), & + SNLCS(1:SNLNQ) +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & SNLNQ, SNLMSC, SNLNSC, SNLSFD, SNLSFS @@ -1342,6 +1662,10 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_NL4 IF ( WRITE ) THEN WRITE (NDSM) ITSA, IALT +#ifdef W3_ASCII + WRITE (NDSA,*) 'ITSA, IALT:', & + ITSA, IALT +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & ITSA, IALT @@ -1355,6 +1679,12 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) CALL INSNL5 WRITE (NDSM) QR5DPT, QR5OML, QI5DIS, QI5KEV, & QI5NNZ, QI5IPL, QI5PMX +#ifdef W3_ASCII + WRITE (NDSA,*) 'QR5DPT, QR5OML, QI5DIS, QI5KEV, & + QI5NNZ, QI5IPL, QI5PMX:', & + QR5DPT, QR5OML, QI5DIS, QI5KEV, & + QI5NNZ, QI5IPL, QI5PMX +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & QR5DPT, QR5OML, QI5DIS, QI5KEV, & @@ -1369,6 +1699,11 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN WRITE (NDSM) & CNLSA, CNLSC, CNLSFM, CNLSC1, CNLSC2, CNLSC3 +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'CNLSA, CNLSC, CNLSFM, CNLSC1, CNLSC2, CNLSC3:', & + CNLSA, CNLSC, CNLSFM, CNLSC1, CNLSC2, CNLSC3 +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & CNLSA, CNLSC, CNLSFM, CNLSC1, CNLSC2, CNLSC3 @@ -1412,6 +1747,9 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_BT1 IF ( WRITE ) THEN WRITE (NDSM) SBTC1 +#ifdef W3_ASCII + WRITE (NDSA,*) 'SBTC1:', SBTC1 +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) SBTC1 END IF @@ -1423,6 +1761,11 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN WRITE (NDSM) & SBTCX, SED_D50, SED_PSIC +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'SBTCX, SED_D50, SED_PSIC:', & + SBTCX, SED_D50, SED_PSIC +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & SBTCX, SED_D50, SED_PSIC @@ -1436,6 +1779,11 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN WRITE (NDSM) & SDBC1, SDBC2, FDONLY +#ifdef W3_ASCII + WRITE (NDSA,*) & + 'SDBC1, SDBC2, FDONLY:', & + SDBC1, SDBC2, FDONLY +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & SDBC1, SDBC2, FDONLY @@ -1448,6 +1796,12 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) IF ( WRITE ) THEN WRITE (NDSM) UOSTFILELOCAL, UOSTFILESHADOW, & UOSTFACTORLOCAL, UOSTFACTORSHADOW +#ifdef W3_ASCII + WRITE (NDSA,*) 'UOSTFILELOCAL, UOSTFILESHADOW, & + UOSTFACTORLOCAL, UOSTFACTORSHADOW:', & + UOSTFILELOCAL, UOSTFILESHADOW, & + UOSTFACTORLOCAL, UOSTFACTORSHADOW +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & UOSTFILELOCAL, UOSTFILESHADOW, & @@ -1464,6 +1818,9 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_IS1 IF ( WRITE ) THEN WRITE (NDSM) IS1C1, IS1C2 +#ifdef W3_ASCII + WRITE (NDSA,*) 'IS1C1, IS1C2:', IS1C1, IS1C2 +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) IS1C1, IS1C2 END IF @@ -1472,6 +1829,9 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_IS2 IF ( WRITE ) THEN WRITE (NDSM) IS2PARS +#ifdef W3_ASCII + WRITE (NDSA,*) 'IS3PARS:', IS2PARS +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) IS2PARS IF ( .NOT. FLIS ) THEN @@ -1487,6 +1847,9 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_PR2 IF ( WRITE ) THEN WRITE (NDSM) DTME, CLATMN +#ifdef W3_ASCII + WRITE (NDSA,*) 'DTME, CLATMN:', DTME, CLATMN +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & DTME, CLATMN @@ -1498,6 +1861,9 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_PR3 IF ( WRITE ) THEN WRITE (NDSM) WDCG, WDTH +#ifdef W3_ASCII + WRITE (NDSA,*) 'WDCG, WDTH:', WDCG, WDTH +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & WDCG, WDTH @@ -1509,6 +1875,10 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_SMC IF ( WRITE ) THEN WRITE(NDSM) DTMS, Refran, FUNO3, FVERG, FSWND, ARCTC +#ifdef W3_ASCII + WRITE(NDSA,*) 'DTMS, Refran, FUNO3, FVERG, FSWND, ARCTC:', & + DTMS, Refran, FUNO3, FVERG, FSWND, ARCTC +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & DTMS, Refran, FUNO3, FVERG, FSWND, ARCTC @@ -1520,6 +1890,10 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_FLD1 IF ( WRITE ) THEN WRITE (NDSM) TAIL_ID, TAIL_LEV, TAIL_TRAN1, TAIL_TRAN2 +#ifdef W3_ASCII + WRITE (NDSA,*) 'TAIL_ID, TAIL_LEV, TAIL_TRAN1, TAIL_TRAN2:', & + TAIL_ID, TAIL_LEV, TAIL_TRAN1, TAIL_TRAN2 +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & TAIL_ID, TAIL_LEV, TAIL_TRAN1, TAIL_TRAN2 @@ -1528,6 +1902,10 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) #ifdef W3_FLD2 IF ( WRITE ) THEN WRITE (NDSM) TAIL_ID, TAIL_LEV, TAIL_TRAN1, TAIL_TRAN2 +#ifdef W3_ASCII + WRITE (NDSA,*) 'TAIL_ID, TAIL_LEV, TAIL_TRAN1, TAIL_TRAN2:', & + TAIL_ID, TAIL_LEV, TAIL_TRAN1, TAIL_TRAN2 +#endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & TAIL_ID, TAIL_LEV, TAIL_TRAN1, TAIL_TRAN2 @@ -1546,6 +1924,11 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT ) END IF ! CLOSE ( NDSM ) +#ifdef W3_ASCII + IF ( WRITE ) THEN + CLOSE ( NDSA ) + END IF +#endif call print_memcheck(memunit, 'memcheck_____:'//' WIOGR SECTION 9') ! RETURN diff --git a/model/src/w3iopomd.F90 b/model/src/w3iopomd.F90 index 802685869..d573879ce 100644 --- a/model/src/w3iopomd.F90 +++ b/model/src/w3iopomd.F90 @@ -1034,7 +1034,11 @@ END SUBROUTINE W3IOPE !> !> @author H. L. Tolman @date 25-Jul-2006 !> - SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) + SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD & +#ifdef W3_ASCII + ,NDSOA & +#endif + ) !/ !/ +-----------------------------------+ !/ | WAVEWATCH III NOAA/NCEP | @@ -1062,7 +1066,8 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) ! ---------------------------------------------------------------- ! INXOUT C*(*) I Test string for read/write, valid are: ! 'READ' and 'WRITE'. - ! NDSOP Int. I File unit number. + ! NDSOP Int. I File unit number. for binary + ! NDSOA Int. I File unit number. for ASCII ! IOTST Int. O Test indictor for reading. ! 0 : Data read. ! -1 : Past end of file. @@ -1140,6 +1145,9 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) !/ Parameter list !/ INTEGER, INTENT(IN) :: NDSOP +#ifdef W3_ASCII + INTEGER, INTENT(IN), OPTIONAL :: NDSOA +#endif INTEGER, INTENT(OUT) :: IOTST INTEGER, INTENT(IN), OPTIONAL :: IMOD CHARACTER, INTENT(IN) :: INXOUT*(*) @@ -1205,6 +1213,10 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) IF ( WRITE ) THEN OPEN (NDSOP,FILE=FNMPRE(:J)//'out_pnt.'//FILEXT(:I), & form='UNFORMATTED', convert=file_endian,ERR=800,IOSTAT=IERR) +#ifdef W3_ASCII + OPEN (NDSOA,FILE=FNMPRE(:J)//'out_pnt.'//FILEXT(:I)//'.txt', & + form='FORMATTED', ERR=800,IOSTAT=IERR) +#endif ELSE OPEN (NDSOP,FILE=FNMPRE(:J)//'out_pnt.'//FILEXT(:I), & form='UNFORMATTED', convert=file_endian,ERR=800,IOSTAT=IERR,STATUS='OLD') @@ -1218,6 +1230,11 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) IF ( WRITE ) THEN WRITE (NDSOP) & IDSTR, VEROPT, NK, NTH, NOPTS +#ifdef W3_ASCII + WRITE (NDSOA,*) & + 'IDSTR, VEROPT, NK, NTH, NOPTS:', & + IDSTR, VEROPT, NK, NTH, NOPTS +#endif ELSE READ (NDSOP,END=801,ERR=802,IOSTAT=IERR) & IDTST, VERTST, MK, MTH, NOPTS @@ -1248,6 +1265,11 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) IF ( WRITE ) THEN WRITE (NDSOP) & ((PTLOC(J,I),J=1,2),I=1,NOPTS), (PTNME(I),I=1,NOPTS) +#ifdef W3_ASCII + WRITE (NDSOA,*) & + '((PTLOC(J,I),J=1,2),I=1,NOPTS), (PTNME(I),I=1,NOPTS):', & + ((PTLOC(J,I),J=1,2),I=1,NOPTS), (PTNME(I),I=1,NOPTS) +#endif ELSE READ (NDSOP,END=801,ERR=802,IOSTAT=IERR) & ((PTLOC(J,I),J=1,2),I=1,NOPTS), (PTNME(I),I=1,NOPTS) @@ -1289,6 +1311,10 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) IF ( WRITE ) THEN OPEN (NDSOP,FILE=FNMPRE(:J)//TIMETAG//'.out_pnt.' & //FILEXT(:I),form='UNFORMATTED', convert=file_endian,ERR=800,IOSTAT=IERR) +#ifdef W3_ASCII + OPEN (NDSOA,FILE=FNMPRE(:J)//TIMETAG//'.out_pnt.' & + //FILEXT(:I)//'.txt',form='FORMATTED', ERR=800,IOSTAT=IERR) +#endif END IF ! REWIND ( NDSOP ) @@ -1300,6 +1326,11 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) IF ( WRITE ) THEN WRITE (NDSOP) & IDSTR, VEROPT, NK, NTH, NOPTS +#ifdef W3_ASCII + WRITE (NDSOA,*) & + 'IDSTR, VEROPT, NK, NTH, NOPTS:', & + IDSTR, VEROPT, NK, NTH, NOPTS +#endif ELSE READ (NDSOP,END=801,ERR=802,IOSTAT=IERR) & IDTST, VERTST, MK, MTH, NOPTS @@ -1330,6 +1361,11 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) IF ( WRITE ) THEN WRITE (NDSOP) & ((PTLOC(J,I),J=1,2),I=1,NOPTS), (PTNME(I),I=1,NOPTS) +#ifdef W3_ASCII + WRITE (NDSOA,*) & + '((PTLOC(J,I),J=1,2),I=1,NOPTS), (PTNME(I),I=1,NOPTS):', & + ((PTLOC(J,I),J=1,2),I=1,NOPTS), (PTNME(I),I=1,NOPTS) +#endif ELSE READ (NDSOP,END=801,ERR=802,IOSTAT=IERR) & ((PTLOC(J,I),J=1,2),I=1,NOPTS), (PTNME(I),I=1,NOPTS) @@ -1349,6 +1385,9 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) ! IF ( WRITE ) THEN WRITE (NDSOP) TIME +#ifdef W3_ASCII + WRITE (NDSOA,*) 'TIME:', TIME +#endif ELSE READ (NDSOP,END=803,ERR=802,IOSTAT=IERR) TIME END IF @@ -1378,6 +1417,23 @@ SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD ) #endif ASO(I), CAO(I), CDO(I), ICEO(I), ICEHO(I), & ICEFO(I), GRDID(I), (SPCO(J,I),J=1,NSPEC) +#ifdef W3_ASCII + WRITE (NDSOA,*) & + 'IW(I), II(I), IL(I), DPO(I), WAO(I), WDO(I):', & + IW(I), II(I), IL(I), DPO(I), WAO(I), WDO(I), & +#ifdef W3_FLX5 + 'TAUAO(I), TAUDO(I), DAIRO(I):', & + TAUAO(I), TAUDO(I), DAIRO(I), & +#endif +#ifdef W3_SETUP + 'ZET_SETO(I):', & + ZET_SETO(I), & +#endif + 'ASO(I), CAO(I), CDO(I), ICEO(I), ICEHO(I):', & + ASO(I), CAO(I), CDO(I), ICEO(I), ICEHO(I), & + 'ICEFO(I), GRDID(I), (SPCO(J,I),J=1,NSPEC):', & + ICEFO(I), GRDID(I), (SPCO(J,I),J=1,NSPEC) +#endif ELSE READ (NDSOP,END=801,ERR=802,IOSTAT=IERR) & IW(I), II(I), IL(I), DPO(I), WAO(I), WDO(I), & diff --git a/model/src/w3odatmd.F90 b/model/src/w3odatmd.F90 index 4fc29eab9..d268793fb 100644 --- a/model/src/w3odatmd.F90 +++ b/model/src/w3odatmd.F90 @@ -436,7 +436,7 @@ MODULE W3ODATMD INTEGER :: TOSNL5(2) #endif INTEGER :: TOFRST(2), TONEXT(2,8), TOLAST(2,8), & - TBPI0(2), TBPIN(2), NDS(13), OFILES(7) + TBPI0(2), TBPIN(2), NDS(15), OFILES(7) REAL :: DTOUT(8) LOGICAL :: FLOUT(8) TYPE(OTYPE1) :: OUT1 diff --git a/model/src/w3wavemd.F90 b/model/src/w3wavemd.F90 index 6cbc7e74f..44c80964d 100644 --- a/model/src/w3wavemd.F90 +++ b/model/src/w3wavemd.F90 @@ -2567,7 +2567,11 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT & #ifdef W3_SBS IF ( J .EQ. 1 ) THEN #endif - CALL W3IOGO( 'WRITE', NDS(7), ITEST, IMOD ) + CALL W3IOGO( 'WRITE', NDS(7), ITEST, IMOD & +#ifdef W3_ASCII + ,NDS(14) & +#endif + ) #ifdef W3_SBS ENDIF #endif @@ -2598,7 +2602,11 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT & ! Gets the necessary spectral data ! CALL W3IOPE ( VA ) - CALL W3IOPO ( 'WRITE', NDS(8), ITEST, IMOD ) + CALL W3IOPO ( 'WRITE', NDS(8), ITEST, IMOD & +#ifdef W3_ASCII + ,NDS(15) & +#endif + ) END IF ! ELSE IF ( J .EQ. 3 ) THEN diff --git a/model/src/wminitmd.F90 b/model/src/wminitmd.F90 index ac9d0036f..daea42c5c 100644 --- a/model/src/wminitmd.F90 +++ b/model/src/wminitmd.F90 @@ -426,6 +426,9 @@ SUBROUTINE WMINIT ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & #endif #ifdef W3_MPRF USE WMMDATMD, ONLY: MDSP +#endif +#ifdef W3_ASCII + USE WMMDATMD, ONLY: MDSUPA #endif USE W3INITMD, ONLY: WWVER USE W3ODATMD, ONLY: OFILES @@ -1897,6 +1900,12 @@ SUBROUTINE WMINIT ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & CALL WMUSET ( MDSS, MDST, MDSUP, .TRUE., 'OUT', & TRIM(FNMPRE)//'out_pnt.'//MNAMES(0)(1:II), & 'Unified point output') +#ifdef W3_ASCII + CALL WMUGET ( MDSS, MDST, MDSUPA, 'OUA' ) + CALL WMUSET ( MDSS, MDST, MDSUPA, .TRUE., 'OUA', & + TRIM(FNMPRE)//'out_pnt.'//MNAMES(0)(1:II)//'.txt', & + 'Unified point output ascii') +#endif END IF END IF ! @@ -3750,6 +3759,9 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & #endif #ifdef W3_MPRF USE WMMDATMD, ONLY: MDSP +#endif +#ifdef W3_ASCII + USE WMMDATMD, ONLY: MDSUPA #endif USE W3INITMD, ONLY: WWVER USE W3NMLMULTIMD @@ -4977,6 +4989,12 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & CALL WMUSET ( MDSS, MDST, MDSUP, .TRUE., 'OUT', & TRIM(FNMPRE)//'out_pnt.'//MNAMES(0)(1:II), & 'Unified point output') +#ifdef W3_ASCII + CALL WMUGET ( MDSS, MDST, MDSUPA, 'OUA' ) + CALL WMUSET ( MDSS, MDST, MDSUPA, .TRUE., 'OUA', & + TRIM(FNMPRE)//'out_pnt.'//MNAMES(0)(1:II)//'.txt', & + 'Unified point output ascii') +#endif END IF END IF ! diff --git a/model/src/wmiopomd.F90 b/model/src/wmiopomd.F90 index 071f7e051..73e036535 100644 --- a/model/src/wmiopomd.F90 +++ b/model/src/wmiopomd.F90 @@ -723,6 +723,9 @@ SUBROUTINE WMIOPO ( TOUT ) ICEO,ICEHO,ICEFO USE WMMDATMD, ONLY: MDST, MDSE, IMPROC, NMPROC, NMPUPT, NRGRD, & RESPEC, UPTMAP, MDSUP +#ifdef W3_ASCII + USE WMMDATMD, ONLY: MDSUPA +#endif #ifdef W3_MPI USE WMMDATMD, ONLY: MPI_COMM_MWAVE, MPI_COMM_GRD, ALLPRC, & MTAG0 @@ -1173,7 +1176,11 @@ SUBROUTINE WMIOPO ( TOUT ) ! TIME = TOUT ! - CALL W3IOPO ( 'WRITE', MDSUP, II, 0 ) + CALL W3IOPO ( 'WRITE', MDSUP, II, 0 & +#ifdef W3_ASCII + ,MDSUPA & +#endif + ) ! RETURN ! diff --git a/model/src/wmmdatmd.F90 b/model/src/wmmdatmd.F90 index e93c2cfb9..94aa7a7a9 100644 --- a/model/src/wmmdatmd.F90 +++ b/model/src/wmmdatmd.F90 @@ -74,6 +74,8 @@ MODULE WMMDATMD ! only. ! MDSP Int. Public Unit number for profiling. ! MDSUP Int. Public Unit number for unified point output. + ! MDSUPA Int. Public Unit number for unified point output. + ! ASCII ! MDSF I.A. Public Unit numbers for input files. ! ! NMPROC Int. Public Number of processors (for total multi- @@ -313,6 +315,9 @@ MODULE WMMDATMD INTEGER :: MDST = 6 !< MDST INTEGER :: MDSE = 6 !< MDSE INTEGER :: MDSUP !< MDSUP +#ifdef W3_ASCII + INTEGER :: MDSUPA !< MDSUPA +#endif INTEGER :: NMPROC = 1 !< NMPROC INTEGER :: IMPROC = 1 !< IMPROC INTEGER :: NMPLOG = 1 !< NMPLOG diff --git a/regtests/bin/matrix.base b/regtests/bin/matrix.base index 88e7ee835..864583358 100755 --- a/regtests/bin/matrix.base +++ b/regtests/bin/matrix.base @@ -689,6 +689,7 @@ echo "$rtst -s ST0 -w work_ST0 $ww3 ww3_tp2.6" >> matrix.body echo "$rtst -s ST0 -w work_ST0 $ww3 ww3_tp2.7" >> matrix.body echo "$rtst -s ST4 -w work_ST4 $ww3 ww3_tp2.6" >> matrix.body + echo "$rtst -s ST4_ASCII -w work_ST4_ASCII $ww3 ww3_tp2.6" >> matrix.body fi if [ "$prop1D" = 'y' ] @@ -1885,6 +1886,7 @@ then echo ' ' >> matrix.body echo "$rtst -s MPI -w work_MPI -m grdset_a -f -p $mpi -n $np $ww3 mww3_test_09" >> matrix.body + echo "$rtst -s MPI_ASCII -w work_MPI_ASCII -m grdset_a -f -p $mpi -n $np $ww3 mww3_test_09" >> matrix.body fi # Rotated pole grid cases, (ww3_tp2.11 MPI only if requested) diff --git a/regtests/bin/run_cmake_test b/regtests/bin/run_cmake_test index 206b3681d..86248bb4e 100755 --- a/regtests/bin/run_cmake_test +++ b/regtests/bin/run_cmake_test @@ -654,6 +654,10 @@ then if [ $multi -eq 2 ] then mv mod_def.ww3 mod_def.$g + if [ -e mod_def.ww3.txt ] + then + mv mod_def.ww3.txt mod_def.${g}.txt + fi if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then mv $prog.nml.log ${prog}_$g.nml.log diff --git a/regtests/mww3_test_09/input/switch_MPI_ASCII b/regtests/mww3_test_09/input/switch_MPI_ASCII new file mode 100644 index 000000000..e3d9628f0 --- /dev/null +++ b/regtests/mww3_test_09/input/switch_MPI_ASCII @@ -0,0 +1 @@ +ASCII NOGRB MPI DIST PR2 UNO SMC FLX2 LN0 ST0 NL0 BT0 DB0 TR0 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 O0 O1 O2 O3 O4 O5 O6 O7 O10 O11 diff --git a/regtests/ww3_tp2.6/input/switch_ST4_ASCII b/regtests/ww3_tp2.6/input/switch_ST4_ASCII new file mode 100644 index 000000000..db1b70b66 --- /dev/null +++ b/regtests/ww3_tp2.6/input/switch_ST4_ASCII @@ -0,0 +1 @@ +ASCII NOGRB SHRD PR3 UQ FLX0 LN0 ST4 NL1 BT1 DB1 MLIM TR0 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 O0 O1 O2 O3 O4 O5 O6 O7 O10 O11 From d148d0906a57487933a8a7e9466da8c293f962ce Mon Sep 17 00:00:00 2001 From: Chris Bunney <48915820+ukmo-ccbunney@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:04:50 +0100 Subject: [PATCH 12/25] Update local unit number arrays (NDS, MDS) to be same size of array defined in w3odatmd (size=15). Also, defined unit numbers for NDS(14) and NDS(15). (#1098) --- model/src/w3initmd.F90 | 2 +- model/src/ww3_shel.F90 | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/model/src/w3initmd.F90 b/model/src/w3initmd.F90 index 50f0680ad..93218d473 100644 --- a/model/src/w3initmd.F90 +++ b/model/src/w3initmd.F90 @@ -456,7 +456,7 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, !/ ------------------------------------------------------------------- / !/ Parameter list !/ - INTEGER, INTENT(IN) :: IMOD, MDS(13), MTRACE(2), & + INTEGER, INTENT(IN) :: IMOD, MDS(15), MTRACE(2), & ODAT(40),NPT, IPRT(6),& MPI_COMM LOGICAL, INTENT(IN) :: IsMulti diff --git a/model/src/ww3_shel.F90 b/model/src/ww3_shel.F90 index d7e9790bb..ee3464f44 100644 --- a/model/src/ww3_shel.F90 +++ b/model/src/ww3_shel.F90 @@ -329,7 +329,7 @@ PROGRAM W3SHEL NDSEN, IERR, J, I, ILOOP, IPTS, NPTS, & NDTNEW, MPI_COMM = -99, & FLAGTIDE, COUPL_COMM, IH, N_TOT - INTEGER :: NDSF(-7:9), NDS(13), NTRACE(2), NDT(7:9), & + INTEGER :: NDSF(-7:9), NDS(15), NTRACE(2), NDT(7:9), & TIME0(2), TIMEN(2), TTIME(2), TTT(2), & NH(-7:10), THO(2,-7:10,NHMAX), RCLD(7:9), & NODATA(7:9), ODAT(40), IPRT(6) = 0, & @@ -600,6 +600,9 @@ PROGRAM W3SHEL NDS(11) = 22 NDS(12) = 23 NDS(13) = 34 + NDS(14) = 36 + NDS(15) = 37 + ! NTRACE(1) = NDS(3) NTRACE(2) = 10 From 66262f6222cf9736729e0f9d48f9d3c7112cb1b6 Mon Sep 17 00:00:00 2001 From: Chris Bunney <48915820+ukmo-ccbunney@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:09:26 +0100 Subject: [PATCH 13/25] Removed code referencing PHIOC in output section for PHICE in ww3_ounf (#1093) --- model/src/ww3_ounf.F90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/model/src/ww3_ounf.F90 b/model/src/ww3_ounf.F90 index f6a928e31..02fd0d6f8 100644 --- a/model/src/ww3_ounf.F90 +++ b/model/src/ww3_ounf.F90 @@ -1815,9 +1815,6 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, & ! Wave to sea ice energy flux ELSE IF ( IFI .EQ. 6 .AND. IFJ .EQ. 11 ) THEN IF (NCVARTYPEI.EQ.3) NCVARTYPE=4 - DO ISEA=1, NSEA - PHIOC(ISEA)=MIN(3000.,PHIOC(ISEA)) - END DO CALL S2GRID(PHICE(1:NSEA), X1) ! ! Partitioned surface stokes drift From 8eb35962c396267b56d569ef32a27be0d5bb1657 Mon Sep 17 00:00:00 2001 From: Mickael Accensi <49198861+mickaelaccensi@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:14:25 +0200 Subject: [PATCH 14/25] implementation of the GQM (Gaussian Quadrature Method) to replace the DIA in NL1 or NL2. (#1083) --- manual/defs.tex | 3 + manual/eqs/NL1.tex | 140 +- manual/impl/switch.tex | 2 +- manual/manual.bib | 20 + model/inp/ww3_grid.inp | 12 + model/nml/namelists.nml | 10 + model/src/w3gdatmd.F90 | 23 + model/src/w3gridmd.F90 | 44 +- model/src/w3iogrmd.F90 | 30 +- model/src/w3snl1md.F90 | 1364 ++++++++++++++++- model/src/w3srcemd.F90 | 7 +- model/src/ww3_ounp.F90 | 7 +- model/src/ww3_outp.F90 | 6 +- model/src/ww3_trnc.F90 | 7 + regtests/bin/matrix.base | 2 + regtests/bin/matrix_cmake_datarmor | 2 +- regtests/ww3_ts1/input/namelists_ST4_T475.nml | 7 + regtests/ww3_ts1/input/namelists_ST4_T700.nml | 2 +- regtests/ww3_ts1/input/namelists_ST4_T702.nml | 12 + regtests/ww3_ts1/input/namelists_ST4_T707.nml | 13 + regtests/ww3_ts1/input/ww3_grid_ST4_T475.nml | 225 +++ regtests/ww3_ts1/input/ww3_grid_ST4_T702.nml | 225 +++ regtests/ww3_ts1/input/ww3_grid_ST4_T707.nml | 225 +++ .../ww3_ts1/input_10ms/namelists_ST4_T707.nml | 14 + .../ww3_ts1/input_10ms/namelists_ST4_T713.nml | 14 + regtests/ww3_ts1/input_10ms/points.list | 1 + regtests/ww3_ts1/input_10ms/switch | 1 + regtests/ww3_ts1/input_10ms/switch_ST4 | 1 + .../ww3_ts1/input_10ms/ww3_grid_ST4_T707.nml | 225 +++ .../ww3_ts1/input_10ms/ww3_grid_ST4_T713.nml | 225 +++ regtests/ww3_ts1/input_10ms/ww3_ounf.nml | 29 + regtests/ww3_ts1/input_10ms/ww3_ounp_spec.nml | 48 + regtests/ww3_ts1/input_10ms/ww3_shel.nml | 54 + 33 files changed, 2942 insertions(+), 58 deletions(-) create mode 100644 regtests/ww3_ts1/input/namelists_ST4_T475.nml create mode 100644 regtests/ww3_ts1/input/namelists_ST4_T702.nml create mode 100644 regtests/ww3_ts1/input/namelists_ST4_T707.nml create mode 100644 regtests/ww3_ts1/input/ww3_grid_ST4_T475.nml create mode 100644 regtests/ww3_ts1/input/ww3_grid_ST4_T702.nml create mode 100644 regtests/ww3_ts1/input/ww3_grid_ST4_T707.nml create mode 100644 regtests/ww3_ts1/input_10ms/namelists_ST4_T707.nml create mode 100644 regtests/ww3_ts1/input_10ms/namelists_ST4_T713.nml create mode 100644 regtests/ww3_ts1/input_10ms/points.list create mode 100644 regtests/ww3_ts1/input_10ms/switch create mode 100644 regtests/ww3_ts1/input_10ms/switch_ST4 create mode 100644 regtests/ww3_ts1/input_10ms/ww3_grid_ST4_T707.nml create mode 100644 regtests/ww3_ts1/input_10ms/ww3_grid_ST4_T713.nml create mode 100644 regtests/ww3_ts1/input_10ms/ww3_ounf.nml create mode 100644 regtests/ww3_ts1/input_10ms/ww3_ounp_spec.nml create mode 100644 regtests/ww3_ts1/input_10ms/ww3_shel.nml diff --git a/manual/defs.tex b/manual/defs.tex index 1f67da7e7..5b8963fa5 100644 --- a/manual/defs.tex +++ b/manual/defs.tex @@ -94,6 +94,9 @@ \newcommand{\cR}{{\cal R}} \newcommand{\cS}{{\cal S}} +\newcommand{\rd}{{\mathrm d}} + + \newcommand{\marbox}[1]{\marginpar{\fbox{{\small #1}}}} \newcommand{\proddefH}[3]{ diff --git a/manual/eqs/NL1.tex b/manual/eqs/NL1.tex index a6539dbe5..d9bc4c521 100644 --- a/manual/eqs/NL1.tex +++ b/manual/eqs/NL1.tex @@ -1,58 +1,84 @@ -\vsssub -\subsubsection{~$S_{nl}$: Discrete Interaction Approximation (\dia)} \label{sec:NL1} -\vsssub - -\opthead{NL1}{\wam\ model}{H. L. Tolman} \noindent -Nonlinear wave-wave interactions can be modeled using the discrete interaction -approximation \citep[\dia,][]{art:Hea85b}. This parameterization was + + +Resonant nonlinear interactions occur between four wave components +(quadruplets) with wavenumber vector $\bk$, $\bk_1$, $\bk_2$ and $\bk_3$ are such that +% eq:resonance +\begin{equation} \left . +\begin{array}{ccc} + \bk + \bk_1 & = & \bk_2 + \bk_3 \\ + f_r + f_{r,1}& =& f_{r,2} + f_{r,3} +\end{array} \:\:\: \right \rbrace \:\:\: , \label{eq:resonance} +\end{equation} + +Nonlinear 4-wave interaction theories were originally developed for the spectrum $F(f_r ,\theta)$. To assure the conservative nature of $S_{nl}$ for this spectrum (which can be considered as the "final product" of the model), this source term is calculated for $F(f_r,\theta)$ instead of $N(k,\theta)$, using the conversion (\ref{eq:jac_fr}). -Resonant nonlinear interactions occur between four wave components -(quadruplets) with wavenumber vector $\bk_1$ through $\bk_4$. In the \dia, it -is assumed that $\bk_1 = \bk_2$. Resonance conditions then require that -%--------------------------% -% Resonance conditions DIA % -%--------------------------% +\vsssub +\subsubsection{~$S_{nl}$: Discrete Interaction Approximation (\dia)} \label{sec:NL1} +\vsssub + +\opthead{NL1}{\wam\ model}{H. L. Tolman} + + + + In the \dia, for each component $\bk$, only 2 quadruplets configuration are +used, while there should be thousands for the full integral, and the interaction caused by these 2 quadruplets +is scaled so that it gives the right order of magnitude for the flux of energy towards low frequencies. + +Both quadruplets used the DIA use % eq:resonance \begin{equation} \left . \begin{array}{ccc} - \bk_1 + \bk_2 & = & \bk_3 + \bk_4 \\ - \sigma_2 & = & \sigma_1 \\ - \sigma_3 & = & (1+\lambda_{nl})\sigma_1 \\ - \sigma_4 & = & (1-\lambda_{nl})\sigma_1 -\end{array} \:\:\: \right \rbrace \:\:\: , \label{eq:resonance} + \bk_1 & = & \bk\\ + f_{r,2} & = & (1+\lambda)f_{r} \\ + f_{r,3} & = & (1-\lambda)f_{r} +\end{array} \:\:\: \right \rbrace \:\:\: , \label{eq:DIAchoice} \end{equation} -where $\lambda_{nl}$ is a constant. For these quadruplets, the contribution -$\delta S_{nl}$ to the interaction for each discrete $(f_r,\theta)$ -combination of the spectrum corresponding to $\bk_1$ is calculated as +where $\lambda$ is a constant, usually 0.25, and they only differ by the choice of the interacting angles +taking either a plus sign or a minus sign in the following +\begin{equation} \left . +\begin{array}{ccc} + \theta_{2,\pm} & = & \theta \pm \delta_{\theta,2} \\ + \theta_{3,\pm} & = & \theta \mp \delta_{\theta,3} \\ + \end{array} \:\:\: \right \rbrace \:\:\: , \label{eq:DIAangles} +\end{equation} +where $\delta_{\theta,2}$ and $\delta_{\theta,3}$ are only a function of $\lambda$ given by the geometry of +the interacting wavenumbers along the "figure of 8", namely +\begin{eqnarray} +\cos(\delta_{\theta,2})&=&(1-\lambda)^4+4-(1+\lambda)^4)/[4(1-\lambda)^2], \\ +\sin(\delta_{\theta,3})&=&\sin(\delta_{\theta,2}) (1-\lambda)^2/(1+\lambda)^2. +\end{eqnarray} + + For these quadruplets, each source term value +$S_{nl}(\bk)$ corresponding to each discrete $(f_r,\theta)$ +we compute the three contributions that correspond to the situation in which $\bk$ takes the role of $\bk$,$\bk_{2,+}$, $\bk_{2,-}$, $\bk_{3,+}$ and $\bk_{3,-}$ in the quadruplet, namely the full source term is +\begin{eqnarray} +S_{\mathrm{nl}}(\bk) &=& -2 \left[\delta S_{\mathrm{nl}}(\bk,\bk_2,\bk_3,+)+\delta S_{\mathrm{nl}}(\bk,\bk_2,\bk_3,-)\right] \nonumber \\ + & & + \delta S_{\mathrm{nl}}(\bk_4,\bk,\bk_5,+) + \delta S_{\mathrm{nl}}(\bk_6,\bk,\bk_7,-) \\ + & & + \delta S_{\mathrm{nl}}(\bk_8,\bk_9,\bk, +) + \delta S_{\mathrm{nl}}(\bk_{10},\bk_{11},\bk, -) . \label{eq:diasum} +\end{eqnarray} +with elementary contributions given by %----------------------------% % Nonlinear interactions DIA % %----------------------------% % eq:snl_dia -\begin{eqnarray} -\left ( \begin{array}{c} - \delta S_{nl,1} \\ \delta S_{nl,3} \\ \delta S_{nl,4} -\end{array} \right ) & = & D -\left ( \begin{array}{r} -2 \\ 1 \\ 1 \end{array} \right ) -C g^{-4} f_{r,1}^{11} \times \nonumber \\ -& & \left [ F_1^2 -\left ( \frac{F_3}{(1+\lambda_{nl})^4} + - \frac{F_4}{(1-\lambda_{nl})^4} \right ) - -\frac{2 F_1 F_3 F_4}{(1-\lambda_{nl}^2)^4} -\right ] \: , \label{eq:snl_dia} -\end{eqnarray} -where $F_1 = F(f_{r,1} ,\theta_1 )$ etc. and $\delta S_{nl,1} = \delta -S_{nl}(f_{r,1} ,\theta_1 )$ etc., $C$ is a proportionality constant. The -nonlinear interactions are calculated by considering a limited number of -combinations $(\lambda_{nl},C)$. In practice, only one combination is -used. Default values for different source term packages are presented in -Table~\ref{tab:snl_par}. + +\begin{equation} +\delta S_{\mathrm{nl}}(\bk,\bk_2,\bk_3,s) = \frac{C}{g^4} f_{r,1}^{11} \left [ F^2 \left ( \frac{F_{2,s}}{(1+\lambda_{nl})^4} + + \frac{F_{3,s}}{(1-\lambda_{nl})^4} \right ) - \frac{2 F F_{2,s} F_{3,s}}{(1-\lambda_{nl}^2)^4} \right] , + \label{eq:snl_dia} +\end{equation} +where $s=+$ or $s=-$ is a sign index, and the spectral densities are $F = F(f_{r} ,\theta)$, $F_{2,+} = F(f_{r,2} ,\theta + \delta_{\theta,2})$, $F_{2,-} = F(f_{r,2} ,\theta - \delta_{\theta,2})$, etc. + $C$ is a proportionality constant that was tuned to reproduce the inverse energy cascade. Default values for different source term packages are presented in Table~\ref{tab:snl_par}. +As a result, when accounting for the two quadruplet configurations, the source term at $\bk$ includes the interactions with +10 other spectral components. Besides, because $f_{r,2}$ and $f_{r,3}$ nor $\theta_{2,\pm} $ and $\theta_{3,\pm} $ fall on discretized frequencies and directions, the spectral densities are bilinearly interpolated, which involves 4 discrete spectral components for each of these 10 components. + % tab:snl_par @@ -68,7 +94,7 @@ \subsubsection{~$S_{nl}$: Discrete Interaction Approximation (\dia)} \label{sec: \caption{Default constants in \dia\ for input-dissipation packages.} \label{tab:snl_par} \botline \end{table} -This source term is developed for deep water, using the appropriate dispersion +This parameterization was developed for deep water, using the appropriate dispersion relation in the resonance conditions. For shallow water the expression is scaled by the factor $D$ (still using the deep-water dispersion relation, however) @@ -132,3 +158,37 @@ \subsubsection{~$S_{nl}$: Discrete Interaction Approximation (\dia)} \label{sec: above constants can be reset by the user in the input files of the model (see \para\ref{sub:ww3grid}). +\vsssub +\subsubsection{~$S_{nl}$: Gaussian Quadrature Method (\dia)} \label{sec:GQM} +\vsssub + +\opthead{NL1 , but with a negative IQTYPE}{TOMAWAC model, M. Benoit}{adaptation to WW3 by S. Siadatmousavi \& F. Ardhuin} + +\noindent +Changing the namelist parameter IQTYPE to a negative value replaces the +DIA parameterization with the possibility to perform an exact but fast cal- +culation of $S_{\mathrm{nl}}$ using the Gaussian Quadrature Method of \cite{Lavrenov2001}. +More details can be found in \cite{Gagnaire-Renou2009}. + + +The quadruplet configurations that are used correspond to the three integrals over $f_1$, $f_2$ and $\theta_1$, with all other frequencies and directions given by the resonance conditions (\ref{eq:resonance}) with only one ambiguity on the angle $\theta_2$ which can be defined by a sign index $s$, as in the DIA. Starting from eq. (A4) in \cite{Lavrenov2001} as writen in (2.25) of \cite{Gagnaire-Renou2009}, the source term is +\begin{equation} +S_{\mathrm{nl}}(\sigma,\theta) = 8 \sum_s \int_{\sigma_1=0}^\infty \int_{\theta_1=0}^{2 \pi} \int_{\sigma_2=0}^{(\sigma+\sigma_1)/2} T \frac{F_2 F_3 (F \sigma_1^4 + F_1 \sigma^4) - F F_1 (F_2 \sigma_3^4 + F_3 \sigma_2^4)}{\sqrt{B}\sqrt{((\left| \bk+\bk_1 \right|/g- \sigma_3^2)^2-\sigma_2^4} } {\mathrm d}\sigma_1 {\mathrm d}\theta_1 {\mathrm d}\sigma_2 , + \label{eq:snl_gqm} +\end{equation} +where $B$ is given by eq. (A5) of Lavrenov (2001) and +\begin{equation} +T(\bk,\bk_1,\bk_2,\bk_3) = \frac{\pi g^2 D^2(\bk,\bk_1,\bk_2,\bk_3) }{4 \sigma \sigma_1 \sigma_2 \sigma_3} +\end{equation} +where $ D(\bk,\bk_1,\bk_2,\bk_3)$ is given by \cite{Webb1978} in his eq. (A1). + +This triple integral is performed using quadrature functions to best resolve the effect of the singularities in the denominator. It is thus replaced with weighted sums over the 3 dimensions. + +Compared to the DIA, there is no bilinear interpolation and the nearest neighbor is used in frequency and direction. Also, +the source term is computed by a loop over the quadruplet configuration, which allows for filtering based on +both the value of the coupling coefficient and the energy level at the frequency corresponding to $\bk$. Within +that loop, the source term contribution is computed for all 4 interacting components, so that any filtering still +conserves energy, action, momentum ... (One may argue that this multiplies by 4 the number of calculations, but it may have the benefit of properly dealing with the high frequency boundary... this is to be verified. The same question arises for the DIA: why have the wavenumber $\bk$ play the role of the other members of the quadruplets when this will also be computed as we loop on the spectral components?). + +If a very aggressive filtering is performed, the source may need to be rescaled. + diff --git a/manual/impl/switch.tex b/manual/impl/switch.tex index 856a7d218..22ab75f34 100644 --- a/manual/impl/switch.tex +++ b/manual/impl/switch.tex @@ -94,7 +94,7 @@ \subsubsection{~Mandatory switches} \label{sub:man_switch} Selection of nonlinear interactions: \begin{slist} \sit{nl0} {No nonlinear interactions used.} -\sit{nl1} {Discrete interaction approximation (\dia).} +\sit{nl1} {Discrete interaction approximation (\dia) or Gaussian Quadrature Method (GQM).} \sit{nl2} {Exact interaction approximation (\xnl).} \sit{nl3} {Generalized Multiple \dia\ (\gmd).} \sit{nl4} {Two-scale approximation (TSA).} diff --git a/manual/manual.bib b/manual/manual.bib index 8cb9734fb..0aacb5105 100644 --- a/manual/manual.bib +++ b/manual/manual.bib @@ -3664,3 +3664,23 @@ @article{art:DC23 volume = {}, year = {2023} } + +@ARTICLE{Lavrenov2001, + author = "Igor V. Lavrenov", + title = "Effect of wind wave parameter fluctuation on the nonlinear spectrum evolution", + journal = JPO, + volume = 31, + pages = "861--873", + year = 2001, + url="http://ams.allenpress.com/archive/1520-0485/31/4/pdf/i1520-0485-31-4-861", + keywords={4-wave interactions,GQM}, +} + + +@PHDTHESIS{Gagnaire-Renou2009, + author = "Elodie Gagnaire-Renou", + title = "Amelioration de la modelisation spectrale des etats de mer par un calcul quasi-exact des interactions non-lineaires vague-vague", + school = "Universit{\'e} du Sud Toulon Var", + year = 2010, +} + diff --git a/model/inp/ww3_grid.inp b/model/inp/ww3_grid.inp index b802c6717..655a10493 100644 --- a/model/inp/ww3_grid.inp +++ b/model/inp/ww3_grid.inp @@ -102,6 +102,18 @@ $ KDCONV : Factor before kd in Eq. (n.nn). $ KDMIN, SNLCS1, SNLCS2, SNLCS3 : $ Minimum kd, and constants c1-3 $ in depth scaling function. +$ IQTYPE : Type of depth treatment +$ -2 : Deep water GQM with scaling +$ 1 : Deep water DIA +$ 2 : Deep water DIA with scaling +$ 3 : Shallow water DIA +$ TAILNL : Parametric tail power. +$ GQMNF1 : number of points along the locus +$ GQMNT1 : idem +$ GQMNQ_OM2 : idem +$ GQMTHRSAT : threshold on saturation for SNL calculation +$ GQMTHRCOU : threshold for filter on coupling coefficient +$ GQAMP1, GQAMP2, GQAMP3, GQAMP4 : amplification factor $ Exact interactions : Namelist SNL2 $ IQTYPE : Type of depth treatment $ 1 : Deep water diff --git a/model/nml/namelists.nml b/model/nml/namelists.nml index 7b373c71e..390fdb874 100644 --- a/model/nml/namelists.nml +++ b/model/nml/namelists.nml @@ -81,6 +81,16 @@ $ KDCONV : Factor before kd in Eq. (n.nn). $ KDMIN, SNLCS1, SNLCS2, SNLCS3 : $ Minimum kd, and constants c1-3 $ in depth scaling function. +$ IQTYPE : Type of depth treatment +$ -2 : Deep water GQM with scaling +$ 1 : Deep water DIA +$ 2 : Deep water DIA with scaling +$ 3 : Shallow water DIA +$ TAILNL : Parametric tail power. +$ GQMNF1, GQMNT1, GQMNQ_OM2 : Gaussian quadrature resolution +$ GQMTHRSAT : Threshold on saturation for SNL calculation +$ GQMTHRCOU : Threshold for filter on coupling coefficient +$ GQAMP1, GQAMP2, GQAMP3, GQAMP4 : Amplification factors $ Exact interactions : Namelist SNL2 $ IQTYPE : Type of depth treatment $ 1 : Deep water diff --git a/model/src/w3gdatmd.F90 b/model/src/w3gdatmd.F90 index 6cd6e91d8..7bc5e2f30 100644 --- a/model/src/w3gdatmd.F90 +++ b/model/src/w3gdatmd.F90 @@ -429,6 +429,17 @@ MODULE W3GDATMD ! KDCON Real Public Conversion factor for relative depth. ! KDMN Real Public Minimum relative depth. ! SNLSn Real Public Constants in shallow water factor. + ! IQTPE Int. Public Type of depth treatment + ! -2 : Deep water GQM with scaling + ! 1 : Deep water DIA + ! 2 : Deep water DIA with scaling + ! 3 : Finite water depth DIA + ! GQNF1 Int. Public Gaussian quadrature resolution + ! GQNT1 Int. Public Gaussian quadrature resolution + ! GQNNQ_OM2 Int. Public Gaussian quadrature resolution + ! GQTHRSAT Real Public Threshold on saturation for SNL calculation + ! GQTHRCOU Real Public Threshold for filter on coupling coefficient + ! GQAMP R.A. Public Amplification factors ! (!/NL2) ! IQTPE Int. Public Type of depth treatment ! 1 : Deep water @@ -910,6 +921,8 @@ MODULE W3GDATMD #ifdef W3_NL1 REAL :: SNLC1, LAM, KDCON, KDMN, & SNLS1, SNLS2, SNLS3 + INTEGER :: IQTPE, GQNF1, GQNT1, GQNQ_OM2 + REAL :: NLTAIL, GQTHRSAT, GQTHRCOU, GQAMP(4) #endif #ifdef W3_NL2 INTEGER :: IQTPE, NDPTHS @@ -1319,6 +1332,8 @@ MODULE W3GDATMD !/ Data aliasses for structure SNLP(S) !/ #ifdef W3_NL1 + INTEGER, POINTER :: IQTPE, GQNF1, GQNT1, GQNQ_OM2 + REAL, POINTER :: NLTAIL, GQTHRSAT, GQTHRCOU, GQAMP(:) REAL, POINTER :: SNLC1, LAM, KDCON, KDMN, & SNLS1, SNLS2, SNLS3 #endif @@ -2690,6 +2705,14 @@ SUBROUTINE W3SETG ( IMOD, NDSE, NDST ) SNLS1 => MPARS(IMOD)%SNLPS%SNLS1 SNLS2 => MPARS(IMOD)%SNLPS%SNLS2 SNLS3 => MPARS(IMOD)%SNLPS%SNLS3 + IQTPE => MPARS(IMOD)%SNLPS%IQTPE + GQNF1 => MPARS(IMOD)%SNLPS%GQNF1 + GQNT1 => MPARS(IMOD)%SNLPS%GQNT1 + GQNQ_OM2 => MPARS(IMOD)%SNLPS%GQNQ_OM2 + NLTAIL => MPARS(IMOD)%SNLPS%NLTAIL + GQTHRSAT => MPARS(IMOD)%SNLPS%GQTHRSAT + GQTHRCOU=> MPARS(IMOD)%SNLPS%GQTHRCOU + GQAMP=> MPARS(IMOD)%SNLPS%GQAMP #endif #ifdef W3_NL2 IQTPE => MPARS(IMOD)%SNLPS%IQTPE diff --git a/model/src/w3gridmd.F90 b/model/src/w3gridmd.F90 index aa618b59f..fa8128afb 100644 --- a/model/src/w3gridmd.F90 +++ b/model/src/w3gridmd.F90 @@ -113,6 +113,7 @@ MODULE W3GRIDMD !/ 27-May-2021 : Moved to a subroutine ( version 7.13 ) !/ 07-Jun-2021 : S_{nl} GKE NL5 (Q. Liu) ( version 7.13 ) !/ 19-Jul-2021 : Momentum and air density support ( version 7.14 ) + !/ 28-Feb-2023 : GQM as an alternative for NL1 ( version 7.15 ) !/ !/ Copyright 2009-2013 National Weather Service (NWS), !/ National Oceanic and Atmospheric Administration. All rights @@ -439,7 +440,7 @@ MODULE W3GRIDMD ! (2006) input and Babanin et al. (2001,2010) dissipation. ! ! !/NL0 No nonlinear interactions. - ! !/NL1 Discrete interaction approximation (DIA). + ! !/NL1 Discrete interaction approximation (DIA or GQM). ! !/NL2 Exact interactions (WRT). ! !/NL3 Generalized Multiple DIA (GMD). ! !/NL4 Two Scale Approximation @@ -867,6 +868,8 @@ MODULE W3GRIDMD #ifdef W3_NL1 REAL :: LAMBDA, KDCONV, KDMIN, & SNLCS1, SNLCS2, SNLCS3 + INTEGER :: IQTYPE, GQMNF1, GQMNT1, GQMNQ_OM2 + REAL :: TAILNL, GQMTHRSAT, GQMTHRCOU, GQAMP1, GQAMP2, GQAMP3, GQAMP4 #endif #ifdef W3_NL2 INTEGER :: IQTYPE, NDEPTH @@ -998,7 +1001,9 @@ MODULE W3GRIDMD #endif #ifdef W3_NL1 NAMELIST /SNL1/ LAMBDA, NLPROP, KDCONV, KDMIN, & - SNLCS1, SNLCS2, SNLCS3 + SNLCS1, SNLCS2, SNLCS3, & + IQTYPE, TAILNL, GQMNF1, GQMNT1, & + GQMNQ_OM2, GQMTHRSAT, GQMTHRCOU, GQAMP1, GQAMP2, GQAMP3, GQAMP4 #endif #ifdef W3_NL2 NAMELIST /SNL2/ IQTYPE, TAILNL, NDEPTH @@ -1831,6 +1836,18 @@ SUBROUTINE W3GRID() SNLCS1 = 5.5 SNLCS2 = 0.833 SNLCS3 = -1.25 + ! Additional parameters for GQM + IQTYPE = 1 + TAILNL = -FACHF + GQMNF1 = 14 + GQMNT1 = 8 + GQMNQ_OM2=8 + GQMTHRSAT=0. + GQMTHRCOU=0.015 + GQAMP1=1. + GQAMP2=0.002 + GQAMP3=1. + GQAMP4=1. CALL READNL ( NDSS, 'SNL1', STATUS ) WRITE (NDSO,922) STATUS WRITE (NDSO,923) LAMBDA, NLPROP, KDCONV, KDMIN, & @@ -1842,6 +1859,18 @@ SUBROUTINE W3GRID() SNLS1 = SNLCS1 SNLS2 = SNLCS2 SNLS3 = SNLCS3 + ! Additional parameters for GQM + IQTPE = IQTYPE + GQNF1 = GQMNF1 + GQNT1 = GQMNT1 + GQNQ_OM2 = GQMNQ_OM2 + GQTHRSAT = GQMTHRSAT + GQTHRCOU = GQMTHRCOU + GQAMP(1) = GQAMP1 + GQAMP(2) = GQAMP2 + GQAMP(3) = GQAMP3 + GQAMP(4) = GQAMP4 + NLTAIL = TAILNL #endif ! #ifdef W3_ST0 @@ -3175,7 +3204,10 @@ SUBROUTINE W3GRID() #endif #ifdef W3_NL1 WRITE (NDSO,2922) LAMBDA, NLPROP, KDCONV, KDMIN, & - SNLCS1, SNLCS2, SNLCS3 + SNLCS1, SNLCS2, SNLCS3, & + IQTYPE, TAILNL, GQMNF1, & + GQMNT1, GQMNQ_OM2, GQMTHRSAT, GQMTHRCOU,& + GQAMP1, GQAMP2, GQAMP3, GQAMP4 #endif #ifdef W3_NL2 WRITE (NDSO,2922) IQTYPE, TAILNL, NDEPTH @@ -6230,7 +6262,11 @@ SUBROUTINE W3GRID() 2922 FORMAT ( ' &SNL1 LAMBDA =',F7.3,', NLPROP =',E10.3, & ', KDCONV =',F7.3,', KDMIN =',F7.3,','/ & ' SNLCS1 =',F7.3,', SNLCS2 =',F7.3, & - ', SNLCS3 = ',F7.3,' /') + ', SNLCS3 = ',F7.3','/ & + ' IQTYPE =',I2,', TAILNL =',F5.1,','/ & + ' GQMNF1 =',I2,', GQMNT1 =',I2,',', & + ' GQMNQ_OM2 =',I2,', GQMTHRSAT =',E11.4,', GQMTHRCOU =',F4.3,','/ & + ' GQAMP1 =',F5.3,', GQAMP2 =',F5.3,', GQAMP3 =',F5.3,', GQAMP4 =',F5.3,' /') #endif ! #ifdef W3_NL2 diff --git a/model/src/w3iogrmd.F90 b/model/src/w3iogrmd.F90 index e96b7b788..4f211402d 100644 --- a/model/src/w3iogrmd.F90 +++ b/model/src/w3iogrmd.F90 @@ -284,7 +284,7 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT & DIKCUMUL #endif #ifdef W3_NL1 - USE W3SNL1MD, ONLY: INSNL1 + USE W3SNL1MD, ONLY: INSNL1, INSNLGQM #endif #ifdef W3_NL2 USE W3SNL2MD, ONLY: INSNL2 @@ -1580,18 +1580,28 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT & #ifdef W3_NL1 IF ( WRITE ) THEN WRITE (NDSM) & - SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3 + SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3, & + IQTPE, NLTAIL, GQNF1, GQNT1, & + GQNQ_OM2, GQTHRSAT, GQTHRCOU, GQAMP #ifdef W3_ASCII WRITE (NDSA,*) & - 'SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3:',& - SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3 + 'SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3, & + IQTPE, NLTAIL, GQNF1, GQNT1, & + GQNQ_OM2, GQTHRSAT, GQTHRCOU, GQAMP:', & + SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3, & + IQTPE, NLTAIL, GQNF1, GQNT1, & + GQNQ_OM2, GQTHRSAT, GQTHRCOU, GQAMP #endif ELSE READ (NDSM,END=801,ERR=802,IOSTAT=IERR) & - SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3 + SNLC1, LAM, KDCON, KDMN, SNLS1, SNLS2, SNLS3, & + IQTPE, NLTAIL, GQNF1, GQNT1, & + GQNQ_OM2, GQTHRSAT, GQTHRCOU, GQAMP END IF IF ( FLTEST ) WRITE (NDST,9051) SNLC1, LAM, & - KDCON, KDMN, SNLS1, SNLS2, SNLS3 + KDCON, KDMN, SNLS1, SNLS2, SNLS3, & + IQTPE, NLTAIL, GQNF1, GQNT1, GQNQ_OM2, & + GQTHRSAT, GQTHRCOU, GQAMP #endif ! #ifdef W3_NL2 @@ -1713,7 +1723,13 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT & #endif ! #ifdef W3_NL1 - IF ( .NOT. WRITE ) CALL INSNL1 ( IGRD ) + IF ( .NOT. WRITE ) THEN + IF (IQTPE.GT.0) THEN + CALL INSNL1 ( IGRD ) + ELSE + CALL INSNLGQM + END IF + END IF #endif #ifdef W3_NL3 IF ( .NOT. WRITE ) CALL INSNL3 diff --git a/model/src/w3snl1md.F90 b/model/src/w3snl1md.F90 index e21349ede..598b627ea 100644 --- a/model/src/w3snl1md.F90 +++ b/model/src/w3snl1md.F90 @@ -28,7 +28,7 @@ MODULE W3SNL1MD !/ | WAVEWATCH III NOAA/NCEP | !/ | H. L. Tolman | !/ | FORTRAN 90 | - !/ | Last update : 03-Sep-2012 | + !/ | Last update : 28-Feb-2023 | !/ +-----------------------------------+ !/ !/ 04-Feb-2000 : Origination. ( version 2.00 ) @@ -36,6 +36,7 @@ MODULE W3SNL1MD !/ 24-Dec-2004 : Multiple grid version. ( version 3.06 ) !/ 29-May-2009 : Preparing distribution version. ( version 3.14 ) !/ 03-Sep-2012 : Clean up of test output T0, T1 ( version 4.07 ) + !/ 28-Feb-2023 : Adds GQM separate routines ( version 7.07 ) !/ !/ Copyright 2009 National Weather Service (NWS), !/ National Oceanic and Atmospheric Administration. All rights @@ -77,8 +78,22 @@ MODULE W3SNL1MD ! !/ ------------------------------------------------------------------- / !/ + !/ PUBLIC !/ + !/ These are the arrays and variables used for GQM method + !/ + INTEGER :: NCONF + INTEGER, ALLOCATABLE :: K_IF2 (:,:,:) , K_IF3 (:,:,:) , K_1P2P(:,:,:) , & + K_1P3M(:,:,:) , K_1P2M(:,:,:) , K_1P3P(:,:,:) , & + K_1M2P(:,:,:) , K_1M3M(:,:,:) , K_1M2M(:,:,:) , & + K_1M3P(:,:,:) + INTEGER, ALLOCATABLE :: F_POIN(:) , T_POIN(:) , K_IF1(:) , K_1P(:,:) , & + K_1M(:,:) , IDCONF(:,:) + DOUBLE PRECISION, ALLOCATABLE :: F_COEF(:) , F_PROJ(:) , TB_SCA(:) , TB_V14(:) + DOUBLE PRECISION, ALLOCATABLE :: TB_V24(:,:,:) , TB_V34(:,:,:) , & + TB_TPM(:,:,:) , TB_TMP(:,:,:) , TB_FAC(:,:,:) + !/ CONTAINS !/ ------------------------------------------------------------------- / @@ -768,6 +783,1353 @@ SUBROUTINE INSNL1 ( IMOD ) !/ End of INSNL1 ----------------------------------------------------- / !/ END SUBROUTINE INSNL1 + + !/ ------------------------------------------------------------------- / + SUBROUTINE W3SNLGQM(A,CG,WN,DEPTH,TSTOTn,TSDERn) + ! This and the following routines are adapted to WW3 from TOMAWAC qnlin3.f + !*********************************************************************** + ! TOMAWAC V6P1 24/06/2011 + !*********************************************************************** + ! + !brief COMPUTES THE CONTRIBUTION OF THE NON-LINEAR INTERACTIONS + !+ SOURCE TERM BETWEEN QUADRUPLETS USING THE GQM METHOD + !+ ("GAUSSIAN QUADRATURE METHOD") PROPOSED BY LAVRENOV + !+ (2001) + !+ + !+ PROCEDURE SPECIFIC TO THE CASE WHERE THE FREQUENCIES + !+ FOLLOW A GEOMETRICAL PROGRESSION AND THE DIRECTIONS + !+ ARE EVENLY DISTRIBUTED OVER [0;2.PI]. + ! + !note THIS SUBROUTINE USES THE OUTPUT FROM 'PRENL3' TO OPTIMISE + !+ THE COMPUTATIONS FOR DIA. + ! + !reference LAVRENOV, I.V. (2001): + !+ "EFFECT OF WIND WAVE PARAMETER FLUCTUATION ON THE NONLINEAR + !+ SPECTRUM EVOLUTION". J. PHYS. OCEANOGR. 31, 861-873. + ! + !history E. GAGNAIRE-RENOU + !+ 04/2011 + !+ V6P1 + !+ CREATED + ! + !history G.MATTAROLO (EDF - LNHE) + !+ 24/06/2011 + !+ V6P1 + !+ Translation of French names of the variables in argument + + ! + !/ Warning, contrary to the DIA routine, there is no extension to frequencies below IK=1 + !/ as a result the first two frequencies are not fully treated. + !================================================================================== + ! This subroutine is same as qnlin3 in TOMWAC + USE CONSTANTS, ONLY: TPI + USE W3GDATMD, ONLY: SIG, NK , NTH , DTH, XFR, FR1, GQTHRSAT, GQAMP + + REAL, intent(in) :: A(NTH,NK), CG(NK), WN(NK) + REAL, intent(in) :: DEPTH + REAL, intent(out) :: TSTOTn(NTH,NK), TSDERn(NTH,NK) + + INTEGER :: ITH,IK,NT,NF + REAL :: q_dfac, SATVAL(NK), SUME, ACCVAL, ACCMAX, AMPFAC + DOUBLE PRECISION :: RAISF, FREQ(NK) + DOUBLE PRECISION :: TSTOT(NTH,NK) , TSDER(NTH,NK), F(NTH,NK) + DOUBLE PRECISION :: TEMP + + !.....LOCAL VARIABLES + INTEGER JF , JT , JF1 , JT1 , IQ_OM2 & + , JFM0 , JFM1 , JFM2 , JFM3 , IXF1 , IXF2 & + , IXF3 , JFMIN , JFMAX , ICONF , LBUF + INTEGER KT1P , KT1M , JT1P , JT1M , KT1P2P, KT1P2M & + , KT1P3P, KT1P3M, KT1M2P, KT1M2M, KT1M3P, KT1M3M & + , JT1P2P, JT1P2M, JT1P3P, JT1P3M, JT1M2P, JT1M2M & + , JT1M3P, JT1M3M + DOUBLE PRECISION V1_4 , V2_4 , V3_4 , Q_2P3M, Q_2M3P, FACTOR & + , T_2P3M, T_2M3P, S_2P3M, S_2M3P, SCAL_T, T2P3M & + , T2M3P , SP0 , SP1P , SP1M , SP1P2P, SP1P2M & + , SP1P3P, SP1P3M, SP1M2P, SP1M2M, SP1M3P, SP1M3M & + , CF0 , CP0 , CF1 , CP1 , CF2 , CP2 & + , CF3 , CP3 , Q2PD0 , Q2PD1 , Q2PD2P, Q2PD3M & + , Q2MD0 , Q2MD1 , Q2MD2M, Q2MD3P ,AUX00 , AUX01 & + , AUX02 , AUX03 , AUX04 , AUX05 , SEUIL & + , AUX06 , AUX07 , AUX08 , AUX09 , AUX10 , FSEUIL + + NT = NTH + NF = NK + LBUF = 500 + SEUIL = 0. + RAISF = XFR + + DO IK = 1,NK + FREQ(IK) = FR1*RAISF**(IK-1) + ENDDO + + DO ITH = 1,NTH + DO IK = 1,NK + ! F is the E(f,theta) spectrum ... + F(ITH,IK) = DBLE(A(ITH,IK)*SIG(IK))*DBLE(TPI)/DBLE(CG(IK)) + ENDDO + ENDDO + ! CALL INSNLGQM + ! it returns: F_POIN , T_POIN , F_COEF , F_PROJ, TB_SCA , K_IF1, K_1P, k_1M , K_IF2 + ! K_IF3, K_1P2P , K_1P3M , K_1P2M , K_1P3P , K_1M2P , K_1M3M , K_1M2M + ! K_1M3P , TB_V14 , TB_FAC , TB_V24 , TB_V34 , TB_TMP , TB_TPM , IDCONF, NCONF + !======================================================================= + ! COMPUTES THE GENERALIZED MIN AND MAX FREQUENCIES : INSTEAD OF GOING + ! FROM 1 TO NF IN FREQ(JF) FOR THE MAIN FREQUENCY, IT GOES FROM JFMIN + ! TO JFMAX + ! JFMIN IS GIVEN BY Fmin=FREQ(1) /Gamma_min + ! JFMAX IS GIVEN BY Fmax=FREQ(NF)*Gamma_max + ! TESTS HAVE SHOWN THAT IT CAN BE ASSUMED Gamma_min=1. (JFMIN=1) AND + ! Gamma_max=1.3 (JFMAX>NF) TO OBTAIN IMPROVED RESULTS + ! Note by Fabrice Ardhuin: this appears to give the difference in tail benaviour with Gerbrant's WRT + !======================================================================= + JFMIN= 1-INT(LOG(1.0D0)/LOG(RAISF)) + JFMAX=NF+INT(LOG(1.3D0)/LOG(RAISF)) + ! + !======================================================================= + ! COMPUTES THE SPECTRUM THRESHOLD VALUES (BELOW WHICH QNL4 IS NOT + ! CALCULATED). THE THRESHOLD IS SET WITHIN 0 AND 1. + ! This was commented by FA + !======================================================================= + ! AUX00=0.0D0 + ! DO JF=1,NF + ! DO JT=1,NT + ! IF (F(JT,JF).GT.AUX00) AUX00=F(JT,JF) + ! ENDDO + ! ENDDO + ! FSEUIL=AUX00*SEUIL + + TSTOT = 0. + TSDER = 0. + !======================================================================= + ACCMAX=0. + DO JF=JFMIN,JFMAX + SUME=SUM(F(:,JF))*DTH + SATVAL(JF) = SUME*FREQ(JF)**5 + ACCVAL = SUME*FREQ(JF)**4 + IF (ACCVAL.GT.ACCMAX) ACCMAX=ACCVAL + END DO + + + ! ================================================== + ! STARTS LOOP 1 OVER THE SELECTED CONFIGURATIONS + ! ================================================== + DO ICONF=1,NCONF + ! ---------selected configuration characteristics + JF1 =IDCONF(ICONF,1) + JT1 =IDCONF(ICONF,2) + IQ_OM2=IDCONF(ICONF,3) + ! + ! ---------Recovers V1**4=(f1/f0)**4 + V1_4 =TB_V14(JF1) + ! ---------Recovers the shift of the frequency index on f1 + IXF1 =K_IF1(JF1) + ! ---------Recovers the direction indexes for Delat1 + KT1P =K_1P(JT1,JF1) + KT1M =K_1M(JT1,JF1) + ! ---------Recovers V2**4=(f2/f0)**4 and V3**4=(f3/f0)**4 + V2_4 =TB_V24(IQ_OM2,JT1,JF1) + V3_4 =TB_V34(IQ_OM2,JT1,JF1) + ! ---------Recovers the frequency indexes shift on f2 and f3 + IXF2 =K_IF2 (IQ_OM2,JT1,JF1) + IXF3 =K_IF3 (IQ_OM2,JT1,JF1) + ! ---------Recovers the direction indexes shift + KT1P2P=K_1P2P(IQ_OM2,JT1,JF1) + KT1P2M=K_1P2M(IQ_OM2,JT1,JF1) + KT1P3P=K_1P3P(IQ_OM2,JT1,JF1) + KT1P3M=K_1P3M(IQ_OM2,JT1,JF1) + KT1M2P=K_1M2P(IQ_OM2,JT1,JF1) + KT1M2M=K_1M2M(IQ_OM2,JT1,JF1) + KT1M3P=K_1M3P(IQ_OM2,JT1,JF1) + KT1M3M=K_1M3M(IQ_OM2,JT1,JF1) + ! ---------Recovers the coupling coefficients + T2P3M =TB_TPM(IQ_OM2,JT1,JF1) + T2M3P =TB_TMP(IQ_OM2,JT1,JF1) + ! ---------Recovers the multiplicative factor of QNL4 + FACTOR=TB_FAC(IQ_OM2,JT1,JF1) + + ! = = = = = = = = = = = = = = = = = = = = = = = = = + ! STARTS LOOP 2 OVER THE SPECTRUM FREQUENCIES + ! = = = = = = = = = = = = = = = = = = = = = = = = = + DO JF=JFMIN,JFMAX + IF (SATVAL(JF).GT.GQTHRSAT) THEN + ! + !.........Recovers the coefficient for the coupling factor + !.........Computes the coupling coefficients for the case +Delta1 (SIG=1) + SCAL_T=TB_SCA(LBUF+JF)*FACTOR + T_2P3M=T2P3M*SCAL_T + T_2M3P=T2M3P*SCAL_T + ! + !.........Frequency indexes and coefficients + JFM0=F_POIN(JF+LBUF) + CF0 =F_COEF(JF+LBUF) + CP0 =F_PROJ(JF+LBUF) + JFM1=F_POIN(JF+IXF1) + CF1 =F_COEF(JF+IXF1) + CP1 =F_PROJ(JF+IXF1) + JFM2=F_POIN(JF+IXF2) + CF2 =F_COEF(JF+IXF2) + CP2 =F_PROJ(JF+IXF2) + JFM3=F_POIN(JF+IXF3) + CF3 =F_COEF(JF+IXF3) + CP3 =F_PROJ(JF+IXF3) + ! + ! ------------------------------------------------- + ! STARTS LOOP 3 OVER THE SPECTRUM DIRECTIONS + ! ------------------------------------------------- + DO JT=1,NT + ! + !...........Direction indexes + ! direct config (+delta1) (sig =1) + JT1P =T_POIN(JT+KT1P) + JT1P2P=T_POIN(JT+KT1P2P) + JT1P2M=T_POIN(JT+KT1P2M) + JT1P3P=T_POIN(JT+KT1P3P) + JT1P3M=T_POIN(JT+KT1P3M) + ! image config (-delta1) + JT1M =T_POIN(JT+KT1M) + JT1M2P=T_POIN(JT+KT1M2P) + JT1M2M=T_POIN(JT+KT1M2M) + JT1M3P=T_POIN(JT+KT1M3P) + JT1M3M=T_POIN(JT+KT1M3M) + ! + ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ! STARTS LOOP 4 OVER THE MESH NODES + ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ! + SP0=F(JT,JFM0)*CF0 + ! + ! IF (SP0.GT.FSEUIL) THEN + ! + ! Config. +Delta1 (SIG=1) + ! ======================= + !...............Computes the spectrum values in 1, 2, 3 + SP1P =F(JT1P ,JFM1)*CF1 + SP1P2P=F(JT1P2P,JFM2)*CF2 + SP1P3M=F(JT1P3M,JFM3)*CF3 + SP1P2M=F(JT1P2M,JFM2)*CF2 + SP1P3P=F(JT1P3P,JFM3)*CF3 + ! + !...............Computes auxiliary products and variables + AUX01=SP0*V1_4+SP1P + AUX02=SP0*SP1P + AUX03=SP1P2P*SP1P3M + AUX04=SP1P2P*V3_4+SP1P3M*V2_4 + AUX05=SP1P2M*SP1P3P + AUX06=SP1P2M*V3_4+SP1P3P*V2_4 + AUX07=AUX02*V3_4 + AUX08=AUX02*V2_4 + ! + !...............Computes the components of the transfer term + S_2P3M=AUX03*AUX01-AUX02*AUX04 + S_2M3P=AUX05*AUX01-AUX02*AUX06 + Q_2P3M=T_2P3M*S_2P3M + Q_2M3P=T_2M3P*S_2M3P + AUX00 =Q_2P3M+Q_2M3P + ! + !...............Computes the components of the derived terms (dQ/dF) + Q2PD0 =T_2P3M*(AUX03*V1_4 - SP1P*AUX04)*CF0 + Q2PD1 =T_2P3M*(AUX03 - SP0 *AUX04)*CF1 + Q2PD2P=T_2P3M*(AUX01*SP1P3M - AUX07 )*CF2 + Q2PD3M=T_2P3M*(AUX01*SP1P2P - AUX08 )*CF3 + Q2MD0 =T_2M3P*(AUX05*V1_4 - SP1P*AUX06)*CF0 + Q2MD1 =T_2M3P*(AUX03 - SP0 *AUX06)*CF1 + Q2MD2M=T_2M3P*(AUX01*SP1P3P - AUX07 )*CF2 + Q2MD3P=T_2M3P*(AUX01*SP1P2M - AUX08 )*CF3 + AUX09=Q2PD0+Q2MD0 + AUX10=Q2PD1+Q2MD1 + ! + !...............Sum of Qnl4 term in the table TSTOT + TSTOT(JT,JFM0 )=TSTOT(JT,JFM0 )+AUX00 *CP0 + TSTOT(JT1P,JFM1 )=TSTOT(JT1P,JFM1 )+AUX00 *CP1 + TSTOT(JT1P2P,JFM2)=TSTOT(JT1P2P,JFM2)-Q_2P3M*CP2 + TSTOT(JT1P2M,JFM2)=TSTOT(JT1P2M,JFM2)-Q_2M3P*CP2 + TSTOT(JT1P3M,JFM3)=TSTOT(JT1P3M,JFM3)-Q_2P3M*CP3 + TSTOT(JT1P3P,JFM3)=TSTOT(JT1P3P,JFM3)-Q_2M3P*CP3 + ! + !...............Sum of the term dQnl4/dF in the table TSDER + TSDER(JT,JFM0)=TSDER(JT,JFM0)+AUX09 *CP0 + TSDER(JT1P,JFM1)=TSDER(JT1P,JFM1)+AUX10 *CP1 + TSDER(JT1P2P,JFM2)=TSDER(JT1P2P,JFM2)-Q2PD2P*CP2 + TSDER(JT1P2M,JFM2)=TSDER(JT1P2M,JFM2)-Q2MD2M*CP2 + TSDER(JT1P3M,JFM3)=TSDER(JT1P3M,JFM3)-Q2PD3M*CP3 + TSDER(JT1P3P,JFM3)=TSDER(JT1P3P,JFM3)-Q2MD3P*CP3 +#ifdef W3_TGQM + ! Test output to set up triplet method ... + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT, JFM0,AUX00 *CP0, F(JT,JFM0),TSTOT(JT ,JFM0) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1P, JFM1,AUX00 *CP1, F(JT1P,JFM1),TSTOT(JT1P,JFM1) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1P2P,JFM2,-Q_2P3M*CP2,F(JT1P2P,JFM2),TSTOT(JT1P2P,JFM2) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1P2M,JFM2,-Q_2M3P*CP2,F(JT1P2M,JFM2),TSTOT(JT1P2M,JFM2) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1P3M,JFM2,-Q_2P3M*CP3,F(JT1P3M,JFM3),TSTOT(JT1P3M,JFM3) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1P3P,JFM2,-Q_2M3P*CP3,F(JT1P3P,JFM3),TSTOT(JT1P3P,JFM3) + TEMP=(TB_TPM(IQ_OM2,JT1,JF1)*(( F(JT1P2P,JFM2)*CF2 *F(JT1P3M,JFM3)*CF3)* & + (F(JT,JFM0 )*CF0*TB_V14(JF1)+F(JT1P ,JFM1)*CF1) & + -SP0*SP1P*(SP1P2P*V3_4+SP1P3M*V2_4))+T_2M3P*(AUX05*AUX01-AUX02*AUX06)) *CP0 + WRITE(995,'(5I3,3E12.3)') ICONF,JF,JT, F(JT,JFM0) + TEMP=(Q_2P3M+Q_2M3P) *CP1 + WRITE(995,'(5I3,3E12.3)') ICONF,JF,JT,JT1P, JFM1,AUX00 *CP1, F(JT1P,JFM1),TSTOT(JT1P,JFM1) + WRITE(995,'(5I3,3E12.3)') ICONF,JF,JT,JT1P2P,JFM2,-Q_2P3M*CP2,F(JT1P2P,JFM2),TSTOT(JT1P2P,JFM2) + WRITE(995,'(5I3,3E12.3)') ICONF,JF,JT,JT1P2M,JFM2,-Q_2M3P*CP2,F(JT1P2M,JFM2),TSTOT(JT1P2M,JFM2) + WRITE(995,'(5I3,3E12.3)') ICONF,JF,JT,JT1P3M,JFM2,-Q_2P3M*CP3,F(JT1P3M,JFM3),TSTOT(JT1P3M,JFM3) + WRITE(995,'(5I3,3E12.3)') ICONF,JF,JT,JT1P3P,JFM2,-Q_2M3P*CP3,F(JT1P3P,JFM3),TSTOT(JT1P3P,JFM3) +#endif + ! + ! Config. -Delta1 (SIG=-1) + ! ======================== + !...............Computes the spectrum values in 1, 2, 3 + SP1M =F(JT1M ,JFM1)*CF1 + SP1M2P=F(JT1M2P,JFM2)*CF2 + SP1M3M=F(JT1M3M,JFM3)*CF3 + SP1M2M=F(JT1M2M,JFM2)*CF2 + SP1M3P=F(JT1M3P,JFM3)*CF3 + ! + !...............Computes auxiliary products and variables + AUX01=SP0*V1_4+SP1M + AUX02=SP0*SP1M + AUX03=SP1M2P*SP1M3M + AUX04=SP1M2P*V3_4+SP1M3M*V2_4 + AUX05=SP1M2M*SP1M3P + AUX06=SP1M2M*V3_4+SP1M3P*V2_4 + AUX07=AUX02*V3_4 + AUX08=AUX02*V2_4 + ! + !...............Computes the transfer term components + S_2P3M=AUX03*AUX01-AUX02*AUX04 + S_2M3P=AUX05*AUX01-AUX02*AUX06 + Q_2P3M=T_2M3P*S_2P3M + Q_2M3P=T_2P3M*S_2M3P + AUX00 =Q_2P3M+Q_2M3P ! Same as in +Delta1, can be commented out + ! + !...............Computes the derived terms components (dQ/dF) + Q2PD0 =T_2P3M*(AUX03*V1_4 - SP1M*AUX04)*CF0 + Q2PD1 =T_2P3M*(AUX03 - SP0 *AUX04)*CF1 + Q2PD2P=T_2P3M*(AUX01*SP1M3M - AUX07 )*CF2 + Q2PD3M=T_2P3M*(AUX01*SP1M2P - AUX08 )*CF3 + Q2MD0 =T_2M3P*(AUX05*V1_4 - SP1M*AUX06)*CF0 + Q2MD1 =T_2M3P*(AUX03 - SP0 *AUX06)*CF1 + Q2MD2M=T_2M3P*(AUX01*SP1M3P - AUX07 )*CF2 + Q2MD3P=T_2M3P*(AUX01*SP1M2M - AUX08 )*CF3 + AUX09=Q2PD0+Q2MD0 + AUX10=Q2PD1+Q2MD1 + ! + !...............Sum of Qnl4 term in the table TSTOT + TSTOT(JT ,JFM0)=TSTOT(JT ,JFM0)+AUX00 *CP0 + TSTOT(JT1M ,JFM1)=TSTOT(JT1M ,JFM1)+AUX00 *CP1 + TSTOT(JT1M2P,JFM2)=TSTOT(JT1M2P,JFM2)-Q_2P3M*CP2 + TSTOT(JT1M2M,JFM2)=TSTOT(JT1M2M,JFM2)-Q_2M3P*CP2 + TSTOT(JT1M3M,JFM3)=TSTOT(JT1M3M,JFM3)-Q_2P3M*CP3 + TSTOT(JT1M3P,JFM3)=TSTOT(JT1M3P,JFM3)-Q_2M3P*CP3 + ! + !...............Sum of the term dQnl4/dF in the table TSDER + TSDER(JT ,JFM0)=TSDER(JT ,JFM0)+AUX09 *CP0 + TSDER(JT1M ,JFM1)=TSDER(JT1M ,JFM1)+AUX10 *CP1 + TSDER(JT1M2P,JFM2)=TSDER(JT1M2P,JFM2)-Q2PD2P*CP2 + TSDER(JT1M2M,JFM2)=TSDER(JT1M2M,JFM2)-Q2MD2M*CP2 + TSDER(JT1M3M,JFM3)=TSDER(JT1M3M,JFM3)-Q2PD3M*CP3 + TSDER(JT1M3P,JFM3)=TSDER(JT1M3P,JFM3)-Q2MD3P*CP3 + ! +#ifdef W3_TGQM + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT, JFM0,AUX00 *CP0, F(JT,JFM0),TSTOT(JT ,JFM0) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1M, JFM1,AUX00 *CP1, F(JT1M,JFM1),TSTOT(JT1M,JFM1) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1M2P,JFM2,-Q_2P3M*CP2,F(JT1M2P,JFM2),TSTOT(JT1M2P,JFM2) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1M2M,JFM2,-Q_2M3P*CP2,F(JT1M2M,JFM2),TSTOT(JT1M2M,JFM2) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1M3M,JFM2,-Q_2P3M*CP3,F(JT1M3M,JFM3),TSTOT(JT1M3M,JFM3) + WRITE(994,'(5I3,3E12.3)') ICONF,JF,JT,JT1M3P,JFM2,-Q_2M3P*CP3,F(JT1M3P,JFM3),TSTOT(JT1M3P,JFM3) +#endif + ! + ! ENDIF ! this was the test on SEUIL + ! + ENDDO + ! ------------------------------------------------- + ! END OF LOOP 3 OVER THE SPECTRUM DIRECTIONS + ! ------------------------------------------------- + ! + ENDIF ! End of test on saturation level + ENDDO + ! = = = = = = = = = = = = = = = = = = = = = = = = = + ! END OF LOOP 2 OVER THE SPECTRUM FREQUENCIES + ! = = = = = = = = = = = = = = = = = = = = = = = = = + ! + ENDDO + ! ================================================== + ! END OF LOOP 1 OVER THE SELECTED CONFIGURATIONS + ! ================================================== + ! Applying WAM DEPTH SCALING ! to be added later ... + ! CALL q_dscale(F,WN,SIG,DTH,NK,NTH,DEPTH,q_dfac) + q_dfac=1 + + ! Amplification inspired by Lavrenov 2001, eq 10. + AMPFAC=GQAMP(4)*MIN(MAX(ACCMAX/GQAMP(2),1.)**GQAMP(1),GQAMP(3)) + !WRITE(991,*) ACCMAX,q_dfac,AMPFAC,GQAMP(1:3),SATVAL(10),SATVAL(30) + + ! Replacing Double Precision with Simple Real and scaling + TSTOTn = TSTOT*q_dfac*AMPFAC + TSDERn = TSDER*q_dfac*AMPFAC + + + ! Converting Snl(theta,f) to Snl(theta,k)/sigma + DO ITH = 1,NT + DO IK = 1,NF + TSTOTn(ITH,IK) = TSTOTn(ITH,IK)*CG(IK)/(TPI*SIG(IK)) + ENDDO + ENDDO + !CLOSE(994) + !STOP + END SUBROUTINE W3SNLGQM + + !/ ------------------------------------------------------------------- / + FUNCTION COUPLE(XK1 ,YK1 ,XK2 ,YK2 ,XK3 ,YK3 ,XK4 ,YK4) + !/ + !/ +-----------------------------------+ + !/ | WAVEWATCH III NOAA/NCEP | + !/ | M. Benoit & E. Gagnaire-Renou | + !/ | Last update : 20-Nov-2022 | + !/ +-----------------------------------+ + !/ + !/ 19-Nov-2022 : Transfer from TOMAWAC code ( version 7.xx ) + !/ + ! 1. Purpose : + ! + ! Computes the 4-wave coupling coefficient used in Snl4 + ! + ! 2. Method : + ! + ! Uses theoretical expression by Webb (1978) + ! + ! 3. Parameters : + ! + ! Parameter list + ! ---------------------------------------------------------------- + ! XK1 Real I x component of k1 wavenumber ... + ! ---------------------------------------------------------------- + ! + ! 5. Called by : + ! + ! Name Type Module Description + ! ---------------------------------------------------------------- + ! INNSLGQM Subr. W3SNL2 Prepares source term integration. + ! ---------------------------------------------------------------- + ! + ! 6. Error messages : + ! + ! None. + ! + ! 10. Source code : + ! + !/ ------------------------------------------------------------------- / + USE CONSTANTS, ONLY: GRAV + ! + DOUBLE PRECISION, INTENT(IN) :: XK1 , YK1 , XK2 , YK2 + DOUBLE PRECISION, INTENT(IN) :: XK3 , YK3 + DOUBLE PRECISION, INTENT(IN) :: XK4 , YK4 + DOUBLE PRECISION COUPLE + ! + !.....LOCAL VARIABLES + ! """""""""""""""""" + DOUBLE PRECISION RK1 , RK2 , RK3 , RK4 , WK1 , WK2 + DOUBLE PRECISION WK3 , WK4 , S12 , S13 , S14 , S23 + DOUBLE PRECISION S24 , S34 , W1P2 , Q12 , W1M3 , Q13 + DOUBLE PRECISION W1M4 , Q14 , DDD , COEF , DENO13, NUME13 + DOUBLE PRECISION DENO14, NUME14, ZERO, PI + + ! + PI = ACOS(-1.) + COEF=PI*GRAV*GRAV/4.D0 + ZERO=1.D-10 + ! + RK1=SQRT(XK1*XK1+YK1*YK1) + RK2=SQRT(XK2*XK2+YK2*YK2) + RK3=SQRT(XK3*XK3+YK3*YK3) + RK4=SQRT(XK4*XK4+YK4*YK4) + ! + WK1=SQRT(RK1) + WK2=SQRT(RK2) + WK3=SQRT(RK3) + WK4=SQRT(RK4) + ! + S12=XK1*XK2+YK1*YK2 + S13=XK1*XK3+YK1*YK3 + S14=XK1*XK4+YK1*YK4 + S23=XK2*XK3+YK2*YK3 + S24=XK2*XK4+YK2*YK4 + S34=XK3*XK4+YK3*YK4 + ! + W1P2=SQRT((XK1+XK2)*(XK1+XK2)+(YK1+YK2)*(YK1+YK2)) + W1M3=SQRT((XK1-XK3)*(XK1-XK3)+(YK1-YK3)*(YK1-YK3)) + W1M4=SQRT((XK1-XK4)*(XK1-XK4)+(YK1-YK4)*(YK1-YK4)) + Q12=(WK1+WK2)*(WK1+WK2) + Q13=(WK1-WK3)*(WK1-WK3) + Q14=(WK1-WK4)*(WK1-WK4) + ! + !.....COMPUTES THE D COEFFICIENT OF WEBB (1978) + ! """""""""""""""""""""""""""""""""""""" + DDD=2.00D0*Q12*(RK1*RK2-S12)*(RK3*RK4-S34)/(W1P2-Q12) & + +0.50D0*(S12*S34+S13*S24+S14*S23) & + +0.25D0*(S13+S24)*Q13*Q13 & + -0.25D0*(S12+S34)*Q12*Q12 & + +0.25D0*(S14+S23)*Q14*Q14 & + +2.50D0*RK1*RK2*RK3*RK4 & + +Q12*Q13*Q14*(RK1+RK2+RK3+RK4) + + DENO13=W1M3-Q13 + NUME13=2.00D0*Q13*(RK1*RK3+S13)*(RK2*RK4+S24) + IF (ABS(DENO13).LT.ZERO) THEN + IF (ABS(NUME13).LT.ZERO) THEN + WRITE(*,*) 'W3SNL2 error for coupling coefficient : (1-3) 0/0 !' + ELSE + WRITE(*,*) 'W3SNL2 error for coupling coefficient : (1-3) inifinte value' + ENDIF + WRITE(*,*) 'W3SNL2 error for coupling coefficient : (1-3) term not used' + ELSE + DDD=DDD+NUME13/DENO13 + ENDIF + DENO14=W1M4-Q14 + NUME14=2.00D0*Q14*(RK1*RK4+S14)*(RK2*RK3+S23) + IF (ABS(DENO14).LT.ZERO) THEN + IF (ABS(NUME14).LT.ZERO) THEN + WRITE(*,*) 'W3SNL2 error for coupling coefficient : (1-4) 0/0 !' + ELSE + WRITE(*,*) 'W3SNL2 error for coupling coefficient : (1-4) inifinte value' + ENDIF + WRITE(*,*) 'W3SNL2 error for coupling coefficient : (1-4) term not used' + ELSE + DDD=DDD+NUME14/DENO14 + ENDIF + + COUPLE=COEF*DDD*DDD/(WK1*WK2*WK3*WK4) + ! RETURN + END FUNCTION COUPLE + + !/ ------------------------------------------------------------------- / + SUBROUTINE GAULEG (W_LEG ,X_LEG ,NPOIN) + !/ ------------------------------------------------------------------- / + !.....VARIABLES IN ARGUMENT + ! """""""""""""""""""" + INTEGER , INTENT(IN) :: NPOIN + DOUBLE PRECISION ,INTENT(INOUT) :: W_LEG(NPOIN) , X_LEG(NPOIN) + ! + !.....LOCAL VARIABLES + ! """"""""""""""""" + INTEGER I, M, J + DOUBLE PRECISION EPS, Z, P1, P2, P3, PP, Z1, PI + PARAMETER (EPS=3.D-14) + ! + PI = ACOS(-1.) + M=(NPOIN+1)/2 + DO I=1,M + Z=COS(PI*(DBLE(I)-0.25D0)/(DBLE(NPOIN)+0.5D0)) +1 CONTINUE + P1=1.0D0 + P2=0.0D0 + DO J=1,NPOIN + P3=P2 + P2=P1 + P1=((2.D0*DBLE(J)-1.D0)*Z*P2-(DBLE(J)-1.D0)*P3)/DBLE(J) + ENDDO + PP=DBLE(NPOIN)*(Z*P1-P2)/(Z*Z-1.D0) + Z1=Z + Z=Z-P1/PP + IF (ABS(Z-Z1).GT.EPS) GOTO 1 + X_LEG(I)=-Z + X_LEG(NPOIN+1-I)=Z + W_LEG(I)=2.D0/((1.D0-Z**2)*PP**2) + W_LEG(NPOIN+1-I)=W_LEG(I) + ENDDO + END SUBROUTINE GAULEG + + !/ ------------------------------------------------------------------- / + SUBROUTINE F1F1F1(F1SF,NF1,IQ_OM1) + ! TOMAWAC V6P3 15/06/2011 + !*********************************************************************** + ! + !brief SUBROUTINE CALLED BY PRENL3 + !+ COMPUTES VALUES OF RATIO F1/F AS FUNCTION OF THE IQ_OM1 + !+ INDICATOR + ! + !history E. GAGNAIRE-RENOU + !+ 04/2011 + !+ V6P1 + !+ CREATED + ! + !history G.MATTAROLO (EDF - LNHE) + !+ 15/06/2011 + !+ V6P1 + !+ Translation of French names of the variables in argument + ! + !history E. GAGNAIRE-RENOU + !+ 12/03/2013 + !+ V6P3 + !+ Better formatted: WRITE(LU,*), etc. + !/ ------------------------------------------------------------------- / + IMPLICIT NONE + INTEGER, INTENT(IN) :: IQ_OM1 + INTEGER, INTENT(INOUT) :: NF1 + DOUBLE PRECISION, INTENT(INOUT) :: F1SF(*) + ! + INTEGER I,M + DOUBLE PRECISION RAISON + ! + IF(IQ_OM1.EQ.1) THEN + IF(NF1.NE.14) THEN + WRITE(*,*) '#1 Incorrect value for NF1',NF1 + ENDIF + F1SF( 1)=0.30D0 + F1SF( 2)=0.40D0 + F1SF( 3)=0.50D0 + F1SF( 4)=0.60D0 + F1SF( 5)=0.70D0 + F1SF( 6)=0.80D0 + F1SF( 7)=0.90D0 + F1SF( 8)=1.00D0 + F1SF( 9)=1.11D0 + F1SF(10)=1.25D0 + F1SF(11)=1.42D0 + F1SF(12)=1.67D0 + F1SF(13)=2.00D0 + F1SF(14)=2.50D0 + F1SF(15)=3.30D0 + ELSEIF(IQ_OM1.EQ.2) THEN + IF (NF1.NE.26) THEN + WRITE(*,*) '#2 Incorrect value for NF1', NF1 + ENDIF + F1SF( 1)=0.32D0 + F1SF( 2)=0.35D0 + F1SF( 3)=0.39D0 + F1SF( 4)=0.44D0 + F1SF( 5)=0.50D0 + F1SF( 6)=0.56D0 + F1SF( 7)=0.63D0 + F1SF( 8)=0.70D0 + F1SF( 9)=0.78D0 + F1SF(10)=0.86D0 + F1SF(11)=0.92D0 + F1SF(12)=0.97D0 + F1SF(13)=1.00D0 + F1SF(14)=1.03D0 + F1SF(15)=1.08D0 + F1SF(16)=1.13D0 + F1SF(17)=1.20D0 + F1SF(18)=1.28D0 + F1SF(19)=1.37D0 + F1SF(20)=1.48D0 + F1SF(21)=1.50D0 + F1SF(22)=1.65D0 + F1SF(23)=1.85D0 + F1SF(24)=2.10D0 + F1SF(25)=2.40D0 + F1SF(26)=2.70D0 + F1SF(27)=3.20D0 + ELSEIF(IQ_OM1.EQ.3) THEN + IF(NF1.NE.11) THEN + WRITE(*,*) 'Incorrect value for NF1', NF1 + ENDIF + F1SF( 1)=0.30D0 + F1SF( 2)=0.48D0 + F1SF( 3)=0.64D0 + F1SF( 4)=0.78D0 + F1SF( 5)=0.90D0 + F1SF( 6)=1.00D0 + F1SF( 7)=1.12D0 + F1SF( 8)=1.28D0 + F1SF( 9)=1.50D0 + F1SF(10)=1.80D0 + F1SF(11)=2.40D0 + F1SF(12)=3.40D0 + ELSEIF(IQ_OM1.EQ.4) THEN + IF(NF1.NE.40) THEN + WRITE(*,*) 'Incorrect value for NF1', NF1 + ENDIF + NF1=20 + M=10 + RAISON=9.D0**(1.D0/DBLE(NF1)) + F1SF(M+1)=1.0D0/3.0D0 + NF1=2*M+NF1 + DO I=M+2,NF1+1 + F1SF(I)=F1SF(I-1)*RAISON + ENDDO + DO I=M,1,-1 + F1SF(I)=F1SF(I+1)/RAISON + ENDDO + ELSEIF(IQ_OM1.EQ.5) THEN + RAISON=9.D0**(1.D0/DBLE(NF1)) + F1SF(1)=1.D0/3.D0 + DO I=2,NF1+1 + F1SF(I)=F1SF(I-1)*RAISON + ENDDO + ELSEIF(IQ_OM1.EQ.6) THEN + RAISON=(3.D0-1.D0/3.D0)/DBLE(NF1) + F1SF(1)=1.D0/3.D0 + DO I=2,NF1+1 + F1SF(I)=F1SF(I-1)+RAISON + ENDDO + ELSEIF(IQ_OM1.EQ.7) THEN + IF(NF1.NE.20) THEN + WRITE(*,*) 'Incorrect value for NF1', NF1 + ENDIF + F1SF( 1)=1.D0/3.D0 + F1SF( 2)=0.40D0 + F1SF( 3)=0.46D0 + F1SF( 4)=0.52D0 + F1SF( 5)=0.60D0 + F1SF( 6)=0.70D0 + F1SF( 7)=0.79D0 + F1SF( 8)=0.86D0 + F1SF( 9)=0.92D0 + F1SF(10)=0.97D0 + F1SF(11)=1.00D0 + F1SF(12)=1.04D0 + F1SF(13)=1.10D0 + F1SF(14)=1.18D0 + F1SF(15)=1.28D0 + F1SF(16)=1.42D0 + F1SF(17)=1.60D0 + F1SF(18)=1.84D0 + F1SF(19)=2.14D0 + F1SF(20)=2.52D0 + F1SF(21)=3.00D0 + ENDIF + ! + END SUBROUTINE F1F1F1 + !/ ------------------------------------------------------------------- / + SUBROUTINE INSNLGQM + !/ + !/ +-----------------------------------+ + !/ | WAVEWATCH III NOAA/NCEP | + !/ | E. Gagnaire-Renou & | + !/ | M. Benoit | + !/ | S. Mostafa Siadatamousavi | + !/ | M. Beyramzadeh | + !/ | FORTRAN 90 | + !/ | Last update : 20-Nov-2022 | + !/ +-----------------------------------+ + !/ + !/ 20-Nov-2022 : Merging with NL2 in WW3. ( version 7.00 ) + !/ + ! 1. Purpose : + ! + ! Preprocessing for nonlinear interactions (Xnl). + ! + ! 2. Method : + ! + ! See Xnl documentation. + ! + ! 3. Parameters : + ! + ! 4. Subroutines used : + ! + ! Name Type Module Description + ! ---------------------------------------------------------------- + ! STRACE Subr. W3SERVMD Subroutine tracing. + ! Subr. GAULEG Gauss-Legendre weights + ! xnl_init Subr. m_constants Xnl initialization routine. + ! ---------------------------------------------------------------- + ! + ! 5. Called by : + ! + ! Name Type Module Description + ! ---------------------------------------------------------------- + ! W3IOGR Subr. W3IOGRMD Model definition file management. + ! ---------------------------------------------------------------- + ! + ! 6. Error messages : + ! + ! 7. Remarks : + ! + ! 8. Structure : + ! + ! - See source code. + ! + ! 9. Switches : + ! + ! !/S Enable subroutine tracing. + ! + ! 10. Source code : + ! + !/ ------------------------------------------------------------------- / + USE CONSTANTS, ONLY: GRAV + USE W3GDATMD, ONLY: NK , NTH , XFR , FR1, GQNF1, GQNT1, GQNQ_OM2, NLTAIL, GQTHRCOU + +#ifdef W3_S + CALL STRACE (IENT, 'INSNLGQM') +#endif + !.....LOCAL VARIABLES + INTEGER JF , JT , JF1 , JT1 , NF1P1 , IAUX , NT , NF , IK + INTEGER IQ_TE1 , IQ_OM2 , LBUF , DIMBUF , IQ_OM1 , NQ_TE1 , NCONFM + + DOUBLE PRECISION EPSI_A, AUX , CCC , DENO , AAA , DP2SG , TAILF + DOUBLE PRECISION V1 , V1_4 , DV1 , DTETAR , ELIM , RAISF + DOUBLE PRECISION V2 , V2_4 , V3 , V3_4 + DOUBLE PRECISION W2 , W2_M , W2_1 , W_MIL , W_RAD + DOUBLE PRECISION RK0 , XK0 , YK0 , RK1 , XK1 , YK1 + DOUBLE PRECISION RK2 , XK2P , YK2P , XK2M , YK2M + DOUBLE PRECISION RK3 , XK3P , YK3P , XK3M , YK3M + DOUBLE PRECISION D01P , C_D01P, S_D01P, D0AP , C_D0AP, S_D0AP + DOUBLE PRECISION GA2P , C_GA2P, S_GA2P, GA3P , C_GA3P, S_GA3P, TWOPI, PI, SEUIL1 , SEUIL2 , SEUIL + ! + !.....Variables related to the Gaussian quadratures + DOUBLE PRECISION W_CHE_TE1, W_CHE_OM2, C_LEG_OM2 + ! + !.....Variables related to the configuration selection + DOUBLE PRECISION TEST1 , TEST2 + DOUBLE PRECISION :: FREQ(NK) + DOUBLE PRECISION, ALLOCATABLE :: F1SF(:) , X_CHE_TE1(:) , X_CHE_OM2(:) , X_LEG_OM2(:) , W_LEG_OM2(:) & + , MAXCLA(:) + + PI = Acos(-1.) + LBUF = 500 + DIMBUF = 2*LBUF+200 + TWOPI = 2.*PI + ! + ! Defines some threshold values for filtering (See Gagnaire-Renou Thesis, p 52) + ! + SEUIL1 = 1E10 + SEUIL2 = GQTHRCOU + + IF(GQNF1.EQ.14) IQ_OM1=1 + IF(GQNF1.EQ.26) IQ_OM1=2 + IF(GQNF1.EQ.11) IQ_OM1=3 + IF(GQNF1.EQ.40) IQ_OM1=4 + IF(GQNF1.EQ.11) IQ_OM1=3 + IF(GQNF1.EQ.40) IQ_OM1=4 + IF(GQNF1.EQ.20) IQ_OM1=7 + ! + ! Note by FA: not sure what the 5 and 6 cases correspond to + ! + NQ_TE1 = GQNT1/2 + NCONFM = GQNF1*GQNT1*GQNQ_OM2 + + RAISF = XFR + NT = NTH + NF = NK + DTETAR = TWOPI/DBLE(NT) + + DO IK = 1,NK + FREQ(IK) = FR1*RAISF**(IK-1) + ENDDO + + TAILF = -NLTAIL + + !===============ALLOCATE MATRICES============================================= + if (Allocated(K_IF2) ) then + deallocate(K_IF2) + endif + ALLOCATE(K_IF2(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_IF3) ) then + deallocate(K_IF3) + endif + ALLOCATE(K_IF3(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_1P2P) ) then + deallocate(K_1P2P) + endif + ALLOCATE(K_1P2P(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_1P3M) ) then + deallocate(K_1P3M) + endif + ALLOCATE(K_1P3M(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_1P2M) ) then + deallocate(K_1P2M) + endif + ALLOCATE(K_1P2M(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_1P3P) ) then + deallocate(K_1P3P) + endif + ALLOCATE(K_1P3P(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_1M2P) ) then + deallocate(K_1M2P) + endif + ALLOCATE(K_1M2P(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_1M3M) ) then + deallocate(K_1M3M) + endif + ALLOCATE(K_1M3M(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_1M2M) ) then + deallocate(K_1M2M) + endif + ALLOCATE(K_1M2M(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_1M3P) ) then + deallocate(K_1M3P) + endif + ALLOCATE(K_1M3P(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(TB_V24) ) then + deallocate(TB_V24) + endif + ALLOCATE(TB_V24(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(TB_V34) ) then + deallocate(TB_V34) + endif + ALLOCATE(TB_V34(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(TB_TPM) ) then + deallocate(TB_TPM) + endif + ALLOCATE(TB_TPM(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(TB_TMP) ) then + deallocate(TB_TMP) + endif + ALLOCATE(TB_TMP(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(TB_FAC) ) then + deallocate(TB_FAC) + endif + ALLOCATE(TB_FAC(GQNQ_OM2,GQNT1,GQNF1)) + + if (Allocated(K_IF1) ) then + deallocate(K_IF1) + endif + ALLOCATE(K_IF1(GQNF1)) + + if (Allocated(K_1P) ) then + deallocate(K_1P) + endif + ALLOCATE(K_1P(GQNT1,GQNF1)) + + if (Allocated(K_1M) ) then + deallocate(K_1M) + endif + ALLOCATE(K_1M(GQNT1,GQNF1)) + + if (Allocated(TB_V14) ) then + deallocate(TB_V14) + endif + ALLOCATE(TB_V14(GQNF1)) + + if (Allocated(IDCONF) ) then + deallocate(IDCONF) + endif + ALLOCATE(IDCONF(NCONFM,3)) + + !======================================================================= + ! INITIALISATION OF AUXILIAIRY TABLES FOR SPECTRUM INTERPOLATION + !======================================================================= + if (Allocated(F_POIN) ) then + deallocate(F_POIN) + endif + ALLOCATE(F_POIN(DIMBUF)) + + if (Allocated(T_POIN) ) then + deallocate(T_POIN) + endif + ALLOCATE(T_POIN(DIMBUF)) + + if (Allocated(F_COEF) ) then + deallocate(F_COEF) + endif + ALLOCATE(F_COEF(DIMBUF)) + + if (Allocated(F_PROJ) ) then + deallocate(F_PROJ) + endif + ALLOCATE(F_PROJ(DIMBUF)) + + if (Allocated(TB_SCA) ) then + deallocate(TB_SCA) + endif + ALLOCATE(TB_SCA(DIMBUF)) + + + F_POIN(:)=0 + T_POIN(:)=0 + F_COEF(:)=0.D0 + F_PROJ(:)=0.D0 + TB_SCA(:)=0.0D0 + + DO JF=1,LBUF + F_POIN(JF)=1 + F_COEF(JF)=0.0D0 + F_PROJ(JF)=0.0D0 + ENDDO + DO JF=1,NF + IAUX=LBUF+JF + F_POIN(IAUX)=JF + F_COEF(IAUX)=1.0D0 + F_PROJ(IAUX)=1.0D0 + ENDDO + AUX=1.D0/RAISF**TAILF + DO JF=1,LBUF + IAUX=LBUF+NF+JF + F_POIN(IAUX)=NF + F_COEF(IAUX)=AUX**JF + F_PROJ(IAUX)=0.0D0 + ENDDO + ! + DO JT=LBUF,1,-1 + T_POIN(JT)=NT-MOD(LBUF-JT,NT) + ENDDO + DO JT=1,NT + T_POIN(LBUF+JT)=JT + ENDDO + DO JT=1,LBUF + T_POIN(LBUF+NT+JT)=MOD(JT-1,NT)+1 + ENDDO + !====================================================================== + ! + !======================================================================= + ! COMPUTES SCALE COEFFICIENTS FOR THE COUPLING COEFFICIENT + ! Would be easier to pass these on from W3SRCE ??? + !======================================================================= + DP2SG=TWOPI*TWOPI/GRAV + DO JF=1,LBUF + AUX=FREQ(1)/RAISF**(LBUF-JF+1) + TB_SCA(JF)=(DP2SG*AUX**2)**6/(TWOPI**3*AUX) + ENDDO + DO JF=1,NF + TB_SCA(LBUF+JF)=(DP2SG*FREQ(JF)**2)**6/(TWOPI**3*FREQ(JF)) + ENDDO + DO JF=1,LBUF + IAUX=LBUF+NF+JF + AUX=FREQ(NF)*RAISF**JF + TB_SCA(IAUX)=(DP2SG*AUX**2)**6/(TWOPI**3*AUX) + ENDDO + !======================================================================= + ! + !======================================================================= + ! COMPUTES VALUES FOR GAUSSIAN QUADRATURES + !======================================================================= + if (Allocated(X_CHE_TE1) ) then + deallocate(X_CHE_TE1) + endif + ALLOCATE(X_CHE_TE1(1:NQ_TE1),X_CHE_OM2(1:GQNQ_OM2)) + + if (Allocated(X_LEG_OM2) ) then + deallocate(X_LEG_OM2) + endif + ALLOCATE(X_LEG_OM2(1:GQNQ_OM2),W_LEG_OM2(1:GQNQ_OM2)) + ! + !.....Abscissa and weight (constant) for Gauss-Chebyshev + DO IQ_TE1=1,NQ_TE1 + X_CHE_TE1(IQ_TE1)=COS(PI*(DBLE(IQ_TE1)-0.5D0)/DBLE(NQ_TE1)) + ENDDO + W_CHE_TE1=PI/DBLE(NQ_TE1) + DO IQ_OM2=1,GQNQ_OM2 + X_CHE_OM2(IQ_OM2)=COS(PI*(DBLE(IQ_OM2)-0.5D0)/DBLE(GQNQ_OM2)) + ENDDO + W_CHE_OM2=PI/DBLE(GQNQ_OM2) + ! + !.....Abscissa et weight for Gauss-Legendre + CALL GAULEG( W_LEG_OM2 , X_LEG_OM2 , GQNQ_OM2 ) + DO IQ_OM2=1,GQNQ_OM2 + X_LEG_OM2(IQ_OM2)=0.25D0*(1.D0+X_LEG_OM2(IQ_OM2))**2 + ENDDO + !======================================================================= + ! + ! + !======================================================================= + ! COMPUTES VALUES OF RATIO F1/F AS FUNCTION OF THE IQ_OM1 INDICATOR + !======================================================================= + NF1P1=GQNF1+1 + if (Allocated(F1SF) ) then + deallocate(F1SF) + endif + ALLOCATE(F1SF(1:NF1P1)) + + CALL F1F1F1 ( F1SF , GQNF1 , IQ_OM1) + !======================================================================= + ! + ! ================================================== + ! STARTS LOOP 1 OVER THE RATIOS F1/F0 + ! ================================================== + DO JF1=1,GQNF1 + ! ---------Computes and stores v1=f1/f0 and v1**4 + V1=(F1SF(JF1+1)+F1SF(JF1))/2.D0 + K_IF1(JF1)=NINT(DBLE(LBUF)+LOG(V1)/LOG(RAISF)) + V1_4=V1**4 + TB_V14(JF1)=V1_4 + ! ---------Computes and stores dv1=df1/f0 + DV1=F1SF(JF1+1)-F1SF(JF1) + ! ---------Computes the A parameter + AAA=((1.D0+V1)**4-4.D0*(1.D0+V1_4))/(8.D0*V1**2) + ! + ! ================================================= + ! STARTS LOOP 2 OVER THE DELTA_1+ VALUES + ! ================================================= + DO JT1=1,GQNT1 + ! + !......Computes the Delta1+ values (=Theta_1-Theta_0) between 0 and Pi. + IF (JT1.LE.NQ_TE1) THEN + ! ---------First interval : X from -1 to A + IQ_TE1=JT1 + C_D01P=(-1.D0+AAA)/2.D0+(1.D0+AAA)/2.D0*X_CHE_TE1(IQ_TE1) + CCC=DV1*SQRT((AAA-C_D01P)/(1.D0-C_D01P))*W_CHE_TE1 + ELSE + ! ---------Second interval : X from A to 1 + IQ_TE1=JT1-NQ_TE1 + C_D01P=( 1.D0+AAA)/2.D0+(1.D0-AAA)/2.D0*X_CHE_TE1(IQ_TE1) + CCC=DV1*SQRT((C_D01P-AAA)/(1.D0+C_D01P))*W_CHE_TE1 + ENDIF + S_D01P=SQRT(1.D0-C_D01P*C_D01P) + D01P =ACOS(C_D01P) + K_1P(JT1,JF1)=LBUF+NINT(D01P/DTETAR) + K_1M(JT1,JF1)=LBUF-NINT(D01P/DTETAR) + ! + ! ---------Computes Epsilon_a + EPSI_A=2.D0*SQRT(1.D0+V1_4+2.D0*V1*V1*C_D01P)/(1.D0+V1)**2 + ! ---------Computes Delta_A+ and its cosinus + C_D0AP=(1.D0-V1_4+0.25D0*EPSI_A**2*(1.D0+V1)**4) & + /(EPSI_A*(1.D0+V1)**2) + S_D0AP=SQRT(1.0D0-C_D0AP*C_D0AP) + D0AP = ACOS(C_D0AP) + ! + !.......Integration over OMEGA2 depending on EPS_A + IF (EPSI_A.LT.1.D0) THEN + ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - + !........Case of a single singularity (in OMEGA2-) + ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - + W2_M=0.5D0*(1.D0-EPSI_A/2.D0) + W2_1=0.5D0 + ! + W_RAD=W2_1-W2_M + C_LEG_OM2=SQRT(W_RAD) + ! + ! ---------------------------------------------------- + !........STARTS LOOP 3 OVER OMEGA_2 (CASE Epsilon_A < 1) + !........Case of a single singularity (in OMEGA2-) + !........Integration over OMEGA2 via GAUSS-LEGENDRE quadrature + ! ---------------------------------------------------- + DO IQ_OM2=1,GQNQ_OM2 + ! ---------Computes W2, V2, and V3 + W2=W2_M+W_RAD*X_LEG_OM2(IQ_OM2) + V2=W2*(1.D0+V1) + V2_4=V2**4 + TB_V24(IQ_OM2,JT1,JF1)=V2_4 + K_IF2 (IQ_OM2,JT1,JF1) = NINT(DBLE(LBUF) & + + LOG(V2)/LOG(RAISF)) + V3=1.D0+V1-V2 + V3_4=V3**4 + TB_V34(IQ_OM2,JT1,JF1)=V3_4 + K_IF3 (IQ_OM2,JT1,JF1) = NINT(DBLE(LBUF) & + + LOG(V3)/LOG(RAISF)) + ! ---------Computes Gamma_2+ et Gamma_3+ angles + C_GA2P=(EPSI_A**2/4.D0+W2**4-(1.D0-W2)**4)/(EPSI_A*W2*W2) + C_GA2P=MAX(MIN(C_GA2P,1.D0),-1.D0) + S_GA2P=SQRT(1.D0-C_GA2P*C_GA2P) + GA2P =ACOS(C_GA2P) + C_GA3P=(EPSI_A**2/4.D0-W2**4+(1.D0-W2)**4)/EPSI_A & + /(1.D0-W2)**2 + C_GA3P=MAX(MIN(C_GA3P,1.D0),-1.D0) + S_GA3P=SQRT(1.D0-C_GA3P*C_GA3P) + GA3P =ACOS(C_GA3P) + ! Shifting of the direction indexes - Config. +Delta1 (SIG=1) + K_1P2P(IQ_OM2,JT1,JF1)=NINT(( D0AP+GA2P)/DTETAR & + +DBLE(LBUF)) + K_1P3M(IQ_OM2,JT1,JF1)=NINT(( D0AP-GA3P)/DTETAR & + +DBLE(LBUF)) + K_1P2M(IQ_OM2,JT1,JF1)=NINT(( D0AP-GA2P)/DTETAR & + +DBLE(LBUF)) + K_1P3P(IQ_OM2,JT1,JF1)=NINT(( D0AP+GA3P)/DTETAR & + +DBLE(LBUF)) + ! Shifting of the direction indexes - Config. -Delta1 (SIG=-1) + K_1M2P(IQ_OM2,JT1,JF1)=NINT((-D0AP+GA2P)/DTETAR & + +DBLE(LBUF)) + K_1M3M(IQ_OM2,JT1,JF1)=NINT((-D0AP-GA3P)/DTETAR & + +DBLE(LBUF)) + K_1M2M(IQ_OM2,JT1,JF1)=NINT((-D0AP-GA2P)/DTETAR & + +DBLE(LBUF)) + K_1M3P(IQ_OM2,JT1,JF1)=NINT((-D0AP+GA3P)/DTETAR & + +DBLE(LBUF)) + ! + !.........Computes the coupling coefficients (only for Delta_1+ ) + RK0=1.D0 + RK1=V1*V1 + RK2=V2*V2 + RK3=(1.D0+V1-V2)**2 + XK0 = RK0 + YK0 = 0.0D0 + XK1 = RK1*C_D01P + YK1 = RK1*S_D01P + XK2P = RK2*(C_D0AP*C_GA2P-S_D0AP*S_GA2P) + YK2P = RK2*(S_D0AP*C_GA2P+C_D0AP*S_GA2P) + XK2M = RK2*(C_D0AP*C_GA2P+S_D0AP*S_GA2P) + YK2M = RK2*(S_D0AP*C_GA2P-C_D0AP*S_GA2P) + XK3P = RK3*(C_D0AP*C_GA3P-S_D0AP*S_GA3P) + YK3P = RK3*(S_D0AP*C_GA3P+C_D0AP*S_GA3P) + XK3M = RK3*(C_D0AP*C_GA3P+S_D0AP*S_GA3P) + YK3M = RK3*(S_D0AP*C_GA3P-C_D0AP*S_GA3P) + TB_TPM(IQ_OM2,JT1,JF1)=COUPLE( XK0 , YK0 , XK1 , YK1 , XK2P , YK2P , XK3M , YK3M) + TB_TMP(IQ_OM2,JT1,JF1)=COUPLE( XK0 , YK0 , XK1 , YK1 , XK2M , YK2M , XK3P , YK3P) + ! + !.........Computes the multiplicative coefficient for QNL4 + DENO=2.D0*SQRT( (0.5D0*(1.D0+EPSI_A/2.D0)-W2) & + *((W2-0.5D0)**2+0.25D0*(1.D0+EPSI_A)) & + *((W2-0.5D0)**2+0.25D0*(1.D0-EPSI_A)) ) + TB_FAC(IQ_OM2,JT1,JF1)=1.D0/(DENO*V1*W2*(1.D0-W2)) & + /(1.D0+V1)**5 * W_LEG_OM2(IQ_OM2)*C_LEG_OM2* CCC + ENDDO + ! ----------------------------------------------- + !........END OF THE LOOP 3 OVER OMEGA_2 (CASE Epsilon_A < 1) + ! ----------------------------------------------- + ! + ELSE + ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - + !........STARTS LOOP 3 OVER OMEGA_2 (CASE Epsilon_A > 1) + !........Case of two singularities (in OMEGA2- and OMEGA2_1) + !........Integration over OMEGA2 via GAUSS-CHEBYSCHEV quadrature + ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - + W2_M=0.5D0*(1.D0-EPSI_A/2.D0) + W2_1=0.5D0*(1.D0-SQRT(EPSI_A-1.D0)) + ! + W_MIL=(W2_M+W2_1)/2.D0 + W_RAD=(W2_1-W2_M)/2.D0 + ! + DO IQ_OM2=1,GQNQ_OM2 + ! ---------Computes W2, V2, and V3 + W2=W_MIL+W_RAD*X_CHE_OM2(IQ_OM2) + V2=W2*(1.D0+V1) + V2_4=V2**4 + TB_V24(IQ_OM2,JT1,JF1)=V2_4 + K_IF2 (IQ_OM2,JT1,JF1)=NINT(DBLE(LBUF) & + +LOG(V2)/LOG(RAISF)) + V3=1.D0+V1-V2 + V3_4=V3**4 + TB_V34(IQ_OM2,JT1,JF1)=V3_4 + K_IF3 (IQ_OM2,JT1,JF1)=NINT(DBLE(LBUF) & + +LOG(V3)/LOG(RAISF)) + ! ---------Computes Gamma_2+ et Gamma_3+ angles + C_GA2P=(EPSI_A**2/4.D0+W2**4-(1.D0-W2)**4)/(EPSI_A*W2*W2) + C_GA2P=MAX(MIN(C_GA2P,1.D0),-1.D0) + S_GA2P=SQRT(1.D0-C_GA2P*C_GA2P) + GA2P =ACOS(C_GA2P) + C_GA3P=(EPSI_A**2/4.D0-W2**4+(1.D0-W2)**4)/EPSI_A & + /(1.D0-W2)**2 + C_GA3P=MAX(MIN(C_GA3P,1.D0),-1.D0) + S_GA3P=SQRT(1.D0-C_GA3P*C_GA3P) + GA3P =ACOS(C_GA3P) + ! Shifts the direction indexes - Config. +Delta1 (SIG=1) + K_1P2P(IQ_OM2,JT1,JF1)=NINT(( D0AP+GA2P)/DTETAR & + +DBLE(LBUF)) + K_1P3M(IQ_OM2,JT1,JF1)=NINT(( D0AP-GA3P)/DTETAR & + +DBLE(LBUF)) + K_1P2M(IQ_OM2,JT1,JF1)=NINT(( D0AP-GA2P)/DTETAR & + +DBLE(LBUF)) + K_1P3P(IQ_OM2,JT1,JF1)=NINT(( D0AP+GA3P)/DTETAR & + +DBLE(LBUF)) + ! Shifts the direction indexes - Config. -Delta1 (SIG=-1) + K_1M2P(IQ_OM2,JT1,JF1)=NINT((-D0AP+GA2P)/DTETAR & + +DBLE(LBUF)) + K_1M3M(IQ_OM2,JT1,JF1)=NINT((-D0AP-GA3P)/DTETAR & + +DBLE(LBUF)) + K_1M2M(IQ_OM2,JT1,JF1)=NINT((-D0AP-GA2P)/DTETAR & + +DBLE(LBUF)) + K_1M3P(IQ_OM2,JT1,JF1)=NINT((-D0AP+GA3P)/DTETAR & + +DBLE(LBUF)) + ! + !.........Computes the coupling coefficients (only for Delta_1+ ) + RK0=1.D0 + RK1=V1*V1 + RK2=V2*V2 + RK3=(1.D0+V1-V2)**2 + XK0 = RK0 + YK0 = 0.0D0 + XK1 = RK1*C_D01P + YK1 = RK1*S_D01P + XK2P = RK2*(C_D0AP*C_GA2P-S_D0AP*S_GA2P) + YK2P = RK2*(S_D0AP*C_GA2P+C_D0AP*S_GA2P) + XK2M = RK2*(C_D0AP*C_GA2P+S_D0AP*S_GA2P) + YK2M = RK2*(S_D0AP*C_GA2P-C_D0AP*S_GA2P) + XK3P = RK3*(C_D0AP*C_GA3P-S_D0AP*S_GA3P) + YK3P = RK3*(S_D0AP*C_GA3P+C_D0AP*S_GA3P) + XK3M = RK3*(C_D0AP*C_GA3P+S_D0AP*S_GA3P) + YK3M = RK3*(S_D0AP*C_GA3P-C_D0AP*S_GA3P) + TB_TPM(IQ_OM2,JT1,JF1)=COUPLE( XK0 , YK0 , XK1 , YK1 , XK2P , YK2P , XK3M , YK3M) + TB_TMP(IQ_OM2,JT1,JF1)=COUPLE( XK0 , YK0 , XK1 , YK1 , XK2M , YK2M , XK3P , YK3P) + ! + !.........Computes the multiplicative coefficient for QNL4 + DENO=2.D0*SQRT( (0.5D0*(1.D0+EPSI_A/2.D0)-W2) & + *((W2-0.5D0)**2+0.25D0*(1.D0+EPSI_A)) & + *(0.5D0*(1.D0+SQRT(EPSI_A-1.D0))-W2) ) + TB_FAC(IQ_OM2,JT1,JF1)=1.D0/(DENO*V1*W2*(1.D0-W2)) & + /(1.D0+V1)**5 * W_CHE_OM2* CCC + ! + ENDDO + ! ----------------------------------------------- + !........END OF LOOP 3 OVER OMEGA_2 (CASE Epsilon_A > 1) + ! ----------------------------------------------- + ! + ENDIF + ENDDO + ! ================================================= + ! END OF LOOP 2 OVER THE DELTA_1+ VALUES + ! ================================================= + ! + ENDDO + ! ================================================== + ! END OF LOOP 1 OVER THE F1/F0 RATIOS + ! ================================================== + DEALLOCATE(F1SF) + DEALLOCATE(X_CHE_TE1) + DEALLOCATE(X_CHE_OM2) + DEALLOCATE(X_LEG_OM2) + DEALLOCATE(W_LEG_OM2) + + ! =========================================================== + ! POST-PROCESSING TO ELIMINATE PART OF THE CONFIGURATIONS + ! =========================================================== + ! + !.....It looks, for every value of the ratio V1, for the maximum value + !.....of FACTOR*COUPLING : it is stored in the local table NAXCLA(.) + ! """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + ALLOCATE(MAXCLA(1:GQNF1)) + DO JF1=1,GQNF1 + AUX=0.0D0 + DO JT1=1,GQNT1 + DO IQ_OM2=1,GQNQ_OM2 + AAA=TB_FAC(IQ_OM2,JT1,JF1)*TB_TPM(IQ_OM2,JT1,JF1) + IF (AAA.GT.AUX) AUX=AAA + CCC=TB_FAC(IQ_OM2,JT1,JF1)*TB_TMP(IQ_OM2,JT1,JF1) + IF (CCC.GT.AUX) AUX=CCC + ENDDO + ENDDO + MAXCLA(JF1)=AUX + ENDDO + ! + !.....It looks for the max V1 value + ! """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + AUX=0.0D0 + DO JF1=1,GQNF1 + IF (MAXCLA(JF1).GT.AUX) AUX=MAXCLA(JF1) + ENDDO + TEST1=SEUIL1*AUX + ! + !.....Set to zero the coupling coefficients not used + ! """"""""""""""""""""""""""""""""""""""""""""""""""""" + NCONF=0 + DO JF1=1,GQNF1 + TEST2 =SEUIL2*MAXCLA(JF1) + DO JT1=1,GQNT1 + DO IQ_OM2=1,GQNQ_OM2 + AAA=TB_FAC(IQ_OM2,JT1,JF1)*TB_TPM(IQ_OM2,JT1,JF1) + CCC=TB_FAC(IQ_OM2,JT1,JF1)*TB_TMP(IQ_OM2,JT1,JF1) + IF ((AAA.GT.TEST1.OR.AAA.GT.TEST2).OR. & + (CCC.GT.TEST1.OR.CCC.GT.TEST2)) THEN + NCONF=NCONF+1 + IDCONF(NCONF,1)=JF1 + IDCONF(NCONF,2)=JT1 + IDCONF(NCONF,3)=IQ_OM2 + ENDIF +#ifdef W3_TGQM + WRITE(993,*) NCONF,JF1,JT1,IQ_OM2,AAA,CCC,(AAA.GT.TEST1.OR.AAA.GT.TEST2), & + (CCC.GT.TEST1.OR.CCC.GT.TEST2) +#endif + ENDDO + ENDDO + ENDDO + DEALLOCATE(MAXCLA) + ! + !..... counts the fraction of the eliminated configurations + ELIM=(1.D0-DBLE(NCONF)/DBLE(NCONFM))*100.D0 + ! WRITE(994,*) 'NCONF:',NCONF,ELIM + END SUBROUTINE INSNLGQM !/ !/ End of module W3SNL1MD -------------------------------------------- / !/ diff --git a/model/src/w3srcemd.F90 b/model/src/w3srcemd.F90 index 6aa708bb8..a846605d8 100644 --- a/model/src/w3srcemd.F90 +++ b/model/src/w3srcemd.F90 @@ -564,6 +564,7 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, & #endif #ifdef W3_NL1 USE W3SNL1MD + USE W3GDATMD, ONLY: IQTPE #endif #ifdef W3_NL2 USE W3SNL2MD @@ -1215,7 +1216,11 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, & ! 2.b Nonlinear interactions. ! #ifdef W3_NL1 - CALL W3SNL1 ( SPEC, CG1, WNMEAN*DEPTH, VSNL, VDNL ) + IF (IQTPE.GT.0) THEN + CALL W3SNL1 ( SPEC, CG1, WNMEAN*DEPTH, VSNL, VDNL ) + ELSE + CALL W3SNLGQM ( SPEC, CG1, WN1, DEPTH, VSNL, VDNL ) + END IF #endif #ifdef W3_NL2 CALL W3SNL2 ( SPEC, CG1, DEPTH, VSNL, VDNL ) diff --git a/model/src/ww3_ounp.F90 b/model/src/ww3_ounp.F90 index 409888da1..0cbc0b653 100644 --- a/model/src/ww3_ounp.F90 +++ b/model/src/ww3_ounp.F90 @@ -1547,6 +1547,7 @@ SUBROUTINE W3EXNC(I,NCID,NREQ,INDREQ,ORDER) #endif #ifdef W3_NL1 USE W3SNL1MD + USE W3GDATMD, ONLY: IQTPE #endif #ifdef W3_NL2 USE W3SNL2MD @@ -2421,7 +2422,11 @@ SUBROUTINE W3EXNC(I,NCID,NREQ,INDREQ,ORDER) END IF IF ( FLSRCE(3) ) THEN #ifdef W3_NL1 - CALL W3SNL1 ( A, CG, WNMEAN*DEPTH, XNL, DIA ) + IF (IQTPE.GT.0) THEN + CALL W3SNL1 ( A, CG, WNMEAN*DEPTH, XNL, DIA ) + ELSE + CALL W3SNLGQM ( A, CG, WN, DEPTH, XNL, DIA ) + END IF #endif #ifdef W3_NL2 CALL W3SNL2 ( A, CG, DEPTH, XNL, DIA ) diff --git a/model/src/ww3_outp.F90 b/model/src/ww3_outp.F90 index a95ec2e93..6d750687a 100644 --- a/model/src/ww3_outp.F90 +++ b/model/src/ww3_outp.F90 @@ -1983,7 +1983,11 @@ SUBROUTINE W3EXPO END IF IF ( FLSRCE(3) ) THEN #ifdef W3_NL1 - CALL W3SNL1 ( A, CG, WNMEAN*DEPTH, XNL, DIA ) + IF (IQTPE.GT.0) THEN + CALL W3SNL1 ( A, CG, WNMEAN*DEPTH, XNL, DIA ) + ELSE + CALL W3SNLGQM ( A, CG, WN, DEPTH, XNL, DIA ) + END IF #endif #ifdef W3_NL2 CALL W3SNL2 ( A, CG, DEPTH, XNL, DIA ) diff --git a/model/src/ww3_trnc.F90 b/model/src/ww3_trnc.F90 index c2049751c..ec69db4dc 100644 --- a/model/src/ww3_trnc.F90 +++ b/model/src/ww3_trnc.F90 @@ -71,6 +71,9 @@ PROGRAM W3TRNC !/ ------------------------------------------------------------------- / USE CONSTANTS +#ifdef W3_NL1 + USE W3ADATMD, ONLY : W3NAUX, W3SETA +#endif USE W3GDATMD, ONLY : W3NMOD, W3SETG, FLAGLL, XFR, GNAME USE W3ODATMD, ONLY : W3NOUT, W3SETO, FNMPRE USE W3SERVMD, ONLY : ITRACE, NEXTLN, EXTCDE @@ -131,6 +134,10 @@ PROGRAM W3TRNC ! CALL W3NMOD ( 1, 6, 6 ) CALL W3SETG ( 1, 6, 6 ) +#ifdef W3_NL1 + CALL W3NAUX ( 6, 6 ) + CALL W3SETA ( 1, 6, 6 ) +#endif CALL W3NOUT ( 6, 6 ) CALL W3SETO ( 1, 6, 6 ) ! diff --git a/regtests/bin/matrix.base b/regtests/bin/matrix.base index 864583358..3d1d84f16 100755 --- a/regtests/bin/matrix.base +++ b/regtests/bin/matrix.base @@ -912,6 +912,8 @@ echo "$rtst -s ST4_TSA -w work_ST4_TSA $ww3 ww3_ts1" >> matrix.body echo "$rtst -s ST6 -w work_ST6 $ww3 ww3_ts1" >> matrix.body echo "$rtst -w work_NL5 -i input_nl5_matrix $ww3 ww3_ts1" >> matrix.body + echo "$rtst -g ST4_T707 -w work_T707GQM -i input_10ms -N $ww3 ww3_ts1" >> matrix.body + echo "$rtst -g ST4_T713 -w work_T713GQM -i input_10ms -N $ww3 ww3_ts1" >> matrix.body fi # fetch limited growth, no switch sharing here diff --git a/regtests/bin/matrix_cmake_datarmor b/regtests/bin/matrix_cmake_datarmor index 4e635f3c2..16c31e47c 100755 --- a/regtests/bin/matrix_cmake_datarmor +++ b/regtests/bin/matrix_cmake_datarmor @@ -129,7 +129,7 @@ main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" export mpi='$MPI_LAUNCH' # Compile option - opt="-f -N -S -T" + opt="-f -N -S -T -o both" # Base run_test command line export rtst="./bin/run_cmake_test $opt" diff --git a/regtests/ww3_ts1/input/namelists_ST4_T475.nml b/regtests/ww3_ts1/input/namelists_ST4_T475.nml new file mode 100644 index 000000000..e104247aa --- /dev/null +++ b/regtests/ww3_ts1/input/namelists_ST4_T475.nml @@ -0,0 +1,7 @@ +&SIN4 BETAMAX = 1.75, SWELLF = 0.66, TAUWSHELTER = 0.3, + SWELLF3 = 0.022, SWELLF4 = 115000.0, SWELLF7 = 432000.00 / +&SDS4 FXFM3 = 2.5 / +&SIC2 IC2ROUGH = 0.001000, IC2VISC = 2.000, IC2DMAX =0.300 / +&SIS2 ISC1 =0.200E+00, IS2BREAK = T, IS2DUPDATE = F, IS2CREEPB = 0.200E+08 / + +END OF NAMELISTS diff --git a/regtests/ww3_ts1/input/namelists_ST4_T700.nml b/regtests/ww3_ts1/input/namelists_ST4_T700.nml index aa6ecdf70..b47cc70d0 100644 --- a/regtests/ww3_ts1/input/namelists_ST4_T700.nml +++ b/regtests/ww3_ts1/input/namelists_ST4_T700.nml @@ -1,4 +1,4 @@ &SDS4 SDSBCHOICE=3, SDSC2 = -3.8, SDSBR = 0.005, - SDSSTRAIN =0., SDSSTRAIN2 = 0., FXFM3 = 20., SDSFACMTF = 400., + FXFM3 = 20., SDSFACMTF = 400., SDSCUM=0., SDSC5 =0. / END OF NAMELISTS diff --git a/regtests/ww3_ts1/input/namelists_ST4_T702.nml b/regtests/ww3_ts1/input/namelists_ST4_T702.nml new file mode 100644 index 000000000..444c02e29 --- /dev/null +++ b/regtests/ww3_ts1/input/namelists_ST4_T702.nml @@ -0,0 +1,12 @@ +&SIN4 BETAMAX = 1.7, SWELLF = 0.60, TAUWSHELTER = 0.2, + SWELLF3 = 0.022, SWELLF4 = 115000.0, SWELLF7 = 432000.00 / +&SDS4 SDSBCHOICE = 3, SDSC2 = -3.80, FXFM3 = 20.00, + SDSBR = 0.005, SDSBT = 0.0011, SDSCUM = 0.300, SDSC5 = 1.0, + SDSMWD = 0.00, SDSFACMTF = 400 / +&SNL1 NLPROP = 25000000.0 / +&SIC2 IC2ROUGH = 0.001000, IC2VISC = 2.000, IC2DMAX =0.300 / +&SIS2 ISC1 =0.200E+00, IS2BREAK = T, IS2DUPDATE = F, IS2CREEPB = 0.200E+08 / +&MISC ICEHINIT = 0.5, ICEHMIN = 0.1, CICE0 = 0.25, NOSW =6, + CICEN = 2.00, LICE = 40000., FLAGTR = 4, FACBERG = 0.2 , + WCOR1=21., WCOR2=0.5 / +END OF NAMELISTS diff --git a/regtests/ww3_ts1/input/namelists_ST4_T707.nml b/regtests/ww3_ts1/input/namelists_ST4_T707.nml new file mode 100644 index 000000000..16f81517d --- /dev/null +++ b/regtests/ww3_ts1/input/namelists_ST4_T707.nml @@ -0,0 +1,13 @@ + &SNL1 IQTYPE = -2, GQMNF1 = 11, GQMNT1 = 6, GQMNQ_OM2 = 6, + TAILNL=-5.0, GQMTHRSAT=5E-5, GQMTHRCOU = 0.05, GQAMP1=1., + GQAMP2=0.0022, GQAMP3=1., GQAMP4=1.0 / + &SIN4 BETAMAX = 1.6, TAUWSHELTER = 0.0 / + &SDS4 SDSBCHOICE=3, SDSC2 = -2.3, SDSBR = 0.005, + FXFM3 = 20, SDSFACMTF = 400., + SDSMWD = 2., SDSCUM = 0.35, SDSNUW =0, SDSC5=1., SDSBRF1=0.5 / +&SIC2 IC2ROUGH = 0.001000, IC2VISC = 2.000, IC2DMAX =0.300 / +&SIS2 ISC1 =0.200E+00, IS2BREAK = T, IS2DUPDATE = F, IS2CREEPB = 0.200E+08 / +&MISC ICEHINIT = 0.5, ICEHMIN = 0.1, CICE0 = 0.25, NOSW =6, + CICEN = 2.00, LICE = 40000., FLAGTR = 4, FACBERG = 0.2 , + WCOR1=21., WCOR2=0.5 / +END OF NAMELISTS diff --git a/regtests/ww3_ts1/input/ww3_grid_ST4_T475.nml b/regtests/ww3_ts1/input/ww3_grid_ST4_T475.nml new file mode 100644 index 000000000..7987e9528 --- /dev/null +++ b/regtests/ww3_ts1/input/ww3_grid_ST4_T475.nml @@ -0,0 +1,225 @@ +! -------------------------------------------------------------------- ! +! WAVEWATCH III - ww3_grid.nml - Grid pre-processing ! +! -------------------------------------------------------------------- ! + +! -------------------------------------------------------------------- ! +! Define the spectrum parameterization via SPECTRUM_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! SPECTRUM%XFR = 0. ! frequency increment +! SPECTRUM%FREQ1 = 0. ! first frequency (Hz) +! SPECTRUM%NK = 0 ! number of frequencies (wavenumbers) +! SPECTRUM%NTH = 0 ! number of direction bins +! SPECTRUM%THOFF = 0. ! relative offset of first direction [-0.5,0.5] +! -------------------------------------------------------------------- ! +&SPECTRUM_NML + SPECTRUM%XFR = 1.10 + SPECTRUM%FREQ1 = 0.0485 + SPECTRUM%NK = 36 + SPECTRUM%NTH = 24 +/ + +! -------------------------------------------------------------------- ! +! Define the run parameterization via RUN_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! RUN%FLDRY = F ! dry run (I/O only, no calculation) +! RUN%FLCX = F ! x-component of propagation +! RUN%FLCY = F ! y-component of propagation +! RUN%FLCTH = F ! direction shift +! RUN%FLCK = F ! wavenumber shift +! RUN%FLSOU = F ! source terms +! -------------------------------------------------------------------- ! +&RUN_NML + RUN%FLSOU = T +/ + +! -------------------------------------------------------------------- ! +! Define the timesteps parameterization via TIMESTEPS_NML namelist +! +! * It is highly recommended to set up time steps which are multiple +! between them. +! +! * The first time step to calculate is the maximum CFL time step +! which depend on the lowest frequency FREQ1 previously set up and the +! lowest spatial grid resolution in meters DXY. +! reminder : 1 degree=60minutes // 1minute=1mile // 1mile=1.852km +! The formula for the CFL time is : +! Tcfl = DXY / (G / (FREQ1*4*Pi) ) with the constants Pi=3,14 and G=9.8m/s²; +! DTXY ~= 90% Tcfl +! DTMAX ~= 3 * DTXY (maximum global time step limit) +! +! * The refraction time step depends on how strong can be the current velocities +! on your grid : +! DTKTH ~= DTMAX / 2 ! in case of no or light current velocities +! DTKTH ~= DTMAX / 10 ! in case of strong current velocities +! +! * The source terms time step is usually defined between 5s and 60s. +! A common value is 10s. +! DTMIN ~= 10 +! +! * namelist must be terminated with / +! * definitions & defaults: +! TIMESTEPS%DTMAX = 0. ! maximum global time step (s) +! TIMESTEPS%DTXY = 0. ! maximum CFL time step for x-y (s) +! TIMESTEPS%DTKTH = 0. ! maximum CFL time step for k-th (s) +! TIMESTEPS%DTMIN = 0. ! minimum source term time step (s) +! -------------------------------------------------------------------- ! +&TIMESTEPS_NML + TIMESTEPS%DTMAX = 900. + TIMESTEPS%DTXY = 900. + TIMESTEPS%DTKTH = 900. + TIMESTEPS%DTMIN = 15. +/ + +! -------------------------------------------------------------------- ! +! Define the grid to preprocess via GRID_NML namelist +! +! * the tunable parameters for source terms, propagation schemes, and +! numerics are read using namelists. +! * Any namelist found in the folowing sections is temporarily written +! to param.scratch, and read from there if necessary. +! * The order of the namelists is immaterial. +! * Namelists not needed for the given switch settings will be skipped +! automatically +! +! * grid type can be : +! 'RECT' : rectilinear +! 'CURV' : curvilinear +! 'UNST' : unstructured (triangle-based) +! +! * coordinate system can be : +! 'SPHE' : Spherical (degrees) +! 'CART' : Cartesian (meters) +! +! * grid closure can only be applied in spherical coordinates +! +! * grid closure can be : +! 'NONE' : No closure is applied +! 'SMPL' : Simple grid closure. Grid is periodic in the +! : i-index and wraps at i=NX+1. In other words, +! : (NX+1,J) => (1,J). A grid with simple closure +! : may be rectilinear or curvilinear. +! 'TRPL' : Tripole grid closure : Grid is periodic in the +! : i-index and wraps at i=NX+1 and has closure at +! : j=NY+1. In other words, (NX+1,J<=NY) => (1,J) +! : and (I,NY+1) => (NX-I+1,NY). Tripole +! : grid closure requires that NX be even. A grid +! : with tripole closure must be curvilinear. +! +! * The coastline limit depth is the value which distinguish the sea +! points to the land points. All the points with depth values (ZBIN) +! greater than this limit (ZLIM) will be considered as excluded points +! and will never be wet points, even if the water level grows over. +! It can only overwrite the status of a sea point to a land point. +! The value must have a negative value under the mean sea level +! +! * The minimum water depth allowed to compute the model is the absolute +! depth value (DMIN) used in the model if the input depth is lower to +! avoid the model to blow up. +! +! * namelist must be terminated with / +! * definitions & defaults: +! GRID%NAME = 'unset' ! grid name (30 char) +! GRID%NML = 'namelists.nml' ! namelists filename +! GRID%TYPE = 'unset' ! grid type +! GRID%COORD = 'unset' ! coordinate system +! GRID%CLOS = 'unset' ! grid closure +! +! GRID%ZLIM = 0. ! coastline limit depth (m) +! GRID%DMIN = 0. ! abs. minimum water depth (m) +! -------------------------------------------------------------------- ! +&GRID_NML + GRID%NAME = 'HOMOGENEOUS SOURCE TERM TEST' + GRID%NML = '../input/namelists_ST4_T475.nml' + GRID%TYPE = 'RECT' + GRID%COORD = 'SPHE' + GRID%CLOS = 'NONE' + GRID%ZLIM = -5. + GRID%DMIN = 5.75 +/ + +! -------------------------------------------------------------------- ! +! Define the rectilinear grid type via RECT_NML namelist +! - only for RECT grids - +! +! * The minimum grid size is 3x3. +! +! * If the grid increments SX and SY are given in minutes of arc, the scaling +! factor SF must be set to 60. to provide an increment factor in degree. +! +! * If CSTRG='SMPL', then SX is forced to 360/NX. +! +! * value <= value_read / scale_fac +! +! * namelist must be terminated with / +! * definitions & defaults: +! RECT%NX = 0 ! number of points along x-axis +! RECT%NY = 0 ! number of points along y-axis +! +! RECT%SX = 0. ! grid increment along x-axis +! RECT%SY = 0. ! grid increment along y-axis +! RECT%SF = 1. ! scaling division factor for x-y axis +! +! RECT%X0 = 0. ! x-coordinate of lower-left corner (deg) +! RECT%Y0 = 0. ! y-coordinate of lower-left corner (deg) +! RECT%SF0 = 1. ! scaling division factor for x0,y0 coord +! -------------------------------------------------------------------- ! +&RECT_NML + RECT%NX = 3 + RECT%NY = 3 + RECT%SX = 1. + RECT%SY = 1. + RECT%SF = 1.E-2 + RECT%X0 = -1. + RECT%Y0 = -1. + RECT%SF0 = 1.E-2 +/ + +! -------------------------------------------------------------------- ! +! Define the depth to preprocess via DEPTH_NML namelist +! - for RECT and CURV grids - +! +! * if no obstruction subgrid, need to set &MISC FLAGTR = 0 +! +! * The depth value must have negative values under the mean sea level +! +! * value <= value_read * scale_fac +! +! * IDLA : Layout indicator : +! 1 : Read line-by-line bottom to top. (default) +! 2 : Like 1, single read statement. +! 3 : Read line-by-line top to bottom. +! 4 : Like 3, single read statement. +! * IDFM : format indicator : +! 1 : Free format. (default) +! 2 : Fixed format. +! 3 : Unformatted. +! * FORMAT : element format to read : +! '(....)' : auto detected (default) +! '(f10.6)' : float type +! +! * Example : +! IDF SF IDLA IDFM FORMAT FILENAME +! 50 0.001 1 1 '(....)' 'GLOB-30M.bot' +! +! * namelist must be terminated with / +! * definitions & defaults: +! DEPTH%SF = 1. ! scale factor +! DEPTH%FILENAME = 'unset' ! filename +! DEPTH%IDF = 50 ! file unit number +! DEPTH%IDLA = 1 ! layout indicator +! DEPTH%IDFM = 1 ! format indicator +! DEPTH%FORMAT = '(....)' ! formatted read format +! -------------------------------------------------------------------- ! +&DEPTH_NML + DEPTH%SF = -2500. + DEPTH%FILENAME = '../input/HOMOGENEOUS.depth' + DEPTH%IDLA = 3 +/ + +! -------------------------------------------------------------------- ! +! WAVEWATCH III - end of namelist ! +! -------------------------------------------------------------------- ! diff --git a/regtests/ww3_ts1/input/ww3_grid_ST4_T702.nml b/regtests/ww3_ts1/input/ww3_grid_ST4_T702.nml new file mode 100644 index 000000000..48135e1d9 --- /dev/null +++ b/regtests/ww3_ts1/input/ww3_grid_ST4_T702.nml @@ -0,0 +1,225 @@ +! -------------------------------------------------------------------- ! +! WAVEWATCH III - ww3_grid.nml - Grid pre-processing ! +! -------------------------------------------------------------------- ! + +! -------------------------------------------------------------------- ! +! Define the spectrum parameterization via SPECTRUM_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! SPECTRUM%XFR = 0. ! frequency increment +! SPECTRUM%FREQ1 = 0. ! first frequency (Hz) +! SPECTRUM%NK = 0 ! number of frequencies (wavenumbers) +! SPECTRUM%NTH = 0 ! number of direction bins +! SPECTRUM%THOFF = 0. ! relative offset of first direction [-0.5,0.5] +! -------------------------------------------------------------------- ! +&SPECTRUM_NML + SPECTRUM%XFR = 1.10 + SPECTRUM%FREQ1 = 0.0485 + SPECTRUM%NK = 36 + SPECTRUM%NTH = 24 +/ + +! -------------------------------------------------------------------- ! +! Define the run parameterization via RUN_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! RUN%FLDRY = F ! dry run (I/O only, no calculation) +! RUN%FLCX = F ! x-component of propagation +! RUN%FLCY = F ! y-component of propagation +! RUN%FLCTH = F ! direction shift +! RUN%FLCK = F ! wavenumber shift +! RUN%FLSOU = F ! source terms +! -------------------------------------------------------------------- ! +&RUN_NML + RUN%FLSOU = T +/ + +! -------------------------------------------------------------------- ! +! Define the timesteps parameterization via TIMESTEPS_NML namelist +! +! * It is highly recommended to set up time steps which are multiple +! between them. +! +! * The first time step to calculate is the maximum CFL time step +! which depend on the lowest frequency FREQ1 previously set up and the +! lowest spatial grid resolution in meters DXY. +! reminder : 1 degree=60minutes // 1minute=1mile // 1mile=1.852km +! The formula for the CFL time is : +! Tcfl = DXY / (G / (FREQ1*4*Pi) ) with the constants Pi=3,14 and G=9.8m/s²; +! DTXY ~= 90% Tcfl +! DTMAX ~= 3 * DTXY (maximum global time step limit) +! +! * The refraction time step depends on how strong can be the current velocities +! on your grid : +! DTKTH ~= DTMAX / 2 ! in case of no or light current velocities +! DTKTH ~= DTMAX / 10 ! in case of strong current velocities +! +! * The source terms time step is usually defined between 5s and 60s. +! A common value is 10s. +! DTMIN ~= 10 +! +! * namelist must be terminated with / +! * definitions & defaults: +! TIMESTEPS%DTMAX = 0. ! maximum global time step (s) +! TIMESTEPS%DTXY = 0. ! maximum CFL time step for x-y (s) +! TIMESTEPS%DTKTH = 0. ! maximum CFL time step for k-th (s) +! TIMESTEPS%DTMIN = 0. ! minimum source term time step (s) +! -------------------------------------------------------------------- ! +&TIMESTEPS_NML + TIMESTEPS%DTMAX = 900. + TIMESTEPS%DTXY = 900. + TIMESTEPS%DTKTH = 900. + TIMESTEPS%DTMIN = 15. +/ + +! -------------------------------------------------------------------- ! +! Define the grid to preprocess via GRID_NML namelist +! +! * the tunable parameters for source terms, propagation schemes, and +! numerics are read using namelists. +! * Any namelist found in the folowing sections is temporarily written +! to param.scratch, and read from there if necessary. +! * The order of the namelists is immaterial. +! * Namelists not needed for the given switch settings will be skipped +! automatically +! +! * grid type can be : +! 'RECT' : rectilinear +! 'CURV' : curvilinear +! 'UNST' : unstructured (triangle-based) +! +! * coordinate system can be : +! 'SPHE' : Spherical (degrees) +! 'CART' : Cartesian (meters) +! +! * grid closure can only be applied in spherical coordinates +! +! * grid closure can be : +! 'NONE' : No closure is applied +! 'SMPL' : Simple grid closure. Grid is periodic in the +! : i-index and wraps at i=NX+1. In other words, +! : (NX+1,J) => (1,J). A grid with simple closure +! : may be rectilinear or curvilinear. +! 'TRPL' : Tripole grid closure : Grid is periodic in the +! : i-index and wraps at i=NX+1 and has closure at +! : j=NY+1. In other words, (NX+1,J<=NY) => (1,J) +! : and (I,NY+1) => (NX-I+1,NY). Tripole +! : grid closure requires that NX be even. A grid +! : with tripole closure must be curvilinear. +! +! * The coastline limit depth is the value which distinguish the sea +! points to the land points. All the points with depth values (ZBIN) +! greater than this limit (ZLIM) will be considered as excluded points +! and will never be wet points, even if the water level grows over. +! It can only overwrite the status of a sea point to a land point. +! The value must have a negative value under the mean sea level +! +! * The minimum water depth allowed to compute the model is the absolute +! depth value (DMIN) used in the model if the input depth is lower to +! avoid the model to blow up. +! +! * namelist must be terminated with / +! * definitions & defaults: +! GRID%NAME = 'unset' ! grid name (30 char) +! GRID%NML = 'namelists.nml' ! namelists filename +! GRID%TYPE = 'unset' ! grid type +! GRID%COORD = 'unset' ! coordinate system +! GRID%CLOS = 'unset' ! grid closure +! +! GRID%ZLIM = 0. ! coastline limit depth (m) +! GRID%DMIN = 0. ! abs. minimum water depth (m) +! -------------------------------------------------------------------- ! +&GRID_NML + GRID%NAME = 'HOMOGENEOUS SOURCE TERM TEST' + GRID%NML = '../input/namelists_ST4_T702.nml' + GRID%TYPE = 'RECT' + GRID%COORD = 'SPHE' + GRID%CLOS = 'NONE' + GRID%ZLIM = -5. + GRID%DMIN = 5.75 +/ + +! -------------------------------------------------------------------- ! +! Define the rectilinear grid type via RECT_NML namelist +! - only for RECT grids - +! +! * The minimum grid size is 3x3. +! +! * If the grid increments SX and SY are given in minutes of arc, the scaling +! factor SF must be set to 60. to provide an increment factor in degree. +! +! * If CSTRG='SMPL', then SX is forced to 360/NX. +! +! * value <= value_read / scale_fac +! +! * namelist must be terminated with / +! * definitions & defaults: +! RECT%NX = 0 ! number of points along x-axis +! RECT%NY = 0 ! number of points along y-axis +! +! RECT%SX = 0. ! grid increment along x-axis +! RECT%SY = 0. ! grid increment along y-axis +! RECT%SF = 1. ! scaling division factor for x-y axis +! +! RECT%X0 = 0. ! x-coordinate of lower-left corner (deg) +! RECT%Y0 = 0. ! y-coordinate of lower-left corner (deg) +! RECT%SF0 = 1. ! scaling division factor for x0,y0 coord +! -------------------------------------------------------------------- ! +&RECT_NML + RECT%NX = 3 + RECT%NY = 3 + RECT%SX = 1. + RECT%SY = 1. + RECT%SF = 1.E-2 + RECT%X0 = -1. + RECT%Y0 = -1. + RECT%SF0 = 1.E-2 +/ + +! -------------------------------------------------------------------- ! +! Define the depth to preprocess via DEPTH_NML namelist +! - for RECT and CURV grids - +! +! * if no obstruction subgrid, need to set &MISC FLAGTR = 0 +! +! * The depth value must have negative values under the mean sea level +! +! * value <= value_read * scale_fac +! +! * IDLA : Layout indicator : +! 1 : Read line-by-line bottom to top. (default) +! 2 : Like 1, single read statement. +! 3 : Read line-by-line top to bottom. +! 4 : Like 3, single read statement. +! * IDFM : format indicator : +! 1 : Free format. (default) +! 2 : Fixed format. +! 3 : Unformatted. +! * FORMAT : element format to read : +! '(....)' : auto detected (default) +! '(f10.6)' : float type +! +! * Example : +! IDF SF IDLA IDFM FORMAT FILENAME +! 50 0.001 1 1 '(....)' 'GLOB-30M.bot' +! +! * namelist must be terminated with / +! * definitions & defaults: +! DEPTH%SF = 1. ! scale factor +! DEPTH%FILENAME = 'unset' ! filename +! DEPTH%IDF = 50 ! file unit number +! DEPTH%IDLA = 1 ! layout indicator +! DEPTH%IDFM = 1 ! format indicator +! DEPTH%FORMAT = '(....)' ! formatted read format +! -------------------------------------------------------------------- ! +&DEPTH_NML + DEPTH%SF = -2500. + DEPTH%FILENAME = '../input/HOMOGENEOUS.depth' + DEPTH%IDLA = 3 +/ + +! -------------------------------------------------------------------- ! +! WAVEWATCH III - end of namelist ! +! -------------------------------------------------------------------- ! diff --git a/regtests/ww3_ts1/input/ww3_grid_ST4_T707.nml b/regtests/ww3_ts1/input/ww3_grid_ST4_T707.nml new file mode 100644 index 000000000..e6ef84a56 --- /dev/null +++ b/regtests/ww3_ts1/input/ww3_grid_ST4_T707.nml @@ -0,0 +1,225 @@ +! -------------------------------------------------------------------- ! +! WAVEWATCH III - ww3_grid.nml - Grid pre-processing ! +! -------------------------------------------------------------------- ! + +! -------------------------------------------------------------------- ! +! Define the spectrum parameterization via SPECTRUM_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! SPECTRUM%XFR = 0. ! frequency increment +! SPECTRUM%FREQ1 = 0. ! first frequency (Hz) +! SPECTRUM%NK = 0 ! number of frequencies (wavenumbers) +! SPECTRUM%NTH = 0 ! number of direction bins +! SPECTRUM%THOFF = 0. ! relative offset of first direction [-0.5,0.5] +! -------------------------------------------------------------------- ! +&SPECTRUM_NML + SPECTRUM%XFR = 1.10 + SPECTRUM%FREQ1 = 0.0485 + SPECTRUM%NK = 36 + SPECTRUM%NTH = 24 +/ + +! -------------------------------------------------------------------- ! +! Define the run parameterization via RUN_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! RUN%FLDRY = F ! dry run (I/O only, no calculation) +! RUN%FLCX = F ! x-component of propagation +! RUN%FLCY = F ! y-component of propagation +! RUN%FLCTH = F ! direction shift +! RUN%FLCK = F ! wavenumber shift +! RUN%FLSOU = F ! source terms +! -------------------------------------------------------------------- ! +&RUN_NML + RUN%FLSOU = T +/ + +! -------------------------------------------------------------------- ! +! Define the timesteps parameterization via TIMESTEPS_NML namelist +! +! * It is highly recommended to set up time steps which are multiple +! between them. +! +! * The first time step to calculate is the maximum CFL time step +! which depend on the lowest frequency FREQ1 previously set up and the +! lowest spatial grid resolution in meters DXY. +! reminder : 1 degree=60minutes // 1minute=1mile // 1mile=1.852km +! The formula for the CFL time is : +! Tcfl = DXY / (G / (FREQ1*4*Pi) ) with the constants Pi=3,14 and G=9.8m/s²; +! DTXY ~= 90% Tcfl +! DTMAX ~= 3 * DTXY (maximum global time step limit) +! +! * The refraction time step depends on how strong can be the current velocities +! on your grid : +! DTKTH ~= DTMAX / 2 ! in case of no or light current velocities +! DTKTH ~= DTMAX / 10 ! in case of strong current velocities +! +! * The source terms time step is usually defined between 5s and 60s. +! A common value is 10s. +! DTMIN ~= 10 +! +! * namelist must be terminated with / +! * definitions & defaults: +! TIMESTEPS%DTMAX = 0. ! maximum global time step (s) +! TIMESTEPS%DTXY = 0. ! maximum CFL time step for x-y (s) +! TIMESTEPS%DTKTH = 0. ! maximum CFL time step for k-th (s) +! TIMESTEPS%DTMIN = 0. ! minimum source term time step (s) +! -------------------------------------------------------------------- ! +&TIMESTEPS_NML + TIMESTEPS%DTMAX = 900. + TIMESTEPS%DTXY = 900. + TIMESTEPS%DTKTH = 900. + TIMESTEPS%DTMIN = 15. +/ + +! -------------------------------------------------------------------- ! +! Define the grid to preprocess via GRID_NML namelist +! +! * the tunable parameters for source terms, propagation schemes, and +! numerics are read using namelists. +! * Any namelist found in the folowing sections is temporarily written +! to param.scratch, and read from there if necessary. +! * The order of the namelists is immaterial. +! * Namelists not needed for the given switch settings will be skipped +! automatically +! +! * grid type can be : +! 'RECT' : rectilinear +! 'CURV' : curvilinear +! 'UNST' : unstructured (triangle-based) +! +! * coordinate system can be : +! 'SPHE' : Spherical (degrees) +! 'CART' : Cartesian (meters) +! +! * grid closure can only be applied in spherical coordinates +! +! * grid closure can be : +! 'NONE' : No closure is applied +! 'SMPL' : Simple grid closure. Grid is periodic in the +! : i-index and wraps at i=NX+1. In other words, +! : (NX+1,J) => (1,J). A grid with simple closure +! : may be rectilinear or curvilinear. +! 'TRPL' : Tripole grid closure : Grid is periodic in the +! : i-index and wraps at i=NX+1 and has closure at +! : j=NY+1. In other words, (NX+1,J<=NY) => (1,J) +! : and (I,NY+1) => (NX-I+1,NY). Tripole +! : grid closure requires that NX be even. A grid +! : with tripole closure must be curvilinear. +! +! * The coastline limit depth is the value which distinguish the sea +! points to the land points. All the points with depth values (ZBIN) +! greater than this limit (ZLIM) will be considered as excluded points +! and will never be wet points, even if the water level grows over. +! It can only overwrite the status of a sea point to a land point. +! The value must have a negative value under the mean sea level +! +! * The minimum water depth allowed to compute the model is the absolute +! depth value (DMIN) used in the model if the input depth is lower to +! avoid the model to blow up. +! +! * namelist must be terminated with / +! * definitions & defaults: +! GRID%NAME = 'unset' ! grid name (30 char) +! GRID%NML = 'namelists.nml' ! namelists filename +! GRID%TYPE = 'unset' ! grid type +! GRID%COORD = 'unset' ! coordinate system +! GRID%CLOS = 'unset' ! grid closure +! +! GRID%ZLIM = 0. ! coastline limit depth (m) +! GRID%DMIN = 0. ! abs. minimum water depth (m) +! -------------------------------------------------------------------- ! +&GRID_NML + GRID%NAME = 'HOMOGENEOUS SOURCE TERM TEST' + GRID%NML = '../input/namelists_ST4_T707.nml' + GRID%TYPE = 'RECT' + GRID%COORD = 'SPHE' + GRID%CLOS = 'NONE' + GRID%ZLIM = -5. + GRID%DMIN = 5.75 +/ + +! -------------------------------------------------------------------- ! +! Define the rectilinear grid type via RECT_NML namelist +! - only for RECT grids - +! +! * The minimum grid size is 3x3. +! +! * If the grid increments SX and SY are given in minutes of arc, the scaling +! factor SF must be set to 60. to provide an increment factor in degree. +! +! * If CSTRG='SMPL', then SX is forced to 360/NX. +! +! * value <= value_read / scale_fac +! +! * namelist must be terminated with / +! * definitions & defaults: +! RECT%NX = 0 ! number of points along x-axis +! RECT%NY = 0 ! number of points along y-axis +! +! RECT%SX = 0. ! grid increment along x-axis +! RECT%SY = 0. ! grid increment along y-axis +! RECT%SF = 1. ! scaling division factor for x-y axis +! +! RECT%X0 = 0. ! x-coordinate of lower-left corner (deg) +! RECT%Y0 = 0. ! y-coordinate of lower-left corner (deg) +! RECT%SF0 = 1. ! scaling division factor for x0,y0 coord +! -------------------------------------------------------------------- ! +&RECT_NML + RECT%NX = 3 + RECT%NY = 3 + RECT%SX = 1. + RECT%SY = 1. + RECT%SF = 1.E-2 + RECT%X0 = -1. + RECT%Y0 = -1. + RECT%SF0 = 1.E-2 +/ + +! -------------------------------------------------------------------- ! +! Define the depth to preprocess via DEPTH_NML namelist +! - for RECT and CURV grids - +! +! * if no obstruction subgrid, need to set &MISC FLAGTR = 0 +! +! * The depth value must have negative values under the mean sea level +! +! * value <= value_read * scale_fac +! +! * IDLA : Layout indicator : +! 1 : Read line-by-line bottom to top. (default) +! 2 : Like 1, single read statement. +! 3 : Read line-by-line top to bottom. +! 4 : Like 3, single read statement. +! * IDFM : format indicator : +! 1 : Free format. (default) +! 2 : Fixed format. +! 3 : Unformatted. +! * FORMAT : element format to read : +! '(....)' : auto detected (default) +! '(f10.6)' : float type +! +! * Example : +! IDF SF IDLA IDFM FORMAT FILENAME +! 50 0.001 1 1 '(....)' 'GLOB-30M.bot' +! +! * namelist must be terminated with / +! * definitions & defaults: +! DEPTH%SF = 1. ! scale factor +! DEPTH%FILENAME = 'unset' ! filename +! DEPTH%IDF = 50 ! file unit number +! DEPTH%IDLA = 1 ! layout indicator +! DEPTH%IDFM = 1 ! format indicator +! DEPTH%FORMAT = '(....)' ! formatted read format +! -------------------------------------------------------------------- ! +&DEPTH_NML + DEPTH%SF = -2500. + DEPTH%FILENAME = '../input/HOMOGENEOUS.depth' + DEPTH%IDLA = 3 +/ + +! -------------------------------------------------------------------- ! +! WAVEWATCH III - end of namelist ! +! -------------------------------------------------------------------- ! diff --git a/regtests/ww3_ts1/input_10ms/namelists_ST4_T707.nml b/regtests/ww3_ts1/input_10ms/namelists_ST4_T707.nml new file mode 100644 index 000000000..0458cd775 --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/namelists_ST4_T707.nml @@ -0,0 +1,14 @@ + &SNL1 IQTYPE = -2, GQMNF1 = 11, GQMNT1 = 6, GQMNQ_OM2 = 6, + TAILNL=-5.0, GQMTHRSAT=5E-5, GQMTHRCOU = 0.05, GQAMP1=1., + GQAMP2=0.0022, GQAMP3=1., GQAMP4=1.0 / + &SIN4 BETAMAX = 1.6, TAUWSHELTER = 0.0 / + &SDS4 SDSBCHOICE=3, SDSC2 = -2.3, SDSBR = 0.005, + FXFM3 = 20, SDSFACMTF = 400., + SDSMWD = 2., SDSCUM = 0.35, SDSNUW =0, SDSC5=1., SDSBRF1=0.5 / +&SIC2 IC2ROUGH = 0.001000, IC2VISC = 2.000, IC2DMAX =0.300 / +&SIS2 ISC1 =0.200E+00, IS2BREAK = T, IS2DUPDATE = F, IS2CREEPB = 0.200E+08 / +! DO NOT FORGET TO ADD FLAGTR = 4 for real life runs ... +&MISC ICEHINIT = 0.5, ICEHMIN = 0.1, CICE0 = 0.25, NOSW =6, + CICEN = 2.00, LICE = 40000., FACBERG = 0.2 , + WCOR1=21., WCOR2=0.5 / +END OF NAMELISTS diff --git a/regtests/ww3_ts1/input_10ms/namelists_ST4_T713.nml b/regtests/ww3_ts1/input_10ms/namelists_ST4_T713.nml new file mode 100644 index 000000000..878604430 --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/namelists_ST4_T713.nml @@ -0,0 +1,14 @@ + &SNL1 IQTYPE = -2, GQMNF1 = 11, GQMNT1 = 6, GQMNQ_OM2 = 6, + TAILNL=-5.0, GQMTHRSAT=5E-5, GQMTHRCOU = 0.05, GQAMP1=1., + GQAMP2=0.0022, GQAMP3=2. / +&SIN4 BETAMAX = 1.1, TAUWSHELTER = 0.0 / +&SDS4 SDSBCHOICE=3, SDSC2 = -2.5, SDSBR = 0.005, + SDSSTRAIN2 =1.,SDSCUMP=1., FXFM3 = 20, SDSFACMTF = 200., + SDSMWD = 0.9, SDSCUM = 0.3, SDSNUW =0, SDSC5=0.5, SDSBRF1=0.5 / +&SIC2 IC2ROUGH = 0.001000, IC2VISC = 2.000, IC2DMAX =0.300 / +&SIS2 ISC1 =0.200E+00, IS2BREAK = T, IS2DUPDATE = F, IS2CREEPB = 0.200E+08 / +! DO NOT FORGET TO ADD FLAGTR = 4 for real life runs ... +&MISC ICEHINIT = 0.5, ICEHMIN = 0.1, CICE0 = 0.25, NOSW =6, + CICEN = 2.00, LICE = 40000., FACBERG = 0.2 , + WCOR1=21., WCOR2=0.5 / +END OF NAMELISTS diff --git a/regtests/ww3_ts1/input_10ms/points.list b/regtests/ww3_ts1/input_10ms/points.list new file mode 100644 index 000000000..5ad8fde50 --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/points.list @@ -0,0 +1 @@ +0.0 0.0 'The_point' diff --git a/regtests/ww3_ts1/input_10ms/switch b/regtests/ww3_ts1/input_10ms/switch new file mode 100644 index 000000000..c3b8938ee --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/switch @@ -0,0 +1 @@ +NOGRB SHRD PR0 FLX0 LN1 ST4 NL1 BT1 DB1 TR0 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 O0 O1 O2 O3 O4 O5 O6 O7 O10 O11 diff --git a/regtests/ww3_ts1/input_10ms/switch_ST4 b/regtests/ww3_ts1/input_10ms/switch_ST4 new file mode 100644 index 000000000..c3b8938ee --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/switch_ST4 @@ -0,0 +1 @@ +NOGRB SHRD PR0 FLX0 LN1 ST4 NL1 BT1 DB1 TR0 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 O0 O1 O2 O3 O4 O5 O6 O7 O10 O11 diff --git a/regtests/ww3_ts1/input_10ms/ww3_grid_ST4_T707.nml b/regtests/ww3_ts1/input_10ms/ww3_grid_ST4_T707.nml new file mode 100644 index 000000000..5378ebec3 --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/ww3_grid_ST4_T707.nml @@ -0,0 +1,225 @@ +! -------------------------------------------------------------------- ! +! WAVEWATCH III - ww3_grid.nml - Grid pre-processing ! +! -------------------------------------------------------------------- ! + +! -------------------------------------------------------------------- ! +! Define the spectrum parameterization via SPECTRUM_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! SPECTRUM%XFR = 0. ! frequency increment +! SPECTRUM%FREQ1 = 0. ! first frequency (Hz) +! SPECTRUM%NK = 0 ! number of frequencies (wavenumbers) +! SPECTRUM%NTH = 0 ! number of direction bins +! SPECTRUM%THOFF = 0. ! relative offset of first direction [-0.5,0.5] +! -------------------------------------------------------------------- ! +&SPECTRUM_NML + SPECTRUM%XFR = 1.10 + SPECTRUM%FREQ1 = 0.034 + SPECTRUM%NK = 36 + SPECTRUM%NTH = 36 +/ + +! -------------------------------------------------------------------- ! +! Define the run parameterization via RUN_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! RUN%FLDRY = F ! dry run (I/O only, no calculation) +! RUN%FLCX = F ! x-component of propagation +! RUN%FLCY = F ! y-component of propagation +! RUN%FLCTH = F ! direction shift +! RUN%FLCK = F ! wavenumber shift +! RUN%FLSOU = F ! source terms +! -------------------------------------------------------------------- ! +&RUN_NML + RUN%FLSOU = T +/ + +! -------------------------------------------------------------------- ! +! Define the timesteps parameterization via TIMESTEPS_NML namelist +! +! * It is highly recommended to set up time steps which are multiple +! between them. +! +! * The first time step to calculate is the maximum CFL time step +! which depend on the lowest frequency FREQ1 previously set up and the +! lowest spatial grid resolution in meters DXY. +! reminder : 1 degree=60minutes // 1minute=1mile // 1mile=1.852km +! The formula for the CFL time is : +! Tcfl = DXY / (G / (FREQ1*4*Pi) ) with the constants Pi=3,14 and G=9.8m/s²; +! DTXY ~= 90% Tcfl +! DTMAX ~= 3 * DTXY (maximum global time step limit) +! +! * The refraction time step depends on how strong can be the current velocities +! on your grid : +! DTKTH ~= DTMAX / 2 ! in case of no or light current velocities +! DTKTH ~= DTMAX / 10 ! in case of strong current velocities +! +! * The source terms time step is usually defined between 5s and 60s. +! A common value is 10s. +! DTMIN = 10 +! +! * namelist must be terminated with / +! * definitions & defaults: +! TIMESTEPS%DTMAX = 0. ! maximum global time step (s) +! TIMESTEPS%DTXY = 0. ! maximum CFL time step for x-y (s) +! TIMESTEPS%DTKTH = 0. ! maximum CFL time step for k-th (s) +! TIMESTEPS%DTMIN = 0. ! minimum source term time step (s) +! -------------------------------------------------------------------- ! +&TIMESTEPS_NML + TIMESTEPS%DTMAX = 900. + TIMESTEPS%DTXY = 900. + TIMESTEPS%DTKTH = 900. + TIMESTEPS%DTMIN = 5. +/ + +! -------------------------------------------------------------------- ! +! Define the grid to preprocess via GRID_NML namelist +! +! * the tunable parameters for source terms, propagation schemes, and +! numerics are read using namelists. +! * Any namelist found in the folowing sections is temporarily written +! to param.scratch, and read from there if necessary. +! * The order of the namelists is immaterial. +! * Namelists not needed for the given switch settings will be skipped +! automatically +! +! * grid type can be : +! 'RECT' : rectilinear +! 'CURV' : curvilinear +! 'UNST' : unstructured (triangle-based) +! +! * coordinate system can be : +! 'SPHE' : Spherical (degrees) +! 'CART' : Cartesian (meters) +! +! * grid closure can only be applied in spherical coordinates +! +! * grid closure can be : +! 'NONE' : No closure is applied +! 'SMPL' : Simple grid closure. Grid is periodic in the +! : i-index and wraps at i=NX+1. In other words, +! : (NX+1,J) => (1,J). A grid with simple closure +! : may be rectilinear or curvilinear. +! 'TRPL' : Tripole grid closure : Grid is periodic in the +! : i-index and wraps at i=NX+1 and has closure at +! : j=NY+1. In other words, (NX+1,J<=NY) => (1,J) +! : and (I,NY+1) => (NX-I+1,NY). Tripole +! : grid closure requires that NX be even. A grid +! : with tripole closure must be curvilinear. +! +! * The coastline limit depth is the value which distinguish the sea +! points to the land points. All the points with depth values (ZBIN) +! greater than this limit (ZLIM) will be considered as excluded points +! and will never be wet points, even if the water level grows over. +! It can only overwrite the status of a sea point to a land point. +! The value must have a negative value under the mean sea level +! +! * The minimum water depth allowed to compute the model is the absolute +! depth value (DMIN) used in the model if the input depth is lower to +! avoid the model to blow up. +! +! * namelist must be terminated with / +! * definitions & defaults: +! GRID%NAME = 'unset' ! grid name (30 char) +! GRID%NML = 'namelists.nml' ! namelists filename +! GRID%TYPE = 'unset' ! grid type +! GRID%COORD = 'unset' ! coordinate system +! GRID%CLOS = 'unset' ! grid closure +! +! GRID%ZLIM = 0. ! coastline limit depth (m) +! GRID%DMIN = 0. ! abs. minimum water depth (m) +! -------------------------------------------------------------------- ! +&GRID_NML + GRID%NAME = 'HOMOGENEOUS SOURCE TERM TEST' + GRID%NML = '../input_10ms/namelists_ST4_T707.nml' + GRID%TYPE = 'RECT' + GRID%COORD = 'SPHE' + GRID%CLOS = 'NONE' + GRID%ZLIM = -5. + GRID%DMIN = 5.75 +/ + +! -------------------------------------------------------------------- ! +! Define the rectilinear grid type via RECT_NML namelist +! - only for RECT grids - +! +! * The minimum grid size is 3x3. +! +! * If the grid increments SX and SY are given in minutes of arc, the scaling +! factor SF must be set to 60. to provide an increment factor in degree. +! +! * If CSTRG='SMPL', then SX is forced to 360/NX. +! +! * value <= value_read / scale_fac +! +! * namelist must be terminated with / +! * definitions & defaults: +! RECT%NX = 0 ! number of points along x-axis +! RECT%NY = 0 ! number of points along y-axis +! +! RECT%SX = 0. ! grid increment along x-axis +! RECT%SY = 0. ! grid increment along y-axis +! RECT%SF = 1. ! scaling division factor for x-y axis +! +! RECT%X0 = 0. ! x-coordinate of lower-left corner (deg) +! RECT%Y0 = 0. ! y-coordinate of lower-left corner (deg) +! RECT%SF0 = 1. ! scaling division factor for x0,y0 coord +! -------------------------------------------------------------------- ! +&RECT_NML + RECT%NX = 3 + RECT%NY = 3 + RECT%SX = 1. + RECT%SY = 1. + RECT%SF = 1.E-2 + RECT%X0 = -1. + RECT%Y0 = -1. + RECT%SF0 = 1.E-2 +/ + +! -------------------------------------------------------------------- ! +! Define the depth to preprocess via DEPTH_NML namelist +! - for RECT and CURV grids - +! +! * if no obstruction subgrid, need to set &MISC FLAGTR = 0 +! +! * The depth value must have negative values under the mean sea level +! +! * value <= value_read * scale_fac +! +! * IDLA : Layout indicator : +! 1 : Read line-by-line bottom to top. (default) +! 2 : Like 1, single read statement. +! 3 : Read line-by-line top to bottom. +! 4 : Like 3, single read statement. +! * IDFM : format indicator : +! 1 : Free format. (default) +! 2 : Fixed format. +! 3 : Unformatted. +! * FORMAT : element format to read : +! '(....)' : auto detected (default) +! '(f10.6)' : float type +! +! * Example : +! IDF SF IDLA IDFM FORMAT FILENAME +! 50 0.001 1 1 '(....)' 'GLOB-30M.bot' +! +! * namelist must be terminated with / +! * definitions & defaults: +! DEPTH%SF = 1. ! scale factor +! DEPTH%FILENAME = 'unset' ! filename +! DEPTH%IDF = 50 ! file unit number +! DEPTH%IDLA = 1 ! layout indicator +! DEPTH%IDFM = 1 ! format indicator +! DEPTH%FORMAT = '(....)' ! formatted read format +! -------------------------------------------------------------------- ! +&DEPTH_NML + DEPTH%SF = -2500. + DEPTH%FILENAME = '../input/HOMOGENEOUS.depth' + DEPTH%IDLA = 3 +/ + +! -------------------------------------------------------------------- ! +! WAVEWATCH III - end of namelist ! +! -------------------------------------------------------------------- ! diff --git a/regtests/ww3_ts1/input_10ms/ww3_grid_ST4_T713.nml b/regtests/ww3_ts1/input_10ms/ww3_grid_ST4_T713.nml new file mode 100644 index 000000000..3efd65adf --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/ww3_grid_ST4_T713.nml @@ -0,0 +1,225 @@ +! -------------------------------------------------------------------- ! +! WAVEWATCH III - ww3_grid.nml - Grid pre-processing ! +! -------------------------------------------------------------------- ! + +! -------------------------------------------------------------------- ! +! Define the spectrum parameterization via SPECTRUM_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! SPECTRUM%XFR = 0. ! frequency increment +! SPECTRUM%FREQ1 = 0. ! first frequency (Hz) +! SPECTRUM%NK = 0 ! number of frequencies (wavenumbers) +! SPECTRUM%NTH = 0 ! number of direction bins +! SPECTRUM%THOFF = 0. ! relative offset of first direction [-0.5,0.5] +! -------------------------------------------------------------------- ! +&SPECTRUM_NML + SPECTRUM%XFR = 1.10 + SPECTRUM%FREQ1 = 0.034 + SPECTRUM%NK = 36 + SPECTRUM%NTH = 36 +/ + +! -------------------------------------------------------------------- ! +! Define the run parameterization via RUN_NML namelist +! +! * namelist must be terminated with / +! * definitions & defaults: +! RUN%FLDRY = F ! dry run (I/O only, no calculation) +! RUN%FLCX = F ! x-component of propagation +! RUN%FLCY = F ! y-component of propagation +! RUN%FLCTH = F ! direction shift +! RUN%FLCK = F ! wavenumber shift +! RUN%FLSOU = F ! source terms +! -------------------------------------------------------------------- ! +&RUN_NML + RUN%FLSOU = T +/ + +! -------------------------------------------------------------------- ! +! Define the timesteps parameterization via TIMESTEPS_NML namelist +! +! * It is highly recommended to set up time steps which are multiple +! between them. +! +! * The first time step to calculate is the maximum CFL time step +! which depend on the lowest frequency FREQ1 previously set up and the +! lowest spatial grid resolution in meters DXY. +! reminder : 1 degree=60minutes // 1minute=1mile // 1mile=1.852km +! The formula for the CFL time is : +! Tcfl = DXY / (G / (FREQ1*4*Pi) ) with the constants Pi=3,14 and G=9.8m/s²; +! DTXY ~= 90% Tcfl +! DTMAX ~= 3 * DTXY (maximum global time step limit) +! +! * The refraction time step depends on how strong can be the current velocities +! on your grid : +! DTKTH ~= DTMAX / 2 ! in case of no or light current velocities +! DTKTH ~= DTMAX / 10 ! in case of strong current velocities +! +! * The source terms time step is usually defined between 5s and 60s. +! A common value is 10s. +! DTMIN = 10 +! +! * namelist must be terminated with / +! * definitions & defaults: +! TIMESTEPS%DTMAX = 0. ! maximum global time step (s) +! TIMESTEPS%DTXY = 0. ! maximum CFL time step for x-y (s) +! TIMESTEPS%DTKTH = 0. ! maximum CFL time step for k-th (s) +! TIMESTEPS%DTMIN = 0. ! minimum source term time step (s) +! -------------------------------------------------------------------- ! +&TIMESTEPS_NML + TIMESTEPS%DTMAX = 900. + TIMESTEPS%DTXY = 900. + TIMESTEPS%DTKTH = 900. + TIMESTEPS%DTMIN = 5. +/ + +! -------------------------------------------------------------------- ! +! Define the grid to preprocess via GRID_NML namelist +! +! * the tunable parameters for source terms, propagation schemes, and +! numerics are read using namelists. +! * Any namelist found in the folowing sections is temporarily written +! to param.scratch, and read from there if necessary. +! * The order of the namelists is immaterial. +! * Namelists not needed for the given switch settings will be skipped +! automatically +! +! * grid type can be : +! 'RECT' : rectilinear +! 'CURV' : curvilinear +! 'UNST' : unstructured (triangle-based) +! +! * coordinate system can be : +! 'SPHE' : Spherical (degrees) +! 'CART' : Cartesian (meters) +! +! * grid closure can only be applied in spherical coordinates +! +! * grid closure can be : +! 'NONE' : No closure is applied +! 'SMPL' : Simple grid closure. Grid is periodic in the +! : i-index and wraps at i=NX+1. In other words, +! : (NX+1,J) => (1,J). A grid with simple closure +! : may be rectilinear or curvilinear. +! 'TRPL' : Tripole grid closure : Grid is periodic in the +! : i-index and wraps at i=NX+1 and has closure at +! : j=NY+1. In other words, (NX+1,J<=NY) => (1,J) +! : and (I,NY+1) => (NX-I+1,NY). Tripole +! : grid closure requires that NX be even. A grid +! : with tripole closure must be curvilinear. +! +! * The coastline limit depth is the value which distinguish the sea +! points to the land points. All the points with depth values (ZBIN) +! greater than this limit (ZLIM) will be considered as excluded points +! and will never be wet points, even if the water level grows over. +! It can only overwrite the status of a sea point to a land point. +! The value must have a negative value under the mean sea level +! +! * The minimum water depth allowed to compute the model is the absolute +! depth value (DMIN) used in the model if the input depth is lower to +! avoid the model to blow up. +! +! * namelist must be terminated with / +! * definitions & defaults: +! GRID%NAME = 'unset' ! grid name (30 char) +! GRID%NML = 'namelists.nml' ! namelists filename +! GRID%TYPE = 'unset' ! grid type +! GRID%COORD = 'unset' ! coordinate system +! GRID%CLOS = 'unset' ! grid closure +! +! GRID%ZLIM = 0. ! coastline limit depth (m) +! GRID%DMIN = 0. ! abs. minimum water depth (m) +! -------------------------------------------------------------------- ! +&GRID_NML + GRID%NAME = 'HOMOGENEOUS SOURCE TERM TEST' + GRID%NML = '../input_10ms/namelists_ST4_T713.nml' + GRID%TYPE = 'RECT' + GRID%COORD = 'SPHE' + GRID%CLOS = 'NONE' + GRID%ZLIM = -5. + GRID%DMIN = 5.75 +/ + +! -------------------------------------------------------------------- ! +! Define the rectilinear grid type via RECT_NML namelist +! - only for RECT grids - +! +! * The minimum grid size is 3x3. +! +! * If the grid increments SX and SY are given in minutes of arc, the scaling +! factor SF must be set to 60. to provide an increment factor in degree. +! +! * If CSTRG='SMPL', then SX is forced to 360/NX. +! +! * value <= value_read / scale_fac +! +! * namelist must be terminated with / +! * definitions & defaults: +! RECT%NX = 0 ! number of points along x-axis +! RECT%NY = 0 ! number of points along y-axis +! +! RECT%SX = 0. ! grid increment along x-axis +! RECT%SY = 0. ! grid increment along y-axis +! RECT%SF = 1. ! scaling division factor for x-y axis +! +! RECT%X0 = 0. ! x-coordinate of lower-left corner (deg) +! RECT%Y0 = 0. ! y-coordinate of lower-left corner (deg) +! RECT%SF0 = 1. ! scaling division factor for x0,y0 coord +! -------------------------------------------------------------------- ! +&RECT_NML + RECT%NX = 3 + RECT%NY = 3 + RECT%SX = 1. + RECT%SY = 1. + RECT%SF = 1.E-2 + RECT%X0 = -1. + RECT%Y0 = -1. + RECT%SF0 = 1.E-2 +/ + +! -------------------------------------------------------------------- ! +! Define the depth to preprocess via DEPTH_NML namelist +! - for RECT and CURV grids - +! +! * if no obstruction subgrid, need to set &MISC FLAGTR = 0 +! +! * The depth value must have negative values under the mean sea level +! +! * value <= value_read * scale_fac +! +! * IDLA : Layout indicator : +! 1 : Read line-by-line bottom to top. (default) +! 2 : Like 1, single read statement. +! 3 : Read line-by-line top to bottom. +! 4 : Like 3, single read statement. +! * IDFM : format indicator : +! 1 : Free format. (default) +! 2 : Fixed format. +! 3 : Unformatted. +! * FORMAT : element format to read : +! '(....)' : auto detected (default) +! '(f10.6)' : float type +! +! * Example : +! IDF SF IDLA IDFM FORMAT FILENAME +! 50 0.001 1 1 '(....)' 'GLOB-30M.bot' +! +! * namelist must be terminated with / +! * definitions & defaults: +! DEPTH%SF = 1. ! scale factor +! DEPTH%FILENAME = 'unset' ! filename +! DEPTH%IDF = 50 ! file unit number +! DEPTH%IDLA = 1 ! layout indicator +! DEPTH%IDFM = 1 ! format indicator +! DEPTH%FORMAT = '(....)' ! formatted read format +! -------------------------------------------------------------------- ! +&DEPTH_NML + DEPTH%SF = -2500. + DEPTH%FILENAME = '../input/HOMOGENEOUS.depth' + DEPTH%IDLA = 3 +/ + +! -------------------------------------------------------------------- ! +! WAVEWATCH III - end of namelist ! +! -------------------------------------------------------------------- ! diff --git a/regtests/ww3_ts1/input_10ms/ww3_ounf.nml b/regtests/ww3_ts1/input_10ms/ww3_ounf.nml new file mode 100644 index 000000000..716f1df4b --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/ww3_ounf.nml @@ -0,0 +1,29 @@ +! -------------------------------------------------------------------- ! +! WAVEWATCH III ww3_ounf.nml - Grid output post-processing ! +! -------------------------------------------------------------------- ! + +! -------------------------------------------------------------------- ! +! Define the output fields to postprocess via FIELD_NML namelist +! -------------------------------------------------------------------- ! +&FIELD_NML + FIELD%TIMESTART = '20000101 000000' + FIELD%TIMESTRIDE = '10' + FIELD%TIMECOUNT = '8000' + FIELD%LIST = 'DPT QP QKK WND ICE HS MSS MSD FAW WCC WCF WCH WCM FOC TAW CHA UST' + FIELD%PARTITION = '0 1 2' + FIELD%TYPE = 4 +/ + +! -------------------------------------------------------------------- ! +! Define the content of the output file via FILE_NML namelist +! -------------------------------------------------------------------- ! +&FILE_NML + FILE%IX0 = 2 + FILE%IXN = 2 + FILE%IY0 = 2 + FILE%IYN = 2 +/ + +! -------------------------------------------------------------------- ! +! WAVEWATCH III - end of namelist ! +! -------------------------------------------------------------------- ! diff --git a/regtests/ww3_ts1/input_10ms/ww3_ounp_spec.nml b/regtests/ww3_ts1/input_10ms/ww3_ounp_spec.nml new file mode 100644 index 000000000..34bac9764 --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/ww3_ounp_spec.nml @@ -0,0 +1,48 @@ +! -------------------------------------------------------------------- ! +! WAVEWATCH III ww3_ounp.nml - Point output post-processing ! +! -------------------------------------------------------------------- ! + +! -------------------------------------------------------------------- ! +! Define the output fields to postprocess via POINT_NML namelist +! -------------------------------------------------------------------- ! +&POINT_NML + POINT%TIMESTART = '20000101 000000' + POINT%TIMESTRIDE = '1800.' + POINT%TIMECOUNT = '1000' + POINT%TIMESPLIT = 4 + POINT%BUFFER = 100 + POINT%TYPE = 3 +/ + +! -------------------------------------------------------------------- ! +! Define the content of the output file via FILE_NML namelist +! -------------------------------------------------------------------- ! +&FILE_NML +/ + +! -------------------------------------------------------------------- ! +! Define the type 0, inventory of file +! -------------------------------------------------------------------- ! + + +! -------------------------------------------------------------------- ! +! Define the type 1, spectra via SPECTRA_NML namelist +! -------------------------------------------------------------------- ! +&SPECTRA_NML +/ + +! -------------------------------------------------------------------- ! +! Define the type 2, mean parameter via PARAM_NML namelist +! -------------------------------------------------------------------- ! +&PARAM_NML +/ + +! -------------------------------------------------------------------- ! +! Define the type 3, source terms via SOURCE_NML namelist +! -------------------------------------------------------------------- ! +&SOURCE_NML +/ + +! -------------------------------------------------------------------- ! +! WAVEWATCH III - end of namelist ! +! -------------------------------------------------------------------- ! diff --git a/regtests/ww3_ts1/input_10ms/ww3_shel.nml b/regtests/ww3_ts1/input_10ms/ww3_shel.nml new file mode 100644 index 000000000..d83106ed1 --- /dev/null +++ b/regtests/ww3_ts1/input_10ms/ww3_shel.nml @@ -0,0 +1,54 @@ +! -------------------------------------------------------------------- ! +! WAVEWATCH III ww3_shel.nml - single-grid model ! +! -------------------------------------------------------------------- ! + + +! -------------------------------------------------------------------- ! +! Define top-level model parameters via DOMAIN_NML namelist +! -------------------------------------------------------------------- ! +&DOMAIN_NML + DOMAIN%START = '20000101 000000' + DOMAIN%STOP = '20000106 000000' +/ + +! -------------------------------------------------------------------- ! +! Define each forcing via the INPUT_NML namelist +! -------------------------------------------------------------------- ! +&INPUT_NML + INPUT%FORCING%WINDS = 'H' +/ + +! -------------------------------------------------------------------- ! +! Define the output types point parameters via OUTPUT_TYPE_NML namelist +! -------------------------------------------------------------------- ! +&OUTPUT_TYPE_NML + TYPE%FIELD%LIST = 'DPT QP QKK WND ICE HS MSS MSD FAW WCC WCF WCH WCM FOC TAW CHA UST' + TYPE%POINT%FILE = '../input_10ms/points.list' +/ + +! -------------------------------------------------------------------- ! +! Define output dates via OUTPUT_DATE_NML namelist +! -------------------------------------------------------------------- ! +&OUTPUT_DATE_NML + DATE%FIELD = '19680606 000000' '1800' '20230618 000000' + DATE%POINT = '19680606 000000' '1800' '20230618 000000' +/ + +! -------------------------------------------------------------------- ! +! Define homogeneous input via HOMOG_COUNT_NML and HOMOG_INPUT_NML namelist +! -------------------------------------------------------------------- ! +&HOMOG_COUNT_NML + HOMOG_COUNT%N_CUR = 0 + HOMOG_COUNT%N_WND = 1 +/ + +&HOMOG_INPUT_NML + HOMOG_INPUT(1)%NAME = 'WND' + HOMOG_INPUT(1)%VALUE1 = 10. + HOMOG_INPUT(1)%VALUE2 = 270. + HOMOG_INPUT(1)%VALUE3 = 0. +/ + +! -------------------------------------------------------------------- ! +! WAVEWATCH III - end of namelist ! +! -------------------------------------------------------------------- ! From 4cd995d09caf1e243d8e724827d2d0bb21bb062f Mon Sep 17 00:00:00 2001 From: Jessica Meixner Date: Tue, 31 Oct 2023 16:00:22 -0400 Subject: [PATCH 15/25] update logic to ensure you are not accessing uninitialized dates (#1114) --- model/src/w3wavemd.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/model/src/w3wavemd.F90 b/model/src/w3wavemd.F90 index 44c80964d..c144ab8d8 100644 --- a/model/src/w3wavemd.F90 +++ b/model/src/w3wavemd.F90 @@ -2409,8 +2409,7 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT & #endif ! #ifdef W3_MPI - IF ( ( (DSEC21(TIME,TONEXT(:,1)).EQ.0.) .AND. FLOUT(1) ) .OR. & - ( (DSEC21(TIME,TONEXT(:,7)).EQ.0.) .AND. FLOUT(7) .AND. SBSED ) ) THEN + IF ( (FLOUTG) .OR. (FLOUTG2 .AND. SBSED) ) THEN IF (.NOT. LPDLIB) THEN IF (NRQGO.NE.0 ) THEN #endif From c3451a9a83ee0247cec3b15cf21610ba15872d30 Mon Sep 17 00:00:00 2001 From: Chris Bunney <48915820+ukmo-ccbunney@users.noreply.github.com> Date: Wed, 1 Nov 2023 21:28:47 +0000 Subject: [PATCH 16/25] Initialised S and D arrays in W3SDB1 before potential early return if zero energy. (#1115) --- model/src/w3sdb1md.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/src/w3sdb1md.F90 b/model/src/w3sdb1md.F90 index c297e8522..34c7ec3bf 100644 --- a/model/src/w3sdb1md.F90 +++ b/model/src/w3sdb1md.F90 @@ -232,12 +232,12 @@ SUBROUTINE W3SDB1 (IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D ) ! ! 0. Initialzations ------------------------------------------------- / ! Never touch this 4 lines below ... otherwise my exceptionhandling will not work. + S = 0. + D = 0. THR = DBLE(1.E-15) IF (SUM(A) .LT. THR) RETURN - S = 0. - D = 0. IWB = 1 ! #ifdef W3_T From f702a8fe0bf9f6a6201111c156dcd7adead7bd88 Mon Sep 17 00:00:00 2001 From: Biao Zhao Date: Thu, 2 Nov 2023 18:25:50 +0100 Subject: [PATCH 17/25] ww3_ounp.F90: x/y units attribute corrected from 'm' to 'km' (#1088) --- model/src/ww3_ounp.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/src/ww3_ounp.F90 b/model/src/ww3_ounp.F90 index 0cbc0b653..499e0371f 100644 --- a/model/src/ww3_ounp.F90 +++ b/model/src/ww3_ounp.F90 @@ -3208,7 +3208,7 @@ SUBROUTINE W3CRNC (ITYPE, OTYPE, NCTYPE, NCFILE, NCID, DIMID, DIMLN, VARID, ONE, IRET=NF90_PUT_ATT(NCID,VARID(4),'long_name','x') IRET=NF90_PUT_ATT(NCID,VARID(4),'standard_name','x') IRET=NF90_PUT_ATT(NCID,VARID(4),'globwave_name','x') - IRET=NF90_PUT_ATT(NCID,VARID(4),'units','m') + IRET=NF90_PUT_ATT(NCID,VARID(4),'units','km') IRET=NF90_PUT_ATT(NCID,VARID(4),'scale_factor',1.) IRET=NF90_PUT_ATT(NCID,VARID(4),'add_offset',0.) IRET=NF90_PUT_ATT(NCID,VARID(4),'valid_min',0.) @@ -3225,7 +3225,7 @@ SUBROUTINE W3CRNC (ITYPE, OTYPE, NCTYPE, NCFILE, NCID, DIMID, DIMLN, VARID, ONE, IRET=NF90_PUT_ATT(NCID,VARID(5),'long_name','y') IRET=NF90_PUT_ATT(NCID,VARID(5),'standard_name','y') IRET=NF90_PUT_ATT(NCID,VARID(5),'globwave_name','y') - IRET=NF90_PUT_ATT(NCID,VARID(5),'units','m') + IRET=NF90_PUT_ATT(NCID,VARID(5),'units','km') IRET=NF90_PUT_ATT(NCID,VARID(5),'scale_factor',1.) IRET=NF90_PUT_ATT(NCID,VARID(5),'add_offset',0.) IRET=NF90_PUT_ATT(NCID,VARID(5),'valid_min',0.) From 1f928aa66d6f59237bc48b93f6e27283f63f6c1d Mon Sep 17 00:00:00 2001 From: Chris Bunney <48915820+ukmo-ccbunney@users.noreply.github.com> Date: Mon, 6 Nov 2023 16:13:40 +0000 Subject: [PATCH 18/25] Bugfix: Assign unit numbers to ASCII gridded/point output in multi-grid mode. (#1118) --- model/src/wminitmd.F90 | 76 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/model/src/wminitmd.F90 b/model/src/wminitmd.F90 index daea42c5c..956490b5e 100644 --- a/model/src/wminitmd.F90 +++ b/model/src/wminitmd.F90 @@ -743,7 +743,7 @@ SUBROUTINE WMINIT ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! ! 2.c Set up I/O for individual models (initial) ! - ALLOCATE ( MDS(13,NRGRD), NTRACE(2,NRGRD), ODAT(40,0:NRGRD), & + ALLOCATE ( MDS(15,NRGRD), NTRACE(2,NRGRD), ODAT(40,0:NRGRD), & FLGRD(NOGRP,NGRPP,NRGRD), OT2(0:NRGRD), FLGD(NOGRP,NRGRD), & MDSF(-NRINP:NRGRD,JFIRST:9), IPRT(6,NRGRD), LPRT(NRGRD), & FLGR2(NOGRP,NGRPP,NRGRD),FLG2D(NOGRP,NGRPP), FLG1D(NOGRP), & @@ -2303,8 +2303,20 @@ SUBROUTINE WMINIT ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & SELECT CASE (J) CASE (1) MDS(7,I) = NDSFND +#ifdef W3_ASCII + CALL WMUGET ( MDSE, MDST, NDSFND, 'OUT' ) + CALL WMUSET ( MDSE, MDST, NDSFND, .TRUE., & + DESC='ASCII output file' ) + MDS(14,I) = NDSFND ! ASCII +#endif CASE (2) MDS(8,I) = NDSFND +#ifdef W3_ASCII + CALL WMUGET ( MDSE, MDST, NDSFND, 'OUT' ) + CALL WMUSET ( MDSE, MDST, NDSFND, .TRUE., & + DESC='ASCII output file' ) + MDS(15,I) = NDSFND ! ASCII +#endif CASE (3) MDS(12,I) = NDSFND CALL WMUGET ( MDSE, MDST, NDSFND, 'INP' ) @@ -2422,6 +2434,28 @@ SUBROUTINE WMINIT ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & END IF END IF ! +#ifdef W3_ASCII + IF ( MDS(14,I) .NE. -1 ) THEN ! Grid output (ASCII) + IF ( IAPROC .EQ. NAPFLD ) THEN + TNAME = TRIM(FNMPRE)//'out_grd.' // FILEXT(:II) // '.txt' + CALL WMUSET ( MDSE,MDST, MDS(14,I), .TRUE., NAME=TNAME ) + ELSE + CALL WMUSET ( MDSE,MDST, MDS(14,I), .FALSE. ) + MDS(14,I) = -1 + END IF + END IF + ! + IF ( MDS(15,I) .NE. -1 ) THEN ! Point output (ASCII) + IF ( IAPROC .EQ. NAPPNT ) THEN + TNAME = TRIM(FNMPRE)//'out_pnt.' // FILEXT(:II) // '.txt' + CALL WMUSET ( MDSE,MDST, MDS(15,I), .TRUE., NAME=TNAME ) + ELSE + CALL WMUSET ( MDSE,MDST, MDS(15,I), .FALSE. ) + MDS(15,I) = -1 + END IF + END IF +#endif +! #ifdef W3_T WRITE (MDST,9081) I, TIME #endif @@ -3389,7 +3423,7 @@ SUBROUTINE WMINIT ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! #ifdef W3_T 9020 FORMAT ( ' TEST WMINIT : UNIT NUMBERS FOR GRIDS (',A,')'/ & - 15X,'GRID MDS(1-13)',43X,'NTRACE') + 15X,'GRID MDS(1-15)',43X,'NTRACE') 9021 FORMAT (14X,16I4) 9022 FORMAT ( ' TEST WMINIT : UNIT NUMBERS FOR INTPUT FILES'/ & 15X,'GRID MDSF(JFIRST-9)') @@ -4108,7 +4142,7 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! ! 2.c Set up I/O for individual models (initial) ! - ALLOCATE ( MDS(13,NRGRD), NTRACE(2,NRGRD), ODAT(40,0:NRGRD), & + ALLOCATE ( MDS(15,NRGRD), NTRACE(2,NRGRD), ODAT(40,0:NRGRD), & FLGRD(NOGRP,NGRPP,NRGRD), OT2(0:NRGRD), FLGD(NOGRP,NRGRD), & MDSF(-NRINP:NRGRD,JFIRST:9), IPRT(6,NRGRD), LPRT(NRGRD), & FLGR2(NOGRP,NGRPP,NRGRD),FLG2D(NOGRP,NGRPP), FLG1D(NOGRP), & @@ -5400,8 +5434,20 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & SELECT CASE (J) CASE (1) MDS(7,I) = NDSFND +#ifdef W3_ASCII + CALL WMUGET ( MDSE, MDST, NDSFND, 'OUT' ) + CALL WMUSET ( MDSE, MDST, NDSFND, .TRUE., & + DESC='ASCII output file' ) + MDS(14,I) = NDSFND ! ASCII +#endif CASE (2) MDS(8,I) = NDSFND +#ifdef W3_ASCII + CALL WMUGET ( MDSE, MDST, NDSFND, 'OUT' ) + CALL WMUSET ( MDSE, MDST, NDSFND, .TRUE., & + DESC='ASCII output file' ) + MDS(15,I) = NDSFND ! ASCII +#endif CASE (3) MDS(12,I) = NDSFND CALL WMUGET ( MDSE, MDST, NDSFND, 'INP' ) @@ -5519,6 +5565,28 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & END IF END IF ! +#ifdef W3_ASCII + IF ( MDS(14,I) .NE. -1 ) THEN ! Grid output (ASCII) + IF ( IAPROC .EQ. NAPFLD ) THEN + TNAME = TRIM(FNMPRE)//'out_grd.' // FILEXT(:II) // '.txt' + CALL WMUSET ( MDSE,MDST, MDS(14,I), .TRUE., NAME=TNAME ) + ELSE + CALL WMUSET ( MDSE,MDST, MDS(14,I), .FALSE. ) + MDS(14,I) = -1 + END IF + END IF + ! + IF ( MDS(15,I) .NE. -1 ) THEN ! Point output (ASCII) + IF ( IAPROC .EQ. NAPPNT ) THEN + TNAME = TRIM(FNMPRE)//'out_pnt.' // FILEXT(:II) // '.txt' + CALL WMUSET ( MDSE,MDST, MDS(15,I), .TRUE., NAME=TNAME ) + ELSE + CALL WMUSET ( MDSE,MDST, MDS(15,I), .FALSE. ) + MDS(15,I) = -1 + END IF + END IF +#endif +! #ifdef W3_T WRITE (MDST,9081) I, TIME #endif @@ -6493,7 +6561,7 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, & ! #ifdef W3_T 9020 FORMAT ( ' TEST WMINITNML : UNIT NUMBERS FOR GRIDS (',A,')'/ & - 15X,'GRID MDS(1-13)',43X,'NTRACE') + 15X,'GRID MDS(1-15)',43X,'NTRACE') 9021 FORMAT (14X,16I4) 9022 FORMAT ( ' TEST WMINITNML : UNIT NUMBERS FOR INTPUT FILES'/ & 15X,'GRID MDSF(JFIRST-9)') From d90078b3cd97418451deeb2909615d77dbd4a136 Mon Sep 17 00:00:00 2001 From: Mickael Accensi <49198861+mickaelaccensi@users.noreply.github.com> Date: Tue, 28 Nov 2023 17:30:37 +0100 Subject: [PATCH 19/25] correct bugs to run correctly GQM implementation (#1127) --- manual/eqs/NL1.tex | 29 +++++++++++++++-------------- manual/manual.bib | 11 +++++++++++ manual/sys/files_w3.tex | 6 +++++- model/src/w3snl1md.F90 | 22 ++++++++++++++-------- model/src/w3src4md.F90 | 2 +- 5 files changed, 46 insertions(+), 24 deletions(-) diff --git a/manual/eqs/NL1.tex b/manual/eqs/NL1.tex index d9bc4c521..c45e9294d 100644 --- a/manual/eqs/NL1.tex +++ b/manual/eqs/NL1.tex @@ -55,37 +55,38 @@ \subsubsection{~$S_{nl}$: Discrete Interaction Approximation (\dia)} \label{sec: \sin(\delta_{\theta,3})&=&\sin(\delta_{\theta,2}) (1-\lambda)^2/(1+\lambda)^2. \end{eqnarray} - For these quadruplets, each source term value -$S_{nl}(\bk)$ corresponding to each discrete $(f_r,\theta)$ -we compute the three contributions that correspond to the situation in which $\bk$ takes the role of $\bk$,$\bk_{2,+}$, $\bk_{2,-}$, $\bk_{3,+}$ and $\bk_{3,-}$ in the quadruplet, namely the full source term is +Hence for any $\bk$ one quadruplet selects $\bk_{2,+}$ and $\bk_{3,+}$, and the other quadruplet selects its mirror image +$\bk_{2,-}$, $\bk_{2,-}$. Because there are 3 different components interacting in the two DIA-selected quadruplets, any discrete spectral component $(f_r,\theta)$ is actually involved in 6 quadruplets and directly exchanges energy with 12 other components $(f_r',\theta')$. Because the values of $f'_r$ and $\theta'$ do not fall exacly on other discrete components, the spectral density is interpolated using a bilinear interpolation, so that each source term value +$S_{nl}(\bk)$ contains the direct exchange of energy with 48 other discrete components. +we compute the three contributions that correspond to the situation in which $\bk$ takes the role of $\bk$,$\bk_{2,+}$, $\bk_{2,-}$, $\bk_{3,+}$ and $\bk_{3,-}$ in the quadruplet, namely the full source term is, without making explicit that bilinear interpolation, \begin{eqnarray} -S_{\mathrm{nl}}(\bk) &=& -2 \left[\delta S_{\mathrm{nl}}(\bk,\bk_2,\bk_3,+)+\delta S_{\mathrm{nl}}(\bk,\bk_2,\bk_3,-)\right] \nonumber \\ - & & + \delta S_{\mathrm{nl}}(\bk_4,\bk,\bk_5,+) + \delta S_{\mathrm{nl}}(\bk_6,\bk,\bk_7,-) \\ - & & + \delta S_{\mathrm{nl}}(\bk_8,\bk_9,\bk, +) + \delta S_{\mathrm{nl}}(\bk_{10},\bk_{11},\bk, -) . \label{eq:diasum} +S_{\mathrm{nl}}(\bk) &=& -2 \left[\delta S_{\mathrm{nl}}(\bk,\bk_{2,+},\bk_{3,+})+\delta S_{\mathrm{nl}}(\bk,\bk_{2,-},\bk_{3,-})\right] \nonumber \\ + & & + \delta S_{\mathrm{nl}}(\bk_4,\bk,\bk_5) + \delta S_{\mathrm{nl}}(\bk_6,\bk,\bk_7) \\ + & & + \delta S_{\mathrm{nl}}(\bk_8,\bk_9,\bk) + \delta S_{\mathrm{nl}}(\bk_{10},\bk_{11},\bk) . \label{eq:diasum} \end{eqnarray} -with elementary contributions given by +where the geometry of the quadruplet $(\bk_4,\bk_4,\bk,\bk_5)$ is obtained from that of $(\bk,\bk,\bk_{2,+},\bk_{3,+})$ by a dilation by a factor $(1+\lambda)^2$ and rotation by the angle $\delta_{\theta,2}$; $(\bk_6,\bk_6,\bk,\bk_7)$ has the same dilation but the opposite rotation; $(\bk_8,\bk_8,\bk_9,\bk)$ is dilated by a factor $(1-\lambda)^2$ and rotated by the angle $-\delta_{\theta,3}$: and $(\bk_{10},\bk_{10},\bk_{11},\bk)$ is dilated by the same factor and rotated by the opposite angle. + + +The elementary contributions $\delta S_{\mathrm{nl}}(\bk_l,\bk_m,\bk_n)$ are given by %----------------------------% % Nonlinear interactions DIA % %----------------------------% % eq:snl_dia \begin{equation} -\delta S_{\mathrm{nl}}(\bk,\bk_2,\bk_3,s) = \frac{C}{g^4} f_{r,1}^{11} \left [ F^2 \left ( \frac{F_{2,s}}{(1+\lambda_{nl})^4} + - \frac{F_{3,s}}{(1-\lambda_{nl})^4} \right ) - \frac{2 F F_{2,s} F_{3,s}}{(1-\lambda_{nl}^2)^4} \right] , +\delta S_{\mathrm{nl}}(\bk_l,\bk_m,\bk_n) = \frac{C}{g^4} f_{r,l}^{11} \left [ F_l^2 \left ( \frac{F_m}{(1+\lambda)^4} + + \frac{F_n}{(1-\lambda)^4} \right ) - \frac{2 F_l F_m F_n}{(1-\lambda^2)^4} \right] , \label{eq:snl_dia} \end{equation} -where $s=+$ or $s=-$ is a sign index, and the spectral densities are $F = F(f_{r} ,\theta)$, $F_{2,+} = F(f_{r,2} ,\theta + \delta_{\theta,2})$, $F_{2,-} = F(f_{r,2} ,\theta - \delta_{\theta,2})$, etc. +where the spectral densities are $F_l = F(f_{r,l} ,\theta_l)$, etc. $C$ is a proportionality constant that was tuned to reproduce the inverse energy cascade. Default values for different source term packages are presented in Table~\ref{tab:snl_par}. -As a result, when accounting for the two quadruplet configurations, the source term at $\bk$ includes the interactions with -10 other spectral components. Besides, because $f_{r,2}$ and $f_{r,3}$ nor $\theta_{2,\pm} $ and $\theta_{3,\pm} $ fall on discretized frequencies and directions, the spectral densities are bilinearly interpolated, which involves 4 discrete spectral components for each of these 10 components. - % tab:snl_par \begin{table} \begin{center} \begin{tabular}{|l|c|c|} \hline - & $\lambda_{nl}$ & $C$ \\ \hline + & $\lambda$ & $C$ \\ \hline ST6 & 0.25 & $3.00 \; 10^7$ \\ \hline \wam-3 & 0.25 & $2.78 \; 10^7$ \\ \hline ST4 (Ardhuin et al.)& 0.25 & $2.50 \; 10^7$ \\ \hline diff --git a/manual/manual.bib b/manual/manual.bib index 0aacb5105..c49e3340b 100644 --- a/manual/manual.bib +++ b/manual/manual.bib @@ -3665,6 +3665,17 @@ @article{art:DC23 year = {2023} } +@ARTICLE{Webb1978, + author = "D. J. Webb", + title = "Nonlinear transfer between sea waves", + journal = DSR, + volume = 25, + pages = "279--298", + year = 1978, + where="paper", +} + + @ARTICLE{Lavrenov2001, author = "Igor V. Lavrenov", title = "Effect of wind wave parameter fluctuation on the nonlinear spectrum evolution", diff --git a/manual/sys/files_w3.tex b/manual/sys/files_w3.tex index fcd48a8f7..d0ad76f7e 100644 --- a/manual/sys/files_w3.tex +++ b/manual/sys/files_w3.tex @@ -506,11 +506,15 @@ \subsubsection{~Wave model modules} \label{sec:wave_mod} \end{flist} \noindent -Nonlinear interaction module (\dia) \hfill {\file w3snl1md.ftn} +Nonlinear interaction module (\dia or GQM) \hfill {\file w3snl1md.ftn} \begin{flisti} \fit{w3snl1}{Calculation of $S_{nl}$.} \fit{insnl1}{Initialization for $S_{nl}$.} +\fit{w3snlgqm}{Calculation of $S_{nl}$.} +\fit{w3scouple}{Calculation of coupling coefficient.} +\fit{gauleg}{Calculation of Gauss-Legendre quadrature coefficients.} +\fit{INSNLGQM}{Initialization for $S_{nl}$ with GQ method.} \end{flisti} \noindent diff --git a/model/src/w3snl1md.F90 b/model/src/w3snl1md.F90 index 598b627ea..09c096d2b 100644 --- a/model/src/w3snl1md.F90 +++ b/model/src/w3snl1md.F90 @@ -825,6 +825,8 @@ SUBROUTINE W3SNLGQM(A,CG,WN,DEPTH,TSTOTn,TSDERn) USE CONSTANTS, ONLY: TPI USE W3GDATMD, ONLY: SIG, NK , NTH , DTH, XFR, FR1, GQTHRSAT, GQAMP + IMPLICIT NONE + REAL, intent(in) :: A(NTH,NK), CG(NK), WN(NK) REAL, intent(in) :: DEPTH REAL, intent(out) :: TSTOTn(NTH,NK), TSDERn(NTH,NK) @@ -883,8 +885,8 @@ SUBROUTINE W3SNLGQM(A,CG,WN,DEPTH,TSTOTn,TSDERn) ! Gamma_max=1.3 (JFMAX>NF) TO OBTAIN IMPROVED RESULTS ! Note by Fabrice Ardhuin: this appears to give the difference in tail benaviour with Gerbrant's WRT !======================================================================= - JFMIN= 1-INT(LOG(1.0D0)/LOG(RAISF)) - JFMAX=NF+INT(LOG(1.3D0)/LOG(RAISF)) + JFMIN=MAX(1-INT(LOG(1.0D0)/LOG(RAISF)),1) + JFMAX=MIN(NF+INT(LOG(1.3D0)/LOG(RAISF)),NK) ! !======================================================================= ! COMPUTES THE SPECTRUM THRESHOLD VALUES (BELOW WHICH QNL4 IS NOT @@ -1065,7 +1067,7 @@ SUBROUTINE W3SNLGQM(A,CG,WN,DEPTH,TSTOTn,TSDERn) TEMP=(TB_TPM(IQ_OM2,JT1,JF1)*(( F(JT1P2P,JFM2)*CF2 *F(JT1P3M,JFM3)*CF3)* & (F(JT,JFM0 )*CF0*TB_V14(JF1)+F(JT1P ,JFM1)*CF1) & -SP0*SP1P*(SP1P2P*V3_4+SP1P3M*V2_4))+T_2M3P*(AUX05*AUX01-AUX02*AUX06)) *CP0 - WRITE(995,'(5I3,3E12.3)') ICONF,JF,JT, F(JT,JFM0) + WRITE(995,'(3I3,3E12.3)') ICONF,JF,JT, F(JT,JFM0) TEMP=(Q_2P3M+Q_2M3P) *CP1 WRITE(995,'(5I3,3E12.3)') ICONF,JF,JT,JT1P, JFM1,AUX00 *CP1, F(JT1P,JFM1),TSTOT(JT1P,JFM1) WRITE(995,'(5I3,3E12.3)') ICONF,JF,JT,JT1P2P,JFM2,-Q_2P3M*CP2,F(JT1P2P,JFM2),TSTOT(JT1P2P,JFM2) @@ -1219,6 +1221,8 @@ FUNCTION COUPLE(XK1 ,YK1 ,XK2 ,YK2 ,XK3 ,YK3 ,XK4 ,YK4) !/ ------------------------------------------------------------------- / USE CONSTANTS, ONLY: GRAV ! + IMPLICIT NONE + DOUBLE PRECISION, INTENT(IN) :: XK1 , YK1 , XK2 , YK2 DOUBLE PRECISION, INTENT(IN) :: XK3 , YK3 DOUBLE PRECISION, INTENT(IN) :: XK4 , YK4 @@ -1305,6 +1309,7 @@ SUBROUTINE GAULEG (W_LEG ,X_LEG ,NPOIN) !/ ------------------------------------------------------------------- / !.....VARIABLES IN ARGUMENT ! """""""""""""""""""" + IMPLICIT NONE INTEGER , INTENT(IN) :: NPOIN DOUBLE PRECISION ,INTENT(INOUT) :: W_LEG(NPOIN) , X_LEG(NPOIN) ! @@ -1552,6 +1557,7 @@ SUBROUTINE INSNLGQM #ifdef W3_S CALL STRACE (IENT, 'INSNLGQM') #endif + IMPLICIT NONE !.....LOCAL VARIABLES INTEGER JF , JT , JF1 , JT1 , NF1P1 , IAUX , NT , NF , IK INTEGER IQ_TE1 , IQ_OM2 , LBUF , DIMBUF , IQ_OM1 , NQ_TE1 , NCONFM @@ -2084,10 +2090,7 @@ SUBROUTINE INSNLGQM AUX=0.0D0 DO JT1=1,GQNT1 DO IQ_OM2=1,GQNQ_OM2 - AAA=TB_FAC(IQ_OM2,JT1,JF1)*TB_TPM(IQ_OM2,JT1,JF1) - IF (AAA.GT.AUX) AUX=AAA - CCC=TB_FAC(IQ_OM2,JT1,JF1)*TB_TMP(IQ_OM2,JT1,JF1) - IF (CCC.GT.AUX) AUX=CCC + AUX=MAX(AUX,TB_FAC(IQ_OM2,JT1,JF1)*TB_TPM(IQ_OM2,JT1,JF1),TB_FAC(IQ_OM2,JT1,JF1)*TB_TMP(IQ_OM2,JT1,JF1)) ENDDO ENDDO MAXCLA(JF1)=AUX @@ -2099,6 +2102,7 @@ SUBROUTINE INSNLGQM DO JF1=1,GQNF1 IF (MAXCLA(JF1).GT.AUX) AUX=MAXCLA(JF1) ENDDO + TEST1=SEUIL1*AUX ! !.....Set to zero the coupling coefficients not used @@ -2128,7 +2132,9 @@ SUBROUTINE INSNLGQM ! !..... counts the fraction of the eliminated configurations ELIM=(1.D0-DBLE(NCONF)/DBLE(NCONFM))*100.D0 - ! WRITE(994,*) 'NCONF:',NCONF,ELIM +#ifdef W3_TGQM + WRITE(994,*) 'NCONF, ELIM FRACTION:',NCONF,ELIM +#endif END SUBROUTINE INSNLGQM !/ !/ End of module W3SNL1MD -------------------------------------------- / diff --git a/model/src/w3src4md.F90 b/model/src/w3src4md.F90 index e2bf12c9a..a1d4423bf 100644 --- a/model/src/w3src4md.F90 +++ b/model/src/w3src4md.F90 @@ -2520,7 +2520,7 @@ SUBROUTINE W3SDS4 (A, K, CG, USTAR, USDIR, DEPTH, DAIR, SRHS, & RETURN END IF ! - WHITECAP(1:2) = 0. + WHITECAP(1:4) = 0. ! ! precomputes integration of Lambda over direction ! times wavelength times a (a=5 in Reul&Chapron JGR 2003) times dk From 3f35df79359f90969b4c33069b82477003d9fdb5 Mon Sep 17 00:00:00 2001 From: Edward Hartnett <38856240+edwardhartnett@users.noreply.github.com> Date: Thu, 30 Nov 2023 12:33:23 -0700 Subject: [PATCH 20/25] Adding documentation to w3iopo() in preparation for code for #682. (#1131) --- model/src/w3iopomd.F90 | 78 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 7 deletions(-) diff --git a/model/src/w3iopomd.F90 b/model/src/w3iopomd.F90 index d573879ce..0c15ea8c6 100644 --- a/model/src/w3iopomd.F90 +++ b/model/src/w3iopomd.F90 @@ -1023,17 +1023,81 @@ SUBROUTINE W3IOPE ( A ) !/ End of W3IOPE ----------------------------------------------------- / !/ END SUBROUTINE W3IOPE - !/ ------------------------------------------------------------------- / + + !> Read or write point output. !> - !> @brief Read/write point output. + !> This subroutine can either read or write the point output file, + !> depending on the value of the first parameter. !> - !> @param[in] INXOUT Test string for read/write. - !> @param[in] NDSOP File unit number. - !> @param[out] IOTST Test indictor for reading. - !> @param[in] IMOD Model number for W3GDAT etc. + !> When reading, the entire file is read with one call to this + !> subroutine. !> - !> @author H. L. Tolman @date 25-Jul-2006 + !> When writing, this subroutine can either write one timestep or + !> the whole model run. This is an option in the input file. If the + !> entire model run is to be written, then OFILES(2) is 0. If only + !> one timestep is to be written, then OFILES(2) is 1. + !> + !> If OFILES(2) is 0, the output file is names out_pnt.ww3. If + !> OFILES(2) is 1, the output file is named TIMETAG.out_pnt.ww3. + !> + !> The format of the point output file is: + !> Size (bytes) | Type | Variable | Meaning + !> -------------|------|----------|-------- + !> 40 | character*40 | IDTST | ID string + !> 4 | integer | VERTST | Model definition file version number + !> 4 | integer | NK | Dimension of frequency + !> 4 | integer | MTH | Directionality of the frequency + !> 4 | integer | NOPTS | Number of output points. + !> 8*NOPTS | integer(2,NOPTS) | PTLOC | Point locations + !> 7*NOPTS | character*7 | PTNME | Point names + !> 8 | integer(2) | TIME | Time + !> reclen*NOPTS | * | * | records + !> + !> Each record contains: + !> Size (bytes) | Type | Variable | Meaning + !> -------------|------|----------|-------- + !> 4 | integer | IW | Number of water points in interpolation box for output point. + !> 4 | integer | II | Number of ice points in interpolation box for output point. + !> 4 | integer | IL | Number of land points in interpolation box for output point. + !> 4 | real | DPO | Interpolated depths. + !> 4 | real | WAO | Interpolated wind speeds. + !> 4 | real | WDO | Interpolated wind directions. + !> 4 | real | TAUAO | (W3_FLX5 only) Interpolated atmospheric stresses. + !> 4 | real | TAUDO | (W3_FLX5 only) Interpolated atmospheric stress directions. + !> 4 | real | DAIRO | (W3_FLX5 only) Interpolated rho atmosphere. + !> 4 | real | ZET_SETO | (W3_SETUP only) Used for wave setup. + !> 4 | real | ASO | Interpolated air-sea temperature difference + !> 4 | real | CAO | Interpolated current speeds. + !> 4 | real | CDO | Interpolated current directions. + !> 4 | real | ICEO | Interpolated ice concentration. + !> 4 | real | ICEHO | Interpolated ice thickness. + !> 4 | real | ICEFO | Interpolated ice floe. + !> 13 | char | GRDID | Originating grid ID + !> 4 | real | SPCO(J,I),J=1,NSPEC | Output spectra !> + !> In the event of error, EXTCDE() will be called with the following exit codes: + !> - 1 INXOUT must be 'READ' or 'WRITE'. + !> - 2 Unexpectedly changed from WRITE to READ in subsequent call. + !> - 10 Unexpected IDSTR + !> - 11 Unexpected VEROPT + !> - 12 Unexpected MK or MTH + !> - 20 Error opening file. + !> - 21 Unexpected end of file during read. + !> - 22 Error reading file. + !> - 23 Unexpected end of file during read. + !> + !> @param[in] INXOUT String indicating read/write. Must be 'READ' or + !> 'WRITE'. + !> @param[in] NDSOP File unit number. + !> @param[out] IOTST Error code: + !> - 0 No error. + !> - -1 Unexpected end of file when reading. + !> @param[in] IMOD Model number for W3GDAT etc. +#ifdef W3_ASCII + !> @param[in] NDSOA File unit number for ASCII output. +#endif + !> + !> @author H. L. Tolman @date 25-Jul-2006 SUBROUTINE W3IOPO ( INXOUT, NDSOP, IOTST, IMOD & #ifdef W3_ASCII ,NDSOA & From ff1b9e9df09607a15b532392594f55a831927941 Mon Sep 17 00:00:00 2001 From: Matthew Masarik <86749872+MatthewMasarik-NOAA@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:42:16 -0500 Subject: [PATCH 21/25] NCEP regtest module updates: uses spack-stack/1.5.0, includes scotch/7.0.4 (#1137) --- regtests/bin/matrix_cmake_ncep | 51 ++++++++++++++++------------------ 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/regtests/bin/matrix_cmake_ncep b/regtests/bin/matrix_cmake_ncep index 771b6f96e..300af93e3 100755 --- a/regtests/bin/matrix_cmake_ncep +++ b/regtests/bin/matrix_cmake_ncep @@ -41,16 +41,18 @@ EOF # Convert main_dir to absolute path main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" -# Module Versions from HPC-Stack that are common for all platforms - modnetcdf='netcdf/4.7.4' - modjasper='jasper/2.0.25' - modzlib='zlib/1.2.11' +# Module Versions from spack-stack that are common for all platforms + modnetcdfc='netcdf-c/4.9.2' + modnetcdff='netcdf-fortran/4.6.0' + modjasper='jasper/2.0.32' + modzlib='zlib/1.2.13' modpng='libpng/1.6.37' - modhdf5='hdf5/1.10.6' + modhdf5='hdf5/1.14.0' modbacio='bacio/2.4.1' modg2='g2/3.4.5' - modw3emc='w3emc/2.9.2' - modesmf='esmf/8.3.0b09' + modw3emc='w3emc/2.10.0' + modesmf='esmf/8.4.2' + modscotch='scotch/7.0.4' # Set batchq queue, choose modules and other custom variables to fit system and # to define headers etc (default to original version if empty) @@ -62,25 +64,21 @@ EOF batchq='slurm' basemodcomp='intel/2022.1.2' basemodmpi='impi/2022.1.2' - hpcstackpath='/scratch1/NCEPDEV/nems/role.epic/hpc-stack/libs/intel-2022.1.2/modulefiles/stack' - hpcstackversion='hpc/1.2.0' - modcomp='hpc-intel/2022.1.2' - modmpi='hpc-impi/2022.1.2' - scotchpath='/scratch1/NCEPDEV/climate/Matthew.Masarik/waves/opt/hpc-stack/scotch-v7.0.3/install' - metispath='/scratch1/NCEPDEV/climate/Matthew.Masarik/waves/opt/hpc-stack/parmetis-4.0.3/install' - modcmake='cmake/3.20.1' + spackstackpath='/scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.5.0/envs/unified-env-noavx512/install/modulefiles/Core' + modcomp='stack-intel/2021.5.0' + modmpi='stack-intel-oneapi-mpi/2021.5.1' + metispath='/scratch1/NCEPDEV/climate/Matthew.Masarik/waves/opt/spack-stack/1.5.0/parmetis-4.0.3/install' + modcmake='cmake/3.23.1' elif [ $isorion ] then batchq='slurm' basemodcomp='intel/2022.1.2' basemodmpi='impi/2022.1.2' - hpcstackpath='/work/noaa/epic-ps/role-epic-ps/hpc-stack/libs/intel-2022.1.2/modulefiles/stack' - hpcstackversion='hpc/1.2.0' - modcomp='hpc-intel/2022.1.2' - modmpi='hpc-impi/2022.1.2' - scotchpath='/work2/noaa/marine/mmasarik/waves/opt/hpc-stack/scotch-v7.0.3/install' - metispath='/work2/noaa/marine/mmasarik/waves/opt/hpc-stack/parmetis-4.0.3/install' - modcmake='cmake/3.22.1' + spackstackpath='/work/noaa/epic/role-epic/spack-stack/orion/spack-stack-1.5.0/envs/unified-env/install/modulefiles/Core' + modcomp='stack-intel/2022.0.2' + modmpi='stack-intel-oneapi-mpi/2021.5.1' + metispath='/work/noaa/marine/Matthew.Masarik/waves/opt/spack-stack/1.5.0/parmetis-4.0.3/install' + modcmake='cmake/3.23.1' else batchq= fi @@ -139,29 +137,28 @@ EOF # Netcdf, Parmetis and SCOTCH modules & variables echo " module purge" >> matrix.head - echo " module load $modcmake" >> matrix.head if [ ! -z $basemodcomp ]; then echo " module load $basemodcomp" >> matrix.head fi if [ ! -z $basemodmpi ]; then echo " module load $basemodmpi" >> matrix.head fi - echo " module use $hpcstackpath" >> matrix.head - echo " module load $hpcstackversion" >> matrix.head + echo " module use $spackstackpath" >> matrix.head echo " module load $modcomp" >> matrix.head echo " module load $modmpi" >> matrix.head + echo " module load $modcmake" >> matrix.head echo " module load $modpng" >> matrix.head echo " module load $modzlib" >> matrix.head echo " module load $modjasper" >> matrix.head echo " module load $modhdf5" >> matrix.head - echo " module load $modnetcdf" >> matrix.head + echo " module load $modnetcdfc" >> matrix.head + echo " module load $modnetcdff" >> matrix.head echo " module load $modbacio" >> matrix.head echo " module load $modg2" >> matrix.head echo " module load $modw3emc" >> matrix.head echo " module load $modesmf" >> matrix.head - + echo " module load $modscotch" >> matrix.head echo " export METIS_PATH=${metispath}" >> matrix.head - echo " export SCOTCH_PATH=${scotchpath}" >> matrix.head echo " export path_build_root=$(dirname $main_dir)/regtests/buildmatrix" >> matrix.head echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}' >> matrix.head echo ' ' From d3ea810da35e9266a4163b4b8f2f4cba5599a5eb Mon Sep 17 00:00:00 2001 From: Jessica Meixner Date: Tue, 12 Dec 2023 15:15:42 -0500 Subject: [PATCH 22/25] Minor update to ncep regtests (#1138) --- regtests/bin/matrix_cmake_ncep | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/regtests/bin/matrix_cmake_ncep b/regtests/bin/matrix_cmake_ncep index 300af93e3..7d0d26bec 100755 --- a/regtests/bin/matrix_cmake_ncep +++ b/regtests/bin/matrix_cmake_ncep @@ -62,8 +62,6 @@ EOF then # If no other h, assuming Hera batchq='slurm' - basemodcomp='intel/2022.1.2' - basemodmpi='impi/2022.1.2' spackstackpath='/scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.5.0/envs/unified-env-noavx512/install/modulefiles/Core' modcomp='stack-intel/2021.5.0' modmpi='stack-intel-oneapi-mpi/2021.5.1' @@ -72,8 +70,6 @@ EOF elif [ $isorion ] then batchq='slurm' - basemodcomp='intel/2022.1.2' - basemodmpi='impi/2022.1.2' spackstackpath='/work/noaa/epic/role-epic/spack-stack/orion/spack-stack-1.5.0/envs/unified-env/install/modulefiles/Core' modcomp='stack-intel/2022.0.2' modmpi='stack-intel-oneapi-mpi/2021.5.1' @@ -94,7 +90,7 @@ EOF # 1.a Computer/ user dependent set up - echo '#!/bin/sh --login' > matrix.head + echo '#!/bin/sh' > matrix.head echo ' ' >> matrix.head if [ $batchq = "slurm" ] && [ $isorion ] then From 88c89be2b4d868442bfea6dfc29feb5eba1e2058 Mon Sep 17 00:00:00 2001 From: Edward Hartnett <38856240+edwardhartnett@users.noreply.github.com> Date: Tue, 26 Dec 2023 13:16:55 -0700 Subject: [PATCH 23/25] Updated intel workflow to install oneapi compilers from new location. (#1157) --- .github/workflows/intel.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml index 700553cea..54a388c55 100644 --- a/.github/workflows/intel.yml +++ b/.github/workflows/intel.yml @@ -1,3 +1,8 @@ +# This is a GitHub actions workflow for WW3. +# +# This workflow builds with the Intel compilers. +# +# Matt Masarik, Alex Richert, Ed Hartnett name: Intel Linux Build on: [push, pull_request, workflow_dispatch] @@ -8,7 +13,7 @@ concurrency: # Set I_MPI_CC/F90 so Intel MPI wrapper uses icc/ifort instead of gcc/gfortran env: - cache_key: intel10 + cache_key: intel10-3 CC: icc FC: ifort CXX: icpc @@ -51,7 +56,7 @@ jobs: sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list sudo apt-get update - sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-mpi-devel intel-oneapi-openmp intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic + sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-mpi-devel intel-oneapi-compiler-fortran-2023.2.1 intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.2.1 intel-oneapi-openmp # Build WW3 spack environment - name: install-dependencies-with-spack From 7bec5605487761a03759a5e2f5f7159f18f0ca1b Mon Sep 17 00:00:00 2001 From: Edward Hartnett <38856240+edwardhartnett@users.noreply.github.com> Date: Thu, 4 Jan 2024 10:03:03 -0700 Subject: [PATCH 24/25] Add unit test for points I/O code. (#1158) --- .github/workflows/io_gnu_yml.old | 122 +++++++++++++++++ CMakeLists.txt | 6 + regtests/unittests/CMakeLists.txt | 39 ++++++ regtests/unittests/data/switch.io | 1 + regtests/unittests/data/ww3_grid.inp | 48 +++++++ regtests/unittests/data/ww3_outp.inp | 8 ++ regtests/unittests/test_io_points_bin.F90 | 152 ++++++++++++++++++++++ 7 files changed, 376 insertions(+) create mode 100644 .github/workflows/io_gnu_yml.old create mode 100644 regtests/unittests/CMakeLists.txt create mode 100644 regtests/unittests/data/switch.io create mode 100644 regtests/unittests/data/ww3_grid.inp create mode 100644 regtests/unittests/data/ww3_outp.inp create mode 100644 regtests/unittests/test_io_points_bin.F90 diff --git a/.github/workflows/io_gnu_yml.old b/.github/workflows/io_gnu_yml.old new file mode 100644 index 000000000..def5a1402 --- /dev/null +++ b/.github/workflows/io_gnu_yml.old @@ -0,0 +1,122 @@ +name: io_gnu +on: [push, pull_request, workflow_dispatch] + +# Cancel in-progress workflows when pushing to a branch +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + cache_key: gnu11-1 + CC: gcc-10 + FC: gfortran-10 + CXX: g++-10 + + +# Split into a steup step, and a WW3 build step which +# builds multiple switches in a matrix. The setup is run once and +# the environment is cached so each build of WW3 can share the dependencies. + +jobs: + setup: + runs-on: ubuntu-latest + + steps: + - name: checkout-ww3 + if: steps.cache-env.outputs.cache-hit != 'true' + uses: actions/checkout@v3 + with: + path: ww3 + # Cache spack, OASIS, and compiler + # No way to flush Action cache, so key may have # appended + - name: cache-env + id: cache-env + uses: actions/cache@v3 + with: + path: | + spack + ~/.spack + work_oasis3-mct + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack_gnu.yaml') }} + + # Build WW3 spack environment + - name: install-dependencies-with-spack + if: steps.cache-env.outputs.cache-hit != 'true' + run: | + # Install NetCDF, ESMF, g2, etc using Spack + sudo apt install cmake + git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git + source spack/share/spack/setup-env.sh + spack env create ww3-gnu ww3/model/ci/spack_gnu.yaml + spack env activate ww3-gnu + spack compiler find + spack external find cmake + spack add mpich@3.4.2 + spack concretize + spack install --dirty -v + + - name: build-oasis + if: steps.cache-env.outputs.cache-hit != 'true' + run: | + source spack/share/spack/setup-env.sh + spack env activate ww3-gnu + export WWATCH3_DIR=${GITHUB_WORKSPACE}/ww3/model + export OASIS_INPUT_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/oasis3-mct + export OASIS_WORK_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct + cd ww3/regtests/ww3_tp2.14/input/oasis3-mct/util/make_dir + cmake . + make VERBOSE=1 + cp -r ${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct ${GITHUB_WORKSPACE} + + io_gnu: + needs: setup + runs-on: ubuntu-latest + + steps: + - name: install-dependencies + run: | + sudo apt-get update + sudo apt-get install doxygen gcovr valgrind + + - name: checkout-ww3 + uses: actions/checkout@v3 + with: + path: ww3 + + - name: cache-env + id: cache-env + uses: actions/cache@v3 + with: + path: | + spack + ~/.spack + work_oasis3-mct + key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack_gnu.yaml') }} + + - name: build-ww3 + run: | + source spack/share/spack/setup-env.sh + spack env activate ww3-gnu + set -x + cd ww3 + export CC=mpicc + export FC=mpif90 + export OASISDIR=${GITHUB_WORKSPACE}/work_oasis3-mct + mkdir build && cd build + export LD_LIBRARY_PATH="/home/runner/work/WW3/WW3/spack/var/spack/environments/ww3-gnu/.spack-env/view/:$LD_LIBRARY_PATH" + cmake -DSWITCH=${GITHUB_WORKSPACE}/ww3/regtests/unittests/data/switch.io -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -Wall -fno-omit-frame-pointer -fsanitize=address" -DCMAKE_C_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -Wall -fno-omit-frame-pointer -fsanitize=address" .. + make -j2 VERBOSE=1 + ./bin/ww3_grid + mv mod_def.ww3 regtests/unittests + ctest --verbose --output-on-failure --rerun-failed + gcovr --root .. -v --html-details --exclude ../regtests/unittests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null + + - name: upload-test-coverage + uses: actions/upload-artifact@v3 + with: + name: ww3-test-coverage + path: | + ww3/build/*.html + ww3/build/*.css + + diff --git a/CMakeLists.txt b/CMakeLists.txt index 58115b3aa..5436f9cb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,3 +58,9 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") endif() add_subdirectory(model) + +# Turn on unit testing. +include(CTest) +if(BUILD_TESTING) + add_subdirectory(regtests/unittests) +endif() diff --git a/regtests/unittests/CMakeLists.txt b/regtests/unittests/CMakeLists.txt new file mode 100644 index 000000000..69445bfb7 --- /dev/null +++ b/regtests/unittests/CMakeLists.txt @@ -0,0 +1,39 @@ +# This is the CMake file for the model/tests directory in the WW3 +# project. +# +# Ed Hartnett, 10/14/23 + +# Some very small test files may be committed to the repo. This +# function copies such a data file to the build directory. +function(copy_test_data name) + message(STATUS "Copying ${name} to ${CMAKE_CURRENT_BINARY_DIR}") + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/data/${name}" + DESTINATION ${CMAKE_CURRENT_BINARY_DIR} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +endfunction() + +# Some very small test files may be committed to the repo. This +# function copies such a data file to the build directory. +function(copy_test_data_2 srcname destname) + message(STATUS "Copying ${srcname} to ${CMAKE_CURRENT_BINARY_DIR}/${destname}") + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/data/${srcname}" + DESTINATION "${CMAKE_BINARY_DIR}" + FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + file(RENAME "${CMAKE_BINARY_DIR}/${srcname}" "${CMAKE_BINARY_DIR}/${destname}") +endfunction() + +# Function to build and run a test. +function(unit_test name) + add_executable(${name} ${name}.F90) + target_link_libraries(${name} PRIVATE ww3_lib) + add_test(NAME ${name} COMMAND ${name}) +endfunction() + +# Copy test data files that are in the repo to the build directory. +copy_test_data(switch.io) +copy_test_data_2(ww3_grid.inp ww3_grid.inp) + +# Build and run the tests. +unit_test(test_io_points_bin) + + diff --git a/regtests/unittests/data/switch.io b/regtests/unittests/data/switch.io new file mode 100644 index 000000000..c97e44765 --- /dev/null +++ b/regtests/unittests/data/switch.io @@ -0,0 +1 @@ +NOGRB SHRD PR1 FLX2 LN0 ST0 NL0 BT0 DB0 TR0 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 O0 O1 O2 O3 O4 O5 O6 O7 O10 O11 \ No newline at end of file diff --git a/regtests/unittests/data/ww3_grid.inp b/regtests/unittests/data/ww3_grid.inp new file mode 100644 index 000000000..6f45604f3 --- /dev/null +++ b/regtests/unittests/data/ww3_grid.inp @@ -0,0 +1,48 @@ +$ WAVEWATCH III Grid preprocessor input file +$ ------------------------------------------ + '1-D REFRACTION X ' +$ + 1.25 0.08 3 24 0. +$ + F T F T F F + 300. 300. 150. 300. +$ + &PRO1 CFLTM = 0.75 / + &PRO2 CFLTM = 0.75 / + &PRO3 CFLTM = 0.75, WDTHCG = 0., WDTHTH = 0. / + &PRO4 CFLTM = 0.75, RNFAC = 0., RSFAC = 0. / +END OF NAMELISTS +$ + 'RECT' F 'NONE' + 13 3 + 5.E3 5.E3 1. + -5.E3 -5.E3 1. +$ + -1. 1. 10 -1. 2 1 '(....)' 'UNIT' 'input' +$ +$ First grid +$ + 50 50 50 45 40 35 30 25 20 15 10 5 0 + 50 50 50 45 40 35 30 25 20 15 10 5 0 + 50 50 50 45 40 35 30 25 20 15 10 5 0 +$ +$ Second grid +$ +$ 0 5 10 15 20 25 30 35 40 45 50 50 50 +$ 0 5 10 15 20 25 30 35 40 45 50 50 50 +$ 0 5 10 15 20 25 30 35 40 45 50 50 50 +$ + 10 1 1 '(....)' 'PART' 'input' +$ +$ First grid +$ + 2 2 F +$ +$ Second grid +$ +$ 12 2 F + 0 0 F + 0 0 F + 0 0 +$ + 0. 0. 0. 0. 0 diff --git a/regtests/unittests/data/ww3_outp.inp b/regtests/unittests/data/ww3_outp.inp new file mode 100644 index 000000000..dd728819f --- /dev/null +++ b/regtests/unittests/data/ww3_outp.inp @@ -0,0 +1,8 @@ +$ + 20100101 000000 3600 1 +$ + 1 + -1 +$ + 4 + 2 30 20100101 000000 'UTC' diff --git a/regtests/unittests/test_io_points_bin.F90 b/regtests/unittests/test_io_points_bin.F90 new file mode 100644 index 000000000..69c197bce --- /dev/null +++ b/regtests/unittests/test_io_points_bin.F90 @@ -0,0 +1,152 @@ +! This is a test for model IO for WW3. This tests the legacy (binary) +! output of points data, done by function W3IOPO(). +! +! Ed Hartnett 10/14/23 +program test_io_points_bin + use w3iopomd + use w3gdatmd + use w3wdatmd + use w3odatmd + use w3iogrmd + use w3adatmd + implicit none + + integer, target :: i + integer :: ndsop, iotest, ndsbul, ndsm + integer :: ndstrc, ntrace + character*7 expected_ptnme + character*6 my_fmt + real :: expected_loc_1 + integer :: write_test_file + + print *, 'Testing WW3 binary point file code.' + + ! These are mysterious but have to be called or else the IPASS + ! variable does not exist and w3iopo() crashes. + call w3nmod(1, 6, 6) + call w3setg(1, 6, 6) + call w3ndat(6, 6) + call w3setw(1, 6, 6) + call w3nout(6, 6) + call w3seto(1, 6, 6) + + ndsm = 20 + ndsop = 20 + ndsbul = 0 + ndstrc = 6 + ntrace = 10 + + ! Create a point output file needed for this test. + if (write_test_file() .ne. 0) stop 1 + + write (ndso,900) +900 FORMAT (/15X,' *** WAVEWATCH III Point output post.*** '/ & + 15X,'==============================================='/) + + ! 2. Read model definition file. + CALL W3IOGR('READ', NDSM) + WRITE (NDSO,920) GNAME +920 FORMAT (' Grid name : ',A/) + + ! This will not work. But cannot be tested because it will change the value of IPASS, +! call w3iopo('EAD', ndsop, iotest) +! if (iotest .ne. 1) stop 7 + + ! Read the file out_pnt.ww3 from the model/tests/data directory. + call w3iopo('READ', ndsop, iotest) + if (iotest .ne. 0) stop 10 + close(ndsop) + + ! Make sure we got the values we expected. + if (nopts .ne. 11) stop 11 + expected_loc_1 = 0.0 + do i = 1, nopts + ! Check ptnme and ptloc arrays. + print *, ptnme(i), ptloc(1, i), ptloc(2, i) + if (i .lt. 10) then + my_fmt = '(a,i1)' + else + my_fmt = '(a,i2)' + endif + write(fmt = my_fmt, unit=expected_ptnme) 'Point', i + if (ptnme(i) .ne. expected_ptnme) stop 20 + print *, expected_loc_1 + if (ptloc(1, i) .ne. expected_loc_1) stop 21 + expected_loc_1 = expected_loc_1 + 5000.0 + if (ptloc(2, i) .ne. 0) stop 22 + end do + + print *, 'OK!' + print *, 'SUCCESS!' +end program test_io_points_bin + +integer function write_test_file() + implicit none + + integer :: ntlu, nk, nth, nopts + character(len=10), parameter :: veropt = '2021-04-06' + character(len=31), parameter :: idstr = 'WAVEWATCH III POINT OUTPUT FILE' + real :: ptloc(2,11) = reshape((/ 0., 0., 5000., 0., 10000., 0., 15000., 0., & + 20000., 0., 25000., 0., 30000., 0., 35000., 0., 40000., 0., 45000., 0., 50000., 0. /), & + (/ 2, 11 /)) + character*40 ptnme(11) + integer :: time(2) = (/ 19680606, 0 /) + integer :: nspec = 72 + integer :: iw(11) = (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /) + integer :: ii(11) = (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /) + integer :: il(11) = (/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /) + real :: iceo(11) = (/ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. /) + real :: iceho(11) = (/ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. /) + real :: icefo(11) = (/ 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000. /) + real :: dpo(11) = (/ 50., 50., 45., 40., 35., 30., 25., 20., 15., 10., 5. /) + real :: wao(11) = (/ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. /) + real :: wdo(11) = (/ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. /) + real :: aso(11) = (/ -999.900024, -999.900024, -999.900024, -999.900024, -999.900024, & + -999.900024, -999.900024, -999.900024, -999.900024, -999.900024, -999.900024 /) + real :: cao(11) = (/ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. /) + real :: cdo(11) = (/ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. /) + character*13 :: grdid(11) + real :: spco(72, 11) + integer :: i, j + integer :: ierr + + ! Initialize some values. + ntlu = 21 + nk = 3 + nth = 24 + nopts = 11 + do i = 1, nopts + if (i .le. 9) then + write(ptnme(i), '(a,i1)') 'Point', i + else + write(ptnme(i), '(a,i2)') 'Point', i + endif + grdid(i) = 'ww3 ' + end do + + ! Open the file. + open(ntlu, file="out_pnt.ww3", form="unformatted", status="replace", & + action="write", convert="big_endian", iostat=ierr) + if (ierr .ne. 0) stop 111 + + ! Write our values. + write (ntlu, iostat=ierr) idstr, veropt, nk, nth, nopts + if (ierr .ne. 0) stop 112 + write (ntlu, iostat=ierr) ((ptloc(j,i),j=1,2),i=1,nopts), (ptnme(i),i=1,nopts) + if (ierr .ne. 0) stop 113 + write (ntlu, iostat=ierr) time + if (ierr .ne. 0) stop 114 + do i=1, nopts + write (ntlu, iostat=ierr) iw(i), ii(i), il(i), dpo(i), wao(i), wdo(i), & + aso(i), cao(i), cdo(i), iceo(i), iceho(i), & + icefo(i), grdid(i), (spco(j,i),j=1,nspec) + if (ierr .ne. 0) stop 115 + enddo + + ! Close the file. + close(ntlu) + + ! We're done! + write_test_file = 0 +end function write_test_file + From 63f82704fb6dce077958cfb562193320fb0d0da7 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:12:05 -0500 Subject: [PATCH 25/25] Update Intel CI (relocate /usr/local; ensure intel-oneapi-mpi; use ubuntu-latest) (#1161) --- .github/workflows/intel.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml index 54a388c55..f5de65dcd 100644 --- a/.github/workflows/intel.yml +++ b/.github/workflows/intel.yml @@ -26,7 +26,7 @@ env: jobs: setup: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: @@ -62,6 +62,7 @@ jobs: - name: install-dependencies-with-spack if: steps.cache-env.outputs.cache-hit != 'true' run: | + sudo mv /usr/local /usr/local_mv # Install NetCDF, ESMF, g2, etc using Spack . /opt/intel/oneapi/setvars.sh git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git @@ -72,7 +73,7 @@ jobs: spack compiler find sudo apt install cmake spack external find - spack add intel-oneapi-mpi + spack config add "packages:mpi:require:'intel-oneapi-mpi'" spack config add "packages:all:require:['%intel']" spack concretize spack install --dirty -v --fail-fast @@ -97,7 +98,7 @@ jobs: strategy: matrix: switch: [Ifremer1, NCEP_st2, NCEP_st4, ite_pdlib, NCEP_st4sbs, NCEP_glwu, OASACM, UKMO, MULTI_ESMF] - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: checkout-ww3 @@ -118,6 +119,8 @@ jobs: - name: build-ww3 run: | + sudo mv /usr/local /usr/local_mv + sudo apt install cmake . /opt/intel/oneapi/setvars.sh source spack/share/spack/setup-env.sh spack env activate ww3-intel