Skip to content

Commit

Permalink
HF ounfpart + NCO switch + DB1 coeff (#14)
Browse files Browse the repository at this point in the history
Merging Hotfixes branch HF_ounfpart into the WW3 master. 

* Bugfix in ww3_ounf.ftn: NBIPART check against NOSWLL was not accouting for zeroth wind partition. See Issue #2.
* Updating link.wcoss_phase2 for grib compile, removing !$ lines in ww3_uprstr that broke compilation of codes with OMPH OMPG switch flags, added new global wave model switch. Added option for writing to fixed netcdf gridded output file when using NCO switch (the issue will be fixed more adequately in v7 following Issue #8).
* DB1 depth-breaking_bugfix: added proper scaling coefficients for radian freq. [radHz]. See issue #7.

Merge will lead to v6.07.1, tag and release will be updated accordingly.
  • Loading branch information
ajhenrique authored Apr 19, 2019
1 parent 913dc83 commit b582f8c
Show file tree
Hide file tree
Showing 22 changed files with 112 additions and 77 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The WAVEWATCH III Framework

WAVEWATCH III ™ is a community wave modeling framework that includes the
WAVEWATCH III ® is a community wave modeling framework that includes the
latest scientific advancements in the field of wind-wave modeling and dynamics.

## General Features
Expand All @@ -11,7 +11,7 @@ for shallow-water (surf zone) applications, as well as wetting and drying of
grid points. Propagation of a wave spectrum can be solved using regular
(rectilinear or curvilinear) and unstructured (triangular) grids. See
[About WW3](https://github.com/NOAA-EMC/WW3/wiki/About-WW3) for a
detailed description of WAVEWATCH III ™.
detailed description of WAVEWATCH III ®.

## Installation

Expand Down
10 changes: 8 additions & 2 deletions model/bin/link.cray_xc.Intel
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@

# Intel compiler ------------------------------------------------------------
# 3.a Build options and determine compiler name
# No GRIB libraries for this one

opt="-o $prog"
opt="$opt -xHost -O3 -ip -fno-alias -fp-model strict -no-fma -ftz"
Expand Down Expand Up @@ -121,7 +120,14 @@
fi
fi

# netcdf library dir
if [ "$ncep_grib_compile" = 'yes' ]
then
# GRIB libraries for this one
opt="$opt -convert big_endian -assume byterecl -prec-div -prec-sqrt -ip"
libs="$libs ${G2_LIB4} ${W3NCO_LIB4} ${BACIO_LIB4} ${JASPER_LIB} ${PNG_LIB} ${Z_LIB}"
fi

# netcdf library dir
if [ "$netcdf_compile" = 'yes' ]
then
case $WWATCH3_NETCDF in
Expand Down
5 changes: 4 additions & 1 deletion model/bin/link.wcoss_phase2
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@
esac
fi

if [ "$prog" = 'ww3_grib' ]
# NCEP grib creation
if [ "$ncep_grib_compile" = 'yes' ]
then
# GRIB libraries for this one
opt="$opt -convert big_endian -assume byterecl -prec-div -prec-sqrt -ip"
libs="$libs ${G2_LIB4} ${W3NCO_LIB4} ${BACIO_LIB4} ${JASPER_LIB} ${PNG_LIB} ${Z_LIB}"
fi

Expand Down
1 change: 1 addition & 0 deletions model/bin/switch_NCEP_glwu
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
F90 NCO NOPA LRB4 NCEP2 DIST MPI SCRIP SCRIPNC NC4 PR3 UQ ST4 STAB0 FLX0 LN1 NL3 BT1 DB1 IC0 IS0 REF0 MLIM TR0 BS0 XX0 WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O4 O5 O6 O7 O14 O15
1 change: 1 addition & 0 deletions model/bin/switch_NCEP_gwm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
F90 NCO NOPA LRB4 NOGRB DIST MPI OMPH OMPG SCRIP SCRIPNC NC4 PR3 UQ ST4 STAB0 FLX0 LN1 NL1 BT1 DB1 IC4 IS0 REF0 TR0 BS0 XX0 WNX1 WNT1 CRX1 CRT1 RWND O0 O1 O2 O4 O5 O6 O7 O14 O15
7 changes: 7 additions & 0 deletions model/bin/w3_make
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@
cdf_programs="$cdf_programs ww3_prtide"
fi

# NCEP GRIB
export ncep_grib_compile="no"
if [ -n "`grep NCEP $switch_file`" ]
then
export ncep_grib_compile="yes"
fi

# MULTI MULTI_ESMF SBS1
if [ -n "`grep SCRIPNC $switch_file`" ] || [ -n "`grep OASIS $switch_file`" ] || [ -n "`grep PDLIB $switch_file`" ]
then
Expand Down
40 changes: 24 additions & 16 deletions model/ftn/w3sdb1md.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,37 @@
!/ | FORTRAN 90 |
!/ | J. H. Alves |
!/ | H. L. Tolman |
!/ ! A. Roland |
!/ | Last update : 08-Jun-2018 |
!/ +-----------------------------------+
!/
!/ 25-Apr-2007 : Origination of module. ( version 3.11 )
!/ 08-Jun-2018 : Add DEBUGDB1. ( version 6.04 )
!/ 03-Apr-2019 : Rewrite in terms of energy density (A. Roland,version 6.07)
!/ 03-Apr-2019 : Add Thornton & Guza, 1983 (A. Roland,version 6.07)
!/
! 1. Purpose :
!
! Compute depth-induced breaking using Battjes and Janssen bore
! model approach
!
! 2. Method :
!
! Sdb = - CDB * FMEAN * QB * B * B * SPEC
!
! Where CDB = SDBC1 = 0.25 * BJALFA (defaults to BJALFA = 1)
! modified via ww3_grid namelist parameter BJALFA
! B = HM / HRMS
! HM = GAMMA * DEP
! GAMMA = SDBC2 defaults to 0.73 (mean Battjes/Janssen value)
! modified via ww3_grid namelist parameter BJGAM
! 2. Method : Battjes & Janssen (1978),
!
! Sbr = Dtot/Etot*WA = D * WA
! Dtot = 0.25*alpha*Qb*fm*Hmax²
! fm = sigma/2Pi
! BB = Hrms²/Hmax² = 8Etot/Hmax²
! D = Dtot/Etot = BJALFA * sigma / pi * Qb/BB = 2 * BJALFA * fm * Qb/BB
!
! AR: only valid for Hrms .le. Hm, Qb .le. 1, otherwise, in the degenrative regime it is
! due to Qb > 1 that all wave are broken and Hrms .le. Hmax
! MLIM can be used to enforce this conditions, source term will smoothly converge to this limit.
!
! Where CDB = SDBC1 = BJALFA (defaults to BJALFA = 1)
! modified via ww3_grid namelist parameter BJALFA
! HM = GAMMA * DEP
! GAMMA = SDBC2 defaults to 0.73 (mean Battjes/Janssen value)
! modified via ww3_grid namelist parameter BJGAM
!
! And QB is estimated by iterations using the nonlinear expression
!
Expand Down Expand Up @@ -145,7 +155,6 @@
!/
INTEGER, INTENT(IN) :: IX ! Local grid number
REAL, INTENT(IN) :: A(NSPEC)
!AR: This below is not good I know ... we need more inlined methods ...
REAL, INTENT(INOUT) :: EMEAN, FMEAN, WNMEAN, DEPTH
REAL, INTENT(OUT) :: S(NSPEC), D(NSPEC)
REAL, INTENT(IN) :: CG(NK)
Expand Down Expand Up @@ -179,7 +188,7 @@
!
!/T WRITE (NDST,9000) SDBC1, SDBC2, FDONLY
!
! 1. Integral quantities ... only for the case when it is used nonlinear in the solver ...
! 1. Integral quantities. AR: make sure mean quantities are computed, need to move upward
!
ETOT = 0.
FMEAN2 = 0.
Expand Down Expand Up @@ -256,16 +265,16 @@
IF (IWB == 1) THEN
IF ( ( BB .GT. THR) .AND. ( ABS ( BB - QB ) .GT. THR) ) THEN
IF ( BB .LT. 1.0) THEN
CBJ = DBLE(SDBC1) * QB * DBLE(FMEAN) / BB
CBJ = 2 * DBLE(SDBC1) * QB * DBLE(FMEAN) / BB
ELSE
CBJ = DBLE(SDBC1) * DBLE(FMEAN) * BB ! Make sure the energy vanishes ...
CBJ = 2 * DBLE(SDBC1) * DBLE(FMEAN) * BB ! AR: degenerative regime, all waves must be .le. Hmax, we just smoothly let the excessive energy vanish by * BB.
END IF
ELSE
CBJ = 0.d0
ENDIF
D = - CBJ
S = D * A
ELSE IF (IWB == 2) THEN
ELSE IF (IWB == 2) THEN
IF (ETOT .GT. THR) THEN
HRMS = SQRT(8*EMEAN)
FAK = (1+4./SQRT(PI)*(B*BB+1.5*B)*exp(-BB)-ERF(B))
Expand All @@ -275,7 +284,6 @@
ENDIF
D = - CBJ
S = D * A
ELSE IF (IWB == 3) THEN
ENDIF

IF (CBJ .GT. 0.) THEN
Expand Down
2 changes: 1 addition & 1 deletion model/ftn/ww3_grid.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,7 @@
!/DB1 ' Using Hmax/d in Miche style formulation.'
!/DB1 END IF
!/DB1 WRITE (NDSO,*)
!/DB1 SDBC1 = 0.25 * BJALFA
!/DB1 SDBC1 = BJALFA
!/DB1 SDBC2 = BJGAM
!/DB1 FDONLY = BJFLAG
!
Expand Down
10 changes: 7 additions & 3 deletions model/ftn/ww3_ounf.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
!/ | F. Ardhuin |
!/ | M. Accensi |
!/ | FORTRAN 90 |
!/ | Last update : 12-Sep-2018 |
!/ | Last update : 28-Mar-2019 |
!/ +-----------------------------------+
!/
!/ 17-Mar-2010 : Creation ( version 3.14_SHOM )
Expand All @@ -31,6 +31,7 @@
!/ 26-Jul-2018 : Changed reading of TABIPART ( version 6.05 )
!/ 12-Sep-2018 : Added extra partitioned fields ( version 6.06 )
!/ 25-Sep-2018 : Add WBT parameter ( version 6.06 )
!/ 28-Mar-2019 : Bugfix to NBIPART check. ( version 6.07 )
!/
!/ Copyright 2009-2013 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
Expand Down Expand Up @@ -381,7 +382,7 @@

! Alternative processing of TABIPART to capture requests
! greater than NOSWLL (C.Bunney):
ALLOCATE(TABIPART(NOSWLL))
ALLOCATE(TABIPART(NOSWLL + 1))
NBIPART=0
DO I=1,30
IF(STRINGIPART(I:I) .EQ. ' ') CYCLE
Expand All @@ -391,7 +392,7 @@
CYCLE
ENDIF
NBIPART = NBIPART + 1
IF(NBIPART .GT. NOSWLL) THEN
IF(NBIPART .GT. NOSWLL + 1) THEN
GOTO 803
ENDIF
TABIPART(NBIPART) = IPART
Expand Down Expand Up @@ -3397,6 +3398,9 @@
FNAMENC(S1+S2+1:S1+S2+3) = '.nc'
FNAMENC(S1+S2+4:S1+S2+6) = ' '

!/NCO ! For NCEP application, requires fixed netcdf file name
!/NCO FNAMENC='ww3.gridded.nc'

! If the flag frequency is .TRUE., defines the fourth dimension
IF (FLFRQ) THEN
UNITVAR(:)=UNITS
Expand Down
2 changes: 1 addition & 1 deletion model/ftn/ww3_ounp.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
!/MPI INTEGER :: IERR_MPI
!/O14 INTEGER :: NDBO
!/S INTEGER, SAVE :: IENT = 0
!/NCO INTEGER :: NDSTAB
!/NCO INTEGER :: NDSTAB, NDST
!
INTEGER, ALLOCATABLE :: INDREQ(:), INDREQTMP(:)
INTEGER,ALLOCATABLE :: NCID(:)
Expand Down
102 changes: 51 additions & 51 deletions model/ftn/ww3_uprstr.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -115,62 +115,62 @@
! i. ww3_uprstr.inp
! It includes some limited information for running the program:
!
!$ -------------------------------------------------------------------- $
!$ WAVEWATCH III Update Restart input file $
!$ -------------------------------------------------------------------- $
!$
!$ Time of Assimilation ----------------------------------------------- $
!$ - Starting time in yyyymmdd hhmmss format.
!$
!$ This is the assimilation starting time and has to be the same with
!$ the time at the restart.ww3.
!$
! -------------------------------------------------------------------- $
! WAVEWATCH III Update Restart input file $
! -------------------------------------------------------------------- $
!
! Time of Assimilation ----------------------------------------------- $
! - Starting time in yyyymmdd hhmmss format.
!
! This is the assimilation starting time and has to be the same with
! the time at the restart.ww3.
!
! 19680607 120000
!$
!$ Choose algorithm to update restart file
!$ UPDN for the Nth approach
!$ The UPDN*, with N<2 the same correction factor is applied at all the grid points
!$ UPD0C:: ELIMINATED
!$ UPDOF:: Option 0F All the spectra are updated with a constant
!$ fac=HsAnl/HsBckg.
!$ Expected input: PRCNTG, as defined at fac
!$ UPD1 :: ELIMINATED
!$ UPDN, with N>1 each gridpoint has its own update factor.
!$ UPD2 :: Option 2 The fac(x,y,frq,theta), is calculated at each grid point
!$ according to HsBckg and HsAnl
!$ Expected input the Analysis field, grbtxt format
!$ UPD3 :: Option 3 The update factor is a surface with the shape of
!$ the background spectrum.
!$ Expected input the Analysis field, grbtxt format
!$ UPD4 :: [NOT INCLUDED in this Version, Just keeping the spot]
!$ Option 4 The generalization of the UPD3. The update factor
!$ is the sum of surfaces which are applied on the background
!$ spectrum.
!$ The algorithm requires the mapping of each partition on the
!$ individual spectra; the map is used to determine the weighting
!$ surfaces.
!$ Expected input: the Analysis field, grbtxt format and the
!$ functions(frq,theta) of the update to be applied.
!
! Choose algorithm to update restart file
! UPDN for the Nth approach
! The UPDN*, with N<2 the same correction factor is applied at all the grid points
! UPD0C:: ELIMINATED
! UPDOF:: Option 0F All the spectra are updated with a constant
! fac=HsAnl/HsBckg.
! Expected input: PRCNTG, as defined at fac
! UPD1 :: ELIMINATED
! UPDN, with N>1 each gridpoint has its own update factor.
! UPD2 :: Option 2 The fac(x,y,frq,theta), is calculated at each grid point
! according to HsBckg and HsAnl
! Expected input the Analysis field, grbtxt format
! UPD3 :: Option 3 The update factor is a surface with the shape of
! the background spectrum.
! Expected input the Analysis field, grbtxt format
! UPD4 :: [NOT INCLUDED in this Version, Just keeping the spot]
! Option 4 The generalization of the UPD3. The update factor
! is the sum of surfaces which are applied on the background
! spectrum.
! The algorithm requires the mapping of each partition on the
! individual spectra; the map is used to determine the weighting
! surfaces.
! Expected input: the Analysis field, grbtxt format and the
! functions(frq,theta) of the update to be applied.
! UPD3
!$
!$ PRCNTG is input for option 1 and it is the percentage of correction
!$applied to all the gridpoints (e.g. 1.)
!$
!
! PRCNTG is input for option 1 and it is the percentage of correction
!applied to all the gridpoints (e.g. 1.)
!
! 0.475
!$
!$ PRCNTG_CAP is global input for option UPD2 and UPD3 and it is a cap on the
!$ maximun correction applied to all the gridpoints (e.g. 0.5)
!$
!
! PRCNTG_CAP is global input for option UPD2 and UPD3 and it is a cap on the
! maximun correction applied to all the gridpoints (e.g. 0.5)
!
! 0.6
!$
!$ Name of the file with the SWH analysis from the DA system $
!$ suffix .grbtxt for text out of grib2 file. $
!$
!
! Name of the file with the SWH analysis from the DA system $
! suffix .grbtxt for text out of grib2 file. $
!
! anl.grbtxt
!$
!$ -------------------------------------------------------------------- $
!$ WAVEWATCH III EoF ww3_uprstr.inp
!$ -------------------------------------------------------------------- $
!
! -------------------------------------------------------------------- $
! WAVEWATCH III EoF ww3_uprstr.inp
! -------------------------------------------------------------------- $
!
! ii. Data files anl.XXX
!
Expand Down
5 changes: 5 additions & 0 deletions regtests/ww3_tpt1.1/info
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
# PTM=5: Wave components defined using a user defined frequency cut-off #
# (PTFCUT). Outputs high frequency and low frequency partition. #
# #
# ===== #
# NOTE: CURRENTLY, THIS TEST NEEDS TO BE RUN WITH THE "-N" FLAG. #
# ===== #
# #
# Use the -g option to select the partitioning method. E.g: #
# for Serial (SHARED): #
# ./bin/run_test -N -g PTM1 -f -o both ../model ww3_tpt1.1 #
Expand All @@ -38,5 +42,6 @@
# ./bin/run_test -N -g PTM2 -n 2 -p aprun -f -s MPI \ #
# -o both ../model ww3_tpt1.1 #
# #
# #
# Chris Bunney, Nov 2018 #
###############################################################################
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b582f8c

Please sign in to comment.