Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Project: WW3 Configuration - Ayy, It’s Wave!

This project is about setting up a WW3 configuration and any nuances we might want to consider.

Download this project by either:

  1. Running the CrocoDash CLI command: crocodash template --machine derecho --notebook crocodash.projects.ww3

  2. Copying the file from your CrocoDash checkout: demos/crocodash/projects/ww3.ipynb

Grid Generation

The first thing we are going to do is think about how to get a WW3 domain going. Do we want OBCs? How expensive is this domain going to be?

For WW3, we need to think a bit about how expensive it’s going to be (and the answer is fairly high). Please talk to Alper Altuntas for more information. We can run WW3 with no OBCs, but for the sake of explaining everything, we are going to use OBCs.

Given this criteria, I’m going to rip through the first few steps.

from pathlib import Path

from CrocoDash.grid import Grid
from CrocoDash.vgrid import VGrid
from CrocoDash.topo import Topo
from CrocoDash.case import Case


grid = Grid(
  resolution = 0.05, # in degrees
  xstart = 278.0, # min longitude in [0, 360]
  lenx = 5.0, # longitude extent in degrees
  ystart = 7.0, # min latitude in [-90, 90]
  leny = 5.0, # latitude extent in degrees
  name = "wave_fun_grid",
)

topo = Topo(
    grid = grid,
    min_depth = 9.5, # in meters
)

topo.set_from_dataset(    
    bathymetry_path = "<GEBCO_LOWRES>",
    longitude_coordinate_name="lon",
    latitude_coordinate_name="lat",
    vertical_coordinate_name="elevation"
)

topo.depth.plot()
vgrid  = VGrid.hyperbolic(
    nk = 75, # number of vertical levels
    depth = topo.max_depth,
    ratio=20.0 # target ratio of top to bottom layer thicknesses
)
# CESM case (experiment) name
casename = "wave_fun_zone"

# CESM source root (Update this path accordingly!!!)
cesmroot ="<CESM>"

# Place where all your input files go 
inputdir = Path("<inputdir>") / casename
    
# CESM case directory
caseroot = Path("<casedir>") / casename


case = Case(
    cesmroot = cesmroot,
    caseroot = caseroot,
    inputdir = inputdir,
    ocn_grid = grid,
    ocn_vgrid = vgrid,
    ocn_topo = topo,
    project = '<PROJECT>',
    override = True,
    machine = "derecho",
    compset = "1850_DATM%NYF_SLND_SICE_MOM6%REGIONAL_SROF_SGLC_WW3",
    atm_grid_name = "T62" )

WW3 Forcing

WW3 OBC Forcing gets set up in a unique way. WW3 comes with a Fortran script to take “station-like” OBCs and regrids them onto the boundaries of your domain. All we do is prep “station-like” data. In CrocoDash, we take a slice of whatever data product we have (which in our case is ERA5 2D Wave Spectra), and do the following steps:

  1. Split the grid points into single point station files (netcdf)

  2. Create a file to list them (spec.list)

  3. Set a few configuration parameters in a different file (bounc.nml)

  4. Place all of these files in the input directory for waves (the directory is defined as a CESM xml variable).

When you run ./preview_namelist after ./case.build, the WW3 section of the preview_namelists script finds these boundary files and the compiled Fortran script and processes them into a file called nest.ww3.

ERA5 2d Wave Spectra is a slow access product, and requesting data can take days to get processed. If you are interested in using ERA5 2d Wave Spectra, request it EARLY in the hacking part of this workshop. You can request ERA5 2d Wave Spectra by running case.configure_forcings() and case.process_forcings() with the ERA5 2D Wave Spectra product (ERA5_WAVE_SPECTRA) and function name (get_era5_2d_spectra). You will need a login.

Because ERA5 2D Wave Spectra is slow, we will use a fake data product to sketch out our domain and make sure everything works first!

case.configure_forcings(
    date_range=["2020-01-01 00:00:00", "2020-01-09 00:00:00"],
    function_name="get_glorys_data_from_rda",
    ww3_obc_product_name="reference_waves",              
    ww3_obc_function_name="get_reference_wave_spectra",           
)
case.process_forcings()

A quick reminder that we are not creating a WW3 initial condition, so run your domain for a month or two!

Cool! Now, I would shake out the NTASKS & ROOTPEs, build and submit! Based on how large your domain is, the preview namelist on submission may take a while (there’s regridding going on after all)

Feel free to iterate with process forcings! You can run it on the command line with crocodash process --caseroot YOURCASEROOT!