<?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=Diego</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=Diego"/>
	<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/Special:Contributions/Diego"/>
	<updated>2026-04-27T15:21:35Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3082</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3082"/>
		<updated>2008-05-20T18:21:30Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Grid Generation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} [http://www.youtube.com/watch?v=wNI202a9TQo &#039;&#039;&#039;WATCH HERE&#039;&#039;&#039;] a YouTube Video with a simulation product of this tutorial. The plotted colormap is &#039;&#039;current velocity in the u direction&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy [[easygrid|EASYGRID]], which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before you compile ROMS, you need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, you need to modify some analytical Fortran files, where you are going to specify how to create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1866241                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
These changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                         ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                           ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Vertical mixing coefficients for active tracers: [1:NAT+NPT,Ngrids]&lt;br /&gt;
 !&lt;br /&gt;
     AKT_BAK == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1.0d-6 1.0d-6&amp;lt;/span&amp;gt;                   ! m2/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                ! days&lt;br /&gt;
    TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;               ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                           ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running ROMS==&lt;br /&gt;
&lt;br /&gt;
Similarly to the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] tutorial...&lt;br /&gt;
*To run ROMS in serial, just type:&lt;br /&gt;
 oceanS &amp;lt; ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;br /&gt;
*or to run in parallel (distributed-memory) on four processors:&lt;br /&gt;
 mpirun -np 4 oceanM ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3074</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3074"/>
		<updated>2008-05-06T17:00:32Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Diffusion coefficients */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} [http://www.youtube.com/watch?v=wNI202a9TQo &#039;&#039;&#039;WATCH HERE&#039;&#039;&#039;] a YouTube Video with a simulation product of this tutorial. The plotted colormap is &#039;&#039;current velocity in the u direction&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before you compile ROMS, you need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, you need to modify some analytical Fortran files, where you are going to specify how to create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1866241                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
These changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                         ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                           ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Vertical mixing coefficients for active tracers: [1:NAT+NPT,Ngrids]&lt;br /&gt;
 !&lt;br /&gt;
     AKT_BAK == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1.0d-6 1.0d-6&amp;lt;/span&amp;gt;                   ! m2/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                ! days&lt;br /&gt;
    TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;               ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                           ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running ROMS==&lt;br /&gt;
&lt;br /&gt;
Similarly to the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] tutorial...&lt;br /&gt;
*To run ROMS in serial, just type:&lt;br /&gt;
 oceanS &amp;lt; ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;br /&gt;
*or to run in parallel (distributed-memory) on four processors:&lt;br /&gt;
 mpirun -np 4 oceanM ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3070</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3070"/>
		<updated>2008-04-29T14:18:08Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} [http://www.youtube.com/watch?v=wNI202a9TQo &#039;&#039;&#039;WATCH HERE&#039;&#039;&#039;] a YouTube Video with a simulation product of this tutorial. The plotted colormap is &#039;&#039;current velocity in the u direction&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before you compile ROMS, you need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, you need to modify some analytical Fortran files, where you are going to specify how to create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1866241                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running ROMS==&lt;br /&gt;
&lt;br /&gt;
Similarly to the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] tutorial...&lt;br /&gt;
*To run ROMS in serial, just type:&lt;br /&gt;
 oceanS &amp;lt; ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;br /&gt;
*or to run in parallel (distributed-memory) on four processors:&lt;br /&gt;
 mpirun -np 4 oceanM ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3069</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3069"/>
		<updated>2008-04-28T19:07:50Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} [http://www.youtube.com/watch?v=wNI202a9TQo &#039;&#039;&#039;WATCH HERE&#039;&#039;&#039;] a YouTube Video with a simulation product of this tutorial. The plotted variable is &#039;&#039;u momentum&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before you compile ROMS, you need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, you need to modify some analytical Fortran files, where you are going to specify how to create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1866241                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running ROMS==&lt;br /&gt;
&lt;br /&gt;
Similarly to the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] tutorial...&lt;br /&gt;
*To run ROMS in serial, just type:&lt;br /&gt;
 oceanS &amp;lt; ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;br /&gt;
*or to run in parallel (distributed-memory) on four processors:&lt;br /&gt;
 mpirun -np 4 oceanM ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3068</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3068"/>
		<updated>2008-04-28T00:12:57Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;[https://www.myroms.org/forum/viewtopic.php?p=3043#3043 Discussion Forum]&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report [https://www.myroms.org/forum/viewtopic.php?p=3043#3043 HERE] not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; section is where you can change the parameters needed to create your grid and initialization files. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you run EASYGRID to plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s &#039;&#039;Mask-Editing interactive plot&#039;&#039;, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by clicking on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 11.2939 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (11.2939 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID to .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-run EASYGRID.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3067</id>
		<title>MEXNC</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3067"/>
		<updated>2008-04-28T00:11:50Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Matlab MEXNC, SNCTOOLS and ROMS tool-kit&amp;lt;/div&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:50%; background:Honeydew; margin-top:10px; border:1px solid YellowGreen;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} Post questions and comments regarding this tutorial in [https://www.myroms.org/forum/viewtopic.php?t=53&amp;amp;highlight=snctools &#039;&#039;&#039;THIS&#039;&#039;&#039;] forum thread.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MATLAB is powerful software that is commonly used to create ROMS inputs and to visualize and analyze ROMS output. However, out-of-the-box Matlab doesn&#039;t come with the capabilities to read/write ROMS NetCDF files. For that you need to download and install MEXNC, which is a mex-file interface to NetCDF files for MATLAB. In simple terms, it is a set of files (mex and .m files) that allows Matlab to read and write NetCDF files. Also, if you want to fully exploit Matlab&#039;s capabilities to manipulate/analyze ROMS files, you may want to download/install SNCTOOLS and the ROMS Matlab tool-kit, which are Matlab routines (that sit on top of MEXNC) that facilitate the manipulation, visualization and analysis of ROMS input/output NetCDF files. There are free alternatives to Matlab (see links below), however in this tutorial I will only review (some) tools for Matlab.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:Honeydew; margin-top:10px; border:1px solid YellowGreen; font-size:85%;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Quick links:&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.mathworks.com/products/matlab/ MATLAB]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/ MEXNC project page] &lt;br /&gt;
|[http://mexcdf.sourceforge.net/tutorial SNCTOOLS tutorial]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.scilab.org/ Scilab] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Scilab/NetCDF Interface]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/netcdf_toolbox/netcdf_toolbox.html NetCDF Toolbox]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.gnu.org/software/octave/ Octave] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ocgmod1.marine.usf.edu/mediawiki/index.php/NetCDF_toolbox_for_Octave OCTCDF]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; Octave/NetCDF interface&amp;lt;/font&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==How to install MEXNC?==&lt;br /&gt;
You have to download the MEXNC version that matches BOTH, your specific Matlab version and your operating system.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# First determine what Matlab version you have by typing on the Matlab command line:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;version(&#039;-release&#039;) &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
# Then, go to the [http://mexcdf.sourceforge.net/downloads/ download] area, scroll down and &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;click&amp;lt;/span&amp;gt; on your Matlab version (verify that you operating system is listed as an option).&lt;br /&gt;
# Download the latest release&lt;br /&gt;
# Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely&lt;br /&gt;
# In Matlab, add the path of your recently extracted mexnc directory. To do this...&lt;br /&gt;
#* Click on &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; File &amp;gt; Set Path...&amp;lt;/span&amp;gt; (a GUI will pop-up)&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; Add with Subfolders...&amp;lt;/span&amp;gt; button, and add the path to your new mexnc folder&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Save&amp;lt;/span&amp;gt; button, and close the GUI&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# If you are using WINDOWS operating system (I don&#039;t know if others too), you will have to add the netcdf.dll file to your Matlab system directory. To do this...&lt;br /&gt;
#* Go to your recently extracted mexnc directory and go inside the win32 folder...&lt;br /&gt;
#* Copy the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;netcdf.dll&amp;lt;/span&amp;gt; file and PASTE it into one (or both) of the following directories:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;and/or&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;{{warning}} &amp;lt;small&amp;gt;In the example above, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB&amp;lt;/span&amp;gt; is the location where matlab is located, but this &#039;&#039;&#039;may be different&#039;&#039;&#039; in your computer.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Similarly as in &#039;&#039;&#039;(5)&#039;&#039;&#039;, add the path to the directory(ies) above (i.e. &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;) to the Matlab search path.&amp;lt;br /&amp;gt;{{note}} &amp;lt;small&amp;gt;NOTE: In some cases, it will be important to have &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt; at the &#039;&#039;&#039;TOP&#039;&#039;&#039; of the searching path.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Done! However, you may need to download [http://mexcdf.sourceforge.net/ SNCTOOLS] and the matlab tool-kit to be fully operational... read below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you are using [http://www.scilab.org/ Scilab] (free Matlab-clone)... [http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Click here] to get the Scilab interface to NetCDF files.&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} If you are using [http://www.gnu.org/software/octave/ Octave] (another free Matlab-clone)... [http://ocgmod1.marine.usf.edu/mediawiki/index.php/NetCDF_toolbox_for_Octave Click here] to get the Octave interface to NetCDF files.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How to install SNCTOOLS?==&lt;br /&gt;
Written by John Evans, [http://mexcdf.sourceforge.net/ SNCTOOLS] is a set of m-files that sit on top of MEXNC (and optionally, java) and strive to provide the user with a kinder, gentler interface (rather than MEXNC alone). Here is a [http://mexcdf.sourceforge.net/tutorial/index.html tutorial]  and below are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://sourceforge.net/project/showfiles.php?group_id=119464&amp;amp;package_id=130914 download] page and get the latest release.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step &#039;&#039;&#039;(5)&#039;&#039;&#039; above, add the path to the recently extracted directory to the Matlab search path.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to install ROMS Matlab tool-kit?==&lt;br /&gt;
This is a compilation (from Hernan Arango) of matlab tools (i.e. m-files), that sit on top of SNCTOOLS (which sits on top of MEXNC). Here are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://www.myroms.org/index.php?page=Processing download] page, enter the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;matlab&amp;lt;/span&amp;gt; directory, and download the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;matlab.tar.gz&#039;&#039;&#039;&amp;lt;/span&amp;gt; file.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step (5) above, add the path to the recently extracted directory to the Matlab search path.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3066</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3066"/>
		<updated>2008-04-27T20:01:31Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;[https://www.myroms.org/forum/viewtopic.php?p=3043#3043 Discussion Forum]&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report [https://www.myroms.org/forum/viewtopic.php?p=3043#3043 HERE] not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; section is where you can change the parameters needed to create your grid and initialization files. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you run EASYGRID to plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s &#039;&#039;Mask-Editing interactive plot&#039;&#039;, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by clicking on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 11.2939 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (11.2939 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID to .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-run EASYGRID.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3065</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3065"/>
		<updated>2008-04-27T19:16:05Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; section is where you can change the parameters needed to create your grid and initialization files. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you run EASYGRID to plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s &#039;&#039;Mask-Editing interactive plot&#039;&#039;, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by clicking on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 11.2939 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (11.2939 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID to .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-run EASYGRID.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3064</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3064"/>
		<updated>2008-04-27T19:14:59Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before you compile ROMS, you need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, you need to modify some analytical Fortran files, where you are going to specify how to create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1866241                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running ROMS==&lt;br /&gt;
&lt;br /&gt;
Similarly to the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] tutorial...&lt;br /&gt;
*To run ROMS in serial, just type:&lt;br /&gt;
 oceanS &amp;lt; ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;br /&gt;
*or to run in parallel (distributed-memory) on four processors:&lt;br /&gt;
 mpirun -np 4 oceanM ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3063</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3063"/>
		<updated>2008-04-27T19:13:04Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Output files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before you compile ROMS, you need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, you need to modify some analytical Fortran files, where you are going to specify how to create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1866241                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running ROMS==&lt;br /&gt;
&lt;br /&gt;
Similarly to the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] tutorial...&lt;br /&gt;
*To run ROMS in serial, just type:&lt;br /&gt;
 oceanS &amp;lt; ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;br /&gt;
*or to run in parallel (distributed-memory) on four processors:&lt;br /&gt;
 mpirun -np 4 oceanM ROMS/External/ocean_fjord.in &amp;gt; &amp;amp; log &amp;amp;&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3062</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3062"/>
		<updated>2008-04-27T19:00:57Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Compiling ROMS with tides */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before you compile ROMS, you need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, you need to modify some analytical Fortran files, where you are going to specify how to create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1866241                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3061</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3061"/>
		<updated>2008-04-27T18:47:50Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Geographical/Grid parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; section is where you can change the parameters needed to create your grid and initialization files. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you run EASYGRID to plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s &#039;&#039;Mask-Editing interactive plot&#039;&#039;, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by clicking on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 11.2939 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (11.2939 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID to .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-run EASYGRID.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3060</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3060"/>
		<updated>2008-04-27T18:45:47Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Setting up USER SETTINGS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; section is where you can change the parameters needed to create your grid and initialization files. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s &#039;&#039;Mask-Editing interactive plot&#039;&#039;, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by clicking on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 11.2939 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (11.2939 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID to .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-run EASYGRID.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3059</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3059"/>
		<updated>2008-04-25T20:08:27Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Forcing files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before we compile ROMS, we need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, we need to modify some analytical Fortran files, where we are going to specify how create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1866241                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3058</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3058"/>
		<updated>2008-04-25T20:04:43Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Time steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before we compile ROMS, we need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, we need to modify some analytical Fortran files, where we are going to specify how create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1866241                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3057</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3057"/>
		<updated>2008-04-25T20:00:24Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Forcing files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before we compile ROMS, we need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, we need to modify some analytical Fortran files, where we are going to specify how create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18607037                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the what that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!   NFFILES == 1                          ! number of forcing files&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3056</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3056"/>
		<updated>2008-04-25T19:59:37Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Input files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before we compile ROMS, we need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, we need to modify some analytical Fortran files, where we are going to specify how create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18607037                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ITLNAME == ocean_itl.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IRPNAME == ocean_irp.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     IADNAME == ocean_iad.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     CLMNAME == ocean_clm.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     BRYNAME == ocean_bry.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     FWDNAME == ocean_fwd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;!     ADSNAME == ocean_ads.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;   NFFILES == 1                          ! number of forcing files&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3055</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3055"/>
		<updated>2008-04-25T19:57:20Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Creating ocean_fjord.in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before we compile ROMS, we need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, we need to modify some analytical Fortran files, where we are going to specify how create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Application Title &amp;amp; RHO-grid dimensions===&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parallelizations parameters ===&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time steps ===&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18607037                 ! 3 days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Other parameters ===&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Diffusion coefficients ===&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Vertical S-coordinates parameters===&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Time-stamp at start and reference time===&lt;br /&gt;
 ! Time-stamp assigned for model initialization, reference time&lt;br /&gt;
 ! origin for tidal forcing, and model reference time for output&lt;br /&gt;
 ! NetCDF units attribute.&lt;br /&gt;
 !&lt;br /&gt;
        DSTART =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
  TIDE_START =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;52791.0d0&amp;lt;/span&amp;gt;                      ! days&lt;br /&gt;
      TIME_REF =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;18581117.0&amp;lt;/span&amp;gt;                    ! yyyymmdd.dd&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logical switches===&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Input files===&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     ITLNAME == ocean_itl.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     IRPNAME == ocean_irp.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     IADNAME == ocean_iad.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     CLMNAME == ocean_clm.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     BRYNAME == ocean_bry.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     FWDNAME == ocean_fwd.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     ADSNAME == ocean_ads.nc&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Forcing files===&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;   NFFILES == 1                          ! number of forcing files&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Output files===&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3054</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3054"/>
		<updated>2008-04-25T19:24:16Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Creating ocean_fjord.in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before we compile ROMS, we need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, we need to modify some analytical Fortran files, where we are going to specify how create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;17280             ! 2-days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     ITLNAME == ocean_itl.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     IRPNAME == ocean_irp.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     IADNAME == ocean_iad.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     CLMNAME == ocean_clm.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     BRYNAME == ocean_bry.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     FWDNAME == ocean_fwd.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     ADSNAME == ocean_ads.nc&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
No forcing. &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;   NFFILES == 1                          ! number of forcing files&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3053</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3053"/>
		<updated>2008-04-25T18:39:16Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable to embayments with a relatively small open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[http://easygrid4roms.googlecode.com/files/FJORD_grid_ini.rar DOWNLOAD HERE] the &#039;&#039;&#039;grid and initialization files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you may want to begin with that tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before we compile ROMS, we need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, we need to modify some analytical Fortran files, where we are going to specify how create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically (at the open boundary) when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy as &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;17280             ! 2-days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen when creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} I&#039;m not sure why, but the values below work ok, while other values make ROMS to blow up&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!Comment-out the ones that we don&#039;t need.&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     ITLNAME == ocean_itl.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     IRPNAME == ocean_irp.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     IADNAME == ocean_iad.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     CLMNAME == ocean_clm.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     BRYNAME == ocean_bry.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     FWDNAME == ocean_fwd.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     ADSNAME == ocean_ads.nc&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
No forcing.&lt;br /&gt;
     NFFILES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;                          ! number of forcing files&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Finally, the output file names (may want to change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3052</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3052"/>
		<updated>2008-04-25T18:17:59Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Saving GRID as .nc file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s &#039;&#039;Mask-Editing interactive plot&#039;&#039;, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by clicking on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 11.2939 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (11.2939 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID to .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-run EASYGRID.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3051</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3051"/>
		<updated>2008-04-25T17:58:15Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Saving GRID as .nc file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s &#039;&#039;Mask-Editing interactive plot&#039;&#039;, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by clicking on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 11.2939 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (11.2939 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-run EASYGRID.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3050</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3050"/>
		<updated>2008-04-25T17:53:35Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Parameter output on screen */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s &#039;&#039;Mask-Editing interactive plot&#039;&#039;, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by clicking on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 11.2939 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (11.2939 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3049</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3049"/>
		<updated>2008-04-25T17:52:25Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Editing Masks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s &#039;&#039;Mask-Editing interactive plot&#039;&#039;, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by clicking on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3048</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3048"/>
		<updated>2008-04-25T17:46:24Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Setting up USER SETTINGS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; You may want to change the name of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; to a name more descriptive of your grid (example: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid_fjord.m&amp;lt;/span&amp;gt;). That way you can keep many copies of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;, each with the parameters of each of your different projects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s Mask-Editing interactive plot, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by click on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to select unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3047</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3047"/>
		<updated>2008-04-25T17:37:38Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Making your grid */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}}&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; (and turn off ALL other switches) and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as many times as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s Mask-Editing interactive plot, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by click on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to select unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3046</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3046"/>
		<updated>2008-04-25T17:26:53Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Download EASYGRID */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes the bathymetry and coastline files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s Mask-Editing interactive plot, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by click on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to select unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3045</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3045"/>
		<updated>2008-04-25T17:03:54Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Editing Masks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s Mask-Editing interactive plot, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by click on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RIGHT-BUTTON TO FINISH&amp;lt;/span&amp;gt; (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to select unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3044</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3044"/>
		<updated>2008-04-25T14:18:37Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Masking Criteria */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s Mask-Editing interactive plot, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by click on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s RIGHT-BUTTON to finish (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to select unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3043</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3043"/>
		<updated>2008-04-25T14:17:59Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Editing Masks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s Mask-Editing interactive plot, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
First, &#039;&#039;&#039;TURN ON&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 0;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; &#039;&#039;&#039;ON&#039;&#039;&#039; will reset the land/sea mask, which means you will &#039;&#039;&#039;LOOSE&#039;&#039;&#039; the manual modifications that you did on your mask.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, run EASYGRID to launch the &#039;&#039;Mask-Editing interactive plot.&#039;&#039; You can change sea-cells into land-cells (and vice versa) by click on them with your mouse&#039;s LEFT-BUTTON. When you are done, simple click on your mouse&#039;s RIGHT-BUTTON to finish (i.e. exit toggle mode). If you want to return to toggle mode, simple run EASYGRID again.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by clicking the RIGHT-BUTTON of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to select unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3042</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3042"/>
		<updated>2008-04-25T13:29:38Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 24, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v0 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s Mask-Editing interactive plot, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; BEFORE you start editing your land/sea mask... and DO NOT turn it back on. Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; ON will reset the land/sea mask, which means you will LOOSE your mask manual modifications.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by PRESSING the right-button of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to select unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3041</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3041"/>
		<updated>2008-04-25T02:33:48Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Editing Masks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s Mask-Editing interactive plot, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; BEFORE you start editing your land/sea mask... and DO NOT turn it back on. Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; ON will reset the land/sea mask, which means you will LOOSE your mask manual modifications.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by PRESSING the right-button of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to select unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3040</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3040"/>
		<updated>2008-04-25T02:31:30Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Editing Masks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
Since the land/sea mask is automatically created using the bathymetry, it is very likely a few pixels will be wrongly assigned as land or sea. If so, you will need to edit your land/sea mask... and to do this, you can use EASYGRID&#039;s Mask-Editing interactive plot, which is a plot of the land/sea mask that lets you (interactive) use your mouse&#039;s left-button to toggle land-cells into sea-cells... and vice versa.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; BEFORE you start editing your land/sea mask... and do NOT turn it back on. Running EASYGRID with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; ON will &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ERASE&amp;lt;/span&amp;gt; (i.e. reset mask) your mask manual modifications.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|{{note}} To &#039;&#039;&#039;Zoom-In, Zoom-Out or Pan&#039;&#039;&#039; your land/sea-mask plot, you have to &#039;&#039;&#039;(1)&#039;&#039;&#039; exit cell-toggle mode by PRESSING the right-button of your mouse, &#039;&#039;&#039;(2)&#039;&#039;&#039; zoom-in, zoom-out or pan the plot and &#039;&#039;&#039;(3)&#039;&#039;&#039; RESUME mask-editing by re-running EASYGRID.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
====Masking Criteria====&lt;br /&gt;
&lt;br /&gt;
# Mask 1-cell bays (in the figure below, see circles A and B as examples)&lt;br /&gt;
# Mask disconnected lakes (in the figure below, see circle C as an example)&lt;br /&gt;
# Although tiny islands apparently don&#039;t cause troubles... you may want to select unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary (in the figure below, see circles D and E as examples)&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3039</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3039"/>
		<updated>2008-04-25T01:42:52Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Making Initial-Conditions file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SAVE INITIAL CONDITIONS FILE&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3038</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3038"/>
		<updated>2008-04-25T01:39:46Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Editing Masks===&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving GRID as .nc file===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your land/sea masks edited... it is time to save your grid in a NetCDF file, which is what ROMS reads. To do this, simply turn ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; You may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; are &#039;&#039;&#039;turned OFF&#039;&#039;&#039; since this may ERASE or alter your previous mask-editing or your bathymetry. On the other hand, you may want to make sure &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON so that EASYGRID outputs some parameters to screen (Lm, MM, N and DT), which your should write down, since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making Initial-Conditions file==&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3037</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3037"/>
		<updated>2008-04-25T01:17:04Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Parameter output on screen */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;screen_output&amp;lt;/span&amp;gt; is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3036</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3036"/>
		<updated>2008-04-25T01:15:18Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Initial Conditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/span&amp;gt; section of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If screen_output is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3035</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3035"/>
		<updated>2008-04-25T01:12:07Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Bathymetry smoothing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SWITCHES &amp;lt;/font&amp;gt; section. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry smoothing&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If screen_output is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3034</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3034"/>
		<updated>2008-04-25T01:08:53Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lon&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Switches section&amp;lt;/font&amp;gt;. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry somoothing&amp;lt;/font&amp;gt; section of the USER SETTINGS until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If screen_output is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3033</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3033"/>
		<updated>2008-04-25T01:04:58Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Setting up USER SETTINGS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
   &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&lt;br /&gt;
                        % ON = 1; OFF = 0&lt;br /&gt;
 %    &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 100;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %    &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %      &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_bathy.mat&#039;&amp;lt;/span&amp;gt;;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;Fjord_coast.mat&#039;);&lt;br /&gt;
                                     % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; 	   % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                                % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throughout the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS ******************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat lon X Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Switches section&amp;lt;/font&amp;gt;. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry somoothing&amp;lt;/font&amp;gt; section of the USER SETTINGS until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If screen_output is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3032</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3032"/>
		<updated>2008-04-25T00:46:41Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Making your grid */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
You probably will need to run EASYGRID several times in a iterative manner to create, smooth and mask-edit your grid. You can turn ON or OFF different functionalities of EASYGRID (like the mask-editing and bathymetry-smoothing routines) using the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; located in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, which is the first part of script (after the help lines). Below a snippet from EASYGRID&#039;s code that contains the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;SWITCHES&amp;lt;/span&amp;gt; section.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%****************************************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS *************************************************************************************************************************************&lt;br /&gt;
 %****************************************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % SWITCHES ( ON = 1; OFF = 0 ) --------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;create_grid = 1;&amp;lt;/span&amp;gt;   % Create GRID. Turn OFF to work with a previously created grid (i.e. grid variables existing on Workspace)&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/span&amp;gt;   % Plot grid&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/span&amp;gt;   % Smooth bathymetry using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;edit_mask = 0;&amp;lt;/span&amp;gt;   % Edit rho-mask using interactive plot. Use this to manually change sea-pixels into land-pixels and vice-versa &lt;br /&gt;
  &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/span&amp;gt;   % Displays (on screen) many parameters that need to be copy-pasted in the ocean.in file    &lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/span&amp;gt;   % Save GRID in a NetCDF file&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/span&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A typical procedure to create a grid will follow (more or less) these steps:&#039;&#039;&#039;&lt;br /&gt;
# TURN ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;plot_grid&amp;lt;/span&amp;gt; and run EASYGRID.&lt;br /&gt;
# Tune-up Geographical and Grid parameters and run EASYGRID again.&lt;br /&gt;
# Repeat step 2 above until satisfied with the grid location, size and resolution.&lt;br /&gt;
# &#039;&#039;&#039;TURN OFF&#039;&#039;&#039; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;create_grid&amp;lt;/span&amp;gt; and proceed to smooth bathymetry by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up smoothing parameters and repeat the step above as necessary... when finished, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt;.&lt;br /&gt;
# Edit land/sea mask by turning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt; and re-running EASYGRID.&lt;br /&gt;
# Tune-up the land/sea mask as many times as necessary... when done, turn OFF &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;edit_mask&amp;lt;/span&amp;gt;.&lt;br /&gt;
# When satisfied with the grid, bathymetry and mask... save it all to a GRID NetCDF file by turnning ON &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;save_grid&amp;lt;/span&amp;gt; and re-running EASYGRID one more time. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setting up USER SETTINGS===&lt;br /&gt;
The first thing to do is to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. To make things easier for you, there are detailed instructions and explanations beside each variable entry line in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%*******************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS ****************************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 30;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %   &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_bathy.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;;&amp;lt;/span&amp;gt;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;test_coast.mat&#039;);&lt;br /&gt;
                                    % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;      % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                               % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throught the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 % &lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS *********************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat lon X Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Switches section&amp;lt;/font&amp;gt;. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry somoothing&amp;lt;/font&amp;gt; section of the USER SETTINGS until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If screen_output is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3031</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3031"/>
		<updated>2008-04-25T00:06:34Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Getting coastline */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, it is handy to have a coastline for reference, especially when editing the land/sea mask. For EASYGRID, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
&lt;br /&gt;
===Set up USER SETTINGS===&lt;br /&gt;
Before you run EASYGRID to create your ROMS grid, you need to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;, which is the first part of script (after the help lines). Beside each entry line there are detailed instructions. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%*******************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS ****************************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 30;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %   &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_bathy.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;;&amp;lt;/span&amp;gt;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;test_coast.mat&#039;);&lt;br /&gt;
                                    % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;      % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                               % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throught the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 % &lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS *********************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat lon X Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Switches section&amp;lt;/font&amp;gt;. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry somoothing&amp;lt;/font&amp;gt; section of the USER SETTINGS until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If screen_output is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3030</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3030"/>
		<updated>2008-04-25T00:03:33Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Getting bathymetry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v0.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, a later step of mask editing (using editmask.m) requires a coastline file. For both, EASYGRID and editmask.m, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
&lt;br /&gt;
===Set up USER SETTINGS===&lt;br /&gt;
Before you run EASYGRID to create your ROMS grid, you need to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;, which is the first part of script (after the help lines). Beside each entry line there are detailed instructions. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%*******************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS ****************************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 30;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %   &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_bathy.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;;&amp;lt;/span&amp;gt;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;test_coast.mat&#039;);&lt;br /&gt;
                                    % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;      % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                               % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throught the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 % &lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS *********************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat lon X Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Switches section&amp;lt;/font&amp;gt;. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry somoothing&amp;lt;/font&amp;gt; section of the USER SETTINGS until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If screen_output is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3029</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3029"/>
		<updated>2008-04-25T00:02:11Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Getting bathymetry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;read_srtm30plus.m&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &#039;&#039;read_srtm30plus.m&#039;&#039; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, a later step of mask editing (using editmask.m) requires a coastline file. For both, EASYGRID and editmask.m, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
&lt;br /&gt;
===Set up USER SETTINGS===&lt;br /&gt;
Before you run EASYGRID to create your ROMS grid, you need to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;, which is the first part of script (after the help lines). Beside each entry line there are detailed instructions. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%*******************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS ****************************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 30;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %   &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_bathy.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;;&amp;lt;/span&amp;gt;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;test_coast.mat&#039;);&lt;br /&gt;
                                    % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;      % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                               % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throught the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 % &lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS *********************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat lon X Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Switches section&amp;lt;/font&amp;gt;. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry somoothing&amp;lt;/font&amp;gt; section of the USER SETTINGS until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If screen_output is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3028</id>
		<title>easygrid</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=easygrid&amp;diff=3028"/>
		<updated>2008-04-25T00:00:56Z</updated>

		<summary type="html">&lt;p&gt;Diego: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;EASYGRID&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
EASYGRID is a simple matlab script to make ROMS grids and initialization files. It is an austere grid-making alternative designed as a beginner&#039;s tool, yet capable of making grids for realistic applications. Since most of EASYGRID is in one file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt;), it is easier to follow and understand the steps required to generate a simple grid (i.e. useful as a learning or teaching tool) and also reduces the required steps to get the software up and running (i.e. downloading and compiling dependencies).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This WikiROMS page is mainly a tutorial, where I provide test bathymetry and coastline files so you can experiment with EASYGRID. Also, this page is where I will post news and updates.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:100%; font-size:92%;&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:25%; background:Honeydew; border:1px solid YellowGreen;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;QUICK LINKS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;[http://easygrid4roms.googlecode.com Hosting page at Google-Code]&amp;lt;br&amp;gt;Discussion Forum (link soon)&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:25%; background:LightCyan; border:1px solid Blue;&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NEWS:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;24 April 2008: Version 0 is out&lt;br /&gt;
|style=&amp;quot;width:2%; background:transparent;&amp;quot;|&lt;br /&gt;
|style=&amp;quot;width:46%; background:LightYellow; border:1px solid red;&amp;quot; valign=&amp;quot;top&amp;quot;| {{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;EASYGRID v1 is in BETA stage and could have problems. Report HERE (link soon) not only bugs, but &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;also report successful use&amp;lt;/span&amp;gt;. Once the bug:success ratio decreases... I will remove this sign.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download EASYGRID== &lt;br /&gt;
*[http://easygrid4roms.googlecode.com/files/EASYGRID_v0.rar &#039;&#039;&#039;Download EASYGRID&#039;&#039;&#039;]&amp;lt;small&amp;gt; (This download also includes, bathymetry, coastline and other files required for this tutorial)&amp;lt;/small&amp;gt;&lt;br /&gt;
*Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely.&lt;br /&gt;
*Add the location where you placed EASYGRID to your Matlab search path &amp;lt;small&amp;gt;(see [[MEXNC#How to install MEXNC?|#5]] as an example).&amp;lt;/small&amp;gt;&lt;br /&gt;
*&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Dependencies:&amp;lt;/span&amp;gt; EASYGRID uses [http://mexcdf.sourceforge.net/downloads/ MEXNC, SNCTOOLS] and [http://www.myroms.org/index.php?page=Processing ROMS Matlab tool-kit] (only a few scripts like spheric_dist.m , smth_bath.m , pcolorjw.m). &lt;br /&gt;
:{{note}} For a &#039;&#039;&#039;tutorial&#039;&#039;&#039; on how to download/install these dependencies, [[MEXNC|CLICK HERE]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting bathymetry==&lt;br /&gt;
EASYGRID needs a bathymetry .mat file containing 3 vectors (xbathy, ybathy and zbathy), where:&lt;br /&gt;
*xbathy = longitude&lt;br /&gt;
*ybathy = latitude&lt;br /&gt;
*zbathy = depth (positive, in meters... For more information about bathymetry for ROMS, click [[Grid_Generation#Bathymetry|HERE]])&lt;br /&gt;
:{{note}} NOTE: Vectors xbathy and ybathy are in [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There easiest way to get bathymetry data (that I know) is to use Rich Signell&#039;s &#039;&#039;read_srtm30plus.m&#039;&#039; Matlab script. Instant bathymetry in 1 line of Matlab code! Click [[seagrid|HERE]] for instructions to get and use &#039;&#039;read_srtm30plus.m&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_latlon.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
The most difficult way to get bathymetry data (that I know) is to scan a chart and then digitize it using your mouse and a digitizing software like [http://www.ssg-surfer.com/ssg/product_info.php?products_id=133 Didger] (sorry, I am not aware of any good digitizing free software).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; by merging two bathymetry files... one high-resolution digitized from a chart and another coarser-resolution using &#039;&#039;read_srtm30plus.m&#039;&#039; (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(xbathy,ybathy,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;.&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting coastline==&lt;br /&gt;
In EASYGRID, the coastline is only used for plotting and it therefore not indispensable. However, a later step of mask editing (using editmask.m) requires a coastline file. For both, EASYGRID and editmask.m, the coastline should be 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot; (both in units of [http://en.wikipedia.org/wiki/Decimal_degrees decimal degrees]) contained in a .mat file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_coast.jpg|left|350px|]]&lt;br /&gt;
&lt;br /&gt;
An easy way to get coastline data is at NOAA&#039;s [http://rimmer.ngdc.noaa.gov/coast/ Coastline Extractor]. Remember to select &#039;&#039;&#039;Matlab&#039;&#039;&#039; as format option (not default). [[seagrid|SEAGRID&#039;s WikiROMS page]] has excellent information on how to use the Coastline Extractor, and tools to correct and manipulate coastline data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this tutorial, you will need &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; . You probably already have this file since it is included in [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  (file from the [[#Download EASYGRID|&amp;quot;Download&amp;quot;]] section). I created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; from the digitized chart I use to make the bathymetry file (see Figure).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you want to reproduce this plot as an exercise, copy-paste the following code on Matlab&#039;s Command Window:&lt;br /&gt;
 load &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt;&lt;br /&gt;
 plot(lon,lat);&lt;br /&gt;
 xlabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Longitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 ylabel(&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Latitude&#039;&amp;lt;/span&amp;gt;);&lt;br /&gt;
 axis &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;square&amp;lt;/span&amp;gt;;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making your grid==&lt;br /&gt;
&lt;br /&gt;
===Set up USER SETTINGS===&lt;br /&gt;
Before you run EASYGRID to create your ROMS grid, you need to edit EASYGRID&#039;s &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;, which is the first part of script (after the help lines). Beside each entry line there are detailed instructions. In fact, most of the &amp;quot;user-manual&amp;quot; for EASYGRID is included within itself. Therefore I will simply copy-paste below a snippet from EASYGRID&#039;s code that contains the USER SETTINGS/instructions section. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;NOTE:&#039;&#039;&#039; The default settings in EASYGRID are for the [[FJORD_TIDAL_CASE|Fjord tidal case]], hence you can just run EASYGRID (using the included &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_bathy.mat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; files) to generate the grid and initial-conditions files required for the [[FJORD_TIDAL_CASE|Fjord tidal case]] tutorial.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;%*******************************************************************************************************************************&lt;br /&gt;
 % USER SETTINGS ****************************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 %&lt;br /&gt;
 % Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 1;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 1;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 1;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 1;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % GRID SETTINGS -----------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 %&lt;br /&gt;
 % Geographical and Grid parameters --------&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lat =  44.8125;&amp;lt;/span&amp;gt;        % Latitude  (degrees) of the bottom-left corner of the grid.&lt;br /&gt;
      &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;lon = -62.8855;&amp;lt;/span&amp;gt;        % Longitude (degrees) of the bottom-left corner of the grid. &lt;br /&gt;
 %&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;X = 9100;&amp;lt;/span&amp;gt;            % Width of domain (meters)&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Y = 2550;&amp;lt;/span&amp;gt;            % Length of domain (meters)&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rotangle = -43;&amp;lt;/span&amp;gt;             % Angle (degrees) to rotate the grid conterclock-wise&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;resol = 30;&amp;lt;/span&amp;gt;              % Cell width and height (i.e. Resolution)in meters. Grid cells are forced to be (almost) square.&lt;br /&gt;
        &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;N = 10;&amp;lt;/span&amp;gt;              % Number of vertical levels&lt;br /&gt;
 %   &lt;br /&gt;
 %     &lt;br /&gt;
 % Bathymetry -------------- % Bathymetry for ROMS is measured positive downwards (zeros are not allowed) see: https://www.myroms.org/wiki/index.php/Grid_Generation#Bathymetry&lt;br /&gt;
                             % To allow variations in surface elevation (eg. tides) while keeping all depths positive,&lt;br /&gt;
                             % an arbitrary offset (see minh below) is added to the depth vector.&lt;br /&gt;
 %    &lt;br /&gt;
       &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;hh = nan;&amp;lt;/span&amp;gt;             % Analytical Depth (meters) used to create a uniform-depth grid. If using a bathymetry file, leave hh = nan;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;minh = 4;&amp;lt;/span&amp;gt;               % Arbitrary depth offset in meters (see above). minh should be a little more than the maximum expected tidal variation.&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Bathy =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_bathy.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;;&amp;lt;/span&amp;gt;% Bathymetry file. If using the analytical depth above (i.e. hh ~= nan), then Bathy will not be used.&lt;br /&gt;
                             % The bathymetry file should be a .mat file containing 3 vectors (xbathy, ybathy and zbathy). where xbathy = Longitude, &lt;br /&gt;
                             % ybathy = Latitude and zbathy = depth (positive, in meters). xbathy and ybathy are in decimal degrees See: http://en.wikipedia.org/wiki/Decimal_degrees&lt;br /&gt;
        %Bathymetry smoothing routine...  See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;smooth_grid == 1;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;order = 2;&amp;lt;/span&amp;gt;       % Order of Shapiro filter (2,4,8)... default: 2&lt;br /&gt;
             &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;rlim = 0.35;&amp;lt;/span&amp;gt;    % Maximum r-factor allowed (0.35)... default: 0.35&lt;br /&gt;
            &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;npass = 50;&amp;lt;/span&amp;gt;      % Maximum number of passes.......... default: 50&lt;br /&gt;
        &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %---------------------------------&lt;br /&gt;
 %                      &lt;br /&gt;
 %&lt;br /&gt;
 % Coastline ----------------------&lt;br /&gt;
    &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Coast = load(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test_coast.mat&#039;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;);&amp;lt;/span&amp;gt; % If there isn&#039;t a coastline file... comment-out this line: e.g. %Coast = load(&#039;test_coast.mat&#039;);&lt;br /&gt;
                                    % The coastline is only used for plotting. The coastline .mat file should contain 2 vectors named &amp;quot;lat&amp;quot; and &amp;quot;lon&amp;quot;&lt;br /&gt;
 %                                    &lt;br /&gt;
 %      &lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % OUTPUT: File naming and NetCDF descriptors ------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Grid_filename =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Fjord&#039;&amp;lt;/span&amp;gt;;      % Filename for grid and initial conditions files (don&#039;t include extension). &lt;br /&gt;
                               % &amp;quot;_grd.nc&amp;quot; is added to grid file and &amp;quot;_ini.nc&amp;quot; is added to initial conditions file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_grd   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test grid&#039;&amp;lt;/span&amp;gt;;               %Description for grid .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Descrip_ini   =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;Test initial conditions&#039;&amp;lt;/span&amp;gt;; %Description for initial conditions .nc file&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Author        =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;John Smith&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;Computer      =&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;My Computer&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
 %&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 % INITIAL CONDITIONS ------------------------------------------------------&lt;br /&gt;
 % -------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;if&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;save_init == 1;&amp;lt;/span&amp;gt; % See &amp;quot;Switches section&amp;quot; (above) to turn this ON or OFF&lt;br /&gt;
     % Initial conditions will be constant throught the grid domain&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NH4          = 0.1;&amp;lt;/span&amp;gt;     % Ammonium concentration (millimole_NH4 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;NO3          = 10;&amp;lt;/span&amp;gt;      % Nitrate concentration (millimole_N03 meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll1 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in small phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;chlorophyll2 = 0.3;&amp;lt;/span&amp;gt;     % Chlorophyll concentration in large phytoplankyon (milligrams_chlorophyll meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus1    = 0.03;&amp;lt;/span&amp;gt;    % Small detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritus2    = 0.03;&amp;lt;/span&amp;gt;    % Large detritus concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC1   = 1;&amp;lt;/span&amp;gt;       % Small detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;detritusC2   = 0.2;&amp;lt;/span&amp;gt;     % Large detritus carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto1       = 0.02;&amp;lt;/span&amp;gt;    % Small phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phyto2       = 0.02;&amp;lt;/span&amp;gt;    % Large phytoplankton concentration (millimole_nitrogen meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC1      = 0.2;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;phytoC2      = 0.1;&amp;lt;/span&amp;gt;     % Small phytoplankton carbon concentration (millimole_carbon meter-3)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;salt         = 30;&amp;lt;/span&amp;gt;      % Salinity (PSU)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;temp         = 9;&amp;lt;/span&amp;gt;       % Potential temperature (Celsius)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;u            = 0;&amp;lt;/span&amp;gt;       % u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;ubar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated u-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;v            = 0;&amp;lt;/span&amp;gt;       % v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;vbar         = 0;&amp;lt;/span&amp;gt;       % Vertically integrated v-momentum component (meter second-1)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zeta         = 0;&amp;lt;/span&amp;gt;       % Free-surface (meters)&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplankton  = 0.01;&amp;lt;/span&amp;gt;    % Zooplankton concentration &amp;quot;millimole_nitrogen meter-3&amp;quot;&lt;br /&gt;
     &amp;lt;span class=&amp;quot;black&amp;quot;&amp;gt;zooplanktonC = 0.5;&amp;lt;/span&amp;gt;     % Zooplankton carbon concentration &amp;quot;millimole_carbon meter-3&amp;quot;&lt;br /&gt;
     %--------------------------------------------------------------------------&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;end&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
 %&lt;br /&gt;
 % &lt;br /&gt;
 %*******************************************************************************************************************************&lt;br /&gt;
 % END OF USER SETTINGS *********************************************************************************************************&lt;br /&gt;
 %*******************************************************************************************************************************&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Geographical/Grid parameters===&lt;br /&gt;
After you got the bathymetry and coastline of your study region, now it is time to place a grid on it... In the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section, you have to specify &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;lat lon X Y&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rotangle&amp;lt;/span&amp;gt;. This is done in an iterative manner, where first you input your best-guesses, then you plot the grid. From the plot you can adjust your geographical/grid parameters... plot... adjust... plot... adjust... and so on. &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;You may want to turn off some switches (see below) to speed up the plotting process.&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:green; font-size:95%; line-height:99%;&amp;quot;&amp;gt;% Switches -------------------------&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_grid = 0;&amp;lt;/font&amp;gt;   % Save GRID in a NetCDF file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;save_init = 0;&amp;lt;/font&amp;gt;   % Create (and save) INITIAL CONDITIONS (from grid) ( yes = 1; no = 0 )&lt;br /&gt;
  &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;screen_output = 0;&amp;lt;/font&amp;gt;   % Displays (on the screen) many parameters that need to be copy-pasted in the ocean.in file ( yes = 1; no = 0 )&lt;br /&gt;
      &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;plot_grid = 1;&amp;lt;/font&amp;gt;   % Plot grid ( yes = 1; no = 0 )&lt;br /&gt;
    &amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt;smooth_grid = 0;&amp;lt;/font&amp;gt;   % Smooth bathymetry ( yes = 1; no = 0 ) using H. Arango&#039;s smth_bath.m , which applies a Shapiro filter to the bathymetry&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|[[image:Fjord_NOTsmooth.jpg|left|500px|]]&lt;br /&gt;
|This is the resulting grid (without smoothing) if you run EASYGRID with the default settings.&lt;br /&gt;
|-&lt;br /&gt;
|{{note}}If you want to see the 4 different grids that ROMS uses, zoom-in (in the grid plot), and then copy-paste the following in Matlab&#039;s Command Window:&lt;br /&gt;
 plot(lon_rho,lat_rho,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;r.&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_u,lat_u,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;bv&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_v,lat_v,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;g^&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
 plot(lon_psi,lat_psi,&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;m+&#039;&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The rho-grid represents the grid centers (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red dots&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The u-grid represents the grid East-West sides (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;blue triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The v-grid represents the grid North-South sides (&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;green triangles&amp;lt;/span&amp;gt;)&lt;br /&gt;
*The psi-grid represents the grid corners (&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;purple crosses&amp;lt;/span&amp;gt;)&lt;br /&gt;
|[[image:Fjord_grid.jpg|right|500px|]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Bathymetry smoothing===&lt;br /&gt;
ROMS doesn&#039;t like rough bathymetry with abrupt changes in topography. Therefore, after you got your grid where you wanted it to be, the next step is to smooth the bathymetry. Turn ON the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;smooth_grid&amp;lt;/span&amp;gt; variable in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Switches section&amp;lt;/font&amp;gt;. Usually simply enabling smoothing (with the default settings) will do a pretty good job. But if unsatisfied, you can iteratively tweak the parameters in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;%Bathymetry somoothing&amp;lt;/font&amp;gt; section of the USER SETTINGS until obtaining the desired smoothness. Below is a comparison of grids without and with smoothing (default settings).&lt;br /&gt;
[[image:Fjord_NOTsmoothNsmooth.jpg|center|1000px|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initial Conditions===&lt;br /&gt;
ROMS initialization NetCDF files contain information of the spatial distribution of one (or multiple) variable(s) that ROMS uses at the &#039;&#039;&#039;START&#039;&#039;&#039; of the simulation. The value of each initialization variable is specified for each corresponding cell in the ROMS grid... hence, inside a typical initial-conditions file, there will be one three-dimensional matrix (matching grid dimensions) for each specified variable. EASYGRID can generate Initial-Conditions NetCDF files for ROMS, however, only in a rudimentary manner... the user can only choose a &#039;&#039;&#039;single value&#039;&#039;&#039; for each initial-condition variable... EASYGRID makes each variable &#039;&#039;&#039;CONSTANT&#039;&#039;&#039; over the entire grid domain. This may be only useful in some simple cases and to do &amp;quot;quick-tests&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
To change the value of a initial-condition variable, simply go to the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt; and change the value of the variable of interest.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need to add another initial-condition variable... (1) add in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;INITIAL CONDITIONS&amp;lt;/font&amp;gt; section of the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/font&amp;gt;: &lt;br /&gt;
 new_variable = 0; &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;% Variable description (units)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and (2) add the following snippet to the &#039;&#039;&#039;end&#039;&#039;&#039; of the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;easygrid.m&amp;lt;/span&amp;gt; file &amp;lt;small&amp;gt;(substitute the parts in red)&amp;lt;/small&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;%--------------------------------------------------------------------------&amp;lt;/span&amp;gt;&lt;br /&gt;
        dims                    = { &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;time&#039;; &#039;s_rho&#039;; &#039;eta_rho&#039;; &#039;xi_rho&#039;&amp;lt;/span&amp;gt;};&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}           = ncdouble(dims);&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}(:,:,:)    = ones(N,Mp,Lp).* &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;new_variable&#039;&amp;lt;/span&amp;gt;;&lt;br /&gt;
        nc{ &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;&#039;newvar&#039;&amp;lt;/span&amp;gt;}.time      = &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&#039;ocean_time&#039;&amp;lt;/span&amp;gt; ;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;WARNING:&amp;lt;/span&amp;gt; The dimensions of the new initial-conditions variable should be the same as the grid that will use it. For example, the &#039;&#039;u momentum&#039;&#039; initial-condition matrix should have the same dimensions as the u-grid. In a biological setting however, most of the newly-specified variables are likely to be used by the rho-grid. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Parameter output on screen===&lt;br /&gt;
If screen_output is turned ON (in the &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;USER SETTINGS&amp;lt;/span&amp;gt; section), EASYGRID will output some parameters to screen. Make sure you write this numbers (Lm, MM, N and DT) since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
 |  COPY-PASTE the following parameters into your ocean.in file&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |     Lm == 90         ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
 |     Mm == 24         ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
 |      N == 10         ! Number of vertical levels&lt;br /&gt;
 |&lt;br /&gt;
 |&lt;br /&gt;
 |  Make sure the Baroclinic time-step (DT) in your ocean.in file is less than: 3.3882 seconds&lt;br /&gt;
 |  ----------------------------------------------------------------------------------------------&lt;br /&gt;
*The parameters &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are the basically the dimensions of the RHO-grid. &lt;br /&gt;
*The parameter &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is the baroclinic time-step and it should be less than &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;SQRT( (dx^2+dy^2)/(g*h(x,y) )&amp;lt;/span&amp;gt;. EASYGRID solves this equation and tells you the result (3.3882 sec in the case above). You can read a bit more about this in [https://www.myroms.org/forum/viewtopic.php?t=850&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;start=0 this forum post] (middle of page).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Saving .nc files===&lt;br /&gt;
Once you got your grid in place, your bathymetry smoothed and your initial-conditions adjusted... it is time to save the NetCDF files for ROMS. To do this, simply turn on ALL the Switches in the &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;USER SETTING&amp;lt;/font&amp;gt; section and run EASYGRID. Besides the plot, this time it will also save the grid and initial conditions .nc files. EASYGRID will also output some parameters to screen. {{warning}}Make sure you write down this numbers (Lm, MM, N and DT), since you will need to enter them in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean.in&amp;lt;/span&amp;gt; file prior to running ROMS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Editing Masks==&lt;br /&gt;
After you created your grid.nc file, you will likely need to edit the mask. That is, you will need to change some land-pixes of the mask into sea-pixels... and vice versa. To edit your grid&#039;s mask, you can use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; , which is a GUI script included in the [[MEXNC#How to install ROMS Matlab tool-kit?|ROMS Matlab tool-kit]] (inside the rmask directory).&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:LightYellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} The current version of editmask.m (from the ROMS toolkit) doesn&#039;t work for me. I included in the [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar EASYGRID_v1.rar]  file (that you probably already downloaded) a revised version of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt; that works for me. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[image:Fjord_editmask1.jpg|right|800px|]]&lt;br /&gt;
&#039;&#039;&#039;Here are step-by-step instructions to use &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;editmask.m&amp;lt;/span&amp;gt;:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Start the GUI by typing in Matlab&#039;s Command Window:&lt;br /&gt;
 editmask&lt;br /&gt;
* Select the NetCDF grid file to edit (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select the .mat coastline file that corresponds to the grid file (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Fjord_coast.mat&amp;lt;/span&amp;gt; in this tutorial)&lt;br /&gt;
* Select &amp;quot;Set Land&amp;quot; (&amp;quot;Edit Mode&amp;quot; section on the right) and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask 1-cell bays&amp;lt;/span&amp;gt; like the examples circled in A and B.&lt;br /&gt;
* Proceed to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;mask disconnected lakes&amp;lt;/span&amp;gt;, like one in example circled in E.&lt;br /&gt;
* Although tiny islands apparently don&#039;t cause troubles... you may want to select &amp;quot;Set Sea&amp;quot; and unmask &amp;quot;islands&amp;quot; that you consider unrealistic or unnecessary, like the ones circled by C and D.&lt;br /&gt;
* Once you finished editing the mask, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;CLICK SAVE&amp;lt;/span&amp;gt;. This will update your NetCDF grid file for ROMS.&lt;br /&gt;
* Close the GUI.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} This concludes this tutorial. However, you should consider reviewing the [[FJORD_TIDAL_CASE|Tidal Fjord TUTORIAL]], which uses the grid and initial-condition files generated here to setup a simple tidal realistic application.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3024</id>
		<title>MEXNC</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3024"/>
		<updated>2008-04-24T05:14:13Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* How to install ROMS Matlab tool-kit? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Matlab MEXNC, SNCTOOLS and ROMS tool-kit&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MATLAB is powerful software that is commonly used to create ROMS inputs and to visualize and analyze ROMS output. However, out-of-the-box Matlab doesn&#039;t come with the capabilities to read/write ROMS NetCDF files. For that you need to download and install MEXNC, which is a mex-file interface to NetCDF files for MATLAB. In simple terms, it is a set of files (mex and .m files) that allows Matlab to read and write NetCDF files. Also, if you want to fully exploit Matlab&#039;s capabilities to manipulate/analyze ROMS files, you may want to download/install SNCTOOLS and the ROMS Matlab tool-kit, which are Matlab routines (that sit on top of MEXNC) that facilitate the manipulation, visualization and analysis of ROMS input/output NetCDF files. There are free alternatives to Matlab (see links below), however in this tutorial I will only review (some) tools for Matlab.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:Honeydew; margin-top:10px; border:1px solid YellowGreen; font-size:85%;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Quick links:&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.mathworks.com/products/matlab/ MATLAB]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/ MEXNC project page] &lt;br /&gt;
|[http://mexcdf.sourceforge.net/tutorial SNCTOOLS tutorial]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.scilab.org/ Scilab] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Scilab/NetCDF Interface]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/netcdf_toolbox/netcdf_toolbox.html NetCDF Toolbox]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.gnu.org/software/octave/ Octave] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ocgmod1.marine.usf.edu/mediawiki/index.php/NetCDF_toolbox_for_Octave OCTCDF]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; Octave/NetCDF interface&amp;lt;/font&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==How to install MEXNC?==&lt;br /&gt;
You have to download the MEXNC version that matches BOTH, your specific Matlab version and your operating system.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# First determine what Matlab version you have by typing on the Matlab command line:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;version(&#039;-release&#039;) &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
# Then, go to the [http://mexcdf.sourceforge.net/downloads/ download] area, scroll down and &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;click&amp;lt;/span&amp;gt; on your Matlab version (verify that you operating system is listed as an option).&lt;br /&gt;
# Download the latest release&lt;br /&gt;
# Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely&lt;br /&gt;
# In Matlab, add the path of your recently extracted mexnc directory. To do this...&lt;br /&gt;
#* Click on &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; File &amp;gt; Set Path...&amp;lt;/span&amp;gt; (a GUI will pop-up)&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; Add with Subfolders...&amp;lt;/span&amp;gt; button, and add the path to your new mexnc folder&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Save&amp;lt;/span&amp;gt; button, and close the GUI&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# If you are using WINDOWS operating system (I don&#039;t know if others too), you will have to add the netcdf.dll file to your Matlab system directory. To do this...&lt;br /&gt;
#* Go to your recently extracted mexnc directory and go inside the win32 folder...&lt;br /&gt;
#* Copy the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;netcdf.dll&amp;lt;/span&amp;gt; file and PASTE it into one (or both) of the following directories:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;and/or&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;{{warning}} &amp;lt;small&amp;gt;In the example above, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB&amp;lt;/span&amp;gt; is the location where matlab is located, but this &#039;&#039;&#039;may be different&#039;&#039;&#039; in your computer.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Similarly as in &#039;&#039;&#039;(5)&#039;&#039;&#039;, add the path to the directory(ies) above (i.e. &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;) to the Matlab search path.&amp;lt;br /&amp;gt;{{note}} &amp;lt;small&amp;gt;NOTE: In some cases, it will be important to have &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt; at the &#039;&#039;&#039;TOP&#039;&#039;&#039; of the searching path.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Done! However, you may need to download [http://mexcdf.sourceforge.net/ SNCTOOLS] and the matlab tool-kit to be fully operational... read below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you are using [http://www.scilab.org/ Scilab] (free Matlab-clone)... [http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Click here] to get the Scilab interface to NetCDF files.&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} If you are using [http://www.gnu.org/software/octave/ Octave] (another free Matlab-clone)... [http://ocgmod1.marine.usf.edu/mediawiki/index.php/NetCDF_toolbox_for_Octave Click here] to get the Octave interface to NetCDF files.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How to install SNCTOOLS?==&lt;br /&gt;
Written by John Evans, [http://mexcdf.sourceforge.net/ SNCTOOLS] is a set of m-files that sit on top of MEXNC (and optionally, java) and strive to provide the user with a kinder, gentler interface (rather than MEXNC alone). Here is a [http://mexcdf.sourceforge.net/tutorial/index.html tutorial]  and below are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://sourceforge.net/project/showfiles.php?group_id=119464&amp;amp;package_id=130914 download] page and get the latest release.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step &#039;&#039;&#039;(5)&#039;&#039;&#039; above, add the path to the recently extracted directory to the Matlab search path.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to install ROMS Matlab tool-kit?==&lt;br /&gt;
This is a compilation (from Hernan Arango) of matlab tools (i.e. m-files), that sit on top of SNCTOOLS (which sits on top of MEXNC). Here are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://www.myroms.org/index.php?page=Processing download] page, enter the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;matlab&amp;lt;/span&amp;gt; directory, and download the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;matlab.tar.gz&#039;&#039;&#039;&amp;lt;/span&amp;gt; file.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step (5) above, add the path to the recently extracted directory to the Matlab search path.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3023</id>
		<title>MEXNC</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3023"/>
		<updated>2008-04-24T05:10:38Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* How to install MEXNC? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Matlab MEXNC, SNCTOOLS and ROMS tool-kit&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MATLAB is powerful software that is commonly used to create ROMS inputs and to visualize and analyze ROMS output. However, out-of-the-box Matlab doesn&#039;t come with the capabilities to read/write ROMS NetCDF files. For that you need to download and install MEXNC, which is a mex-file interface to NetCDF files for MATLAB. In simple terms, it is a set of files (mex and .m files) that allows Matlab to read and write NetCDF files. Also, if you want to fully exploit Matlab&#039;s capabilities to manipulate/analyze ROMS files, you may want to download/install SNCTOOLS and the ROMS Matlab tool-kit, which are Matlab routines (that sit on top of MEXNC) that facilitate the manipulation, visualization and analysis of ROMS input/output NetCDF files. There are free alternatives to Matlab (see links below), however in this tutorial I will only review (some) tools for Matlab.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:Honeydew; margin-top:10px; border:1px solid YellowGreen; font-size:85%;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Quick links:&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.mathworks.com/products/matlab/ MATLAB]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/ MEXNC project page] &lt;br /&gt;
|[http://mexcdf.sourceforge.net/tutorial SNCTOOLS tutorial]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.scilab.org/ Scilab] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Scilab/NetCDF Interface]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/netcdf_toolbox/netcdf_toolbox.html NetCDF Toolbox]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.gnu.org/software/octave/ Octave] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ocgmod1.marine.usf.edu/mediawiki/index.php/NetCDF_toolbox_for_Octave OCTCDF]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; Octave/NetCDF interface&amp;lt;/font&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==How to install MEXNC?==&lt;br /&gt;
You have to download the MEXNC version that matches BOTH, your specific Matlab version and your operating system.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# First determine what Matlab version you have by typing on the Matlab command line:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;version(&#039;-release&#039;) &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
# Then, go to the [http://mexcdf.sourceforge.net/downloads/ download] area, scroll down and &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;click&amp;lt;/span&amp;gt; on your Matlab version (verify that you operating system is listed as an option).&lt;br /&gt;
# Download the latest release&lt;br /&gt;
# Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely&lt;br /&gt;
# In Matlab, add the path of your recently extracted mexnc directory. To do this...&lt;br /&gt;
#* Click on &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; File &amp;gt; Set Path...&amp;lt;/span&amp;gt; (a GUI will pop-up)&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; Add with Subfolders...&amp;lt;/span&amp;gt; button, and add the path to your new mexnc folder&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Save&amp;lt;/span&amp;gt; button, and close the GUI&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# If you are using WINDOWS operating system (I don&#039;t know if others too), you will have to add the netcdf.dll file to your Matlab system directory. To do this...&lt;br /&gt;
#* Go to your recently extracted mexnc directory and go inside the win32 folder...&lt;br /&gt;
#* Copy the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;netcdf.dll&amp;lt;/span&amp;gt; file and PASTE it into one (or both) of the following directories:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;and/or&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;{{warning}} &amp;lt;small&amp;gt;In the example above, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB&amp;lt;/span&amp;gt; is the location where matlab is located, but this &#039;&#039;&#039;may be different&#039;&#039;&#039; in your computer.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Similarly as in &#039;&#039;&#039;(5)&#039;&#039;&#039;, add the path to the directory(ies) above (i.e. &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;) to the Matlab search path.&amp;lt;br /&amp;gt;{{note}} &amp;lt;small&amp;gt;NOTE: In some cases, it will be important to have &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt; at the &#039;&#039;&#039;TOP&#039;&#039;&#039; of the searching path.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Done! However, you may need to download [http://mexcdf.sourceforge.net/ SNCTOOLS] and the matlab tool-kit to be fully operational... read below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you are using [http://www.scilab.org/ Scilab] (free Matlab-clone)... [http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Click here] to get the Scilab interface to NetCDF files.&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} If you are using [http://www.gnu.org/software/octave/ Octave] (another free Matlab-clone)... [http://ocgmod1.marine.usf.edu/mediawiki/index.php/NetCDF_toolbox_for_Octave Click here] to get the Octave interface to NetCDF files.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How to install SNCTOOLS?==&lt;br /&gt;
Written by John Evans, [http://mexcdf.sourceforge.net/ SNCTOOLS] is a set of m-files that sit on top of MEXNC (and optionally, java) and strive to provide the user with a kinder, gentler interface (rather than MEXNC alone). Here is a [http://mexcdf.sourceforge.net/tutorial/index.html tutorial]  and below are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://sourceforge.net/project/showfiles.php?group_id=119464&amp;amp;package_id=130914 download] page and get the latest release.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step &#039;&#039;&#039;(5)&#039;&#039;&#039; above, add the path to the recently extracted directory to the Matlab search path.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to install ROMS Matlab tool-kit?==&lt;br /&gt;
This is a compilation (from a lot of smart people) of matlab tools (i.e. m-files), that sit on top of SNCTOOLS (which sits on top of MEXNC). Here are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://www.myroms.org/index.php?page=Processing download] page, enter the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;matlab&amp;lt;/span&amp;gt; directory, and download the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;matlab.tar.gz&#039;&#039;&#039;&amp;lt;/span&amp;gt; file.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step (5) above, add the path to the recently extracted directory to the Matlab search path.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3022</id>
		<title>MEXNC</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3022"/>
		<updated>2008-04-24T05:04:52Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* How to install MEXNC? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Matlab MEXNC, SNCTOOLS and ROMS tool-kit&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MATLAB is powerful software that is commonly used to create ROMS inputs and to visualize and analyze ROMS output. However, out-of-the-box Matlab doesn&#039;t come with the capabilities to read/write ROMS NetCDF files. For that you need to download and install MEXNC, which is a mex-file interface to NetCDF files for MATLAB. In simple terms, it is a set of files (mex and .m files) that allows Matlab to read and write NetCDF files. Also, if you want to fully exploit Matlab&#039;s capabilities to manipulate/analyze ROMS files, you may want to download/install SNCTOOLS and the ROMS Matlab tool-kit, which are Matlab routines (that sit on top of MEXNC) that facilitate the manipulation, visualization and analysis of ROMS input/output NetCDF files. There are free alternatives to Matlab (see links below), however in this tutorial I will only review (some) tools for Matlab.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:Honeydew; margin-top:10px; border:1px solid YellowGreen; font-size:85%;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Quick links:&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.mathworks.com/products/matlab/ MATLAB]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/ MEXNC project page] &lt;br /&gt;
|[http://mexcdf.sourceforge.net/tutorial SNCTOOLS tutorial]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.scilab.org/ Scilab] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Scilab/NetCDF Interface]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/netcdf_toolbox/netcdf_toolbox.html NetCDF Toolbox]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.gnu.org/software/octave/ Octave] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ocgmod1.marine.usf.edu/mediawiki/index.php/NetCDF_toolbox_for_Octave OCTCDF]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; Octave/NetCDF interface&amp;lt;/font&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==How to install MEXNC?==&lt;br /&gt;
You have to download the MEXNC version that matches BOTH, your specific Matlab version and your operating system.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# First determine what Matlab version you have by typing on the Matlab command line:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;version(&#039;-release&#039;) &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
# Then, go to the [http://mexcdf.sourceforge.net/downloads/ download] area, scroll down and &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;click&amp;lt;/span&amp;gt; on your Matlab version (verify that you operating system is listed as an option).&lt;br /&gt;
# Download the latest release&lt;br /&gt;
# Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely&lt;br /&gt;
# In Matlab, add the path of your recently extracted mexnc directory. To do this...&lt;br /&gt;
#* Click on &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; File &amp;gt; Set Path...&amp;lt;/span&amp;gt; (a GUI will pop-up)&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; Add with Subfolders...&amp;lt;/span&amp;gt; button, and add the path to your new mexnc folder&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Save&amp;lt;/span&amp;gt; button, and close the GUI&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# If you are using WINDOWS operating system (I don&#039;t know if others too), you will have to add the netcdf.dll file to your Matlab system directory. To do this...&lt;br /&gt;
#* Go to your recently extracted mexnc directory and go inside the win32 folder...&lt;br /&gt;
#* Copy the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;netcdf.dll&amp;lt;/span&amp;gt; file and PASTE it into one (or both) of the following directories:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;and/or&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;{{warning}} &amp;lt;small&amp;gt;In the example above, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB&amp;lt;/span&amp;gt; is the location where matlab is located, but this &#039;&#039;&#039;may be different&#039;&#039;&#039; in your computer.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Similarly as in &#039;&#039;&#039;(5)&#039;&#039;&#039;, add the path to the directory(ies) above (i.e. &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;) to the Matlab search path.&amp;lt;br /&amp;gt;{{note}} &amp;lt;small&amp;gt;NOTE: In some cases, it will be important to have &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt; at the &#039;&#039;&#039;TOP&#039;&#039;&#039; of the searching path.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Done! However, you may need to download [http://mexcdf.sourceforge.net/ SNCTOOLS] and the matlab tool-kit to be fully operational... read below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you are using [http://www.scilab.org/ Scilab] (free Matlab-clone)... [http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Click here] to get the Scilab interface to NetCDF files.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How to install SNCTOOLS?==&lt;br /&gt;
Written by John Evans, [http://mexcdf.sourceforge.net/ SNCTOOLS] is a set of m-files that sit on top of MEXNC (and optionally, java) and strive to provide the user with a kinder, gentler interface (rather than MEXNC alone). Here is a [http://mexcdf.sourceforge.net/tutorial/index.html tutorial]  and below are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://sourceforge.net/project/showfiles.php?group_id=119464&amp;amp;package_id=130914 download] page and get the latest release.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step &#039;&#039;&#039;(5)&#039;&#039;&#039; above, add the path to the recently extracted directory to the Matlab search path.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to install ROMS Matlab tool-kit?==&lt;br /&gt;
This is a compilation (from a lot of smart people) of matlab tools (i.e. m-files), that sit on top of SNCTOOLS (which sits on top of MEXNC). Here are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://www.myroms.org/index.php?page=Processing download] page, enter the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;matlab&amp;lt;/span&amp;gt; directory, and download the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;matlab.tar.gz&#039;&#039;&#039;&amp;lt;/span&amp;gt; file.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step (5) above, add the path to the recently extracted directory to the Matlab search path.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3021</id>
		<title>MEXNC</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=MEXNC&amp;diff=3021"/>
		<updated>2008-04-24T05:03:10Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* How to install MEXNC? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Matlab MEXNC, SNCTOOLS and ROMS tool-kit&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MATLAB is powerful software that is commonly used to create ROMS inputs and to visualize and analyze ROMS output. However, out-of-the-box Matlab doesn&#039;t come with the capabilities to read/write ROMS NetCDF files. For that you need to download and install MEXNC, which is a mex-file interface to NetCDF files for MATLAB. In simple terms, it is a set of files (mex and .m files) that allows Matlab to read and write NetCDF files. Also, if you want to fully exploit Matlab&#039;s capabilities to manipulate/analyze ROMS files, you may want to download/install SNCTOOLS and the ROMS Matlab tool-kit, which are Matlab routines (that sit on top of MEXNC) that facilitate the manipulation, visualization and analysis of ROMS input/output NetCDF files. There are free alternatives to Matlab (see links below), however in this tutorial I will only review (some) tools for Matlab.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width:100%; background:Honeydew; margin-top:10px; border:1px solid YellowGreen; font-size:85%;&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Quick links:&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.mathworks.com/products/matlab/ MATLAB]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/ MEXNC project page] &lt;br /&gt;
|[http://mexcdf.sourceforge.net/tutorial SNCTOOLS tutorial]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.scilab.org/ Scilab] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Scilab/NetCDF Interface]&lt;br /&gt;
|[http://mexcdf.sourceforge.net/netcdf_toolbox/netcdf_toolbox.html NetCDF Toolbox]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; (for Matlab)&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[http://www.gnu.org/software/octave/ Octave] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Free&amp;lt;/font&amp;gt; Matlab-clone&lt;br /&gt;
|[http://ocgmod1.marine.usf.edu/mediawiki/index.php/NetCDF_toolbox_for_Octave OCTCDF]&amp;lt;font color=&amp;quot;gray&amp;quot;&amp;gt; Octave/NetCDF interface&amp;lt;/font&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==How to install MEXNC?==&lt;br /&gt;
You have to download the MEXNC version that matches BOTH, your specific Matlab version and your operating system.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# First determine what Matlab version you have by typing on the Matlab command line:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;version(&#039;-release&#039;) &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
# Then, go to the [http://mexcdf.sourceforge.net/downloads/ download] area, scroll down and &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;click&amp;lt;/span&amp;gt; on your Matlab version (verify that you operating system is listed as an option).&lt;br /&gt;
# Download the latest release&lt;br /&gt;
# Extract (i.e. unzip or unpack) the file in a location where it can stay indefinitely&lt;br /&gt;
# In Matlab, add the path of your recently extracted mexnc directory. To do this...&lt;br /&gt;
#* Click on &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; File &amp;gt; Set Path...&amp;lt;/span&amp;gt; (a GUI will pop-up)&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; Add with Subfolders...&amp;lt;/span&amp;gt; button, and add the path to your new mexnc folder&lt;br /&gt;
#* Click on the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Save&amp;lt;/span&amp;gt; button, and close the GUI&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# If you are using WINDOWS operating system (I don&#039;t know if others too), you will have to add the netcdf.dll file to your Matlab system directory. To do this...&lt;br /&gt;
#* Go to your recently extracted mexnc directory and go inside the win32 folder...&lt;br /&gt;
#* Copy the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;netcdf.dll&amp;lt;/span&amp;gt; file and PASTE it into one (or both) of the following directories:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;and/or&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;{{warning}} &amp;lt;small&amp;gt;In the example above, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB&amp;lt;/span&amp;gt; is the location where matlab is located, but this &#039;&#039;&#039;may be different&#039;&#039;&#039; in your computer.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Similarly as in &#039;&#039;&#039;(5)&#039;&#039;&#039;, add the path to the directory(ies) above (i.e. &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt;) to the Matlab search path.&amp;lt;br /&amp;gt;{{note}} &amp;lt;small&amp;gt;NOTE: In some cases, it will be important to have &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;C:\MATLAB\bin\win32&amp;lt;/span&amp;gt; at the &#039;&#039;&#039;TOP&#039;&#039;&#039; of the searching path.&amp;lt;/small&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* Done! However, you may need have to download [http://mexcdf.sourceforge.net/ SNCTOOLS] and the matlab tool-kit to be fully operational... read below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} If you are using [http://www.scilab.org/ Scilab] (free Matlab-clone)... [http://ace.acadiau.ca/math/ACMMaC/software/scilab_netcdf.html Click here] to get the Scilab interface to NetCDF files.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How to install SNCTOOLS?==&lt;br /&gt;
Written by John Evans, [http://mexcdf.sourceforge.net/ SNCTOOLS] is a set of m-files that sit on top of MEXNC (and optionally, java) and strive to provide the user with a kinder, gentler interface (rather than MEXNC alone). Here is a [http://mexcdf.sourceforge.net/tutorial/index.html tutorial]  and below are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://sourceforge.net/project/showfiles.php?group_id=119464&amp;amp;package_id=130914 download] page and get the latest release.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step &#039;&#039;&#039;(5)&#039;&#039;&#039; above, add the path to the recently extracted directory to the Matlab search path.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to install ROMS Matlab tool-kit?==&lt;br /&gt;
This is a compilation (from a lot of smart people) of matlab tools (i.e. m-files), that sit on top of SNCTOOLS (which sits on top of MEXNC). Here are instructions for download and &amp;quot;installation&amp;quot;:&lt;br /&gt;
# Go to the [http://www.myroms.org/index.php?page=Processing download] page, enter the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;matlab&amp;lt;/span&amp;gt; directory, and download the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;matlab.tar.gz&#039;&#039;&#039;&amp;lt;/span&amp;gt; file.&lt;br /&gt;
# Extract the file in a location where it can stay indefinitely&lt;br /&gt;
# Similar to step (5) above, add the path to the recently extracted directory to the Matlab search path.&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3020</id>
		<title>FJORD TIDAL CASE</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=FJORD_TIDAL_CASE&amp;diff=3020"/>
		<updated>2008-04-23T14:58:39Z</updated>

		<summary type="html">&lt;p&gt;Diego: /* Creating ocean_fjord.in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Fjord Tidal Test Case&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:98%; background:yellow; margin-top:10px; border:1px solid red;&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{warning}} &#039;&#039;&#039;This WikiROMS article is currently under HEAVY construction. This message will be erased when active construction is finished (in 1 or 2 days).&#039;&#039;&#039;&amp;lt;br&amp;gt; &amp;lt;small&amp;gt;April 21, 2008 &amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a few ways to setup tidal forcing in ROMS ([[Tidal_Forcing|...learn more about tides in ROMS]]). This tutorial will explain the simplest way, which is to prescribe (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;analytically&amp;lt;/span&amp;gt;) tidal variations in sea-surface height at a open boundary (this uses a FLATHER/CHAPMAN combination). &lt;br /&gt;
I learned this trick from &#039;&#039;&#039;hetland&#039;&#039;&#039; in this [https://www.myroms.org/forum/viewtopic.php?p=249&amp;amp;sid=a059e4ffb90b2ad96b0a5463875277fe forum post] (at the bottom). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RESTRICTIONS:&amp;lt;/span&amp;gt; This technique is ONLY applicable in cases with one relatively narrow open boundary (say &amp;lt; 10 km). In this cases, the tidal height along the open boundary is essentially uniform and can be prescribed analytically.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;PREREQUISITES:&amp;lt;/span&amp;gt; This tutorial assumes that you have (1) downloaded ROMS, (2) installed it in your computer (or cluster), and (3) tested it by compiling and running one of the included test cases. If you haven&#039;t done all the above, check the [[Getting_Started|&amp;quot;Getting Started&amp;quot;]] and [[Tutorials|&amp;quot;Tutorials&amp;quot;]] WikiROMS sections.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Geographical Preamble==&lt;br /&gt;
This application is for Ship Harbour, an estuarine fjord in Nova Scotia, Canada. [http://maps.google.ca/maps/ms?hl=en&amp;amp;ie=UTF8&amp;amp;msa=0&amp;amp;ll=44.774524,-62.817421&amp;amp;spn=0.177915,0.310707&amp;amp;t=h&amp;amp;z=12&amp;amp;msid=109937017048460614209.00044a9aa08be20958242 Click here] to see the location in Google. Tides are semidiurnal and tidal range is 1.4 m on average and 2 m on spring tides. Ship Harbour is a long embayment (~7 km) with an open (EAST) boundary of ~1 km, therefore it is an ideal candidate for the type of analytical tidal forcing taught in this tutorial. For now I will only include tidal forcing, however, there is a river at the uppermost end of the estuary, which discharges freshwater at an annual average rate of 18 m&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;. I plan to write another tutorial on how to add a river, but for now is only tides. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Grid Generation==&lt;br /&gt;
The first step to set up a realistic application is to set up a realistic grid. There are several [[Grid_Generation|software packages]] to generate ROMS grids; [[seagrid|SEAGRID]] and [http://www.marine.csiro.au/~sak007/ GRIDGEN] being the most popular ones. I used the much-less-fancy EASYGRID, which is a bit easier to get up and running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
DOWNLOAD HERE to get the &#039;&#039;&#039;GRID and INITIALIZATION files required for this tutorial&#039;&#039;&#039;.  Alternatively, you can create your own grid and initialization files for this tutorial using the grid-generation software of your choice. You can download the bathymetry and coastline data for Ship Harbour Fjord [http://easygrid4roms.googlecode.com/files/EASYGRID_v1.rar HERE].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; I also wrote a [[easygrid|tutorial for grid generation using EASYGRID]]. The output of that tutorial are the grid and initialization files &#039;&#039;&#039;used in this tutorial&#039;&#039;&#039; (see above). So if you want to start from scratch, you should begin with the EASYGRID tutorial. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Compiling ROMS with tides==&lt;br /&gt;
Before we compile ROMS, we need to create a header (.h) file with the appropriate cpp definitions that turn ON the analytical tides. Also, we need to modify some analytical Fortran files, where we are going to specify how create the analytical tide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating header (.h) file===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; and copy-paste the cpp definitions below:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/*&lt;br /&gt;
 **&lt;br /&gt;
 ** Options for Tidal Fjord.&lt;br /&gt;
 **&lt;br /&gt;
 ** Application flag:   FJORD&lt;br /&gt;
 ** Input script:       ocean_fjord.in&lt;br /&gt;
 */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_ADV                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF advection terms  */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_COR                 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF Coriolis term    */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_QDRAG               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF quadratic bottom friction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; UV_VIS4                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to turn ON or OFF harmonic horizontal mixing */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MIX_S_UV               &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* momentum mixing on s-surfaces */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; DJ_GRADPS              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if splines density Jacobian (Shchepetkin, 2000) */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_U3HADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3rd-order upstream horiz. advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; TS_C4VADVECTION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 4th-order centered vertical advection */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SOLVE3D                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if solving 3D primitive equations */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; SPLINES                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use to activate parabolic splines reconstruction */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SMFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface momentum stress */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_STFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_SSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical surface salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BSFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom salinity flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_BTFLUX             &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical bottom temperature flux */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; MASKING                &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical masking is enabled */&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_FSCHAPMAN         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if free-surface Chapman condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M2FLATHER         &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 2D momentum Flather condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_M3RADIATION       &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if 3D momentum radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; EAST_TRADIATION        &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if tracers radiation condition*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_FSOBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical free-surface boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; ANA_M2OBC              &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/* use if analytical 2D momentum boundary conditions*/&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} The last 6 cpp definitions are the responsible for the analytical tidal forcing. I used the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;basin.h&amp;lt;/span&amp;gt; header file as a starting template... the first 10 cpp definitions are from it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} If your open boundary is not EAST... change EAST_FSCHAPMAN, EAST_M2FLATHER, EAST_M3RADIATION and EAST_TRADIATION to represent your open boundary (e.g. WEST__FSCHAPMAN for a west open boundary... etc.).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_fsobc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_fsobc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate surface height analytically when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined TEST_CHAN&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        cff=0.0_r8&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        cff=-0.4040_r8*MIN(time(ng)/150000.0_r8,1.0_r8)&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=cff&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        val=0.53_r8+(0.53_r8-0.48_r8)&lt;br /&gt;
        phase=(277.0_r8+(277.0_r8-240.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=fac*val*COS(omega-phase)&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF  &amp;lt;/font&amp;gt;    &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%zeta_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_fsobc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Modify ana_m2obc.h===&lt;br /&gt;
You will have to edit the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_m2obc.h&amp;lt;/span&amp;gt; (located in trunk/ROMS/Functionals) to tell ROMS to estimate currents analytically when running the FJORD case. Below is a snippet of the end of the file... you have to &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;ADD the green code&amp;lt;/span&amp;gt;.&lt;br /&gt;
 #elif defined WEDDELL&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 &amp;lt;font color=&amp;quot;Green&amp;quot;&amp;gt;#elif defined FJORD&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)/REAL(Iend+1,r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8)/REAL(Iend+1,r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j)+angler(Istr,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Istr-1,j-1)+angler(Istr-1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        fac=TANH((tdays(ng)-dstart)/1.0_r8)&lt;br /&gt;
        omega=2.0_r8*pi*time(ng)/(12.42_r8*3600.0_r8)  !  M2 Tide period&lt;br /&gt;
        minor=0.0143_r8+(0.0143_r8+0.010_r8)&lt;br /&gt;
        major=0.1144_r8+(0.1144_r8-0.013_r8)&lt;br /&gt;
        phase=(318.0_r8+(318.0_r8-355.0_r8))*deg2rad&lt;br /&gt;
        angle=(125.0_r8+(125.0_r8- 25.0_r8))*deg2rad&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend,j)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=fac*(major*COS(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         SIN(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          val=0.5_r8*(angler(Iend+1,j-1)+angler(Iend+1,j))&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=fac*(major*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase)-        &amp;amp;&lt;br /&gt;
     &amp;amp;                                   minor*SIN(angle-val)*          &amp;amp;&lt;br /&gt;
     &amp;amp;                                         COS(omega-phase))&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&amp;lt;/font&amp;gt;      &lt;br /&gt;
 #else&lt;br /&gt;
      IF (EASTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_east(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (WESTERN_EDGE) THEN&lt;br /&gt;
        DO j=JstrR,JendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO j=Jstr,JendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_west(j)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (SOUTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_south(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
      IF (NORTHERN_EDGE) THEN&lt;br /&gt;
        DO i=Istr,IendR&lt;br /&gt;
          BOUNDARY(ng)%ubar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
        DO i=IstrR,IendR&lt;br /&gt;
          BOUNDARY(ng)%vbar_north(i)=0.0_r8&lt;br /&gt;
        END DO&lt;br /&gt;
      END IF&lt;br /&gt;
 #endif&lt;br /&gt;
      RETURN&lt;br /&gt;
      END SUBROUTINE ana_m2obc_tile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Now you are ready to compile ROMS!&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Same as you did with the test cases... now you have to compile ROMS using the newly created &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;fjord.h&amp;lt;/span&amp;gt; header file. If you are unsure of how to compile ROMS, you may want to take a look to the [[build_Script|build.sh / build.bash]] page and to the [[Talk:build_Script|example]] within the &amp;quot;contributions&amp;quot; section of that page.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Creating ocean_fjord.in==&lt;br /&gt;
Once ROMS has been compiled and you have your oceanS (or oceanM) executable file, you need to created an input file to run ROMS. You may want to make a copy of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt; (trunk/ROMS/External) and use it as a starting template. {{warning}} Don&#039;t forget to rename the copy &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Below are snippets of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_basin.in&amp;lt;/span&amp;gt;. In &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;GREEN&amp;lt;/span&amp;gt; are the parts that you need to change in the copy (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_fjord.in&amp;lt;/span&amp;gt;). Parts in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;RED&amp;lt;/span&amp;gt; also need to be changed in the copy, but the actual &#039;&#039;replaced text&#039;&#039; will depend on your own configuration.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Application title.&lt;br /&gt;
 !&lt;br /&gt;
       TITLE = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Tidal Fjord&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! C-preprocessing Flag.&lt;br /&gt;
 !&lt;br /&gt;
    MyAppCPP = &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;FJORD&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Input variable information file name.  This file needs to be processed&lt;br /&gt;
 ! first so all information arrays can be initialized properly.&lt;br /&gt;
 !&lt;br /&gt;
     VARNAME = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2VARINFO&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;/varinfo.dat&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Grid dimension parameters. See notes below in the Glossary for how to set&lt;br /&gt;
 ! these parameters correctly.&lt;br /&gt;
 !&lt;br /&gt;
          Lm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;90&amp;lt;/span&amp;gt;             ! Number of I-direction INTERIOR RHO-points&lt;br /&gt;
          Mm == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;24&amp;lt;/span&amp;gt;             ! Number of J-direction INTERIOR RHO-points&lt;br /&gt;
           N == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;             ! Number of vertical levels&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Lm, Mm&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;N&amp;lt;/span&amp;gt; are output to the screen while creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If Running ROMS in parallel, use the configuration below... otherwise you may leave NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; and NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;&lt;br /&gt;
 ! Domain decomposition parameters for serial, distributed-memory or&lt;br /&gt;
 ! shared-memory configurations used to determine tile horizontal range&lt;br /&gt;
 ! indices (Istr,Iend) and (Jstr,Jend), [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
      NtileI == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;4&amp;lt;/span&amp;gt;                               ! I-direction partition&lt;br /&gt;
      NtileJ == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;                               ! J-direction partition&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Time-Stepping parameters.&lt;br /&gt;
 !&lt;br /&gt;
      NTIMES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;17280             ! 2-days&amp;lt;/span&amp;gt;&lt;br /&gt;
          DT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDTFAST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NOTE:&amp;lt;/span&amp;gt; The values of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;DT&amp;lt;/span&amp;gt; is also output to the screen while creating the grid file using EASYGRID.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This changes are just to speed up simulations.&lt;br /&gt;
 ! Number of eigenvalues (NEV) and eigenvectors (NCV) to compute for the&lt;br /&gt;
 ! Lanczos/Arnoldi problem in the Generalized Stability Theory (GST)&lt;br /&gt;
 ! analysis. NCV must be greater than NEV (see documentation below).&lt;br /&gt;
 !&lt;br /&gt;
         NEV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2&amp;lt;/span&amp;gt;                              ! Number of eigenvalues&lt;br /&gt;
         NCV =  &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;10&amp;lt;/span&amp;gt;                             ! Number of eigenvectors&lt;br /&gt;
 !&lt;br /&gt;
 ! Input/Output parameters.&lt;br /&gt;
 !&lt;br /&gt;
       NRREC == 0&lt;br /&gt;
   LcycleRST == T&lt;br /&gt;
        NRST == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NSTA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
        NFLT == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
       NINFO == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;360                            ! Every 1 hour&amp;lt;/span&amp;gt;&lt;br /&gt;
 !&lt;br /&gt;
 ! Output history, average, diagnostic files parameters.&lt;br /&gt;
 !&lt;br /&gt;
     LDEFOUT == T&lt;br /&gt;
        NHIS == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFHIS == 0             &lt;br /&gt;
      NTSAVG == 1&lt;br /&gt;
        NAVG == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFAVG == 0&lt;br /&gt;
      NTSDIA == 1&lt;br /&gt;
        NDIA == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;60            ! Every 10 minutes&amp;lt;/span&amp;gt;&lt;br /&gt;
     NDEFDIA == 0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{warning}} Lets see if this works&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Harmonic/biharmonic horizontal diffusion of tracer: [1:NAT+NPT,Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
        TNU2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;20.0d0  20.0d0&amp;lt;/span&amp;gt;                  ! m2/s&lt;br /&gt;
        TNU4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;2*0.0d0&amp;lt;/span&amp;gt;                         ! m4/s&lt;br /&gt;
 !&lt;br /&gt;
 ! Harmononic/biharmonic, horizontal viscosity coefficient: [Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
       VISC2 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;100.0d0&amp;lt;/span&amp;gt;                          ! m2/s&lt;br /&gt;
       VISC4 == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.0d0&amp;lt;/span&amp;gt;                            ! m4/s&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Adjust parameters for the depth of the our fjord &lt;br /&gt;
 ! Vertical S-coordinates parameters, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     THETA_S == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;5.0d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_S &amp;lt; 20&lt;br /&gt;
     THETA_B == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0.4d0&amp;lt;/span&amp;gt;                      ! 0 &amp;lt; THETA_B &amp;lt; 1&lt;br /&gt;
      TCLINE == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;30.0d0&amp;lt;/span&amp;gt;                     ! m&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 ! Logical switches (TRUE/FALSE) to specify the state surface forcing&lt;br /&gt;
 ! variable whose stochastic optimals is required.&lt;br /&gt;
 !&lt;br /&gt;
 SOstate(isUstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface u-stress&lt;br /&gt;
 SOstate(isVstr) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                       ! surface v-stress&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To speed up simulations&lt;br /&gt;
 Hout(inert) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F&amp;lt;/span&amp;gt;                          ! inert passive tracers&lt;br /&gt;
&lt;br /&gt;
 Hout(idBott) == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;F F F F F F F F F F F F F F F F&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Write path to the GRID and INITIALIZATION input files. Comment-out the one that we don&#039;t need.&lt;br /&gt;
 ! Input NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GRDNAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_grd.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
     ININAME == &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;../PATH2yourFILE/&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_ini.nc&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     ITLNAME == ocean_itl.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     IRPNAME == ocean_irp.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     IADNAME == ocean_iad.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     CLMNAME == ocean_clm.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     BRYNAME == ocean_bry.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     FWDNAME == ocean_fwd.nc&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;     ADSNAME == ocean_ads.nc&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
No forcing.&lt;br /&gt;
     NFFILES == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;0&amp;lt;/span&amp;gt;                          ! number of forcing files&lt;br /&gt;
 !&lt;br /&gt;
 &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;!&amp;lt;/span&amp;gt;    FRCNAME == ocean_frc.nc               ! forcing file 1, grid 1&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Finally, the output file names (change all, eventhough only &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;his, avg&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;rst&amp;lt;/span&amp;gt; will be used)&lt;br /&gt;
 ! Output NetCDF file names, [1:Ngrids].&lt;br /&gt;
 !&lt;br /&gt;
     GSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_gst.nc&lt;br /&gt;
     RSTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_rst.nc&lt;br /&gt;
     HISNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_his.nc&lt;br /&gt;
     TLMNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlm.nc&lt;br /&gt;
     TLFNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_tlf.nc&lt;br /&gt;
     ADJNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_adj.nc&lt;br /&gt;
     AVGNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_avg.nc&lt;br /&gt;
     DIANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_dia.nc&lt;br /&gt;
     STANAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_sta.nc&lt;br /&gt;
     FLTNAME == &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Fjord_&amp;lt;/span&amp;gt;ocean_flt.nc&lt;/div&gt;</summary>
		<author><name>Diego</name></author>
	</entry>
</feed>