Skip to content

Commit

Permalink
cleaned up merge with develop in the documentation of the namelists.n…
Browse files Browse the repository at this point in the history
…ml example
  • Loading branch information
Tyler James Hesser committed Dec 13, 2024
2 parents 3aff39b + d82913b commit 98690ce
Show file tree
Hide file tree
Showing 95 changed files with 3,785 additions and 1,137 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
20 changes: 14 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ project(

get_directory_property(hasParent PARENT_DIRECTORY)
if(hasParent)
# Unset flags that come from Parent (ie UFS or other coupled build)
# Unset flags that come from Parent (ie UFS or other coupled build)
# for potential (-r8/-r4) conflict
set(CMAKE_Fortran_FLAGS "")
set(CMAKE_C_FLAGS "")
Expand All @@ -22,8 +22,9 @@ endif()

set(MULTI_ESMF OFF CACHE BOOL "Build ww3_multi_esmf library")
set(NETCDF ON CACHE BOOL "Build NetCDF programs (requires NetCDF)")
set(ENDIAN "BIG" CACHE STRING "Endianness of unformatted output files. Valid values are 'BIG', 'LITTLE', 'NATIVE'.")
set(ENDIAN "BIG" CACHE STRING "Endianness of unformatted output files. Valid values are 'BIG', 'LITTLE', 'NATIVE'.")
set(EXCLUDE_FIND "" CACHE STRING "Don't try and search for these libraries (assumd to be handled by the compiler/wrapper)")
set(ENABLE_DOCS OFF CACHE BOOL "Enable building of doxygen generated documentation")

# make sure all "exclude_find" entries are lower case
list(TRANSFORM EXCLUDE_FIND TOLOWER)
Expand Down Expand Up @@ -59,8 +60,15 @@ endif()

add_subdirectory(model)

# Turn on unit testing.
include(CTest)
if(BUILD_TESTING)
add_subdirectory(regtests/unittests)
# Turn on doxygen documentation
if (ENABLE_DOCS)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/docs/cmake")
include(EnableDoxygen)
add_subdirectory(docs)
endif()

# Turn on unit testing.
#include(CTest)
#if(BUILD_TESTING)
# add_subdirectory(regtests/unittests)
#endif()
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# The WAVEWATCH III Framework

WAVEWATCH III<sup>&reg;</sup> is a community wave modeling framework that includes the
WAVEWATCH III<sup>&reg;</sup> is a community wave modeling framework that includes the
latest scientific advancements in the field of wind-wave modeling and dynamics.

## General Features

WAVEWATCH III<sup>&reg;</sup> solves the random phase spectral action density
balance equation for wavenumber-direction spectra. The model includes options
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<sup>&reg;</sup> .
WAVEWATCH III<sup>&reg;</sup> solves the random phase spectral action density
balance equation for wavenumber-direction spectra. The model includes options
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<sup>&reg;</sup>. For a web-based
view of the WAVEWATCH III<sup>&reg;</sup> source code
refer to the [WW3 doxygen documentation](https://noaa-emc.github.io/WW3).

## Installation

The WAVEWATCH III<sup>&reg;</sup> framework package has two parts that need to be combined so
all runs smoothly: the GitHub repo itself, and a binary data file bundle that
needs to be obtained from our ftp site. Steps to successfully acquire and install
The WAVEWATCH III<sup>&reg;</sup> framework package has two parts that need to be combined so
all runs smoothly: the GitHub repo itself, and a binary data file bundle that
needs to be obtained from our ftp site. Steps to successfully acquire and install
the framework are outlined in our [Quick Start](https://github.com/NOAA-EMC/WW3/wiki/Quick-Start)
guide.

Expand All @@ -35,4 +37,3 @@ endorsement, recommendation or favoring by the Department of Commerce. The
Department of Commerce seal and logo, or the seal and logo of a DOC bureau,
shall not be used in any manner to imply endorsement of any commercial product
or activity by DOC or the United States Government.

1 change: 1 addition & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EnableDoxygen(docs)
6 changes: 3 additions & 3 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.

OUTPUT_DIRECTORY = docs
OUTPUT_DIRECTORY = @doc_output@

# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
Expand Down Expand Up @@ -829,7 +829,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = model/src
INPUT = @src_input@

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -2285,7 +2285,7 @@ CLASS_DIAGRAMS = NO
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.

DIA_PATH =
DIA_PATH =

# If set to YES the inheritance and collaboration graphs will hide inheritance
# and usage relations if the target is undocumented or is not a class.
Expand Down
27 changes: 27 additions & 0 deletions docs/cmake/EnableDoxygen.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Doxygen documentation- Matt Masarik 24-Jul-2024.
function(EnableDoxygen outdir)
find_package(Doxygen REQUIRED)
if (NOT DOXYGEN_FOUND)
add_custom_target(enable_docs
COMMAND false
COMMENT "Doxygen not found")
return()
endif()

set(src_input "${CMAKE_SOURCE_DIR}/model/src")
set(doc_output "${CMAKE_BINARY_DIR}/${outdir}")
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${outdir}/html)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/docs/Doxyfile.in
${CMAKE_BINARY_DIR}/${outdir}/Doxyfile @ONLY)
set(DOXYGEN_GENERATE_HTML YES)
set(DOXYGEN_QUIET YES)
add_custom_target(enable_docs
COMMAND
${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/${outdir}/Doxyfile
WORKING_DIRECTORY
${CMAKE_BINARY_DIR}/${outdir}
COMMENT
"Generate Doxygen HTML documentation")
message("-- Doxygen HTML index page: "
${CMAKE_BINARY_DIR}/${outdir}/html/index.html)
endfunction()
4 changes: 4 additions & 0 deletions manual/eqs/output.tex
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ \subsection{~Output parameters} \label{sub:outpars}
\begin{equation} Q_{kk} = \frac{1}{E^2} \int_0^{f_{NK}} \int_0^{2\pi}
0.5 \left[ A(k,\theta)+ A(k,\theta+\pi)\right]^2 \frac{\sigma^2}{k C_g} \:\rd \theta \: \rd \sigma \: \label{eq:qkk}
\end{equation}
\item \textbf{SKW} Skewness of surface elevation sampled at zero slope. This is the $\lambda_1$ parameter defined in \cite{Barrick&Lipa1985} or $\lambda_{3,0,0}$ in \cite{Srokosz1986}. It is computed from the second order correction to the surface elevation, using ECWAM code by P. Janssen.
\item \textbf{EMB} this is $-\gamma/8 = -(\lambda_{1,2,0}+\lambda_{1,0,2}-2 \lambda{0,1,1} \lambda{1,1,1})/8 (1-\lambda_{0,1,1]^2)$, such that the mean sea level of points with zero slope
is EMB$\times H_s$.
\item \textbf{EMC} this is hte additional tracker bias coefficient equal to $-\lambda_{3,0,0}/24$, which is specific to the choice of retracker, see the $J_z$ function in \cite{DeCarlo&Ardhuin2024}.
\end{list}
\item{Numerical diagnostics }
Expand Down
10 changes: 10 additions & 0 deletions manual/manual.bib
Original file line number Diff line number Diff line change
Expand Up @@ -3760,3 +3760,13 @@ @PHDTHESIS{Gagnaire-Renou2009
year = 2010,
}

@ARTICLE{Srokosz1986,
author = "Meric A. Srokosz",
title = "On the joint distribution of surface elevation and slopes for a non linear random sea, with an application to radar altimetry",
journal = JGR,
volume = 91,
pages = "995--1006",
year = 1986,
keywords={altimeter;sea state bias},
}

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
2 changes: 1 addition & 1 deletion model/inp/ww3_ounf.inp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ DPT CUR WND AST WLV ICE IBG TAU RHO D50 IC1 IC5 HS LM T02 T0M1 T01 FP
$ DIR SPR DP HIG 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 SXY TWO BHD FOC TUS USS P2S USF P2L TWI FIC ABR UBR BED
$ FBB TBB MSS MSC DTD FC CFX CFD CFK U1 U2 WNM TOC
$ FBB TBB MSS MSC DTD FC CFX CFD CFK U1 U2 WNM TOC MSS QP QKK SKW EMB EMC
$
N
DPT HS FP T01
Expand Down
11 changes: 7 additions & 4 deletions model/inp/ww3_shel.inp
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,13 @@ $ 8 Spectrum parameters
$ -------------------------------------------------
$ 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 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
$ 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
$ F F 8 7 SKEW SKW Skewness of elevation for zero slopes
$ F F 8 8 EMBIA1 EMB Mean sea level at zero slopes / Hs
$ F F 8 9 EMBIA2 EMC Tracker bias for LRM least square altimetry
$ -------------------------------------------------
$ 9 Numerical diagnostics
$ -------------------------------------------------
Expand Down
Loading

0 comments on commit 98690ce

Please sign in to comment.