# Tidal Forcing

## Contents

## Tidal Forcing Files in ROMS

Once the appropriate CPP options have been set (e.g. SSH_TIDES, UV_TIDES, RAMP_TIDES), a netcdf file of tidal constituents must be generated.

**Download the desired tidal constituent database and associated software**. There are many tidal constituent databases available for download and the choice of databases depends on the desired constituents and location of the ROMS grid. Two possibilities which have broad geographic range and generally the dominant constituents are the OSU Tidal Data Prediction Software(OTPS) and the ADCIRC tidal database. Remember to download the associated software with each data base as there ire typically routines which facilitate the extraction and interpolation of the database to the ROMS grid.**Interpolate the tidal constituent database to the desired ROMS grid**. See the above comment. While it is possible to write code (e.g. MATLAB, FORTRAN) to perform this task, it is typically easier to use the provided packages.**Verify all open boundary grid cells contain valid data**. During the interpolation process, depending on the land mask for the ROMS grid and the tidal database grid, it is possible to have grid cells near land points which the ROMS grid may define as water, but the tidal grid defines as land. Should this occur a 180 degree phase shift along the open boundary near land points is possible. As ROMS is tidally forced on the open boundary, this could be problematic.**The phase of the u/v/zeta components of the tidal constituents should be shifted to the appropriate reference time(t=to)**.It is typical for tidal constituent databases to be stored with the phase shifted by the equilibrium tidal argument. Consequently the reference time for the tide is not the desired time, as set in ocean.in using the variable TIDE_START. In addition, nodal corrections need to be made due to long period tides. The equilibrium argument and nodal corrections can be calculated using the tidal database software or Rich Pawlowicz's T_TIDE MATLAB package. Also, see below for more thoughts on the 18.6 year business.**Convert the amplitude/phase information to tidal ellipse parameters, if necessary**. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is ap2ep.m from Zhigang Xu.MATLAB tidal ellipse code is available.**Export tidal ellipse parameters to a ROMS netcdf forcing file**.

Two examples of this process are described below.

Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the "finite" function has been replaced with "isfinite" Rich Pawlowicz has provided an updated version of t_tide on his website http://www.eos.ubc.ca/~rich/#T_Tide. I have also provided a link here [1]

## OSU Tidal Prediction Software Example (Matlab)

The fortran based OTPS tidal constituent extraction routines have been replaced by a MATLAB based version.

The processing in this example was carried out in MATLAB using routines found in http://myroms.org/hunter/roms_tides/ and http://myroms.org/hunter/roms_tides/update/otps It requires T_TIDE and the Earth and Space Research TMD TOOLBOX.

- Download the ESR Tidal Model Driver(OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the TMD routines.
- cd OTPS/
- uncompress tmd_toolbox.zip
- add tmd_toolbox directory to the matlab path.

- Download the appropriate regional or global model database with respect to the ROMS domain. e.g. For a model of the East coast of the United states, download EC.tar.Z. Uncompressing and extracting this file should great a subdirectory called DATA/
- uncompress EC.tar.Z
- tar xvf EC.tar

- Now the tidal constituents are ready to be extracted and saved to a ROMS forcing file. An example (using MATLAB) of how to do this is given in otps2frc_wrapper.m. In the following example, t is the reference date for the tide (i.e. TIDE_START), tpred is the nodal corrections reference time (usually the midpoint of range of the prediction time), and gfile is the ROMS grid file. Also included are and output file and the path the OTIS database.
- >> t=datenum(2005,1,1);
- >> tpred=datenum(2006,1,1);
- >> gfile='/home/hunter/roms/in/roms_latte_grid_3c.nc';
- >> domain='LATTE';
- >> otps2frc_5(gfile,t,tpred,'test_EC.nc','DATA/Model_EC',domain)

Depending on the versions of the Matlab scripts used the user may have problems creating a ROMS forcing file. Depending on the version of the file t_vuf.m (called by otps2frc_v5.m) in the Matlab path, the two lines of otps2frc_v5.m that call t_vuf.m may need to be modified. If the version t_vuf.m in the Matlab path requires 4 inputs, instead of the three given by otps2frc_v5.m, then either 'full' or 'nodal' needs to be added as the first input variable.

## ADCIRC Tidal Database Example (Matlab)

The processing in this example was carried out in MATLAB using routines found in http://myroms.org/hunter/roms_tides/. It requires T_TIDE.

- Download the desired ADCIRC tidal database. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory.
- unzip ec2001_v2e.zip

- Compile tides_ec2001.f into the executable tides_ec2001.out. *
- f77 -g -o adcirc_extract tides_ec2001.f

- Now the tidal constituents are ready to be extracted and saved to a ROMS forcing file. An example (using MATLAB) of how to do this is given in adcirc2frc_wrapper.m. In the following example, t is the reference date for the tide (i.e. TIDE_START),tp is a prediction time(usually the same as the reference data) used to calculate nodal corrections and gfile is the ROMS grid file. Also included are an output filename and a processing flag. The processing flag determines whether adcirc_extract is executed. It needs to be run only once. As it can take a very long time, once the output file tides.out is generated, change this from 1 to 0.
- >> t=datenum(2005,1,1);
- >> tp=datenum(2006,1,1);
- >> gfile='/home/hunter/roms/in/roms_latte_grid_3c.nc';
- >> domain='LATTE';
- >> adcirc2frc_v5(gfile,t,tp,'test_adcirc.nc',1,domain)

* - The file tides_ec2001.f is written to compile using SUN f77. It will not work with g77 as downloaded from the ADCIRC website. There is a logical unit of of 105 which is out of range for g77. It must be edited to change thes lo a number <99.

This version of adcirc2frc_v5.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.

The files adcirc2frc_v6.m, adcirc2frc_wrapper_v6.m, and read_adcirc_tdb.m have been added to http://myroms.org/hunter/roms_tides/update/adcirc/. This set of files allows the use to extract constituents from the ADCIRC database without the use of fortran.

## Comments on the 18.6 year tides

The "18 year" tide is not a separate tidal constituent, but is rather a modulation of the amplitude (and a phase shift) of the other tides. The amplitude of the modulation for three constituents is shown here:

- Because we run multi-decadal simulations, we have chosen not to include the "nodal corrections" in the external forcing file but to modify ROMS to compute them for the time at hand. The alternative would be to swap out the tidal forcing file every few years.

- These long-period modulations cause us to be dubious of the ROMS detiding algorithm since it is learning on the fly but not forgetting what it was learning nine years before.

- I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are File:Tides ncl.tar.gz.