<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.myroms.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Elhunter</id>
	<title>WikiROMS - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.myroms.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Elhunter"/>
	<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/Special:Contributions/Elhunter"/>
	<updated>2026-04-27T13:46:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=6691</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=6691"/>
		<updated>2025-11-20T21:02:44Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* OSU Tidal Prediction Software Example (Matlab) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Astronomical Tide Generating Forces==&lt;br /&gt;
The influence of the tide generating forces (&#039;&#039;&#039;TGF&#039;&#039;&#039;) can be introduced in ROMS by consideration of the gradient of the difference between ROMS sea surface, &amp;lt;math&amp;gt;\zeta&amp;lt;/math&amp;gt;, and the sea surface denoted as the equilibrium tide, &amp;lt;math&amp;gt;\zeta_{EQ}&amp;lt;/math&amp;gt;, which is the shape the sea surface would assume if it were motionless and in equilibrium with the tide generating forces on a fluid planet. It is activated with the option [[Options#TIDE_GENERATING_FORCES|TIDE_GENERATING_FORCES]]. It is restricted to spherical grids since we need &#039;&#039;&#039;(lon, lat)&#039;&#039;&#039; of every cell to compute the harmonic constituents parameters for the location of the Moon and Sun. We recommend activating this option in conjunction with boundary tidal forcing ([[Options#SSH_TIDES|SSH_TIDES]] and [[Options#UV_TIDES|UV_TIDES]]). Check the following [https://www.myroms.org/projects/src/ticket/896 trac] ticket for more information about this capability.&lt;br /&gt;
&lt;br /&gt;
If ROMS &amp;lt;math&amp;gt;\zeta&amp;lt;/math&amp;gt; is parallel to the equilibrium tide, i.e. &amp;lt;math&amp;gt;\zeta-\zeta_{EQ} = constant&amp;lt;/math&amp;gt;, then the gradient of this is zero and there is no lateral force due to the tides. Therefore, we can implement the TGF by subtracting &amp;lt;math&amp;gt;\zeta_{EQ}&amp;lt;/math&amp;gt; from ROMS &amp;lt;math&amp;gt;\zeta&amp;lt;/math&amp;gt; prior to computing the baroclinic (3D applications) or barotropic (2D applications) pressure gradient. This will effectively impart the tide generating force as a lateral body force throughout the water column. &lt;br /&gt;
&lt;br /&gt;
If, say, ROMS sea surface was flat but &amp;lt;math&amp;gt;\zeta_{EQ}&amp;lt;/math&amp;gt; was increasing in the positive &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; direction, then &amp;lt;math&amp;gt;-g \frac{\part(\zeta-\zeta_{EQ})}{\part x}&amp;lt;/math&amp;gt; on the RHS of the x-momentum equation is positive indicating flow will be driven in the positive &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; direction until the sea level becomes parallel to the equilibrium tide. &lt;br /&gt;
The equilibrium tide at latitude &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;, longitude &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt;, and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; for the principal diurnal and semi-diurnal tidal constituents is given by ([[Bibliography#ArbicBK_2018a|Arbic &#039;&#039;et al.&#039;&#039; 2018]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
      \zeta_{EQ}(\phi,\lambda,t)= &amp;amp; \sum_{diurnal} A \,\, f(t_T)\,[1+k_2-h_2]\,sin(2\,\phi)\,cos[\omega(t - t_{TS}) + \lambda + \chi(t_{TS}) + \nu(t_{TS})] + \\&lt;br /&gt;
                        &amp;amp;\sum_{semi-d} A \,\, f(t_{TS})\,[1+k_2-h_2]\,cos^{2}(\phi)\,cos[\omega(t - t_{TS}) + 2\lambda + \chi(t_{TS}) + \nu(t_{TS})]\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diurnal and semi-diurnal constituent-dependent parameters in the respective summations above are given in Table 1. Equations for the nodal factors &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; that account for the slow modulation of the tidal constituents due (principally) to the 18.6-year lunar nodal cycle, and the phase &amp;lt;math&amp;gt;\chi&amp;lt;/math&amp;gt; of each constituent at the Greenwich meridian (&amp;lt;math&amp;gt;\lambda=0&amp;lt;/math&amp;gt;), are computed from the equations given in Table 2 using astronomical arguments calculated as indicated in Table 3 for the reference time, &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;, when &#039;&#039;Tides Start&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
For simplicity, I have neglected the long period tidal constituents, &amp;lt;math&amp;gt;M_m&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M_f&amp;lt;/math&amp;gt;. The former is smaller than all the constituents included in Table 1, and the amplitude of &amp;lt;math&amp;gt;M_f&amp;lt;/math&amp;gt; exceeds only those of &amp;lt;math&amp;gt;Q_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Principal diurnal and semi-diurnal tidal constituent frequencies ω, astronomical forcing amplitudes A, and Love number factors [1+k_2-h_2] for computing the equilibrium tide. (Data adapted from [[Bibliography#ArbicBK_2004a|Arbic &#039;&#039;et al.&#039;&#039;, 2004]], Table 1).&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
!Constituent !!Relevant &amp;lt;math&amp;gt;\Sigma&amp;lt;/math&amp;gt; in&amp;lt;br /&amp;gt; &amp;lt;math&amp;gt;\phi_{EQ}&amp;lt;/math&amp;gt; equation !!Frequency&amp;lt;br /&amp;gt;&amp;lt;math&amp;gt;\omega (10^{-4} s^{-1})&amp;lt;/math&amp;gt; !!Amplitude&amp;lt;br /&amp;gt;A (cm) !!Love factors&amp;lt;br /&amp;gt;&amp;lt;math&amp;gt;1+k_2-h_2&amp;lt;/math&amp;gt; !!Period&amp;lt;br /&amp;gt;(solar days)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;Q_1&amp;lt;/math&amp;gt;||diurnal||0.6495854||1.9273||0.695||1.1195&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;O_1&amp;lt;/math&amp;gt;||diurnal||0.6759774||10.0661||0.695||1.0758&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_1&amp;lt;/math&amp;gt;||diurnal||0.7292117||14.1565||0.736||0.9973&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;||semi-diurnal||1.378797||4.6397||0.693||0.5274&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;M_2&amp;lt;/math&amp;gt;||semi-diurnal||1.405189||24.2334||0.693||0.5175&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;S_2&amp;lt;/math&amp;gt;||semi-diurnal||1.454441||11.2743||0.693||0.5000&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_2&amp;lt;/math&amp;gt;||semi-diurnal||1.458423||3.0684||0.693||0.4986&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Harmonic constituents of the equilibrium tide on the Greenwich meridian. The fundamental astronomical arguments &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; must be computed according to the reference date &amp;lt;math&amp;gt;T_{TS}&amp;lt;/math&amp;gt; when tides start using the equations in Table 3. (Data adapted from [[Bibliography#DoodsonAT_1941a|Doodson and Warburg, 1941]], Table 1.) &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
!Constituent!!&amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;non-dimensional&#039;&#039;!!&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;degrees&#039;&#039;!!&amp;lt;math&amp;gt;\chi&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;degrees&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;Q_1&amp;lt;/math&amp;gt;||as for &amp;lt;math&amp;gt;O_1&amp;lt;/math&amp;gt;||as for &amp;lt;math&amp;gt;O_1&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;h-3s+p-90^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;O_1&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;1.009 + 0.187\,cos\,N - 0.015\,cos\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;10.8^{\circ}\,sin\,N - 1.3^{\circ}\,sin\,2N&amp;lt;/math&amp;gt;⁡||&amp;lt;math&amp;gt;h - 2s - 90^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_1&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;1.006 + 0.115\,cos\,N - 0.009\,cos\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;-8.9^{\circ}\,sin\,N + 0.7^{\circ}\,sin\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;h + 90^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;||as for &amp;lt;math&amp;gt;M_2&amp;lt;/math&amp;gt;||as for &amp;lt;math&amp;gt;M_2&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;2h - 3s + p&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;M_2&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;1 - 0.037\,cos\,N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;-2.1^{\circ}\,sin\,N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;2h-2s&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;S_2&amp;lt;/math&amp;gt;||1||&amp;lt;math&amp;gt;0^{\circ}&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;0^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_2&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;1.024 + 0.286\,cos\,N + 0.008\,cos\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;-17.7^{\circ}\,sin\,N + 0.7^{\circ}\,sin\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;2h&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Table 3:&#039;&#039;&#039; Fundamental astronomical arguments to be used in Table 2 for the calculation of nodal factors and phase at Greenwich. Set the value of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; according to the chosen Tide Start time &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;. (Data adapted from [[Bibliography#EgbertGD_2017a|Egbert and Ray, 2017]], Table 1.)&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
!Argument!!Description!!equation!!period&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||terrestrial time in Julian centuries since 12:00 on January 1, 2000||(days since 2000-01-01:12:00:00) / 36525||&amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;||mean longitude of moon||218.316 + 481267.8812 &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||tropical month&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;||mean longitude of sun||280.466 + 36000.7698 &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||tropical year&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;||mean longitude of lunar perigee||83.353 + 4069.0137 &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||8.85 &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;||mean longitude of lunar node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;||–234.955 – 1934.1363 &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||18.6 &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ROMS allows users to specify a different reference time for the model time and the Tide Start time used for the open boundary tide harmonics. We need to accommodate this here while enforcing that the tide generating forces and boundary harmonics have the same reference time, i.e. &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we denote the date when ROMS time starts as &amp;lt;math&amp;gt;t_{RS}&amp;lt;/math&amp;gt; (variable &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;time_ref&amp;lt;/span&amp;gt; in &#039;&#039;&#039;roms.in&#039;&#039;&#039;) then ROMS’ internal clock is working with  &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is seconds since &amp;lt;math&amp;gt;t_{RS}&amp;lt;/math&amp;gt;. In &#039;&#039;&#039;roms.in&#039;&#039;&#039; the variable &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;tide_start&amp;lt;/span&amp;gt;, in days, is &amp;lt;math&amp;gt;t_{TS} - t_{RS}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 &lt;br /&gt;
In the equation for &amp;lt;math&amp;gt;\zeta_{EQ}&amp;lt;/math&amp;gt; the time coordinate was implicitly time since &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;. The corresponding equation for the equilibrium tide in terms of ROMS time, &amp;lt;math&amp;gt;t^R&amp;lt;/math&amp;gt;, which is time since &amp;lt;math&amp;gt;t_{RS}&amp;lt;/math&amp;gt; is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
     \zeta_{EQ}(\phi,\lambda,t^R)= &amp;amp; \sum_{diurnal} A \,\, f(t_T)\,[1 + k_2 - h_2]\,sin(2\phi)\,cos[\omega(t^R - (t_{TS} - t_{RS})) + \lambda + \chi(t_{TS}) + \nu(t_{TS})] + \\&lt;br /&gt;
     &amp;amp; \sum_{semi-d} A \,\, f(t_{TS})\,[1 + k_2 - h_2]\,cos^{2}(\phi)\,cos[\omega(t^R - (t_{TS} - t_{RS})) + 2\lambda + \chi(t_{TS}) + \nu(t_{TS})]\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calendar date to use with Table 3 must correspond to &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;, which is ROMS time_ref + tide_start (in days).&lt;br /&gt;
&lt;br /&gt;
As an example, below are two figures that show the sea surface elevation for the center of the Gulf of Maine (left) and at the entrance of the Bay of Fundi (right). ROMS is configured with boundary tidal forcing, tide generating force, and inverted barometer effect in the pressure gradient.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:doppio_tides_Gulf_of_Maine.png|thumb|500px|&amp;lt;center&amp;gt;Center of the Gulf of Maine sea surface elevation&amp;lt;/center&amp;gt;]]&lt;br /&gt;
|[[Image:doppio_tides_Bay_of_Fundi.png|thumb|500px|&amp;lt;center&amp;gt;Entrance of the Bay of Fundi sea surface elevation&amp;lt;/center&amp;gt;]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [https://www.tpxo.net/otps OSU Tidal Data Prediction Software](OTPS) and the [https://adcirc.org/products/adcirc-tidal-databases/ ADCIRC tidal database]. Remember to download the associated software with each data base as there are typically routines which facilitate the extraction and interpolation of the database to the ROMS grid.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=t&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;)&#039;&#039;&#039;. 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 [[roms.in]] using the variable  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [https://github.com/dcherian/tools/blob/master/ROMS/arango/tidal_ellipse/ap2ep.m ap2ep.m] from Zhigang Xu. MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip here]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} The fortran based OTPS tidal constituent extraction routines have been replaced by a MATLAB based version. &lt;br /&gt;
&lt;br /&gt;
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 [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] and the Earth and Space Research [https://github.com/EarthAndSpaceResearch/TMD_Matlab_Toolbox_v2.5 TMD TOOLBOX v2.5], or [https://github.com/chadagreene/Tide-Model-Driver TMD TOOLBOX v3.0]. &lt;br /&gt;
&lt;br /&gt;
#Download the [https://www.esr.org/research/polar-tide-models/tmd-software/ ESR Tidal Model Driver](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the TMD routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress tmd_toolbox.zip&lt;br /&gt;
#* add tmd_toolbox directory to the matlab path.&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/otps otps2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_5(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;,domain) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} 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 &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://myroms.org/hunter/roms_tides/. It requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [https://adcirc.org/products/adcirc-tidal-databases/ ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec2001_v2e.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable adcirc_extract&lt;br /&gt;
#* f77 -g -o adcirc_extract  tides_ec2001.f&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/adcirc/ adcirc2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v5(gfile,t,tp,&#039;test_adcirc.nc&#039;,1,domain)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 105 which is out of range for g77. It must be edited to change these to a number &amp;lt;99.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=6654</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=6654"/>
		<updated>2024-03-12T12:57:29Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* Tidal Forcing Files in ROMS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Astronomical Tide Generating Forces==&lt;br /&gt;
The influence of the tide generating forces (&#039;&#039;&#039;TGF&#039;&#039;&#039;) can be introduced in ROMS by consideration of the gradient of the difference between ROMS sea surface, &amp;lt;math&amp;gt;\zeta&amp;lt;/math&amp;gt;, and the sea surface denoted as the equilibrium tide, &amp;lt;math&amp;gt;\zeta_{EQ}&amp;lt;/math&amp;gt;, which is the shape the sea surface would assume if it were motionless and in equilibrium with the tide generating forces on a fluid planet. It is activated with the option [[Options#TIDE_GENERATING_FORCES|TIDE_GENERATING_FORCES]]. It is restricted to spherical grids since we need &#039;&#039;&#039;(lon, lat)&#039;&#039;&#039; of every cell to compute the harmonic constituents parameters for the location of the Moon and Sun. We recommend activating this option in conjunction with boundary tidal forcing ([[Options#SSH_TIDES|SSH_TIDES]] and [[Options#UV_TIDES|UV_TIDES]]). Check the following [https://www.myroms.org/projects/src/ticket/896 trac] ticket for more information about this capability.&lt;br /&gt;
&lt;br /&gt;
If ROMS &amp;lt;math&amp;gt;\zeta&amp;lt;/math&amp;gt; is parallel to the equilibrium tide, i.e. &amp;lt;math&amp;gt;\zeta-\zeta_{EQ} = constant&amp;lt;/math&amp;gt;, then the gradient of this is zero and there is no lateral force due to the tides. Therefore, we can implement the TGF by subtracting &amp;lt;math&amp;gt;\zeta_{EQ}&amp;lt;/math&amp;gt; from ROMS &amp;lt;math&amp;gt;\zeta&amp;lt;/math&amp;gt; prior to computing the baroclinic (3D applications) or barotropic (2D applications) pressure gradient. This will effectively impart the tide generating force as a lateral body force throughout the water column. &lt;br /&gt;
&lt;br /&gt;
If, say, ROMS sea surface was flat but &amp;lt;math&amp;gt;\zeta_{EQ}&amp;lt;/math&amp;gt; was increasing in the positive &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; direction, then &amp;lt;math&amp;gt;-g \frac{\part(\zeta-\zeta_{EQ})}{\part x}&amp;lt;/math&amp;gt; on the RHS of the x-momentum equation is positive indicating flow will be driven in the positive &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; direction until the sea level becomes parallel to the equilibrium tide. &lt;br /&gt;
The equilibrium tide at latitude &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;, longitude &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt;, and time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; for the principal diurnal and semi-diurnal tidal constituents is given by ([[Bibliography#ArbicBK_2018a|Arbic &#039;&#039;et al.&#039;&#039; 2018]])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
      \zeta_{EQ}(\phi,\lambda,t)= &amp;amp; \sum_{diurnal} A \,\, f(t_T)\,[1+k_2-h_2]\,sin(2\,\phi)\,cos[\omega(t - t_{TS}) + \lambda + \chi(t_{TS}) + \nu(t_{TS})] + \\&lt;br /&gt;
                        &amp;amp;\sum_{semi-d} A \,\, f(t_{TS})\,[1+k_2-h_2]\,cos^{2}(\phi)\,cos[\omega(t - t_{TS}) + 2\lambda + \chi(t_{TS}) + \nu(t_{TS})]\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diurnal and semi-diurnal constituent-dependent parameters in the respective summations above are given in Table 1. Equations for the nodal factors &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; that account for the slow modulation of the tidal constituents due (principally) to the 18.6-year lunar nodal cycle, and the phase &amp;lt;math&amp;gt;\chi&amp;lt;/math&amp;gt; of each constituent at the Greenwich meridian (&amp;lt;math&amp;gt;\lambda=0&amp;lt;/math&amp;gt;), are computed from the equations given in Table 2 using astronomical arguments calculated as indicated in Table 3 for the reference time, &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;, when &#039;&#039;Tides Start&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
For simplicity, I have neglected the long period tidal constituents, &amp;lt;math&amp;gt;M_m&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M_f&amp;lt;/math&amp;gt;. The former is smaller than all the constituents included in Table 1, and the amplitude of &amp;lt;math&amp;gt;M_f&amp;lt;/math&amp;gt; exceeds only those of &amp;lt;math&amp;gt;Q_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Principal diurnal and semi-diurnal tidal constituent frequencies ω, astronomical forcing amplitudes A, and Love number factors [1+k_2-h_2] for computing the equilibrium tide. (Data adapted from [[Bibliography#ArbicBK_2004a|Arbic &#039;&#039;et al.&#039;&#039;, 2004]], Table 1).&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
!Constituent !!Relevant &amp;lt;math&amp;gt;\Sigma&amp;lt;/math&amp;gt; in&amp;lt;br /&amp;gt; &amp;lt;math&amp;gt;\phi_{EQ}&amp;lt;/math&amp;gt; equation !!Frequency&amp;lt;br /&amp;gt;&amp;lt;math&amp;gt;\omega (10^{-4} s^{-1})&amp;lt;/math&amp;gt; !!Amplitude&amp;lt;br /&amp;gt;A (cm) !!Love factors&amp;lt;br /&amp;gt;&amp;lt;math&amp;gt;1+k_2-h_2&amp;lt;/math&amp;gt; !!Period&amp;lt;br /&amp;gt;(solar days)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;Q_1&amp;lt;/math&amp;gt;||diurnal||0.6495854||1.9273||0.695||1.1195&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;O_1&amp;lt;/math&amp;gt;||diurnal||0.6759774||10.0661||0.695||1.0758&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_1&amp;lt;/math&amp;gt;||diurnal||0.7292117||14.1565||0.736||0.9973&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;||semi-diurnal||1.378797||4.6397||0.693||0.5274&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;M_2&amp;lt;/math&amp;gt;||semi-diurnal||1.405189||24.2334||0.693||0.5175&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;S_2&amp;lt;/math&amp;gt;||semi-diurnal||1.454441||11.2743||0.693||0.5000&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_2&amp;lt;/math&amp;gt;||semi-diurnal||1.458423||3.0684||0.693||0.4986&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Harmonic constituents of the equilibrium tide on the Greenwich meridian. The fundamental astronomical arguments &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; must be computed according to the reference date &amp;lt;math&amp;gt;T_{TS}&amp;lt;/math&amp;gt; when tides start using the equations in Table 3. (Data adapted from [[Bibliography#DoodsonAT_1941a|Doodson and Warburg, 1941]], Table 1.) &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
!Constituent!!&amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;non-dimensional&#039;&#039;!!&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;degrees&#039;&#039;!!&amp;lt;math&amp;gt;\chi&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;degrees&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;Q_1&amp;lt;/math&amp;gt;||as for &amp;lt;math&amp;gt;O_1&amp;lt;/math&amp;gt;||as for &amp;lt;math&amp;gt;O_1&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;h-3s+p-90^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;O_1&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;1.009 + 0.187\,cos\,N - 0.015\,cos\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;10.8^{\circ}\,sin\,N - 1.3^{\circ}\,sin\,2N&amp;lt;/math&amp;gt;⁡||&amp;lt;math&amp;gt;h - 2s - 90^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_1&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;1.006 + 0.115\,cos\,N - 0.009\,cos\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;-8.9^{\circ}\,sin\,N + 0.7^{\circ}\,sin\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;h + 90^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;N_2&amp;lt;/math&amp;gt;||as for &amp;lt;math&amp;gt;M_2&amp;lt;/math&amp;gt;||as for &amp;lt;math&amp;gt;M_2&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;2h - 3s + p&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;M_2&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;1 - 0.037\,cos\,N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;-2.1^{\circ}\,sin\,N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;2h-2s&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;S_2&amp;lt;/math&amp;gt;||1||&amp;lt;math&amp;gt;0^{\circ}&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;0^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_2&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;1.024 + 0.286\,cos\,N + 0.008\,cos\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;-17.7^{\circ}\,sin\,N + 0.7^{\circ}\,sin\,2N&amp;lt;/math&amp;gt;||&amp;lt;math&amp;gt;2h&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Table 3:&#039;&#039;&#039; Fundamental astronomical arguments to be used in Table 2 for the calculation of nodal factors and phase at Greenwich. Set the value of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; according to the chosen Tide Start time &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;. (Data adapted from [[Bibliography#EgbertGD_2017a|Egbert and Ray, 2017]], Table 1.)&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
!Argument!!Description!!equation!!period&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||terrestrial time in Julian centuries since 12:00 on January 1, 2000||(days since 2000-01-01:12:00:00) / 36525||&amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;||mean longitude of moon||218.316 + 481267.8812 &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||tropical month&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt;||mean longitude of sun||280.466 + 36000.7698 &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||tropical year&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;||mean longitude of lunar perigee||83.353 + 4069.0137 &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||8.85 &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;||mean longitude of lunar node &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;||–234.955 – 1934.1363 &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;||18.6 &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ROMS allows users to specify a different reference time for the model time and the Tide Start time used for the open boundary tide harmonics. We need to accommodate this here while enforcing that the tide generating forces and boundary harmonics have the same reference time, i.e. &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we denote the date when ROMS time starts as &amp;lt;math&amp;gt;t_{RS}&amp;lt;/math&amp;gt; (variable &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;time_ref&amp;lt;/span&amp;gt; in &#039;&#039;&#039;roms.in&#039;&#039;&#039;) then ROMS’ internal clock is working with  &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is seconds since &amp;lt;math&amp;gt;t_{RS}&amp;lt;/math&amp;gt;. In &#039;&#039;&#039;roms.in&#039;&#039;&#039; the variable &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;tide_start&amp;lt;/span&amp;gt;, in days, is &amp;lt;math&amp;gt;t_{TS} - t_{RS}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 &lt;br /&gt;
In the equation for &amp;lt;math&amp;gt;\zeta_{EQ}&amp;lt;/math&amp;gt; the time coordinate was implicitly time since &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;. The corresponding equation for the equilibrium tide in terms of ROMS time, &amp;lt;math&amp;gt;t^R&amp;lt;/math&amp;gt;, which is time since &amp;lt;math&amp;gt;t_{RS}&amp;lt;/math&amp;gt; is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
     \zeta_{EQ}(\phi,\lambda,t^R)= &amp;amp; \sum_{diurnal} A \,\, f(t_T)\,[1 + k_2 - h_2]\,sin(2\phi)\,cos[\omega(t^R - (t_{TS} - t_{RS})) + \lambda + \chi(t_{TS}) + \nu(t_{TS})] + \\&lt;br /&gt;
     &amp;amp; \sum_{semi-d} A \,\, f(t_{TS})\,[1 + k_2 - h_2]\,cos^{2}(\phi)\,cos[\omega(t^R - (t_{TS} - t_{RS})) + 2\lambda + \chi(t_{TS}) + \nu(t_{TS})]\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calendar date to use with Table 3 must correspond to &amp;lt;math&amp;gt;t_{TS}&amp;lt;/math&amp;gt;, which is ROMS time_ref + tide_start (in days).&lt;br /&gt;
&lt;br /&gt;
As an example, below are two figures that show the sea surface elevation for the center of the Gulf of Maine (left) and at the entrance of the Bay of Fundi (right). ROMS is configured with boundary tidal forcing, tide generating force, and inverted barometer effect in the pressure gradient.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:doppio_tides_Gulf_of_Maine.png|thumb|500px|&amp;lt;center&amp;gt;Center of the Gulf of Maine sea surface elevation&amp;lt;/center&amp;gt;]]&lt;br /&gt;
|[[Image:doppio_tides_Bay_of_Fundi.png|thumb|500px|&amp;lt;center&amp;gt;Entrance of the Bay of Fundi sea surface elevation&amp;lt;/center&amp;gt;]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [https://www.tpxo.net/otps OSU Tidal Data Prediction Software](OTPS) and the [https://adcirc.org/products/adcirc-tidal-databases/ ADCIRC tidal database]. Remember to download the associated software with each data base as there are typically routines which facilitate the extraction and interpolation of the database to the ROMS grid.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=t&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;)&#039;&#039;&#039;. 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 [[roms.in]] using the variable  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [https://github.com/dcherian/tools/blob/master/ROMS/arango/tidal_ellipse/ap2ep.m ap2ep.m] from Zhigang Xu. MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip here]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} The fortran based OTPS tidal constituent extraction routines have been replaced by a MATLAB based version. &lt;br /&gt;
&lt;br /&gt;
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 [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] and the Earth and Space Research [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip TMD TOOLBOX]. &lt;br /&gt;
&lt;br /&gt;
#Download the [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip ESR Tidal Model Driver](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the TMD routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress tmd_toolbox.zip&lt;br /&gt;
#* add tmd_toolbox directory to the matlab path.&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/otps otps2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_5(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;,domain) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} 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 &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://myroms.org/hunter/roms_tides/. It requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [https://adcirc.org/products/adcirc-tidal-databases/ ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec2001_v2e.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable adcirc_extract&lt;br /&gt;
#* f77 -g -o adcirc_extract  tides_ec2001.f&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/adcirc/ adcirc2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v5(gfile,t,tp,&#039;test_adcirc.nc&#039;,1,domain)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 105 which is out of range for g77. It must be edited to change these to a number &amp;lt;99.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6121</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6121"/>
		<updated>2022-01-11T21:47:07Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* Using the SLURM batch job scheduler */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model, and analyzing model output, on the Rutgers Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. There is a comprehensive user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for more detailed information.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, the Username will be your NetID, the password field for either will be your NetID Password and for 2FA,&lt;br /&gt;
you have 4 options to enter in the Second Password/Duo Action field:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to logon.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open Terminal (found in the Applications -&amp;gt; Utilities folder) or iTerm2 and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become very annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below. &lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User [NetID]&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;[NetID]&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;, enter the following command: &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. This will create the .ssh folder and set the required permissions.&lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039; then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a couple lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with Terminal/iTerm2 or MobaXterm and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following three lines (shown in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;) should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=“%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R”&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
The first line allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). The first export line will tell Lmod where to find the modules that will load the custom software. The second export line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
==Checking Out the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form (found [https://www.myroms.org/register here]) and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;git&#039;&#039; repository available but Subversion (SVN) is our recommended way to obtain the ROMS source code. If you prefer git, the initial process is a little more involved but you can follow the directions found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The same svn commands you’re used to will work on &#039;&#039;Amarel&#039;&#039;. However, the first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. After typing your password it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039; but it’s up to you. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
Setting up your environment to compile and run ROMS is as simple as loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
Using the build script is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. Some of the modules that load with the &#039;&#039;&#039;roms&#039;&#039;&#039; module also set environment variables that help simplify your roms build script. Starting from the latest build_roms.sh you will likely only need to change &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remembering the name you gave above for &amp;lt;my_src_dir&amp;gt;, you will find latest build_roms.sh script in subdirectory ROMS/Bin. Copy that script to the directory you will work in to run ROMS. &lt;br /&gt;
&lt;br /&gt;
Configure build_roms.sh by setting the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated by the build_roms.sh setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=UPWELLING&amp;lt;/span&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
Copy to your working directory the file upwelling.h from subdirectory ROMS/Include of your source code. &lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfers output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into the directory that you will work from. The contents are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=dmcs_1              # Partition (job queue)&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits to roms_upwelling.in to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt; to 2. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p dmcs_1&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using OnDemand to launch a Personal Jupyter Notebook==&lt;br /&gt;
To plot model output you can use Matlab or Python through the Rutgers OnDemand system. Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;My Interactive Sessions&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For Matlab:&lt;br /&gt;
# Select the MATLAB option in the left column choose your time, cores, memory, MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;dmcs_1&amp;lt;/span&amp;gt; in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
For Python:&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; and choose time, cores, memory, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;dmcs_1&amp;lt;/span&amp;gt; in partition. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank, enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; for &#039;&#039;conda path&#039;&#039;, and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt; for &#039;&#039;conda environment&#039;&#039;.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button appears, click it and wait again.&lt;br /&gt;
# Near the top-right click &#039;&#039;&#039;New&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Python 3 (ipykernel)&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6120</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6120"/>
		<updated>2022-01-11T21:40:01Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* Running on the Amarel Compute Nodes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model, and analyzing model output, on the Rutgers Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. There is a comprehensive user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for more detailed information.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, the Username will be your NetID, the password field for either will be your NetID Password and for 2FA,&lt;br /&gt;
you have 4 options to enter in the Second Password/Duo Action field:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to logon.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open Terminal (found in the Applications -&amp;gt; Utilities folder) or iTerm2 and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become very annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below. &lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User [NetID]&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;[NetID]&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;, enter the following command: &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. This will create the .ssh folder and set the required permissions.&lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039; then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a couple lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with Terminal/iTerm2 or MobaXterm and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following three lines (shown in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;) should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=“%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R”&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
The first line allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). The first export line will tell Lmod where to find the modules that will load the custom software. The second export line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
==Checking Out the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form (found [https://www.myroms.org/register here]) and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;git&#039;&#039; repository available but Subversion (SVN) is our recommended way to obtain the ROMS source code. If you prefer git, the initial process is a little more involved but you can follow the directions found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The same svn commands you’re used to will work on &#039;&#039;Amarel&#039;&#039;. However, the first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. After typing your password it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039; but it’s up to you. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
Setting up your environment to compile and run ROMS is as simple as loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
Using the build script is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. Some of the modules that load with the &#039;&#039;&#039;roms&#039;&#039;&#039; module also set environment variables that help simplify your roms build script. Starting from the latest build_roms.sh you will likely only need to change &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remembering the name you gave above for &amp;lt;my_src_dir&amp;gt;, you will find latest build_roms.sh script in subdirectory ROMS/Bin. Copy that script to the directory you will work in to run ROMS. &lt;br /&gt;
&lt;br /&gt;
Configure build_roms.sh by setting the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated by the build_roms.sh setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=UPWELLING&amp;lt;/span&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
Copy to your working directory the file upwelling.h from subdirectory ROMS/Include of your source code. &lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfers output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into the directory that you will work from. The contents are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=dmcs_1              # Partition (job queue)&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits to roms_upwelling.in to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt; to 2. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p dmcs_1&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using OnDemand to launch a Personal Jupyter Notebook==&lt;br /&gt;
To plot model output you can use Matlab or Python through the Rutgers OnDemand system. Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;My Interactive Sessions&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For Matlab:&lt;br /&gt;
# Select the MATLAB option in the left column choose your time, cores, memory, MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;dmcs_1&amp;lt;/span&amp;gt; in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
For Python:&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; and choose time, cores, memory, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;dmcs_1&amp;lt;/span&amp;gt; in partition. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank, enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; for &#039;&#039;conda path&#039;&#039;, and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt; for &#039;&#039;conda environment&#039;&#039;.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button appears, click it and wait again.&lt;br /&gt;
# Near the top-right click &#039;&#039;&#039;New&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Python 3 (ipykernel)&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6119</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6119"/>
		<updated>2022-01-11T21:13:07Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* Checking Progress with tail */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model, and analyzing model output, on the Rutgers Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. There is a comprehensive user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for more detailed information.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, the Username will be your NetID, the password field for either will be your NetID Password and for 2FA,&lt;br /&gt;
you have 4 options to enter in the Second Password/Duo Action field:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to logon.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open Terminal (found in the Applications -&amp;gt; Utilities folder) or iTerm2 and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become very annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below. &lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User [NetID]&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;[NetID]&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;, enter the following command: &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. This will create the .ssh folder and set the required permissions.&lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039; then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a couple lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with Terminal/iTerm2 or MobaXterm and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following three lines (shown in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt;) should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=“%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R”&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
The first line allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). The first export line will tell Lmod where to find the modules that will load the custom software. The second export line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
==Checking Out the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form (found [https://www.myroms.org/register here]) and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;git&#039;&#039; repository available but Subversion (SVN) is our recommended way to obtain the ROMS source code. If you prefer git, the initial process is a little more involved but you can follow the directions found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The same svn commands you’re used to will work on &#039;&#039;Amarel&#039;&#039;. However, the first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. After typing your password it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039; but it’s up to you. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
Setting up your environment to compile and run ROMS is as simple as loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
Using the build script is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. Some of the modules that load with the &#039;&#039;&#039;roms&#039;&#039;&#039; module also set environment variables that help simplify your roms build script. Starting from the latest build_roms.sh you will likely only need to change &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remembering the name you gave above for &amp;lt;my_src_dir&amp;gt;, you will find latest build_roms.sh script in subdirectory ROMS/Bin. Copy that script to the directory you will work in to run ROMS. &lt;br /&gt;
&lt;br /&gt;
Configure build_roms.sh by setting the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated by the build_roms.sh setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=UPWELLING&amp;lt;/span&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
Copy to your working directory the file upwelling.h from subdirectory ROMS/Include of your source code. &lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfers output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into the directory that you will work from. The contents are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=dmcs_1              # Partition (job queue)&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits to roms_upwelling.in to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt; to 2. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p dmcs_1&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using OnDemand to launch a Personal Jupyter Notebook==&lt;br /&gt;
To plot model output you can use Matlab or Python through the Rutgers OnDemand system. Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;My Interactive Sessions&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For Matlab:&lt;br /&gt;
# Select the MATLAB option in the left column choose your time, cores, memory, MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;dmcs_1&amp;lt;/span&amp;gt; in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
For Python:&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; and choose time, cores, memory, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;dmcs_1&amp;lt;/span&amp;gt; in partition. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank, enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; for &#039;&#039;conda path&#039;&#039;, and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt; for &#039;&#039;conda environment&#039;&#039;.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button appears, click it and wait again.&lt;br /&gt;
# Near the top-right click &#039;&#039;&#039;New&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Python 3 (ipykernel)&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5233</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5233"/>
		<updated>2016-06-13T15:23:44Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example (Matlab) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://volkov.oce.orst.edu/tides/otps.html OSU Tidal Data Prediction Software](OTPS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} The fortran based OTPS tidal constituent extraction routines have been replaced by a MATLAB based version. &lt;br /&gt;
&lt;br /&gt;
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 [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] and the Earth and Space Research [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip TMD TOOLBOX]. &lt;br /&gt;
&lt;br /&gt;
#Download the [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip ESR Tidal Model Driver](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the TMD routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress tmd_toolbox.zip&lt;br /&gt;
#* add tmd_toolbox directory to the matlab path.&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/otps otps2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_5(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;,domain) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} 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 &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://myroms.org/hunter/roms_tides/. It requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec2001_v2e.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o adcirc_extract  tides_ec2001.f&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/adcirc/ adcirc2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v5(gfile,t,tp,&#039;test_adcirc.nc&#039;,1,domain)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5232</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5232"/>
		<updated>2016-06-10T12:55:59Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example (Matlab) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://volkov.oce.orst.edu/tides/otps.html OSU Tidal Data Prediction Software](OTPS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} The fortran based OTPS tidal constituent extraction routines have been replaced by a MATLAB based version. &lt;br /&gt;
&lt;br /&gt;
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 [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] and the Earth and Space Research [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip TMD TOOLBOX]. &lt;br /&gt;
&lt;br /&gt;
#Download the [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip ESR Tidal Model Driver](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the TMD routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress tmd_toolbox.zip&lt;br /&gt;
#* add tmd_toolbox directory to the matlab path.&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/otps otps2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_5(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;,domain) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} 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 &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://myroms.org/hunter/roms_tides/. It requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec2001_v2e.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o adcirc_extract  tides_ec2001.f&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/adcirc/ adcirc2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1,domain)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5231</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5231"/>
		<updated>2016-06-10T12:55:10Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example (Matlab) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://volkov.oce.orst.edu/tides/otps.html OSU Tidal Data Prediction Software](OTPS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} The fortran based OTPS tidal constituent extraction routines have been replaced by a MATLAB based version. &lt;br /&gt;
&lt;br /&gt;
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 [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] and the Earth and Space Research [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip TMD TOOLBOX]. &lt;br /&gt;
&lt;br /&gt;
#Download the [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip ESR Tidal Model Driver](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the TMD routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress tmd_toolbox.zip&lt;br /&gt;
#* add tmd_toolbox directory to the matlab path.&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/otps otps2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_5(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;,domain) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} 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 &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://myroms.org/hunter/roms_tides/. It requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec2001_v2e.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o adcirc_extract  tides_ec2001.f&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/adcirc/ adcirc2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1,domain)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5230</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5230"/>
		<updated>2016-06-10T12:49:50Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* OSU Tidal Prediction Software Example (Matlab) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://volkov.oce.orst.edu/tides/otps.html OSU Tidal Data Prediction Software](OTPS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} The fortran based OTPS tidal constituent extraction routines have been replaced by a MATLAB based version. &lt;br /&gt;
&lt;br /&gt;
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 [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] and the Earth and Space Research [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip TMD TOOLBOX]. &lt;br /&gt;
&lt;br /&gt;
#Download the [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip ESR Tidal Model Driver](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the TMD routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress tmd_toolbox.zip&lt;br /&gt;
#* add tmd_toolbox directory to the matlab path.&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#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 [http://myroms.org/hunter/roms_tides/update/otps otps2frc_wrapper.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; domain=&#039;LATTE&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_5(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;,domain) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} 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 &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5229</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5229"/>
		<updated>2016-06-10T12:44:42Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* OSU Tidal Prediction Software Example (Matlab) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://volkov.oce.orst.edu/tides/otps.html OSU Tidal Data Prediction Software](OTPS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} The fortran based OTPS tidal constituent extraction routines have been replaced by a MATLAB based version. &lt;br /&gt;
&lt;br /&gt;
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 [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] and the Earth and Space Research [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip TMD TOOLBOX]. &lt;br /&gt;
&lt;br /&gt;
#Download the [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip ESR Tidal Model Driver](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the TMD routines. &lt;br /&gt;
#* cd OTPS/a&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;margin-left:27px;&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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_v3.m) in the Matlab path, the two lines of otps2frc_v3.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_v3.m, then either &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database.&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5228</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5228"/>
		<updated>2016-06-10T12:40:54Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* OSU Tidal Prediction Software Example (Matlab) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://volkov.oce.orst.edu/tides/otps.html OSU Tidal Data Prediction Software](OTPS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} The fortran based OTPS tidal constituent extraction routines have been replaced by a MATLAB based version. &lt;br /&gt;
&lt;br /&gt;
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 [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] and the Earth and Space Research [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip TMD TOOLBOX]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;margin-left:27px;&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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_v3.m) in the Matlab path, the two lines of otps2frc_v3.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_v3.m, then either &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database.&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5227</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=5227"/>
		<updated>2016-06-10T12:38:05Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* OSU Tidal Prediction Software Example (Matlab) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://volkov.oce.orst.edu/tides/otps.html OSU Tidal Data Prediction Software](OTPS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{warning}} There is in issue in MATLAB R2012a that may cause files (such as extract_HC) compiled with gfortran to fail when executed from matlab. Workarounds are described here [http://www.mathworks.com/matlabcentral/answers/44388-or-system-or-unix-input-redirection] and here [http://meftgg.blogspot.com/2012/05/problems-running-gfortran-compiled.html]. An update which removes the need to compile fortran executables is currently under development.&lt;br /&gt;
&lt;br /&gt;
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 [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] and the Earth and Space Research [ftp://ftp.esr.org/pub/datasets/tmd/tmd_toolbox.zip TMD TOOLBOX]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;margin-left:27px;&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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_v3.m) in the Matlab path, the two lines of otps2frc_v3.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_v3.m, then either &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database.&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=4761</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=4761"/>
		<updated>2012-07-30T15:41:27Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{warning}} There is in issue in MATLAB R2012a that may cause files (such as extract_HC) compiled with gfortran to fail when executed from matlab. Workarounds are described here [http://www.mathworks.com/matlabcentral/answers/44388-or-system-or-unix-input-redirection] and here [http://meftgg.blogspot.com/2012/05/problems-running-gfortran-compiled.html]. An update which removes the need to compile fortran executables is currently under development.&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;margin-left:27px;&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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_v3.m) in the Matlab path, the two lines of otps2frc_v3.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_v3.m, then either &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=4760</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=4760"/>
		<updated>2012-07-30T15:39:54Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{warning}} There is in issue in MATLAB R2012a that may cause files (such as extract_HC) compiled with gfortran to fail when executed from matlab. Workarounds are described here [http://www.mathworks.com/matlabcentral/answers/44388-or-system-or-unix-input-redirection] and here [http://meftgg.blogspot.com/2012/05/problems-running-gfortran-compiled.html]&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;margin-left:27px;&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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_v3.m) in the Matlab path, the two lines of otps2frc_v3.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_v3.m, then either &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=4759</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=4759"/>
		<updated>2012-07-30T15:38:02Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{warning}} There is in issue in MATLAB R2012a that may cause files (such as extract_HC) compiled with gfortran to fail when executed from matlab. &lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;margin-left:27px;&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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_v3.m) in the Matlab path, the two lines of otps2frc_v3.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_v3.m, then either &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=4419</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=4419"/>
		<updated>2011-08-01T14:48:30Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tidal Forcing Files in ROMS==&lt;br /&gt;
Once the appropriate [[Options|CPP options]] have been set (e.g. [[Options#SSH_TIDES|SSH_TIDES]], [[Options#UV_TIDES|UV_TIDES]], [[Options#RAMP_TIDES|RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u|u]]/[[Variables#v|v]]/[[Variables#zeta|zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#tide_start|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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package. Also, see below for more thoughts on the 18.6 year business.&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
{{warning}} Newer Matlab versions are incompatible with older versions of t_tide and will cause errors. In particular, the &amp;quot;finite&amp;quot; function has been replaced with &amp;quot;isfinite&amp;quot; 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 [http://marine.rutgers.edu/~hunter/roms/tides/t_tide/t_tide_v1.3beta.zip]&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example (Matlab)==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;margin-left:27px;&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m.&lt;br /&gt;
&lt;br /&gt;
{{note}} 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_v3.m) in the Matlab path, the two lines of otps2frc_v3.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_v3.m, then either &#039;full&#039; or &#039;nodal&#039; needs to be added as the first input variable.&lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example (Matlab)==&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#tide_start|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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;br /&gt;
&lt;br /&gt;
==Comments on the 18.6 year tides==&lt;br /&gt;
The &amp;quot;18 year&amp;quot; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:18yrs_small.jpg]]&lt;br /&gt;
&lt;br /&gt;
* Because we run multi-decadal simulations, we have chosen not to include the &amp;quot;nodal corrections&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* I have been asked by several people how I create the tides files. My scripts (without tidal potentials) are [[File:Tides_ncl.tar.gz | here]].&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2468</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2468"/>
		<updated>2008-01-11T21:01:43Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2467</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2467"/>
		<updated>2008-01-11T21:01:25Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;br /&gt;
{{note}} This version of adcirc2frc_v2.m includes all tidal constituents from the ADCIRC database. Any undesired constituents must be removed after the tidal file is generated.&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2466</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2466"/>
		<updated>2008-01-11T20:59:09Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2465</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2465"/>
		<updated>2008-01-11T20:58:44Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the working directory. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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 tides_ec2001.out is executed. It needs to b e 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. &lt;br /&gt;
&lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2464</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2464"/>
		<updated>2008-01-11T20:57:56Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the worikng direcotry. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out. *&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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 tides_ec2001.out is execited. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;br /&gt;
&lt;br /&gt;
{{note}} * - 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 &amp;lt;99. An example of and edited file is available in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/tides_ec2001.f.&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2463</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2463"/>
		<updated>2008-01-11T20:53:49Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec2001_v2e.zip. Unzip this file into the worikng direcotry. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_ec2001.f into the executable tides_ec2001.out&lt;br /&gt;
#* f77 -g -o tides_ec2001.out tides_ec2001.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v2.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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 tides_ec2001.out is execited. It needs to b e 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tp=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_2(gfile,t,tp,&#039;test_adcirc.nc&#039;,1)&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2462</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2462"/>
		<updated>2008-01-10T15:51:33Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: /* ADCIRC Tidal Database Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
{{warning}} THIS SECTION IS CURRENTLY BEING UPDATED. CERTAIN ASPECTS OF THE ADCIRC SCRIPTS DO NOT WORK AS ADVERTISED HERE.&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the file  [http://www.unc.edu/ims/adcirc/document/Utility_programs.html tide_fac.f](from the ADCIRC website and put it in the working directory.  e.g. ADCIRC/. &lt;br /&gt;
#Compile tide_fac.f using and f77 compiler.&lt;br /&gt;
#*f77 -g -o tide_fac.out tided_fac.f&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec_95d.zip. Unzip this file into the worlikng direcotry. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_v1.05a.f into the executabletides_v1.05a.out&lt;br /&gt;
#* f77 -g -o tides_v1.05a.out tides_v1.05a.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v1.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | TIDE_START]]) and gfile is the ROMS grid file. Also included are an output filename and a processing flag.  &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v1(gfile,t,&#039;test_adcirc.nc&#039;,1)&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2436</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2436"/>
		<updated>2007-10-23T20:36:15Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the file  [http://www.unc.edu/ims/adcirc/document/Utility_programs.html tide_fac.f](from the ADCIRC website and put it in the working directory.  e.g. ADCIRC/. &lt;br /&gt;
#Compile tide_fac.f using and f77 compiler.&lt;br /&gt;
#*f77 -g -o tide_fac.out tided_fac.f&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec_95d.zip. Unzip this file into the worlikng direcotry. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_v1.05a.f into the executabletides_v1.05a.out&lt;br /&gt;
#* f77 -g -o tides_v1.05a.out tides_v1.05a.f&lt;br /&gt;
#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 [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v1.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | TIDE_START]]) and gfile is the ROMS grid file. Also included are an output filename and a processing flag.  &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v1(gfile,t,&#039;test_adcirc.nc&#039;,1)&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2435</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2435"/>
		<updated>2007-10-23T20:34:55Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#Now the tidal constituents are ready to be extracted and saved to a ROMS forcing file. An example of how to do this is given in [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the file  [http://www.unc.edu/ims/adcirc/document/Utility_programs.html tide_fac.f](from the ADCIRC website and put it in the working directory.  e.g. ADCIRC/. &lt;br /&gt;
#Compile tide_fac.f using and f77 compiler.&lt;br /&gt;
#*f77 -g -o tide_fac.out tided_fac.f&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec_95d.zip. Unzip this file into the worlikng direcotry. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_v1.05a.f into the executabletides_v1.05a.out&lt;br /&gt;
#* f77 -g -o tides_v1.05a.out tides_v1.05a.f&lt;br /&gt;
#Now the tidal constituents are ready to be extracted and saved to a ROMS forcing file. An example of how to do this is given in [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v1.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | TIDE_START]]) and gfile is the ROMS grid file. Also included are an output filename and a processing flag.  &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v1(gfile,t,&#039;test_adcirc.nc&#039;,1)&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2434</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2434"/>
		<updated>2007-10-23T20:33:56Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#Now the tidal constituents are ready to be extracted and saved to a ROMS forcing file. An example of how to do this is given in [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the file  [http://www.unc.edu/ims/adcirc/document/Utility_programs.html tide_fac.f](from the ADCIRC website and put it in the working directory.  e.g. ADCIRC/. &lt;br /&gt;
#Compile tide_fac.f using and f77 compiler.&lt;br /&gt;
#*f77 -g -o tide_fac.out tided_fac.f&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec_95d.zip. Unzip this file into the worlikng direcotry. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_v1.05a.f into the executabletides_v1.05a.out&lt;br /&gt;
#* f77 -g -o tides_v1.05a.out tides_v1.05a.f&lt;br /&gt;
#Now the tidal constituents are ready to be extracted and saved to a ROMS forcing file. An example of how to do this is given in [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | TIDE_START]]) and gfile is the ROMS grid file. Also included are an output filename and a processing flag.  &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; adcirc2frc_v1(gfile,t,&#039;test_adcirc.nc&#039;,1)&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2433</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2433"/>
		<updated>2007-10-23T20:29:32Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/otps/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the [http://www.coas.oregonstate.edu/research/po/research/tide/region.html OSU  tidal processing software](OTPS.tar.Z) to the the working directory e.g. OTPS/. Extract the OTPS routines. &lt;br /&gt;
#* cd OTPS/&lt;br /&gt;
#* uncompress OTPS.tar.Z&lt;br /&gt;
#* tar xvf OTPS.tar&lt;br /&gt;
#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/&lt;br /&gt;
#* uncompress EC.tar.Z&lt;br /&gt;
#* tar xvf EC.tar&lt;br /&gt;
#Compile extract_HC.f into the executable extract_HC. There is a makefile included in the OTPS.tar.Z archive. It requires an f90 compiler.&lt;br /&gt;
#* make extract_HC&lt;br /&gt;
#Now the tidal constituents are ready to be extracted and saved to a ROMS forcing file. An example of how to do this is given in [http://marine.rutgers.edu/~hunter/roms/tides/otps/ otps2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | 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. &lt;br /&gt;
#*&amp;gt;&amp;gt; t=datenum(2005,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; tpred=datenum(2006,1,1);&lt;br /&gt;
#*&amp;gt;&amp;gt; gfile=&#039;/home/hunter/roms/in/roms_latte_grid_3c.nc&#039;;&lt;br /&gt;
#*&amp;gt;&amp;gt; otps2frc_v3(gfile,t,tpred,&#039;test_EC.nc&#039;,&#039;DATA/Model_EC&#039;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} otps2frc_v3 calls extract_HC and generates several intermediate files. It also generates the file setup.inp as input to extract_HC. The format of setup.inp is:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
DATA/Model_NA       ! 1. tidal model control file&lt;br /&gt;
../ll.dat           ! 2. latitude/longitude/time file&lt;br /&gt;
z                   ! 3. z/U/V/u/v&lt;br /&gt;
o1,k1,n2,m2,s2      ! 4. tidal constituents to include&lt;br /&gt;
AP                  ! 5. AP/RI&lt;br /&gt;
oce                 ! 6. oce/geo&lt;br /&gt;
0                   ! 7. 1/0 correct for minor constituents&lt;br /&gt;
../nena_8g_z.out    ! 8. output file (ASCII)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Details of the format are found in the OTPS.tar.Z README file. &lt;br /&gt;
&lt;br /&gt;
{{note}} It is also hard-coded into otps2frc_v3 to only look for the constituents m2,s2,k1,o1. If you want more constituents(and they exist in the regional or global database of your choice) you will have to edit otps2frc_v3.m. &lt;br /&gt;
&lt;br /&gt;
{{warning}} If you attempt to extract constituents that don&#039;t exist in the database, extract_HC MAY fill in data for those constituents, usually by filling in with data from a constituent that exists. So verify the constituent is part of the database. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
The processing in this example was carried out in MATLAB using routines found in http://marine.rutgers.edu/~hunter/roms/tides/adcirc/. It has been tested on a SUN and requires [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE]. &lt;br /&gt;
&lt;br /&gt;
#Download the file  [http://www.unc.edu/ims/adcirc/document/Utility_programs.html tide_fac.f](from the ADCIRC website and put it in the working directory.  e.g. ADCIRC/. &lt;br /&gt;
#Compile tide_fac.f using and f77 compiler.&lt;br /&gt;
#*f77 -g -o tide_fac.out tided_fac.f&lt;br /&gt;
#Download the desired [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. e.g. Download ec_95d.zip. Unzip this file into the worlikng direcotry. &lt;br /&gt;
#* unzip ec_95d.zip&lt;br /&gt;
#Compile tides_v1.05a.f into the executabletides_v1.05a.out&lt;br /&gt;
#* f77 -g -o tides_v1.05a.out tides_v1.05a.f&lt;br /&gt;
#Now the tidal constituents are ready to be extracted and saved to a ROMS forcing file. An example of how to do this is given in [http://marine.rutgers.edu/~hunter/roms/tides/adcirc/ adcirc2frc_v3.m]. In the following example, t is the reference date for the tide (i.e. [[Variables#TIDE_START | TIDE_START]]) and gfile is the ROMS grid file.&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2432</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2432"/>
		<updated>2007-10-23T19:18:39Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | 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&#039;s [http://www.eos.ubc.ca/~rich/#T_Tide T_TIDE] MATLAB package&lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use. One tidal ellipse package is [http://woodshole.er.usgs.gov/operations/sea-mat/tidal_ellipse-html/index.html ap2ep.m] from Zhigang Xu.MATLAB tidal ellipse code is available.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
http://www.coas.oregonstate.edu/research/po/research/tide/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
http://www.unc.edu/ims/ccats/tides/tides.htm&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2431</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2431"/>
		<updated>2007-10-23T19:01:51Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software](OTIS) and the [http://www.unc.edu/ims/ccats/tides/tides.htm 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.&lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. 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. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.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  [[Variables#TIDE_START | TIDE_START]]. In addition, nodal corrections need to be made due to long period tides. &lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;. ROMS requires tidal information to be stored as ellipse parameters for use.  &lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two examples of this process are described below. &lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
http://www.coas.oregonstate.edu/research/po/research/tide/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
http://www.unc.edu/ims/ccats/tides/tides.htm&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2430</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2430"/>
		<updated>2007-10-23T18:42:03Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: Examples of tidal forcing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the appropriate [[Options|cpp options]] have been set (e.g. [[Options#SSH_TIDES | SSH_TIDES]],[[Options#UV_TIDES | UV_TIDES]],[[Options#RAMP_TIDES | RAMP_TIDES]]), a netcdf file of tidal constituents must be generated.   &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. 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 [http://www.coas.oregonstate.edu/research/po/research/tide/index.html OSU Tidal Data Inversion Software] and the [http://www.unc.edu/ims/ccats/tides/tides.htm ADCIRC tidal database]. &lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;.&lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.[[ocean.in]] &lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
http://www.coas.oregonstate.edu/research/po/research/tide/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
http://www.unc.edu/ims/ccats/tides/tides.htm&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2429</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2429"/>
		<updated>2007-10-23T18:05:30Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of Tidal Forcing in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
Tidal forcing in ROMS is currently &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. &lt;br /&gt;
#&#039;&#039;&#039;Interpolate the tidal constituent database to the desired ROMS grid&#039;&#039;&#039;.&lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal constituents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.[[ocean.in]] &lt;br /&gt;
#&#039;&#039;&#039;Convert the amplitude/phase information to tidal ellipse parameters, if necessary&#039;&#039;&#039;.&lt;br /&gt;
#&#039;&#039;&#039;Export tidal ellipse parameters to a ROMS netcdf forcing file&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
http://www.coas.oregonstate.edu/research/po/research/tide/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ADCIRC Tidal Database Example==&lt;br /&gt;
&lt;br /&gt;
http://www.unc.edu/ims/ccats/tides/tides.htm&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2428</id>
		<title>Tidal Forcing</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tidal_Forcing&amp;diff=2428"/>
		<updated>2007-10-23T17:54:36Z</updated>

		<summary type="html">&lt;p&gt;Elhunter: New page: &amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt; Tidal forcing in ROMS is currently   #&amp;#039;&amp;#039;&amp;#039;Download the desired tidal constituent database and associated software&amp;#039;&amp;#039;&amp;#039;.  #&amp;#039;&amp;#039;&amp;#039;Interpolate t...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Tidal Forcing Files in ROMS&amp;lt;/div&amp;gt;&lt;br /&gt;
Tidal forcing in ROMS is currently &lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Download the desired tidal constituent database and associated software&#039;&#039;&#039;. &lt;br /&gt;
#&#039;&#039;&#039;Interpolate the data base to the desired ROMS grid&#039;&#039;&#039;.&lt;br /&gt;
#&#039;&#039;&#039;Verify all open boundary grid cells contain valid data&#039;&#039;&#039;. &lt;br /&gt;
#&#039;&#039;&#039;The phase of the [[Variables#u | u]]/[[Variables#v | v]]/[[Variables#zeta | zeta]] components of the tidal consitutents should be shifted to the appropriate reference time(t=to)&#039;&#039;&#039;.[[ocean.in]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OSU Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
http://www.coas.oregonstate.edu/research/po/research/tide/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Oregon Tidal Prediction Software Example==&lt;br /&gt;
&lt;br /&gt;
http://www.unc.edu/ims/ccats/tides/tides.htm&lt;/div&gt;</summary>
		<author><name>Elhunter</name></author>
	</entry>
</feed>