19.4.4.2. WW3 pre-processing

19.4.4.2.1. WW3 GRIDGEN

Preprocessing tools for WW3 have been developed under Matlab software. They are available in the GRIDGEN matlab package (a tutorial is available here: ftp://ftp.ifremer.fr/ifremer/ww3/COURS/WAVES_SHORT_COURSE/TUTORIALS/TUTORIAL_GRIDGEN/waves-workshop-exercise-gridgen.pdf).

Basic steps for regular grids are summarized here:

  1. Define your grid parameters:

    dx= ... # in degrees
    dy= ... # in degrees
    lon1d=[...:dx:...] # in degrees
    lat1d=[...:dy:...] # in degrees
    [lon,lat]=meshgrid(lon1d,lat1d);
    
  2. Coastline (defined as polygons in coastal bound ….mat) and bathy (e.g., etopo1.nc) files are used. Some threshold values are set up:

    lim_wet=... ; # proportion of cell from which it is considered " wet"
    cut_off=0; # depth at which cell is considered as "wet"
    dry_val=999; # value given to "dry" cells
    
  3. Grid can then be generated:

    depth=generate_grid(lon,lat,ref_dir,’etopo1’,’lim_wet,cut_off, dry_val)
    
  4. Definition of boundaries:

    lon_start=min(min(lon))-dx;
    lon_end=max(max(lon))+dx;
    lat_start=min(min(lat))-dy;
    lat_end=max(max(lat))+dy;
    coord=[lat_start lon_start lat_end lon_end];
    [b,n]=compute_boundary(coord,bound,1);
    
  5. Mask generation (use of bathy and coastline):

    m=ones(size(depth));
    m(depth==dry_val)=0;
    b_split=split_boundary(b,5*max([dx dy])); # splitting to make computation more efficient
    lim_wet=0.5;
    offset=max([dx,dy]);
    # mask cleaning remove lonely wet cells close to the coastline:
    m2=clean_mask(lon,lat,m,b_split,lim_wet,offset);
    cell_limit=-1 ; # if this value is negative all water bodies except the larger are considered dry (\ie remove all lakes or closed seas), if positive: has to be the minimum number of cells to consider a body as water
    glob=0 ; # if global or not
    [m4,mask_map]=remove_lake(m2,cell_limit,glob);
    
  6. To make a grid from another model grid:

    • read bathymetry and mask from your model file

    • write the bathymetry thanks to write ww3file function, note that WW3 is expecting negative depth in the ocean:

      write_ww3file([data_dir,’/’,’bottomm2’,’.inp’],depth’.*(-1));
      
    • build the mask for WW3: mask=1 is water, mask=0 is for points which won’t be computed, mask=2 for active boundary points

    • write the mask file:

      write_ww3file([data_dir,’/’,’mapsta’,’.inp’],mm’);
      

19.4.4.2.2. Alternative

Alternatively, you can build the grid input files from a CROCO grid file. A script is provided in Coupling_tools/WW3: make_ww3_grd_input_files_from_croco_grd.m

Warning

Do not put the mask to 0 all around your domain, it will create problems in OASIS interpolations. You can either set 1 for sea points or 2 for boundary points.

19.4.4.2.3. Wind, current, and water level forcings

Eventually, wind, current, and water level forcing files with a valid time axis have to be prepared (if you need them as forcing for your WW3 run, not requested in full ocean-wave-atmosphere coupled mode).

A few scripts for preparing ww3 forcing files from CROCO (current and water level, WRF (wind) and CFSR (wind) files already processed through Process_CFSR_files_for_CROCO.sh are provided in croco_tools/Coupling_tools/WW3:

  • script_make_CROCO_current_and_level_for_ww3.sh

  • script_make_WRF_wind_for_ww3.sh

  • script_make_CFSR_wind_for_ww3.sh

WW3 routines are named ww3_ROUTINENAME and take as input file by default: ww3_ROUTINENAME.inp. You have to set parameters in these .inp input files before running.

Steps for WW3 pre-processing are:

./ww3_grid # To prepare the grid and run (NB: timesteps are defined in ww3_grid.inp file)
./ww3_prnc # To prepare wind forcing if you want to use one (not mandatory)
./ww3_strt # To prepare initialisation (not mandatory, will take defalut rest state if not runned)
./ww3_bounc # To prepare spectral boundary conditions (not mandatory, will take initial state as boundary conditions if not runned)

These steps will be performed automatically by the coupling scripts, when you submit the job.

Note

Note on mask/mapsta and bathy in WW3: The input map status (MAPSTA) value in the mask file can be :

  • -2 : excluded boundary points (sea points covered by ice)

  • -1 : excluded sea points (sea points covered by ice)

  • 0 : excluded points (land)

  • 1 : sea points (ocean)

  • 2 : active boundary points • 3 : excluded

  • 7 : ice

The final possible values of the output map status MAPSTA are :

  • -5 : other disabled point

  • -4 : point masked in the two-way nesting

  • -3 : dry point covered by ice

  • -2 : dry point, not covered by ice

  • -1 : wet point covered by ice

  • 0 : land point

  • 1 : active sea point

  • 2 : active boundary point

  • 8 : excluded sea/ice point

  • 7 : excluded sea point, considered iced

  • 15 : excluded sea point, considered dried: can become wet

  • 31 : excluded sea point, inferred in nesting

  • 63 : excluded sea point, masked in 2-way nesting

Coastline limiting depth (m, negative in the ocean) defined in ww3 grid.inp will also affect your MAPSTA: points with depth values above this coastline limit will be transformed to land points and therefore considered as excluded points (never become wet points, even if the water level grows over). In the output of the model, the depth (dpt) is described as : DEPTH = LEV - BATHY, in which the bathy is negative in the sea and positive on land, so the depth will be positive in the sea and a fillvalue on land. When the input water level (LEV) increases, it increases the output depth (DPT) value. The input water level forcing value is stored in WLV output variable, thus it gives the possibility to retrieve the input bathy value at each grid point : BATHY = WLV - DPT.