Skip to content

Commit

Permalink
Merge branch 'NOAA-EMC:develop' into ww3_shom
Browse files Browse the repository at this point in the history
  • Loading branch information
aronroland authored Jul 22, 2024
2 parents 7df5855 + b4e119e commit 65b36df
Show file tree
Hide file tree
Showing 40 changed files with 1,887 additions and 770 deletions.
130 changes: 130 additions & 0 deletions .github/workflows/regtest_gnu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: regtest_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}
regtest_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 ..
# make -j2 VERBOSE=1
cd ${GITHUB_WORKSPACE}/ww3
ls -l
${GITHUB_WORKSPACE}/ww3/model/bin/ww3_from_ftp.sh -k
cd regtests
./bin/run_cmake_test -o all -S -T -s PR1_MPI -w work_PR1_MPI -f -p mpirun -n 24 ../model ww3_tp2.5
cd ww3_tp2.5
ls -l
cd work_PR1_MPI
pwd
ls -l
# ncdump -h out_pnt.ww3.nc > ncdump_out.txt
# cat ncdump_out.txt
# pwd
# cat ${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.5/out_pnt_ncdump.txt
# cmp ${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.5/out_pnt_ncdump.txt ncdump_out.txt
- name: cache-data
id: cache-data
uses: actions/cache@v3
with:
path: ww3/ww3_from_ftp.v7.14.1.tar.gz
key: ww3_from_ftp.v7.14.1
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ endif()
add_subdirectory(model)

# Turn on unit testing.
include(CTest)
if(BUILD_TESTING)
add_subdirectory(regtests/unittests)
endif()
#include(CTest)
#if(BUILD_TESTING)
# add_subdirectory(regtests/unittests)
#endif()
9 changes: 6 additions & 3 deletions model/bin/ww3_from_ftp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,14 @@ fi
#Move to top level directory of ww3:
cd $ww3dir

#Download from ftp and uptar:
echo -e "Downloading and untaring file from ftp:"
wget --no-check-certificate https://ftp.emc.ncep.noaa.gov/static_files/public/WW3/ww3_from_ftp.${ww3ver}.tar.gz
#Download from ftp (if not already present) and uptar:
echo -e "Downloading (or finding) and untaring file from ftp:"
if ! test -f ww3_from_ftp.${ww3ver}.tar.gz; then
wget --no-check-certificate https://ftp.emc.ncep.noaa.gov/static_files/public/WW3/ww3_from_ftp.${ww3ver}.tar.gz
fi
tar -xvzf ww3_from_ftp.${ww3ver}.tar.gz


#Move regtest info from data_regtests to regtests:
echo -e "Moving data from data_regtests to regtests"
cp -r data_regtests/ww3_tp2.18/input/*.nc regtests/ww3_tp2.18/input/
Expand Down
6 changes: 6 additions & 0 deletions model/inp/ww3_grid.inp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ $ effective wind speed (!/STAB2).
$ WAM4 and variants : Namelist SIN3
$ ZWND : Height of wind (m).
$ ALPHA0 : minimum value of Charnock coefficient
$ CAPCHA : enable functional form for Cd (1=enabled),
$ only valid when SINTABLE=0.
$ UCAP : Wind speed threshold for cap (CAPCHA=1)
$ SIGMAUCAP : Width of functional form (CAPCHA=1)
$ CHA0 : Initial Charnock coefficient (CAPCHA=1)
$ CHAMIN : Minimum Charnock value (CAPCHA=1)
$ Z0MAX : maximum value of air-side roughness z0
$ BETAMAX : maximum value of wind-wave coupling
$ SINTHP : power of cosine in wind input
Expand Down
6 changes: 6 additions & 0 deletions model/nml/namelists.nml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ $
$ Janssen / Ardhuin : Namelist SIN4
$ ZWND : Height of wind (m).
$ ALPHA0 : minimum value of Charnock coefficient
$ CAPCHA : enable functional form for Cd (1=enabled),
$ only valid when SINTABLE=0.
$ UCAP : Wind speed threshold for cap (CAPCHA=1)
$ SIGMAUCAP : Width of functional form (CAPCHA=1)
$ CHA0 : Initial Charnock coefficient (CAPCHA=1)
$ CHAMIN : Minimum Charnock value (CAPCHA=1)
$ Z0MAX : maximum value of air-side roughness z0
$ BETAMAX : maximum value of wind-wave coupling
$ SINTHP : power of cosine in wind input
Expand Down
5 changes: 2 additions & 3 deletions model/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,9 @@ if("SCRIP" IN_LIST switches)
target_sources(ww3_lib PRIVATE ${scrip_src})
endif()


if("SCRIPNC" IN_LIST switches OR "OASIS" IN_LIST switches OR "TRKNC" IN_LIST switches)
if("SCRIPNC" IN_LIST switches OR "OASIS" IN_LIST switches OR "TRKNC" IN_LIST switches OR "BIN2NC" IN_LIST switches)
if(NOT NetCDF_Fortran_FOUND)
message(FATAL_ERROR "Cannot build SCRIPNC, OASIS, or TRKNC without NetCDF")
message(FATAL_ERROR "Cannot build SCRIPNC, OASIS, TRKNC, or BIN2NC without NetCDF")
endif()
endif()

Expand Down
10 changes: 10 additions & 0 deletions model/src/cmake/switches.json
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,16 @@
}
]
},
{
"name": "bin2nc",
"num_switches": "upto1",
"description": "use netcdf instead of binary model output",
"valid-options": [
{
"name": "BIN2NC"
}
]
},
{
"name": "ascii",
"num_switches": "upto1",
Expand Down
12 changes: 12 additions & 0 deletions model/src/gx_outp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ PROGRAM GXOUTP
#endif
USE W3ODATMD, ONLY: W3SETO, W3NOUT
USE W3IOGRMD, ONLY: W3IOGR
#ifdef W3_BIN2NC
USE W3IOPOMD, ONLY: W3IOPON
#else
USE W3IOPOMD, ONLY: W3IOPO
#endif
USE W3SERVMD, ONLY : ITRACE, NEXTLN, EXTCDE
#ifdef W3_S
USE W3SERVMD, ONLY : STRACE
Expand Down Expand Up @@ -277,7 +281,11 @@ PROGRAM GXOUTP
!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! 3. Read general data and first fields from file
!
#ifdef W3_BIN2NC
CALL W3IOPON ( 'READ', NDSOP, IOTEST )
#else
CALL W3IOPO ( 'READ', NDSOP, IOTEST )
#endif
ALLOCATE ( FLREQ(NOPTS) )
!
WRITE (NDSO,930)
Expand Down Expand Up @@ -369,7 +377,11 @@ PROGRAM GXOUTP
DO
DTEST = DSEC21 ( TIME , TOUT )
IF ( DTEST .GT. 0. ) THEN
#ifdef W3_BIN2NC
CALL W3IOPON ( 'READ', NDSOP, IOTEST )
#else
CALL W3IOPO ( 'READ', NDSOP, IOTEST )
#endif
IF ( IOTEST .EQ. -1 ) THEN
WRITE (NDSO,998)
EXIT
Expand Down
12 changes: 7 additions & 5 deletions model/src/w3bullmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ SUBROUTINE W3BULL &
!
CSVBLINE = BLANK2
!
IPG1 = 0
IF (IOUT .EQ. 1) THEN
IPG1 = 0
DO IP=1, NPTAB
HST(IP,1) = -99.9
TPT(IP,1) = -99.9
Expand All @@ -286,10 +286,12 @@ SUBROUTINE W3BULL &
!
HSTOT = XPART(1,0)
TP = XPART(2,0)
HSP = XPART(1,1:NPART)
TPP = XPART(2,1:NPART)
WNP = TPI / XPART(3,1:NPART)
DMP = MOD( XPART(4,1:NPART) + 180., 360.)
DO IP=1, NPART
HSP(IP) = XPART(1,IP)
TPP(IP) = XPART(2,IP)
WNP(IP) = TPI / XPART(3,IP)
DMP(IP) = MOD( XPART(4,IP) + 180., 360.)
ENDDO

NZERO = 0
NZERO = COUNT( HSP <= BHSMIN .AND. HSP /= 0. )
Expand Down
7 changes: 5 additions & 2 deletions model/src/w3gdatmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,8 @@ MODULE W3GDATMD
SSDSP, WWNMEANP, SSTXFTF, SSTXFTWN, &
FFXPM, FFXFM, FFXFA, &
SSDSBRF1, SSDSBRF2, SSDSBINT,SSDSBCK,&
SSDSHCK, SSDSABK, SSDSPBK, SSINBR
SSDSHCK, SSDSABK, SSDSPBK, SSINBR, &
CAPCHNK(1:10)
REAL :: ZZWND
REAL :: SSDSCOS, SSDSDTH, SSDSBT, SSDSBM(0:4)
#endif
Expand Down Expand Up @@ -1328,7 +1329,8 @@ MODULE W3GDATMD
SSDSPBK, SSINBR,SSINTHP,TTAUWSHELTER,&
SINTAILPAR(:), SSWELLF(:), SSDSC(:), SSDSBR, &
SSDSP, WWNMEANP, SSTXFTF, SSTXFTWN, &
SSDSBT, SSDSCOS, SSDSDTH, SSDSBM(:)
SSDSBT, SSDSCOS, SSDSDTH, SSDSBM(:), &
CAPCHNK(:)
#endif
#ifdef W3_ST6
REAL, POINTER :: SIN6A0, SDS6A1, SDS6A2, SWL6B1, &
Expand Down Expand Up @@ -2670,6 +2672,7 @@ SUBROUTINE W3SETG ( IMOD, NDSE, NDST )
ZZALP => MPARS(IMOD)%SRCPS%ZZALP
TTAUWSHELTER => MPARS(IMOD)%SRCPS%TTAUWSHELTER
SINTAILPAR => MPARS(IMOD)%SRCPS%SINTAILPAR
CAPCHNK => MPARS(IMOD)%SRCPS%CAPCHNK
SSWELLFPAR => MPARS(IMOD)%SRCPS%SSWELLFPAR
SSWELLF => MPARS(IMOD)%SRCPS%SSWELLF
SSDSC => MPARS(IMOD)%SRCPS%SSDSC
Expand Down
24 changes: 20 additions & 4 deletions model/src/w3gridmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ MODULE W3GRIDMD
!/ 19-Jul-2021 : Momentum and air density support ( version 7.14 )
!/ 28-Feb-2023 : GQM as an alternative for NL1 ( version 7.15 )
!/ 11-Jan-2024 : New namelist parameters for IC4 ( version 7.15 )
!/ 03-May-2024 : New CAPCHNK parameters for SIN4 ( version 7.15 )
!/
!/ Copyright 2009-2013 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
Expand Down Expand Up @@ -860,7 +861,8 @@ MODULE W3GRIDMD
SDSBM0, SDSBM1, SDSBM2, SDSBM3, &
SDSBM4, SDSFACMTF, SDSCUMP, SDSNUW, &
SDSL, SDSMWD, SDSMWPOW, SPMSS, SDSNMTF, SINTAIL1, SINTAIL2, &
CUMSIGP, VISCSTRESS
CUMSIGP, VISCSTRESS, &
CAPCHA, CHAMIN, CHA0, UCAP, SIGMAUCAP
#endif
!
#ifdef W3_ST6
Expand Down Expand Up @@ -1004,7 +1006,8 @@ MODULE W3GRIDMD
NAMELIST /SIN4/ ZWND, ALPHA0, Z0MAX, BETAMAX, SINTHP, ZALP, &
TAUWSHELTER, SWELLFPAR, SWELLF, &
SWELLF2, SWELLF3, SWELLF4, SWELLF5, SWELLF6, &
SWELLF7, Z0RAT, SINBR, SINTABLE, SINTAIL1, SINTAIL2, TAUWBUG, VISCSTRESS
SWELLF7, Z0RAT, SINBR, SINTABLE, SINTAIL1, SINTAIL2, TAUWBUG, VISCSTRESS, &
CAPCHA, CHAMIN, CHA0, UCAP, SIGMAUCAP
#endif
#ifdef W3_NL1
NAMELIST /SNL1/ LAMBDA, NLPROP, KDCONV, KDMIN, &
Expand Down Expand Up @@ -1731,6 +1734,11 @@ SUBROUTINE W3GRID()
TAUWBUG = 1 ! TAUWBUG is 1 is the bug is kept:
! initializes TAUWX/Y to zero in W3SRCE
VISCSTRESS =0
CAPCHA = 0. ! =1 indicates capping of drag is active
CHAMIN = 0.0001 !
CHA0 = ALPHA0 ! initial value for charnock
UCAP = 30. ! U10 threshold from which drag capping is applied
SIGMAUCAP = 10. ! Width for reduction of drag beyond UCAP
#endif
!
#ifdef W3_ST6
Expand Down Expand Up @@ -1819,6 +1827,11 @@ SUBROUTINE W3GRID()
SINTAILPAR(3) = SINTAIL2
SINTAILPAR(4) = FLOAT(TAUWBUG)
SINTAILPAR(5) = VISCSTRESS
CAPCHNK(1) = CAPCHA
CAPCHNK(2) = CHAMIN
CAPCHNK(3) = CHA0
CAPCHNK(4) = UCAP
CAPCHNK(5) = SIGMAUCAP
#endif
!
#ifdef W3_ST6
Expand Down Expand Up @@ -3222,7 +3235,8 @@ SUBROUTINE W3GRID()
#ifdef W3_ST4
WRITE (NDSO,2920) ZWND, ALPHA0, Z0MAX, BETAMAX, SINTHP, ZALP, &
TAUWSHELTER, SWELLFPAR, SWELLF, SWELLF2, SWELLF3, SWELLF4, &
SWELLF5, SWELLF6, SWELLF7, Z0RAT, SINBR, SINTABLE, TAUWBUG, VISCSTRESS, SINTAIL1, SINTAIL2
SWELLF5, SWELLF6, SWELLF7, Z0RAT, SINBR, SINTABLE, TAUWBUG, VISCSTRESS, SINTAIL1, SINTAIL2, &
CAPCHA, CHAMIN, CHA0, UCAP, SIGMAUCAP
#endif
#ifdef W3_ST6
WRITE (NDSO,2920) SINA0, SINWS, SINFC
Expand Down Expand Up @@ -6280,7 +6294,9 @@ SUBROUTINE W3GRID()
' SWELLF5 =',F8.5,', SWELLF6 =',F8.5, &
', SWELLF7 =',F12.2,', Z0RAT =',F8.5,', SINBR =',F8.5,','/ &
' SINTABLE =',I2,', TAUWBUG =',I2, &
', VISCSTRESS =',F8.5,', SINTAIL1 =',F8.5,', SINTAIL2 =',F8.5,' /')
', VISCSTRESS =',F8.5,', SINTAIL1 =',F8.5,', SINTAIL2 =',F8.5,',' / &
', CAPCHA =',F8.5,', CHAMIN =',F8.5,', CHA0 =',F8.5,', UCAP =',F5.1,', SIGMAUCAP =', &
F5.1,' /')
#endif
!
#ifdef W3_ST6
Expand Down
Loading

0 comments on commit 65b36df

Please sign in to comment.