<?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=Csherwood</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=Csherwood"/>
	<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/Special:Contributions/Csherwood"/>
	<updated>2026-04-27T20:55:13Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3682</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3682"/>
		<updated>2009-04-09T15:26:39Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Make an init file (Run03) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original &#039;&#039;.h&#039;&#039; and &#039;&#039;.in&#039;&#039; files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the &#039;&#039;.h&#039;&#039; file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the &#039;&#039;.in&#039;&#039; file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to &#039;&#039;../out&#039;&#039;.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[w:ChangeTcline|Changing netCDF variables]].&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;and&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations. First, the following declarations are needed. Some of these were already defined...the additional ones represent fluxes that are required but not provided by a sediment bed, and will be set to zero in their respective ana_xx.F files.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define ANA_BPFLUX /* needed when sediment and bulk fluxes are on */&amp;lt;br&amp;gt;#define ANA_SPFLUX /* needed when sediment and bulk fluxes are on */&amp;lt;br&amp;gt;#define ANA_BSFLUX /* bottom temp flux...defaults to zero */&amp;lt;br&amp;gt;#define ANA_BTFLUX /* bottom heat flux...defaults to zero */&amp;lt;br&amp;gt;#define ANA_SSFLUX /* analytical surface salt flux defaults to zero */&amp;lt;/div&amp;gt;Now add the declarations for the wave-current bottom stress calculations, and for sediment. We have to turn off the quadratic drag specification, because we are replacing it with SSW_BBL.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;Finally, to reduce the output, we can also:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#undef AVERAGES /* reduce output */&amp;lt;br&amp;gt;#undef STATIONS /* reduce output */&amp;lt;/div&amp;gt;You can download the resulting .h file from https://coast-enviro.er.usgs.gov/Latte/run03.&lt;br /&gt;
* Copy a sediment.in file from an example application and make some changes.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;We will only have one bed layer; it should be thick enough so that it does not erode completely in most of the model domain but, if it is too thick, changes in composition during the model run will be less apparent. We are going to specify only one non-cohesive sediment class, so we need only one value for each parameter.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;    SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;If we had several sediment classes, we would need more (NNS) numbers arrayed across after each variable.&lt;br /&gt;
* Make several changes to the .in file, starting with the title.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;       TITLE = Latte Tutorial, Run03&amp;lt;/div&amp;gt;Specify the number of sediment tracers...in this case, one non-cohesive size.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NCS =  0             ! Number of cohesive (mud) sediment tracers&amp;lt;br&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;/div&amp;gt;Turn on additional output to appear in the .his output file.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;...&amp;lt;br&amp;gt;Hout(idUbrs) == T                          ! bottom U-current stress&amp;lt;br&amp;gt;Hout(idVbrs) == T                          ! bottom V-current stress&amp;lt;br&amp;gt;Hout(idUbws) == T                          ! bottom U-wave stress&amp;lt;br&amp;gt;Hout(idVbws) == T                          ! bottom V-wave stress&amp;lt;br&amp;gt;Hout(idUbcs) == T                          ! bottom max wave-current U-stress&amp;lt;br&amp;gt;Hout(idVbcs) == T                          ! bottom max wave-current V-stress&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Hout(idUbot) == T                          ! bed wave orbital U-velocity&amp;lt;br&amp;gt;Hout(idVbot) == T                          ! bed wave orbital V-velocity&amp;lt;br&amp;gt;Hout(idUbur) == T                          ! bottom U-velocity above bed&amp;lt;br&amp;gt;Hout(idVbvr) == T                          ! bottom V-velocity above bed&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;Hout(idBott) == T T T T T T T T T F F F F F F F&amp;lt;br&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
* Add more information to the initialization file (discussed in the next section), so we will point to that in the .in file&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     ININAME == ../in/lattec_sed1_ini_94.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
* We want to add some waves, so a wave forcing file (see below) is added to the list and NFFILES is increased.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     NFFILES == 10                          ! number of forcing files&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     FRCNAME == ../in/frc_latte_wrf_Lwrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Pair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Qair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Swrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Tair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Uwind.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Vwind.nc \&amp;lt;br&amp;gt;               ../in/roms_lattec_river.nc \&amp;lt;br&amp;gt;                ../in/frc_tides_lattec.nc \&amp;lt;br&amp;gt;                ../in/frc_lattec_small_waves.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;* Also, rename the output files&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ! Output NetCDF file names, [1:Ngrids].&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     GSTNAME == ocean_gst.nc&amp;lt;br&amp;gt;     RSTNAME == ../out/lattec_rst_run03.nc&amp;lt;br&amp;gt;     HISNAME == ../out/lattec_his_run03.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Needs waves!==&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3681</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3681"/>
		<updated>2009-04-09T13:30:46Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Make an init file (Run03) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original &#039;&#039;.h&#039;&#039; and &#039;&#039;.in&#039;&#039; files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the &#039;&#039;.h&#039;&#039; file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the &#039;&#039;.in&#039;&#039; file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to &#039;&#039;../out&#039;&#039;.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[w:ChangeTcline|Changing netCDF variables]].&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;and&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations. First, the following declarations are needed.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define ANA_BPFLUX /* needed when sediment and bulk fluxes are on */&amp;lt;br&amp;gt;#define ANA_SPFLUX /* needed when sediment and bulk fluxes are on */&amp;lt;br&amp;gt;#define ANA_BSFLUX /* bottom temp flux...defaults to zero */&amp;lt;br&amp;gt;#define ANA_BTFLUX /* bottom heat flux...defaults to zero */&amp;lt;br&amp;gt;#define ANA_SSFLUX /* analytical surface salt flux defaults to zero */&amp;lt;/div&amp;gt;Now add the declarations for sediment.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application and make some changes.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;We will only have one bed layer; it should be thick enough so that it does not erode completely in most of the model domain but, if it is too thick, changes in composition during the model run will be less apparent. We are going to specify only one non-cohesive sediment class, so we need only one value for each parameter.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;    SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;If we had several sediment classes, we would need more (NNS) numbers arrayed across after each variable.&lt;br /&gt;
* Make several changes to the .in file, starting with the title.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;       TITLE = Latte Tutorial, Run03&amp;lt;/div&amp;gt;Specify the number of sediment tracers...in this case, one non-cohesive size.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NCS =  0             ! Number of cohesive (mud) sediment tracers&amp;lt;br&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;/div&amp;gt;Turn on additional output to appear in the .his output file.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;...&amp;lt;br&amp;gt;Hout(idUbrs) == T                          ! bottom U-current stress&amp;lt;br&amp;gt;Hout(idVbrs) == T                          ! bottom V-current stress&amp;lt;br&amp;gt;Hout(idUbws) == T                          ! bottom U-wave stress&amp;lt;br&amp;gt;Hout(idVbws) == T                          ! bottom V-wave stress&amp;lt;br&amp;gt;Hout(idUbcs) == T                          ! bottom max wave-current U-stress&amp;lt;br&amp;gt;Hout(idVbcs) == T                          ! bottom max wave-current V-stress&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Hout(idUbot) == T                          ! bed wave orbital U-velocity&amp;lt;br&amp;gt;Hout(idVbot) == T                          ! bed wave orbital V-velocity&amp;lt;br&amp;gt;Hout(idUbur) == T                          ! bottom U-velocity above bed&amp;lt;br&amp;gt;Hout(idVbvr) == T                          ! bottom V-velocity above bed&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;Hout(idBott) == T T T T T T T T T F F F F F F F&amp;lt;br&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
* Add more information to the initialization file (discussed in the next section), so we will point to that in the .in file&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     ININAME == ../in/lattec_sed1_ini_94.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
* We want to add some waves, so a wave forcing file (see below) is added to the list and NFFILES is increased.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     NFFILES == 10                          ! number of forcing files&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     FRCNAME == ../in/frc_latte_wrf_Lwrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Pair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Qair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Swrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Tair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Uwind.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Vwind.nc \&amp;lt;br&amp;gt;               ../in/roms_lattec_river.nc \&amp;lt;br&amp;gt;                ../in/frc_tides_lattec.nc \&amp;lt;br&amp;gt;                ../in/frc_lattec_small_waves.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;* Also, rename the output files&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ! Output NetCDF file names, [1:Ngrids].&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     GSTNAME == ocean_gst.nc&amp;lt;br&amp;gt;     RSTNAME == ../out/lattec_rst_run03.nc&amp;lt;br&amp;gt;     HISNAME == ../out/lattec_his_run03.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Needs waves!==&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=ROMS_UNSW2008&amp;diff=3680</id>
		<title>ROMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=ROMS_UNSW2008&amp;diff=3680"/>
		<updated>2009-04-09T02:23:49Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Installing and Running ROMS for First Time Users&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A tutorial for new ROMS users will be held at the UNSW Computer Labs on Monday 30 March 2009, immediately prior to the ROMS Sydney 2009 User Workshop at the Sydney Institute of Marine Sciences, 31 March to 2 April 2009.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{note}}&#039;&#039;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;This tutorial is intended for complete newcomers to ROMS. It assumes basic knowledge of working in a UNIX environment, and that the essential components required to compile and execute ROMS are already installed on the host computer network. This wiki page borrows heavily from David Robertson&#039;s excellent [[ROMS_Cygwin|Installing ROMS under Cygwin]] tutorial where you will find more information about setting up the required computing environment (compilers, libraries etc.) for ROMS.&amp;lt;/span&amp;gt;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
In this tutorial, we cover how to download the code, configure it for an application, and run the model. Error messages that arise during the configuration process will be explained so that these can better be debugged when users return to their home institutions and try to work through this process again.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A follow-on [[CSTMS_UNSW2008|tutorial discussing sediment in ROMS]] will be presented on Friday 03 April.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{note}}An important resource you should use as you get started is the [[Frequently_Asked_Questions | Frequently Asked Questions]] entry in [https://www.myroms.org/wiki WikiROMS].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Download ROMS==&lt;br /&gt;
&lt;br /&gt;
The disk space available on the UNSW Computer Lab machines is quite limited, so for the purposes of this tutorial we have downloaded the ROMS source code to &#039;&#039;&#039;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/srv/ckpt/roms/shared/src&amp;lt;/span&amp;gt;&#039;&#039;&#039; on host &#039;&#039;&#039;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;matht001&amp;lt;/span&amp;gt;&#039;&#039;&#039;. Instructions below will explain how to point the &#039;&#039;&#039;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;&#039;&#039;&#039; script that compiles ROMS to this directory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;To download the code to your own machine, these are the steps you would follow:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:*You must have already registered on the ROMS portal and obtained your ROMS username/password as indicated in the [[ROMS_Cygwin#Register|Register]]. If you are also interested in access to research branches of the sediment code, indicate an interest in the Community Sediment Transport Modeling System (CSTMS) while you are registering. Once your registration is accepted, or if you are already registered, ask Dave Robertson (&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;robertson at marine.rutgers.edu&amp;lt;/span&amp;gt;) to add you as a CSTMS user.&lt;br /&gt;
&lt;br /&gt;
:*Create a &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;src&amp;lt;/span&amp;gt; folder where you will keep the ROMS source code. You can place this wherever you wish in your directory tree (here we assume under your home directory &amp;quot;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;~&amp;lt;/span&amp;gt;&amp;quot;) and name it whatever you like.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~&amp;lt;br /&amp;gt;mkdir src&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Check out the ROMS source code replacing &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;bruce&#039;&#039;&amp;lt;/span&amp;gt; with the ROMS user name you registered with.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;svn checkout --username bruce &amp;lt;nowiki&amp;gt;https://www.myroms.org/svn/src/trunk src&amp;lt;/nowiki&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; Note the target directory &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;src&amp;lt;/span&amp;gt; at the end of the command. If your code ends up in the wrong place, you may have omitted this. &lt;br /&gt;
&lt;br /&gt;
You will see many lines stream by indicating the files that are being added to your src directory. When it finishes, you can type &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ls src&amp;lt;/span&amp;gt; to see the contents of the directory. &lt;br /&gt;
&lt;br /&gt;
To see the contents of the directory where the code is downloaded for this tutorial, type this:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd /srv/ckpt/roms/shared&amp;lt;br /&amp;gt;ls src&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Customize the [[build Script|Build Script]]==&lt;br /&gt;
The ROMS source code comes with a [[build Script|build script]] in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ROMS/Bin&amp;lt;/span&amp;gt; directory. Examples written with &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;bash&amp;lt;/span&amp;gt; (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;) and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;csh&amp;lt;/span&amp;gt; (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.sh&amp;lt;/span&amp;gt;) are provided. The UNSW Computer Lab machines are configured to use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;bash&amp;lt;/span&amp;gt; as the default login shell, so we will work with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;. A full description of the build script can be found [[build Script|here]].&lt;br /&gt;
&lt;br /&gt;
:*In your home directory (you can use some other directory to organize your ROMS projects if you wish) create a new folder named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; and change into it.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~&amp;lt;br /&amp;gt;mkdir Projects&amp;lt;br /&amp;gt;cd Projects&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
:*Create a folder named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling&amp;lt;/span&amp;gt; and change into it. ROMS is distributed with several [[Test Cases|Test Cases]] and the [[UPWELLING_CASE|Upwelling example]] is the default which we will compile and run here.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;mkdir upwelling&amp;lt;br /&amp;gt;cd upwelling&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Copy the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; file distributed with ROMS to your &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; directory.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/Bin/build.bash .&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we need to configure a few options inside &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; so that it finds the directories where the source code and your Project are located. &lt;br /&gt;
&lt;br /&gt;
:*Open the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; script you just copied into your &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling&amp;lt;/span&amp;gt; directory using your preferred text editor, e.g. vi.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;vi build.bash&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Scroll down until you find &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;. You will notice it is set as follows:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING&amp;lt;/div&amp;gt; We do not need to change this. But this is the first thing you will alter when starting your own project. This tells ROMS the name of an include file that will contain all the directives to the C-PreProcessor to configure your application at compile time. ROMS&#039; rule is change this string to lowercase and append a &amp;quot;.h&amp;quot;, so this will search for a file called &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt;. It must be in the directory specified by &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
:*Scroll down until you find &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt; and set it as follows:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;=${&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;HOME&amp;lt;/span&amp;gt;}/Projects/upwelling&amp;lt;/div&amp;gt; This obviously assumes you put &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; under your home directory.&lt;br /&gt;
  &lt;br /&gt;
If you frequently move your ROMS project between hosts where you have a different directory structure, e.g. a temporary scratch space, you can use the &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt; variable to minimize the changes you make to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*For example: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt;=/usr/scratch/bruce&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;=${&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt;}/Projects/upwelling&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we tell &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; where to find the ROMS source code downloaded from the svn repository (which you can keep up to date the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;svn update&amp;lt;/span&amp;gt; command - see more on this at LINK ). Note that most of the source code changes you make to customize ROMS will be made in your Projects space, and need not be made to the downloaded code directly. We will discuss exceptions to this during the tutorial, and how source code modifications interact with svn.&lt;br /&gt;
&lt;br /&gt;
:*Set &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to the location of the source code:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt;=/srv/ckpt/roms/shared/src&amp;lt;/div&amp;gt; In practise, you will probably do something more like this:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt;=${&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt;}/src&amp;lt;/div&amp;gt; assuming this is the relative path in which you keep your source code on the various machines you work on. &lt;br /&gt;
&lt;br /&gt;
Make sure that &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_CPP_FLAGS&amp;lt;/span&amp;gt; is &#039;&#039;&#039;not&#039;&#039;&#039; set. Sometimes this is set in the distributed build.bash exmaple. Comment out options with the # symbol like so:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#export MY_CPP_FLAGS=&amp;quot;-DAVERAGES&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UNSW Computer Lab machines are single core, so we need to tell &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; not to assume MPI parallel compilation. &lt;br /&gt;
&lt;br /&gt;
:*Comment out the options for &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_MPI&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_MPIF90&amp;lt;/span&amp;gt;&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#export USE_MPI=on &amp;lt;br&amp;gt;#export USE_MPIF90=on&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*If you were compiling in parallel you would leave the default entries in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;            &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_MPI&amp;lt;/span&amp;gt;=&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;         &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_MPIF90&amp;lt;/span&amp;gt;=&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*We leave the compiler option as the default because this says use the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ifort&amp;lt;/span&amp;gt; (Intel FORTRAN) compiler which is what we want on the UNSW machines. &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt;=ifort&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*In the interests of speed for this tutorial, we turn off compiler optimization by activating the debug option: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_DEBUG&amp;lt;/span&amp;gt;=on&amp;lt;/div&amp;gt;On the UNSW Lab machines compiling with optimization on will take over 15 minutes, but with optimization off (USE_DEBUG=on) it will be less than 60 seconds.&lt;br /&gt;
&lt;br /&gt;
Save and close the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Copy the input and CPPDEFS options files==&lt;br /&gt;
&lt;br /&gt;
We need three more files in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; to configure and run ROMS. We copy the versions downloaded with svn because these are files you will work with locally when you experiment with changes to the test case example configuration. &lt;br /&gt;
&lt;br /&gt;
:*Copy files &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in, varinfo.dat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; into the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; directory you just created.&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~/Projects/upwelling&amp;lt;br /&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/External/ocean_upwelling.in . &amp;lt;br&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/External/varinfo.dat . &amp;lt;br&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/Include/upwelling.h .&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt;.  It contains all the [[C_Preprocessor|C-Pre-Processor (CPP)]] options that the compiler interprets to activate certain source code options within ROMS.&lt;br /&gt;
&lt;br /&gt;
View the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt;. It contains the inputs options that ROMS [[ocean.in|reads from standard input]] at run time to set options that need not be fixed at compile time. &lt;br /&gt;
&lt;br /&gt;
View &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt;. The file [[varinfo.dat]] contains descriptions of the names and attributes of input and output variables that ROMS reads and writes from netcdf files. For most applications you will not need to change the entries in this file. If you need to know the default units assumed for different variables, those are noted in this file. (Before we run ROMS, we will need to tell it where to find this file). &lt;br /&gt;
&lt;br /&gt;
Now we are ready to compile ROMS by executing the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
==Compile ROMS==&lt;br /&gt;
&lt;br /&gt;
Before you run ROMS, you need to compile it to create an executable &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;oceanS&amp;lt;/span&amp;gt; file (&#039;&#039;&#039;S&#039;&#039;&#039; for serial or single processor computer), or &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;oceanM&amp;lt;/span&amp;gt; file (if using &#039;&#039;&#039;MPI&#039;&#039;&#039; on a parallel computer).&lt;br /&gt;
&lt;br /&gt;
:*Go to your upwelling project directory:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~/Projects/upwelling&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Then type:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build.bash&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*If lots of stuff comes on the screen then compilation is proceeding, and make take some time.  &lt;br /&gt;
&lt;br /&gt;
:*If the build process ends quickly with an error, then it is likely that &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; does not point to the correct location for the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; file, the FORTRAN compiler, or some libraries. We describe common &#039;&#039;getting started&#039;&#039; errors and solutions in the next section. &lt;br /&gt;
&lt;br /&gt;
:*You may give the option &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;-j&amp;lt;/span&amp;gt; to the build command to distribute the compilation to multiple processors if your host supports this, e.g.:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build.bash -j 8&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; to compile on 8 processor at once. &lt;br /&gt;
 &lt;br /&gt;
If your build was successful it will not have reported any errors, and there will be an executable file in your &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanG&amp;lt;/span&amp;gt;. The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;G&amp;quot;&amp;lt;/span&amp;gt; in the file name indicates &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; activated the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;USE_DEBUG&amp;lt;/span&amp;gt; option. &lt;br /&gt;
&lt;br /&gt;
If &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;USE_DEBUG&amp;lt;/span&amp;gt; were not selected, the executable would be &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanS&amp;lt;/span&amp;gt;, where the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;S&amp;quot;&amp;lt;/span&amp;gt; indicates &amp;quot;serial&amp;quot; or &amp;quot;single-processor&amp;quot; because we deactivated MPI. &lt;br /&gt;
&lt;br /&gt;
If you had activated MPI with the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;USE_MPI&amp;lt;/span&amp;gt; option the executable would be named &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanM&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(See also [[Frequently_Asked_Questions#My_build_finished_with_no_errors._Where_is_the_ROMS_executable.3F|FAQ: My build finished with no errors, where is the ROMS executable?]]). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Common &#039;&#039;getting started&#039;&#039; compile error messages===&lt;br /&gt;
&lt;br /&gt;
Getting past the first few errors with compilation is often tricky. Carefully read any error messages you get for clues on what might be wrong with your configuration. Here are some common difficulties new users encounter getting started when first executing the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Compilers/../ROMS/Include/cppdefs.h:709:22: &amp;lt;br&amp;gt;error: /student/0/a0000020/Projects/upwelling/upwelling.h: No such file or directory&amp;lt;/div&amp;gt; This says the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; is not where Build expects it to be, which is in &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;. You set this to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;~/Projects/upwelling&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp: cannot stat `/opt/intelsoft/netcdf/include/netcdf.mod&#039;: No such file or directory&amp;lt;/div&amp;gt; This says that netcdf is not where build.bash expects to find it. Locate where the netcdf include and lib directories with steps something like:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd /usr &amp;lt;br&amp;gt;find . -name netcdf.mod -print&amp;lt;br&amp;gt;&amp;lt;/span&amp;gt;  ./local/netcdf-3.6.2/include/netcdf.mod &amp;lt;br&amp;gt;  ./local/netcdf/intel/3.6.3/include/netcdf.mod&amp;lt;/div&amp;gt;This tells us the most recent (3.6.3) netcdf is in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/usr/local/netcdf/intel/3.6.3&amp;lt;/span&amp;gt;. Direct ROMS to this location by making two changes to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;. First, advise ROMS to read your changes to the default library path by uncommenting the option for &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_MY_LIBS&amp;lt;/span&amp;gt;.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;      &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_MY_LIBS&amp;lt;/span&amp;gt;=on&amp;lt;/div&amp;gt; Then specifiy the correct location for netcdf:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;      &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NETCDF_INCDIR&amp;lt;/span&amp;gt;=/usr/local/netcdf/intel/3.6.3/include&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;      &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NETCDF_LIBDIR&amp;lt;/span&amp;gt;=/usr/local/netcdf/intel/3.6.3/lib&amp;lt;/div&amp;gt; {{warning}} Be careful where you make this change. You need to make it for the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ifort&amp;lt;/span&amp;gt; compiler option, and NOT for the &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_NETCDF4&amp;lt;/span&amp;gt; option (we are using netcdf-3). If you&#039;ve done this correctly, your compilation with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; should now succeed.&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;error &amp;lt;br&amp;gt;error: &amp;lt;/div&amp;gt; Note here further errors we encounter during the tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Run ROMS==&lt;br /&gt;
&lt;br /&gt;
You run ROMS by executing the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanG&amp;lt;/span&amp;gt; (or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanS&amp;lt;/span&amp;gt;) binary, giving it the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt; file as UNIX standard input. &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./oceanS &amp;lt; ocean_upwelling.in&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; ROMS standard output will be typed to the screen. To save it a file instead, enter, e.g.:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./oceanS &amp;lt; ocean_upwelling.in &amp;gt; my_upwelling.log &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have compiled a parallel (MPI) executable, the syntax for running the mode is slightly &#039;&#039;&#039;but critically&#039;&#039;&#039; different. The &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt; file is no longer read from UNIX standard input (it has handled by all the MPI threads) so the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;&amp;lt;&amp;quot;&amp;lt;/span&amp;gt; disappears from the command, and you need the correct syntax on your UNIX host for running an MPI process. It is probably something like: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;mpirun -np 8 ./oceanM ocean_upwelling.in &amp;gt; my_upwelling.log&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; where the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;-np 8&amp;quot;&amp;lt;/span&amp;gt; indicates use 8 processors and this number of tiles must have been set by   &lt;br /&gt;
&lt;br /&gt;
(See also [[Frequently_Asked_Questions#What_do_I_have_to_do_to_run_an_application.3F | FAQ: What do I have to do to runs ROMS?]]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Common &#039;&#039;getting started&#039;&#039; run error messages===&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;bash: oceanG: command not found&amp;lt;/div&amp;gt;The working directory is not in your UNIX path. That&#039;s why we type &amp;quot;dot-slash&amp;quot; in front of the commands above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Successful execution==&lt;br /&gt;
&lt;br /&gt;
===Standard Output===&lt;br /&gt;
&lt;br /&gt;
When ROMS runs it will type a lot of information to UNIX standard output. This is the &amp;quot;logfile&amp;quot; you named following the &amp;quot;&amp;gt;&amp;quot;, or your terminal if you did not redirect stdout. &lt;br /&gt;
&lt;br /&gt;
STDOUT shows the following:&lt;br /&gt;
&lt;br /&gt;
:*UNIX process info, run time, run TITLE &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Process Information: &amp;lt;br&amp;gt; Thread #  0 (pid=    4449) is active. &amp;lt;br&amp;gt; Model Input Parameters:  ROMS/TOMS version 3.2 &amp;lt;br&amp;gt;        Monday - March 23, 2009 - 10:02:39 AM &amp;lt;br&amp;gt;----------------------------------------------------------- &amp;lt;br&amp;gt; Wind-Driven Upwelling/Downwelling over a Periodic Channel&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*OS, compiler information, SVN version, and your MY_ROMS_SRC, MY_HEADER_DIR and ROMS_APPLICATION settings&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Operating system : Linux&amp;lt;br&amp;gt;CPU/hardware     : i686&amp;lt;br&amp;gt;Compiler system  : ifort &amp;lt;br&amp;gt;Compiler command : /usr/local/intel/fc/10.1.021/bin/ifort &amp;lt;br&amp;gt;Compiler flags   : -heap-arrays -ip -O3 -pc80 -xW -free&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;SVN Root URL  : &amp;lt;nowiki&amp;gt;https://www.myroms.org/svn/src/trunk&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;SVN Revision  : 333&amp;lt;br&amp;gt;Local Root    : /srv/ckpt/roms/shared/src&amp;lt;br&amp;gt;Header Dir    : /student/0/a0000020/srv/Projects/upwelling&amp;lt;br&amp;gt;Header file   : upwelling.h&amp;lt;br&amp;gt;Analytical Dir: /student/0/a0000020/srv/Projects/upwelling&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Resolution, Grid 01: 0041x0080x016,  Parallel Threads:  1,  Tiling: 001x001&amp;lt;/div&amp;gt;Check that these are what you intended. In last line above&lt;br /&gt;
::*&amp;quot;Grid 01&amp;quot; pertains to future ROMS developments with multiple nested/connected grids, &lt;br /&gt;
::* 0041x0080x016 shows the grid size is 41 x 80 x 16 grid points in the K,J,I directions&lt;br /&gt;
::* The Parallel/Tiling message shows you are using a single process and a single domain tile. When using MPI, this message will describe how many tiles you are using and the MPI processes assigned. &lt;br /&gt;
&lt;br /&gt;
:*Input parameters set in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt;&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Physical Parameters, Grid: 01&amp;lt;br&amp;gt;=============================&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;        288  ntimes          Number of timesteps for 3-D equations.&amp;lt;br&amp;gt;    300.000  dt              Timestep size (s) for 3-D equations.&amp;lt;br&amp;gt;         30  ndtfast         Number of timesteps for 2-D equations between&amp;lt;br&amp;gt;                               each 3D timestep.&amp;lt;br&amp;gt;   ...&amp;lt;br&amp;gt;            Output Averages File:  ocean_avg.nc&amp;lt;br&amp;gt;         Output Diagnostics File:  ocean_dia.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Then some more about the tiling when running in parallel&lt;br /&gt;
&lt;br /&gt;
:*The C-PreProcessor (CPP) flags set in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; but &#039;&#039;&#039;AS MODIFIED&#039;&#039;&#039; by ROMS when interpreting and checking the selected CPP options.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Activated C-preprocessing Options:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  UPWELLING          Wind-Driven Upwelling/Downwelling over a Periodic Channel&amp;lt;br&amp;gt;  ANA_BSFLUX         Analytical kinematic bottom salinity flux.&amp;lt;br&amp;gt;  ANA_BTFLUX         Analytical kinematic bottom temperature flux.&amp;lt;br&amp;gt;  ANA_GRID           Analytical grid set-up.&amp;lt;br&amp;gt;  ANA_INITIAL        Analytical initial conditions.&amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;You should check that the CPP options displayed here agree with what you intended. For example, if you inadvertently specify more than one horizontal advection scheme option, ROMS will have chosen only one and reported that option here.&lt;br /&gt;
&lt;br /&gt;
:*The preamble in STDOUT continues with information about the space and time discretization: grid spacing, grid volume, Courant number (time step stability) and stiffness (related to s-coordinate accuracy).&lt;br /&gt;
&lt;br /&gt;
:*Then the model starts time stepping:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;NL ROMS/TOMS: started time-stepping: (Grid: 01 TimeSteps: 00000001 - 00000288)&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   STEP   Day HH:MM:SS  KINETIC_ENRG   POTEN_ENRG    TOTAL_ENRG    NET_VOLUME&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;      0     0 00:00:00  0.000000E+00  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;      DEF_HIS   - creating history file: ocean_his.nc&amp;lt;br&amp;gt;      WRT_HIS   - wrote history  fields (Index=1,1) into time record = 000000&amp;lt;br&amp;gt;      DEF_AVG   - creating average file: ocean_avg.nc&amp;lt;br&amp;gt;      DEF_DIAGS - creating diagnostics file: ocean_dia.nc&amp;lt;br&amp;gt;      1     0 00:05:00  3.268255E-13  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;      2     0 00:10:00  6.503587E-12  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;      3     0 00:15:00  4.592307E-11  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;This output indicates several things:&lt;br /&gt;
::*the run is programmed to run from time step 1 to 288&lt;br /&gt;
::*the run starts at time 00:00:0&lt;br /&gt;
::*netcdf output HISTORY, AVERAGES and DIAGNOSTICS files are created. Every time ROMS creates a new netcdf file, and writes to an existing file, it reports this to STDOUT&lt;br /&gt;
::*output is written to the HISTORY file&lt;br /&gt;
::*then global quantities related to the model KE, PE and domain volume are reported on each time step&lt;br /&gt;
&lt;br /&gt;
{{note}} In 99% of situations, &#039;&#039;getting started&#039;&#039; problems with model set-up and configuration can be diagnosed by carefully reading the STDOUT above. Things to look for are:&lt;br /&gt;
:*misconfigured CPP options (what you got is not what you thought you asked for)&lt;br /&gt;
:*parameter errors (e.g. you activated horizontal mixing but left the coefficient as zero)&lt;br /&gt;
:*misnamed output files (that&#039;s why the files from your last run got overwritten)&lt;br /&gt;
:*irrational choices of grid spacing or time step  &lt;br /&gt;
:*initial/boundary/forcing data being read from the wrong file, or not read at all (because you selected analytical conditions)&lt;br /&gt;
&lt;br /&gt;
At the conclusion of the run, ROMS reports information about run time:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Elapsed CPU time (seconds):&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; Thread #  0 CPU:     108.079&amp;lt;br&amp;gt; Total:               108.079&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Nonlinear model elapsed time profile:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  Initialization ...................................         0.016  ( 0.0148 %)&amp;lt;br&amp;gt;  Processing of input data .........................         0.028  ( 0.0259 %)&amp;lt;br&amp;gt;  Processing of output time averaged data ..........         4.312  ( 3.9899 %)&amp;lt;br&amp;gt;   ... &amp;lt;/div&amp;gt;&lt;br /&gt;
:*about the number of output records written to each file&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ROMS/TOMS - Output NetCDF summary for Grid 01: &amp;lt;br&amp;gt;             number of time records written in HISTORY file = 00000005 &amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;&lt;br /&gt;
:*and the analytical files included &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Analytical header files used:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     ROMS/Functionals/ana_btflux.h&amp;lt;br&amp;gt;     ROMS/Functionals/ana_grid.h&amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;If you used a modified analytical file in your &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_HEADER_DIR&amp;lt;/span&amp;gt; it will be reported here and is another thing you should check for consistency with your intentions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Netcdf file output===&lt;br /&gt;
&lt;br /&gt;
As reported above, ROMS created 4 output netcdf files when it ran. There are ocean_his.nc, ocean_avg.nc, ocean_dia.nc, and coean_rst.nc. These are, respectively:&lt;br /&gt;
:*history records or &#039;snapshots&#039; of the model state a selected time intervals&lt;br /&gt;
:*averages of the model state over selected intervals (not necessarily the same intervals as the history)&lt;br /&gt;
:*diagnostics of the model state, the precise contents of which are controlled by CPP options&lt;br /&gt;
:*a restart file with everything ROMS needs to restart a application. This is useful if your job crashes at some point and you want to recommence from a previous state without starting over. Typically the restart file is set to keep just 2 time records by continually over-writing the oldest as the run proceeds. This behaviour is controlled in ocean_upwelling.in. Also, when ROMS &amp;quot;blows up&amp;quot; it dumps the ocean state to a 3rd record in the restart file. &lt;br /&gt;
&lt;br /&gt;
You can browse the contents of netcdf files at the UNIX command line with the command ncdump, e.g. &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ncdump -h ocean_his.nc | more&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
Note the use of the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;-h&amp;quot;&amp;lt;/span&amp;gt; option. This restricts the output from ncdump to be just the header information, or metadata, in the netcdf file. Without the &amp;quot;-h&amp;quot; option you will get the entire contents of the file converted to ascii.  &lt;br /&gt;
&lt;br /&gt;
Things to notice when you ncdump the ocean_his.nc file are that it contains all the input parameters (time step, mixing coefficients, s-coordinate parameters, etc.) from ocean.in, the model grid coordinates (x, y, lon, lat, depth, Coriolis parameter, etc.) which may have been computed by the ANA_GRID option or read from an input grid netcdf file, in addition to the actual model output (ocean_time, zeta, u, v, temp, salt). &lt;br /&gt;
&lt;br /&gt;
There are netcdf &#039;&#039;&#039;global attributes&#039;&#039;&#039; that echo much of the information typed to STDOUT. This includes compiler, svn version, and project directory information, and all the CPP options. This is a valuable source of information when returning to a project and trying to figure out what you did!  The global attributes metadata show precisely which options were activated when creating the output in this netcdf file.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Changing the UPWELLING test case configuration==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Compile time changes: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Changes to options that must be set at compilation time are made to the upwelling.h file. These settings are interpreted during the C-PreProcessing step. &lt;br /&gt;
&lt;br /&gt;
To see what the present options are, edit the upwelling.h file:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;vi upwelling.h&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that the actual options active after this file in interpreted will be typed to STDOUT (the &amp;quot;logfile&amp;quot;) and also written to the output netcdf file in the global attributes.&lt;br /&gt;
&lt;br /&gt;
To see the all the options that might be set using C-PreProcessor directives, you can browse the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cppdefs.h&amp;lt;/span&amp;gt; file in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ROMS/Include&amp;lt;/span&amp;gt; directory underneath the &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; location set in your build.bash.  In this case:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd /srv/ckpt/roms/shared/src&amp;lt;br&amp;gt;more ROMS/Include/cppdefs.h&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The contents of this file are almost entirely comments and are provided to document the options available. For more information consult WikiROMS or the User Forum.&lt;br /&gt;
&lt;br /&gt;
At the very bottom of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;cppdefs.h&amp;lt;/span&amp;gt; you will see a short code segment that loads the actual application options from ROMS_HEADER. This variable is set by the &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; value in build.bash.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Run time changes: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Changes to options that are set at run time are made to the ocean_upwelling.in file. &lt;br /&gt;
&lt;br /&gt;
To see what the present options are, edit the ocean_upwelling.in file:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;vi ocean_upwelling.in&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Comments at the beginning of this file document the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;KEYWORD &amp;lt;nowiki&amp;gt;==&amp;lt;/nowiki&amp;gt; value&amp;lt;/span&amp;gt; syntax.&lt;br /&gt;
&lt;br /&gt;
Comments at the end of file provide brief summaries of what each parameter does. &lt;br /&gt;
&lt;br /&gt;
For more information consult WikiROMS or the Use Forum. &lt;br /&gt;
&lt;br /&gt;
Recall that the actual parameter values ROMS uses after reading this file will be typed to STDOUT (the &amp;quot;logfile&amp;quot;) and also written to the output netcdf files.&lt;br /&gt;
&lt;br /&gt;
==A &#039;&#039;Realistic&#039;&#039; model example: LaTTE==&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial assumes you have successfully compiled and run the UPWELLING example above. Key concepts you should be comfortable with before you proceed are:&lt;br /&gt;
:*you need a new directory where you will keep the files specific to the new application&lt;br /&gt;
:*customize &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; for the new application (copy the build.bash from &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling&amp;lt;/span&amp;gt; because it has all the correct compiler and library settings)&lt;br /&gt;
:*set &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; to point to the directory for the new application&lt;br /&gt;
:*set &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; to the correct name for the new application&lt;br /&gt;
:*if you wish to customize any of the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; files, copy just the ones you need into the new project directory &lt;br /&gt;
:*you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; need to make a copy the source code a new application&lt;br /&gt;
&lt;br /&gt;
With these concepts in mind, we proceed by configuring ROMS to run a realistic coastal ocean application that includes open boundaries on 3 sides, open boundary tides and climatological open boundary velocity and tracer (temperature and salinity) conditions, surface meteorological forcing, and initial conditions, all provided by input netcdf files. &lt;br /&gt;
&lt;br /&gt;
The example is called LaTTE_C because it simulates ocean conditions during the &#039;&#039;&#039;Lagrangian Transport and Transformation Experiment&#039;&#039;&#039; conducted on the New Jersey inner shelf in the Spring of 2006. The &#039;_C&#039; denotes a coarse resolution configuration suitable for this training exercise. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Create a latte_c project directory===&lt;br /&gt;
&lt;br /&gt;
We have placed the CPP options file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;latte_c.h&amp;lt;/span&amp;gt;, standand input &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_lattec.in&amp;lt;/span&amp;gt;, and a modified &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/srv/ckpt/roms/shared/latte_c/Forward&amp;lt;/span&amp;gt;. Make a new Project directory for this new application and copy these 3 files. &#039;&#039;&#039;DO NOT&#039;&#039;&#039; copy all the netcdf files from &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/srv/ckpt/roms/shared/latte_c/in&lt;br /&gt;
&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Edit build.bash===&lt;br /&gt;
&lt;br /&gt;
Set the correct entries for environment variables that define the user application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C&amp;lt;/span&amp;gt; causes &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; to look for the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;latte_c.h&amp;lt;/span&amp;gt; in order to set the CPP options&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c&amp;lt;/span&amp;gt; will instruct build.bash where to look for the latte_c.h file. &lt;br /&gt;
&lt;br /&gt;
Setting &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;MY_HEADER_DIR&amp;lt;/span&amp;gt; would instruct ROMS where to look for the user functional files &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; that over-ride default options. In this example, however, we don’t actually need to modify any of those functionals. This is typical of “realistic” applications where input grid, initial and boundary conditions are provided from data in input netcdf files. &lt;br /&gt;
&lt;br /&gt;
{{note}}The format of ROMS output files (history, averages and restart) is the same as ROMS input initial conditions and climatology. This means the output of previous runs can become the initial conditions, or 3-D climatology (for nudging) for new runs.  &lt;br /&gt;
&lt;br /&gt;
===Edit ocean_lattec.in===&lt;br /&gt;
&lt;br /&gt;
Open the ocean_lattec.in file in an editor. There are KEYWORDS that define the names of the input netcdf files for applications of this type:&lt;br /&gt;
:*GRDNAME is the grid file with coordinates, grid metrics (spacing), bathymetry, land/sea mask and Coriolis&lt;br /&gt;
:*ININAME is the initial conditions&lt;br /&gt;
:*BRYNAME are the open boundary sea leve, velocity and tracer conditions&lt;br /&gt;
:*FRCNAME are the tides, river source, and surface meteorological forcing files. Notice there are multiple files and the number of files ROMS is to read is set by the NFFILES parameter. On initialization, ROMS scans this list for each forcing variable it needs, using the first file to contain the necessary and &#039;&#039;shadowing&#039;&#039; any entry in subsequent files. Therefore if you want to re-run your model with a new set of wind data but happen to have other wind data in a files with all your other meteorology inputs, just put the new file at the beginning of the list.&lt;br /&gt;
&lt;br /&gt;
There are KEYWORDS that determine the output file names. These are:&lt;br /&gt;
:*RSTNAME, HISNAME, AVGNAME, DIANAME, STANAME, FLTNAME .... etc&lt;br /&gt;
&lt;br /&gt;
There are keywords that set how many time steps ROMS takes between writing output. These are:&lt;br /&gt;
:*NRST,NHIS,NAVG,NDIA,NSTA ...etc&lt;br /&gt;
&lt;br /&gt;
You can have ROMS write multiple records to each output file at these intervals, but periodically create a new file (to keep file sizes manageable) by setting the keywords:&lt;br /&gt;
:*NDEFHIS,NDEFAVG,NDEFDIA &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Compile with build.bash===&lt;br /&gt;
&lt;br /&gt;
If you have set the entries in build.bash correctly, you compile exactly as before by executing the script. &lt;br /&gt;
&lt;br /&gt;
Watch the output of the build process. You should see that instead of &amp;quot;Project/upwelling/Build&amp;quot; the compilation is now writing temporary files to &amp;quot;Project/latte_c/Build&amp;quot;.   This Build subdirectory is kept separate so you can be working on two projects at once and not confuse things.&lt;br /&gt;
&lt;br /&gt;
cd to the Build subdirectory and look at some of the files there, e.g.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~/Projects/latte_c/Build&amp;lt;br&amp;gt;more u3dbc_im.f90&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
This is the file that sets open boundary conditions on 3-d velocity. This is the Fortran90 file that is generated after the C-PreProcessor has done its job. If you find your model is doing things you don&#039;t expect, it can be instructive to view the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;.f90&amp;quot;&amp;lt;/span&amp;gt; file and corresponding &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;.F&amp;quot;&amp;lt;/span&amp;gt; (in MY_ROMS_SRC) to see whether the CPP options being processed are what you intended. If not, review your header file (in this case latte_c.h), and the list of CPP options typed to STDOUT. Don&#039;t edit the &amp;quot;f90&amp;quot; file directly because it gets over-written when you recompile.&lt;br /&gt;
&lt;br /&gt;
==Before we run latte_c==&lt;br /&gt;
&lt;br /&gt;
===Browse the latte_c.h options===&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;vi&amp;lt;/span&amp;gt; or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;more&amp;lt;/span&amp;gt; to browse the CPP options used in this &amp;quot;realistic&amp;quot; application. Things to notice that are different from &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; are:&lt;br /&gt;
&lt;br /&gt;
:*There are no &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ANA_INITIAL&amp;lt;/span&amp;gt; or &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ANA_WINDS&amp;lt;/span&amp;gt; options. If analytical initial and forcing options are not set with a &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#define&amp;lt;/span&amp;gt; then ROMS defaults to reading this information from input netcdf files.&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;WEST_, EAST_, SOUTH_&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NORTHERN_WALL&amp;lt;/span&amp;gt;. These options define the open boundary schemes. (The nomenclature of the compass points assume a grid oriented with west along &#039;&#039;i=1&#039;&#039; and south along &#039;&#039;j=1&#039;&#039;). The upwelling case had closed boundaries to the north and south, and periodic conditions east-west. The open boundary conditions here are set with the following options:&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;WEST_FSCHAPMAN,WEST_M2FLATHER&amp;lt;/span&amp;gt; etc. indicate “west” side free surface (FS) and depth-averaged velocity/momentum (M2)&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;WEST_M3GRADIENT,WEST_TGRADIENT&amp;lt;/span&amp;gt; “west side” 3-d velocity/momentum (M3) and all tracers. &lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;SSH_TIDES, UV_TIDES&amp;lt;/span&amp;gt; cause ROMS to add tidal variability in sea level and depth-average velocity using the harmonics read from the tides forcing file. See the wikiROMS entry on tides for more information. &lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt;ifdef SSH_TIDES&amp;lt;br&amp;gt;         #define ADD_FSOBC&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;This construct is a conditional test that causes prescribed mean or slowly varying sea surface height to be added to the tidal variability. &amp;lt;br&amp;gt; The further option &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ANA_FSOBC&amp;lt;/span&amp;gt; means the prescribed value is set by one of the analytical functional include files. If &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ANA_FSOBC&amp;lt;/span&amp;gt; is not defined, ROMS will look for the boundary sea level in a boundary conditions file. &lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;BULK_FLUXES&amp;lt;/span&amp;gt; In this application the surface meteorology forcing files give net shortwave and longwave radiation and the temperature, pressure and humidity conditions in the marine atmospheric boundary layer. These values are converted to air-sea fluxes of heat and momentum according to the Fairall et al. bulk formulae. &lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;GLS_MIXING&amp;lt;/span&amp;gt; This activates the Generalized Length Scale vertical turbulence closure parameterization of Umlauf and Buchard. Parameters in ocean_lattec.in determine details such as whether the closure method is actually k-epsilon, k-kl, etc. &lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;UV_PSOURCE, TS_PSOURCE&amp;lt;/span&amp;gt; These options activate point sources; in this case the inflow of the Hudson River.&lt;br /&gt;
&lt;br /&gt;
===The input netcdf files===&lt;br /&gt;
&lt;br /&gt;
Use ncdump to browse the contents of some of the input files, e.g.:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ncdump -h frc_lattec_wrf_Pair.nc | more&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We see that in this case the dimensions of the data match the dimensions of the ROMS grid:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;dimensions:&amp;lt;br&amp;gt;	time = UNLIMITED ; // (1560 currently)&amp;lt;br&amp;gt;	eta_rho = 82 ;&amp;lt;br&amp;gt;	xi_rho = 146 ;&amp;lt;/div&amp;gt;For &#039;&#039;&#039;time varying 2D surface forcing data only&#039;&#039;&#039; (e.g. meteorological data) ROMS will regrid during execution 2D data defined on simple 1D coordinates (vectors of lon and lat). In all other cases, the forcing data must have already been interpolated to the ROMS grid. &lt;br /&gt;
&lt;br /&gt;
ROMS associates the variable name of the forcing data with the appropriate internal variable by consulting the entries in varinfo.dat. Edit varinfo.dat and search for the string &amp;quot;Pair&amp;quot; &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;vi varinfo.dat&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;Pair&#039;                                             ! Input&amp;lt;br&amp;gt;  &#039;surface air pressure&#039;&amp;lt;br&amp;gt;  &#039;millibar&#039;                                       ! [millibar]&amp;lt;br&amp;gt;  &#039;Pair, scalar, series&#039;&amp;lt;br&amp;gt;  &#039;pair_time&#039;&amp;lt;br&amp;gt;  &#039;idPair&#039;&amp;lt;br&amp;gt;  &#039;r2dvar&#039;&amp;lt;br&amp;gt;  1.0d0&amp;lt;/div&amp;gt;This tells us 3 important things:&lt;br /&gt;
::*The name of the surface air pressure variable in the forcing netcdf is &amp;quot;Pair&amp;quot;. If your netcdf file was made with some other name you can change it here, e.g. &amp;quot;press_sfc&amp;quot; and you DO NOT need to change the netcdf file. This is acceptable because the variable is strictly an &#039;&#039;Input&#039;&#039; variable as noted by the comment &amp;lt;nowiki&amp;gt;(! Input)&amp;lt;/nowiki&amp;gt; at the end of the first line.&lt;br /&gt;
::*The units are assumed to be millibars. If your data are not in millibars you must either modify the data in the forcing netcdf file, or you may apply a scalar factor by editing the last line in the block above (presently set to 1.0d0).&lt;br /&gt;
::*The Pair data are defined at the times recorded by the variable named &amp;quot;pair_time&amp;quot; in the same forcing netcdf file. &#039;&#039;&#039;However&#039;&#039;&#039;, in the netcdf file itself this default can be reset by adding a &amp;quot;time&amp;quot; attribute to Pair. Return to viewing the netcdf file with ncdump to see this: &lt;br /&gt;
&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;variables:&amp;lt;br&amp;gt;	double Pair(time, eta_rho, xi_rho) ;&amp;lt;br&amp;gt;		Pair:long_name = &amp;quot;Surface air pressure&amp;quot; ;&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;		Pair:time = &amp;quot;ncep_time&amp;quot; ;&amp;lt;br&amp;gt;	double ncep_time(time) ;&amp;lt;br&amp;gt;		ncep_time:long_name = &amp;quot;forcing observations time&amp;quot; ;&amp;lt;br&amp;gt;		ncep_time:units = &amp;quot;days since 01-Jan-2006&amp;quot; ;&amp;lt;/div&amp;gt;The &amp;quot;time&amp;quot; attribute &amp;quot;Pair:time&amp;quot; indicates that variable &amp;quot;ncep_time&amp;quot; in this file contains the times at which the air pressure is reported. This overrides the value in varinfo.dat. The units attribute to ncep_time shows the CF convention of &amp;quot;days since 2006-01-01 00:00:0&amp;quot;. This time base must match in ALL your forcing netcdf files AND the initial conditions file. ROMS &#039;&#039;&#039;will not enforce consistency between different time conventions&#039;&#039;&#039; - that would be nice but for now it&#039;s on you. (Nor will the &#039;&#039;TIME_REF&#039;&#039; keyword in ocean.in adjust this time - it only sets the units attribute string for &#039;&#039;ocean_time&#039;&#039; in output netcdf files so you need to take care to set all these times be be consistent.) Nor will ROMS convert data units if they do not match what is assumed in varinfo.dat. The units attributes in this file are therefore purely metadata that document the file contents. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let&#039;s also examine the format of the open boundary conditions file:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ncdump -h lattec_bndy_uv2d_half.nc | more&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file has the same dimensions as the forcing files and output netcdf files. It contains parameters and variables that define the vertical s-coordinate and then the actual open boundary data such as:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;	float temp_east(time, s_rho, eta_rho) ;&amp;lt;br&amp;gt;		temp_east:long_name = &amp;quot;potential temperature east boundary condition&amp;quot; ;&amp;lt;br&amp;gt;		temp_east:units = &amp;quot;Celcius&amp;quot; ;&amp;lt;br&amp;gt;		temp_east:field = &amp;quot;temp_east, scalar, series&amp;quot; ;&amp;lt;br&amp;gt;		temp_east:time = &amp;quot;ocean_time&amp;quot; ;&amp;lt;/div&amp;gt;Notice that this variable has dimensions &amp;quot;&#039;&#039;(time, s_rho, eta_rho)&#039;&#039;&amp;quot; which describe a time varying 2D spatial structure in depth (s_rho) and horizontal coordinate (eta_rho). This &amp;quot;east&amp;quot; boundary is at constant &amp;quot;i&amp;quot; index (i=L) and therefore has no &amp;quot;xi&amp;quot; coordinate dimension. The data along the southern boundary  on the other hand,&#039;&#039; temp_south&#039;&#039;, has dimensions &amp;quot;&#039;&#039;(time, s_rho, xi_rho)&#039;&#039;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Run the latte_c example==&lt;br /&gt;
&lt;br /&gt;
Run the model exactly as you did in the UPWELLING example, but giving the new ocean_lattec.in as the input file.&lt;br /&gt;
&lt;br /&gt;
:*UNIX process info, run time, run TITLE &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./oceanG &amp;lt; ocean_lattec.in&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Stdout for Latte_C===&lt;br /&gt;
&lt;br /&gt;
The preamble to STDOUT (which you might redirect to a logfile with &amp;quot;&amp;gt;&amp;quot;) will resemble what you saw for UPWELLING. UNIX process information, compiler and svn version information, model input parameters read from the ocean.in file, and the list of active CPP options. &lt;br /&gt;
&lt;br /&gt;
The differences from UPWELLING come shortly before the model begins time stepping. ROMS reports the following information to help you check that you have configured the model correctly.&lt;br /&gt;
&lt;br /&gt;
:*Initial conditions&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;NLM: GET_STATE - Read state initial conditions,             t =    94 00:00:00&amp;lt;br&amp;gt;                   (File: lattec_ini_94.nc, Rec=0001, Index=1)&amp;lt;br&amp;gt;                - free-surface&amp;lt;br&amp;gt;                   (Min = -7.02081803E-01 Max =  0.00000000E+00)&amp;lt;/div&amp;gt;This shows initial time is 94 days, that initial conditions were read from record 1 of file lattec_ini_94.nc, and that the free surface data read ranged from -0.702 meters to 0 meters. Check: are data being read from the correct file for the correct record/time? If you see unrealistic values in the Min/Max range you may have special values (999?) in your input netcdf file, or a units error.&lt;br /&gt;
&lt;br /&gt;
:*Forcing data - static non time varying&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    GET_NGFLD   - tidal period&amp;lt;br&amp;gt;                   (Min =  4.30820452E+04 Max =  9.67260840E+04)&amp;lt;br&amp;gt;    GET_2DFLD   - tidal elevation amplitude&amp;lt;br&amp;gt;                   (Min =  0.00000000E+00 Max =  1.13473975E+00) &amp;lt;/div&amp;gt;The vector of tidal priods (in hours) are read and then 2D fields of tidal elevation and velocity. Again: check the file source and Min/Max range. &lt;br /&gt;
&lt;br /&gt;
:*Forcing data - time varying &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    GET_NGFLD   - river runoff mass transport,               t =    94 00:00:00&amp;lt;br&amp;gt;                   (Rec=0465, Index=2, File: roms_lattec_river.nc)&amp;lt;br&amp;gt;                   (Tmin=       -370.0000 Tmax=        267.0000)&amp;lt;br&amp;gt;                   (Min = -9.25473328E+02 Max = -1.69902756E+02)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;    GET_2DFLD   - surface u-wind component,                  t =    94 00:00:00&amp;lt;br&amp;gt;                   (Rec=0001, Index=1, File: frc_latte_wrf_Uwind.nc)&amp;lt;br&amp;gt;                   (Tmin=         94.0000 Tmax=        158.9583)&amp;lt;br&amp;gt;                   (Min = -8.73357999E-02 Max =  4.12751995E+00)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;    GET_NGFLD   - river runoff mass transport,               t =    95 00:00:00&amp;lt;br&amp;gt;                   (Rec=0466, Index=1, File: roms_lattec_river.nc)&amp;lt;br&amp;gt;                   (Tmin=       -370.0000 Tmax=        267.0000)&amp;lt;br&amp;gt;                   (Min = -9.88811890E+02 Max = -1.86609863E+02)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;    GET_2DFLD   - surface u-wind component,                  t =    94 00:59:59&amp;lt;br&amp;gt;                   (Rec=0002, Index=2, File: frc_latte_wrf_Uwind.nc)&amp;lt;br&amp;gt;                   (Tmin=         94.0000 Tmax=        158.9583)&amp;lt;br&amp;gt;                   (Min = -1.26112560E-01 Max =  2.46840043E+00)&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;Time varying forcing data will be read for times that bracket the current ROMS time. ROMS finds the correct times from the time variable in the files (which can be different for each variable - see the &amp;quot;time&amp;quot; attribute of the data). ROMS linearly interpolates the forcing data for these two records to the ROMS ocean_time on every model time step. The forcing data do not need to be regularly spaced in time, but the data do need to bracket ROMS initial time for the model to start. Again: check file names, data ranges and the times. Recall that if forcing data of the same name occurs in two forcing files in the list set by FRCNAME in ocean.in then ROMS takes the first data it finds. This will be the filename in the message above. &lt;br /&gt;
&lt;br /&gt;
:*The model then begins execution, reporting global energy diagnostics and any netcdf files it creates and writes to.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;   STEP   Day HH:MM:SS  KINETIC_ENRG   POTEN_ENRG    TOTAL_ENRG    NET_VOLUME&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;      0    94 00:00:00  9.698352E-03  2.011729E+02  2.011826E+02  1.421876E+12&amp;lt;br&amp;gt;      DEF_HIS   - creating history file: ./out/his_lattec.nc&amp;lt;br&amp;gt;      WRT_HIS   - wrote history  fields (Index=1,1) into time record = 0000001&amp;lt;br&amp;gt;      DEF_STATION - creating stations file: ./out/sta_ocean.nc&amp;lt;br&amp;gt;      1    94 00:06:00  8.873902E-03  2.011284E+02  2.011372E+02  1.422005E+12&amp;lt;br&amp;gt;      2    94 00:12:00  8.377911E-03  2.011090E+02  ...&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If in this initialization phase you do not see a report of values you expected ROMS to read, then ROMS &#039;&#039;&#039;did not&#039;&#039;&#039; read those data. This could be because you have an ANA option set that causes ROMS to get the information internally, or you may have set other CPP options such that there is no need to read the data. &#039;&#039;&#039;ROMS does not read data from netcdf files that it does not need to run.&#039;&#039;&#039; This information will help you diagnose misconfiguration or misunderstanding of the interaction of various CPP options.&lt;br /&gt;
&lt;br /&gt;
:*New forcing data when required&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      9    94 00:54:00  6.518542E-03  2.012623E+02  2.012688E+02  1.424463E+12&amp;lt;br&amp;gt;    GET_2DFLD   - surface u-wind component,                  t =    94 02:00:00&amp;lt;br&amp;gt;                   (Rec=0003, Index=1, File: frc_latte_wrf_Uwind.nc)&amp;lt;br&amp;gt;                   (Tmin=         94.0000 Tmax=        158.9583)&amp;lt;br&amp;gt;                   (Min = -4.55454426E-01 Max =  4.03826709E+00)&amp;lt;/div&amp;gt;When ROMS ocean_time reaches the end of the interval bracketed by any forcing data it holds in memory it will read the next set of values from the netcdf file and report this to STDOUT. If ROMS runs for a while and crashes shortly after reading some new forcing data check that you don&#039;t have corrupt data (from the Min/Max range). &lt;br /&gt;
&lt;br /&gt;
Eventually ROMS concludes and provides the same report it did in the UPWELLING example: elapsed time profile, the number of output records written, and the analytical functional used at compilation.&lt;br /&gt;
&lt;br /&gt;
==Plotting netcdf output with Matlab==&lt;br /&gt;
&lt;br /&gt;
===Basics of Matlab-Netcdf===&lt;br /&gt;
&lt;br /&gt;
Matlab version 2008b, which is installed on the UNSW Computer Lab machines, has support for reading netcdf files. It uses the built-in java tools to do this and the necessity to install a machine-dependent set of mexnc routines that was required in earlier versions of Matlab is no longer necessary.&lt;br /&gt;
&lt;br /&gt;
To ease the process of reading netcdf files into the Matlab workspace we have however installed a set of Matlab m-files called SNCTOOLS, written by John Evans at Mathworks. These tools should be in your Matlab path. You can verify this in Matlab by entering the command &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;which nc_varget&amp;lt;/span&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
nc_varget is the workhorse utility that reads subsets of data from a netcdf file.  Many of the Matlab tools that people distribute for working with ROMS output use SNCTOOLS functions, like nc_varget, to provide the interface to reading netcd files. You won&#039;t get much further in this part of the tutorial if you can&#039;t work nc_varget.&lt;br /&gt;
&lt;br /&gt;
Enter &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;help nc_varget&amp;lt;/span&amp;gt; to see the syntax. &lt;br /&gt;
&lt;br /&gt;
Note that nc_varget also supports reading from OPeNDAP/THREDDS data servers in addition to reading from local netcdf files.  &lt;br /&gt;
&lt;br /&gt;
===Using the roms_wilkin Matlab routines===&lt;br /&gt;
&lt;br /&gt;
ROMS output files are CF-Compliant netcdf files and therefore there are many software tools that allow you to browse, extract and plot output easily. There are also a number of collections of code written for Matlab that offer tools for plotting ROMS output.  What you choose to use is a matter of personal preference and the functionality offered. &lt;br /&gt;
&lt;br /&gt;
For this tutorial I show just a few tools out of the set of &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt; Matlab tools described in more detail at the tiddlywiki http://romsmatlab.tiddlyspot.com and also at [https://www.myroms.org/forum/viewtopic.php?f=23&amp;amp;t=916&amp;amp;start=0&amp;amp;hilit=roms_wilkin this thread] on the ROMS forum.&lt;br /&gt;
&lt;br /&gt;
On the UNSW Computer Lab machines you can add the directory of roms_wilkin Matlab routines to your Matlab path using the command: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;&amp;gt;&amp;gt; addpath(&#039;/student/0/a0000020/matlab/roms_wilkin&#039;,&#039;-end&#039;)&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;{z,s,i,j}view&amp;lt;/span&amp;gt; routines in roms_wilkin make simple plots directly from a ROMS file or OPeNDAP URL by slicing along coordinate directions.  Enter &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;help roms_zview&amp;lt;/span&amp;gt; to see the syntax. The functions all make use of the model coordinates loaded into a structure by function &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;roms_get_grid&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
In matlab, load this grid structure from any file containing the grid coordinates, such as an output file:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt; &amp;gt;&amp;gt; file = &#039;his_lattec.h&#039;;&amp;lt;br&amp;gt; &amp;gt;&amp;gt; g = roms_get_grid(file,file); &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then to make a plot at constant z = -3 metres of salinity from time record 2 of the file, overlaying green coloured velocity vectors at every 2nd grid point (scaled by a factor of 0.2 deg lon/at per m/s), enter:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt; &amp;gt;&amp;gt; roms_zview(file,&#039;salt&#039;,2,-3,g,3,0.2,&#039;g&#039;);&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; Not much has happened because we are only a few hours into the simulation so make it easier to the extent of the low salinity Hudson River water by changing the colorbar range and zooming in:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt; &amp;gt;&amp;gt; caxis([20 34]); colorbar &amp;lt;br&amp;gt; &amp;gt;&amp;gt; axis([-74.4 -73.2 39.9 41]) &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you specify time as a string instead of an index, &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;roms_zview&amp;lt;/span&amp;gt; will endeavour to parse the time/date information in the file and select the record nearest in time to plot. You can also give an optional output argument to roms_zview in which case it returns a structure with the data that went in to the plot.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt; &amp;gt;&amp;gt; thedata = roms_zview(file,&#039;salt&#039;,&#039;2006-04-05 02:00&#039;,-3,g,3,0.2,&#039;g&#039;);&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output structure &amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;thedata&amp;lt;/span&amp;gt; contains: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt;thedata = &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;       x: [82x146 double]&amp;lt;br&amp;gt;       y: [82x146 double]&amp;lt;br&amp;gt;    data: [82x146 double]&amp;lt;br&amp;gt;       t: 7.3277e+05&amp;lt;br&amp;gt;    tstr: &#039;05-Apr-2006 03:00:00&#039;&amp;lt;br&amp;gt;       u: [82x145 double]&amp;lt;br&amp;gt;       v: [81x146 double]&amp;lt;br&amp;gt;      ue: [726x1 double]&amp;lt;br&amp;gt;      vn: [726x1 double]&amp;lt;br&amp;gt;      xq: [726x1 double]&amp;lt;br&amp;gt;      yq: [726x1 double]&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;File&amp;quot; could equally well have been an OPeNDAP URL to ROMS output such as the example in the [https://www.myroms.org/forum/viewtopic.php?f=23&amp;amp;t=916&amp;amp;start=0&amp;amp;hilit=roms_wilkin ROMS Forum].&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;purple&amp;quot;&amp;gt; &amp;gt;&amp;gt; file = &amp;lt;nowiki&amp;gt;&#039;http://tashtego.marine.rutgers.edu:8080/thredds/dodsC/roms/cblast/2002-050/averages&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt; &amp;gt;&amp;gt; g = roms_get_grid(file,file); % the grid structure&amp;lt;br&amp;gt; &amp;gt;&amp;gt; % temperature slice for time step nearest to 20JUN2002, at 2-m &amp;lt;br&amp;gt; &amp;gt;&amp;gt; % depth, with every 3rd velocity vector over-plotted&amp;lt;br&amp;gt; &amp;gt;&amp;gt; roms_zview(file,&#039;temp&#039;,&#039;20-Jun-2002&#039;,-2,g,3,.1,&#039;k&#039;)&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3679</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3679"/>
		<updated>2009-04-09T02:21:39Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Make an init file (Run03) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original &#039;&#039;.h&#039;&#039; and &#039;&#039;.in&#039;&#039; files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the &#039;&#039;.h&#039;&#039; file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the &#039;&#039;.in&#039;&#039; file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to &#039;&#039;../out&#039;&#039;.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[w:ChangeTcline|Changing netCDF variables]].&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;and&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application and make some changes.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;We will only have one bed layer; it should be thick enough so that it does not erode completely in most of the model domain but, if it is too thick, changes in composition during the model run will be less apparent. We are going to specify only one non-cohesive sediment class, so we need only one value for each parameter.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;    SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;If we had several sediment classes, we would need more (NNS) numbers arrayed across after each variable.&lt;br /&gt;
* Make several changes to the .in file, starting with the title.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;       TITLE = Latte Tutorial, Run03&amp;lt;/div&amp;gt;Specify the number of sediment tracers...in this case, one non-cohesive size.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NCS =  0             ! Number of cohesive (mud) sediment tracers&amp;lt;br&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;/div&amp;gt;Turn on additional output to appear in the .his output file.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;...&amp;lt;br&amp;gt;Hout(idUbrs) == T                          ! bottom U-current stress&amp;lt;br&amp;gt;Hout(idVbrs) == T                          ! bottom V-current stress&amp;lt;br&amp;gt;Hout(idUbws) == T                          ! bottom U-wave stress&amp;lt;br&amp;gt;Hout(idVbws) == T                          ! bottom V-wave stress&amp;lt;br&amp;gt;Hout(idUbcs) == T                          ! bottom max wave-current U-stress&amp;lt;br&amp;gt;Hout(idVbcs) == T                          ! bottom max wave-current V-stress&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Hout(idUbot) == T                          ! bed wave orbital U-velocity&amp;lt;br&amp;gt;Hout(idVbot) == T                          ! bed wave orbital V-velocity&amp;lt;br&amp;gt;Hout(idUbur) == T                          ! bottom U-velocity above bed&amp;lt;br&amp;gt;Hout(idVbvr) == T                          ! bottom V-velocity above bed&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;Hout(idBott) == T T T T T T T T T F F F F F F F&amp;lt;br&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
* Add more information to the initialization file (discussed in the next section), so we will point to that in the .in file&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     ININAME == ../in/lattec_sed1_ini_94.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
* We want to add some waves, so a wave forcing file (see below) is added to the list and NFFILES is increased.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     NFFILES == 10                          ! number of forcing files&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     FRCNAME == ../in/frc_latte_wrf_Lwrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Pair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Qair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Swrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Tair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Uwind.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Vwind.nc \&amp;lt;br&amp;gt;               ../in/roms_lattec_river.nc \&amp;lt;br&amp;gt;                ../in/frc_tides_lattec.nc \&amp;lt;br&amp;gt;                ../in/frc_lattec_small_waves.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;* Also, rename the output files&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ! Output NetCDF file names, [1:Ngrids].&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     GSTNAME == ocean_gst.nc&amp;lt;br&amp;gt;     RSTNAME == ../out/lattec_rst_run03.nc&amp;lt;br&amp;gt;     HISNAME == ../out/lattec_his_run03.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Needs waves!==&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3678</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3678"/>
		<updated>2009-04-09T02:17:28Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Make an init file (Run03) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original &#039;&#039;.h&#039;&#039; and &#039;&#039;.in&#039;&#039; files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the &#039;&#039;.h&#039;&#039; file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the &#039;&#039;.in&#039;&#039; file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to &#039;&#039;../out&#039;&#039;.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[w:ChangeTcline|Changing netCDF variables]].&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;and&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application and make some changes.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;We will only have one bed layer; it should be thick enough so that it does not erode completely in most of the model domain but, if it is too thick, changes in composition during the model run will be less apparent. We are going to specify only one non-cohesive sediment class, so we need only one value for each parameter.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;    SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;If we had several sediment classes, we would need more (NNS) numbers arrayed across after each variable.&lt;br /&gt;
* Make several changes to the .in file, starting with the title.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;       TITLE = Latte Tutorial, Run03&amp;lt;/div&amp;gt;Specify the number of sediment tracers...in this case, one non-cohesive size.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NCS =  0             ! Number of cohesive (mud) sediment tracers&amp;lt;br&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;/div&amp;gt;Turn on additional output to appear in the .his output file.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;...&amp;lt;br&amp;gt;Hout(idUbrs) == T                          ! bottom U-current stress&amp;lt;br&amp;gt;Hout(idVbrs) == T                          ! bottom V-current stress&amp;lt;br&amp;gt;Hout(idUbws) == T                          ! bottom U-wave stress&amp;lt;br&amp;gt;Hout(idVbws) == T                          ! bottom V-wave stress&amp;lt;br&amp;gt;Hout(idUbcs) == T                          ! bottom max wave-current U-stress&amp;lt;br&amp;gt;Hout(idVbcs) == T                          ! bottom max wave-current V-stress&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Hout(idUbot) == T                          ! bed wave orbital U-velocity&amp;lt;br&amp;gt;Hout(idVbot) == T                          ! bed wave orbital V-velocity&amp;lt;br&amp;gt;Hout(idUbur) == T                          ! bottom U-velocity above bed&amp;lt;br&amp;gt;Hout(idVbvr) == T                          ! bottom V-velocity above bed&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;Hout(idBott) == T T T T T T T T T F F F F F F F&amp;lt;br&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
* Add more information to the initialization file (discussed in the next section), so we will point to that in the .in file&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     ININAME == ../in/lattec_sed1_ini_94.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
* We want to add some waves, so a wave forcing file (see below) is added to the list and NFFILES is increased.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     NFFILES == 10                          ! number of forcing files&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     FRCNAME == ../in/frc_latte_wrf_Lwrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Pair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Qair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Swrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Tair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Uwind.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Vwind.nc \&amp;lt;br&amp;gt;               ../in/roms_lattec_river.nc \&amp;lt;br&amp;gt;                ../in/frc_tides_lattec.nc \&amp;lt;br&amp;gt;                ../in/frc_lattec_small_waves.nc&amp;lt;br&amp;gt;&amp;lt;\div&amp;gt;* Also, rename the output files&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ! Output NetCDF file names, [1:Ngrids].&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     GSTNAME == ocean_gst.nc&amp;lt;br&amp;gt;     RSTNAME == ../out/lattec_rst_run03.nc&amp;lt;br&amp;gt;     HISNAME == ../out/lattec_his_run03.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3677</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3677"/>
		<updated>2009-04-09T02:07:59Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Change the advection scheme (Run01) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original &#039;&#039;.h&#039;&#039; and &#039;&#039;.in&#039;&#039; files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the &#039;&#039;.h&#039;&#039; file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the &#039;&#039;.in&#039;&#039; file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to &#039;&#039;../out&#039;&#039;.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[w:ChangeTcline|Changing netCDF variables]].&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;and&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application and make some changes.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
We are going to specify only one non-cohesive sediment class.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;    SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;If we had several sediment classes, we would need more (NNS) numbers arrayed across after each variable.&lt;br /&gt;
* Make several changes to the .in file, starting with the title.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;       TITLE = Latte Tutorial, Run03&amp;lt;/div&amp;gt;Specify the number of sediment tracers...in this case, one non-cohesive size.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NCS =  0             ! Number of cohesive (mud) sediment tracers&amp;lt;br&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;/div&amp;gt;Turn on additional output to appear in the .his output file.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;...&amp;lt;br&amp;gt;Hout(idUbrs) == T                          ! bottom U-current stress&amp;lt;br&amp;gt;Hout(idVbrs) == T                          ! bottom V-current stress&amp;lt;br&amp;gt;Hout(idUbws) == T                          ! bottom U-wave stress&amp;lt;br&amp;gt;Hout(idVbws) == T                          ! bottom V-wave stress&amp;lt;br&amp;gt;Hout(idUbcs) == T                          ! bottom max wave-current U-stress&amp;lt;br&amp;gt;Hout(idVbcs) == T                          ! bottom max wave-current V-stress&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Hout(idUbot) == T                          ! bed wave orbital U-velocity&amp;lt;br&amp;gt;Hout(idVbot) == T                          ! bed wave orbital V-velocity&amp;lt;br&amp;gt;Hout(idUbur) == T                          ! bottom U-velocity above bed&amp;lt;br&amp;gt;Hout(idVbvr) == T                          ! bottom V-velocity above bed&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;Hout(idBott) == T T T T T T T T T F F F F F F F&amp;lt;br&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
* We will need to add more information to the initialization file (discussed in the next section), so we will point to that in the .in file&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     ININAME == ../in/lattec_sed1_ini_94.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
* We want to add some waves, so a wave forcing file (see below) is added to the list and NFFILES is increased.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     NFFILES == 10                          ! number of forcing files&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     FRCNAME == ../in/frc_latte_wrf_Lwrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Pair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Qair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Swrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Tair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Uwind.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Vwind.nc \&amp;lt;br&amp;gt;                ../in/roms_lattec_river.nc \&amp;lt;br&amp;gt;                ../in/frc_tides_lattec.nc \&amp;lt;br&amp;gt;                ../in/frc_lattec_small_waves.nc&amp;lt;br&amp;gt;&amp;lt;\div&amp;gt;&lt;br /&gt;
* Also, rename the output files&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ! Output NetCDF file names, [1:Ngrids].&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     GSTNAME == ocean_gst.nc&amp;lt;br&amp;gt;     RSTNAME == ../out/lattec_rst_run03.nc&amp;lt;br&amp;gt;     HISNAME == ../out/lattec_his_run03.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3676</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3676"/>
		<updated>2009-04-09T02:07:34Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Change the advection scheme (Run01) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original &#039;&#039;.h&#039;&#039; and &#039;&#039;.in&#039;&#039; files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the &#039;&#039;.h&#039;&#039; file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the &#039;&#039;.in&#039;&#039; file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to &#039;&#039;../out&#039;&#039;.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[w:ChangeTcline|Changing netCDF variables]].&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;and&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application and make some changes.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
We are going to specify only one non-cohesive sediment class.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;    SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;If we had several sediment classes, we would need more (NNS) numbers arrayed across after each variable.&lt;br /&gt;
* Make several changes to the .in file, starting with the title.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;       TITLE = Latte Tutorial, Run03&amp;lt;/div&amp;gt;Specify the number of sediment tracers...in this case, one non-cohesive size.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NCS =  0             ! Number of cohesive (mud) sediment tracers&amp;lt;br&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;/div&amp;gt;Turn on additional output to appear in the .his output file.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;...&amp;lt;br&amp;gt;Hout(idUbrs) == T                          ! bottom U-current stress&amp;lt;br&amp;gt;Hout(idVbrs) == T                          ! bottom V-current stress&amp;lt;br&amp;gt;Hout(idUbws) == T                          ! bottom U-wave stress&amp;lt;br&amp;gt;Hout(idVbws) == T                          ! bottom V-wave stress&amp;lt;br&amp;gt;Hout(idUbcs) == T                          ! bottom max wave-current U-stress&amp;lt;br&amp;gt;Hout(idVbcs) == T                          ! bottom max wave-current V-stress&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Hout(idUbot) == T                          ! bed wave orbital U-velocity&amp;lt;br&amp;gt;Hout(idVbot) == T                          ! bed wave orbital V-velocity&amp;lt;br&amp;gt;Hout(idUbur) == T                          ! bottom U-velocity above bed&amp;lt;br&amp;gt;Hout(idVbvr) == T                          ! bottom V-velocity above bed&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;Hout(idBott) == T T T T T T T T T F F F F F F F&amp;lt;br&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
* We will need to add more information to the initialization file (discussed in the next section), so we will point to that in the .in file&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     ININAME == ../in/lattec_sed1_ini_94.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
* We want to add some waves, so a wave forcing file (see below) is added to the list and NFFILES is increased.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     NFFILES == 10                          ! number of forcing files&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     FRCNAME == ../in/frc_latte_wrf_Lwrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Pair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Qair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Swrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Tair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Uwind.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Vwind.nc \&amp;lt;br&amp;gt;                ../in/roms_lattec_river.nc \&amp;lt;br&amp;gt;                ../in/frc_tides_lattec.nc \&amp;lt;br&amp;gt;                ../in/frc_lattec_small_waves.nc&amp;lt;br&amp;gt;&amp;lt;\div&amp;gt;&lt;br /&gt;
* Also, rename the output files&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ! Output NetCDF file names, [1:Ngrids].&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     GSTNAME == ocean_gst.nc&amp;lt;br&amp;gt;     RSTNAME == ../out/lattec_rst_run03.nc&amp;lt;br&amp;gt;     HISNAME == ../out/lattec_his_run03.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3675</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3675"/>
		<updated>2009-04-09T02:06:48Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Build and run the Latte example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original &#039;&#039;.h&#039;&#039; and &#039;&#039;.in&#039;&#039; files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the &#039;&#039;.h&#039;&#039; file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the &#039;&#039;.in&#039;&#039; file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to &#039;&#039;../out&#039;&#039;.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[w:ChangeTcline|Changing netCDF variables]].&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application and make some changes.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
We are going to specify only one non-cohesive sediment class.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;    SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;If we had several sediment classes, we would need more (NNS) numbers arrayed across after each variable.&lt;br /&gt;
* Make several changes to the .in file, starting with the title.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;       TITLE = Latte Tutorial, Run03&amp;lt;/div&amp;gt;Specify the number of sediment tracers...in this case, one non-cohesive size.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NCS =  0             ! Number of cohesive (mud) sediment tracers&amp;lt;br&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;/div&amp;gt;Turn on additional output to appear in the .his output file.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;...&amp;lt;br&amp;gt;Hout(idUbrs) == T                          ! bottom U-current stress&amp;lt;br&amp;gt;Hout(idVbrs) == T                          ! bottom V-current stress&amp;lt;br&amp;gt;Hout(idUbws) == T                          ! bottom U-wave stress&amp;lt;br&amp;gt;Hout(idVbws) == T                          ! bottom V-wave stress&amp;lt;br&amp;gt;Hout(idUbcs) == T                          ! bottom max wave-current U-stress&amp;lt;br&amp;gt;Hout(idVbcs) == T                          ! bottom max wave-current V-stress&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Hout(idUbot) == T                          ! bed wave orbital U-velocity&amp;lt;br&amp;gt;Hout(idVbot) == T                          ! bed wave orbital V-velocity&amp;lt;br&amp;gt;Hout(idUbur) == T                          ! bottom U-velocity above bed&amp;lt;br&amp;gt;Hout(idVbvr) == T                          ! bottom V-velocity above bed&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;Hout(idBott) == T T T T T T T T T F F F F F F F&amp;lt;br&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
* We will need to add more information to the initialization file (discussed in the next section), so we will point to that in the .in file&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     ININAME == ../in/lattec_sed1_ini_94.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
* We want to add some waves, so a wave forcing file (see below) is added to the list and NFFILES is increased.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     NFFILES == 10                          ! number of forcing files&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     FRCNAME == ../in/frc_latte_wrf_Lwrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Pair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Qair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Swrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Tair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Uwind.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Vwind.nc \&amp;lt;br&amp;gt;                ../in/roms_lattec_river.nc \&amp;lt;br&amp;gt;                ../in/frc_tides_lattec.nc \&amp;lt;br&amp;gt;                ../in/frc_lattec_small_waves.nc&amp;lt;br&amp;gt;&amp;lt;\div&amp;gt;&lt;br /&gt;
* Also, rename the output files&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ! Output NetCDF file names, [1:Ngrids].&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     GSTNAME == ocean_gst.nc&amp;lt;br&amp;gt;     RSTNAME == ../out/lattec_rst_run03.nc&amp;lt;br&amp;gt;     HISNAME == ../out/lattec_his_run03.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3674</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3674"/>
		<updated>2009-04-08T18:27:40Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original .h and .in files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the .h file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the .in file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to ../out.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[ChangeTcline]Changing netCDF variables]&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application and make some changes.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
We are going to specify only one non-cohesive sediment class.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;    SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;If we had several sediment classes, we would need more (NNS) numbers arrayed across after each variable.&lt;br /&gt;
* Make several changes to the .in file, starting with the title.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;       TITLE = Latte Tutorial, Run03&amp;lt;/div&amp;gt;Specify the number of sediment tracers...in this case, one non-cohesive size.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NCS =  0             ! Number of cohesive (mud) sediment tracers&amp;lt;br&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;/div&amp;gt;Turn on additional output to appear in the .his output file.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;...&amp;lt;br&amp;gt;Hout(idUbrs) == T                          ! bottom U-current stress&amp;lt;br&amp;gt;Hout(idVbrs) == T                          ! bottom V-current stress&amp;lt;br&amp;gt;Hout(idUbws) == T                          ! bottom U-wave stress&amp;lt;br&amp;gt;Hout(idVbws) == T                          ! bottom V-wave stress&amp;lt;br&amp;gt;Hout(idUbcs) == T                          ! bottom max wave-current U-stress&amp;lt;br&amp;gt;Hout(idVbcs) == T                          ! bottom max wave-current V-stress&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Hout(idUbot) == T                          ! bed wave orbital U-velocity&amp;lt;br&amp;gt;Hout(idVbot) == T                          ! bed wave orbital V-velocity&amp;lt;br&amp;gt;Hout(idUbur) == T                          ! bottom U-velocity above bed&amp;lt;br&amp;gt;Hout(idVbvr) == T                          ! bottom V-velocity above bed&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;Hout(idBott) == T T T T T T T T T F F F F F F F&amp;lt;br&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
* We will need to add more information to the initialization file (discussed in the next section), so we will point to that in the .in file&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     ININAME == ../in/lattec_sed1_ini_94.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
* We want to add some waves, so a wave forcing file (see below) is added to the list and NFFILES is increased.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     NFFILES == 10                          ! number of forcing files&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     FRCNAME == ../in/frc_latte_wrf_Lwrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Pair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Qair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Swrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Tair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Uwind.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Vwind.nc \&amp;lt;br&amp;gt;                ../in/roms_lattec_river.nc \&amp;lt;br&amp;gt;                ../in/frc_tides_lattec.nc \&amp;lt;br&amp;gt;                ../in/frc_lattec_small_waves.nc&amp;lt;br&amp;gt;&amp;lt;\div&amp;gt;&lt;br /&gt;
* Also, rename the output files&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ! Output NetCDF file names, [1:Ngrids].&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     GSTNAME == ocean_gst.nc&amp;lt;br&amp;gt;     RSTNAME == ../out/lattec_rst_run03.nc&amp;lt;br&amp;gt;     HISNAME == ../out/lattec_his_run03.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3673</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3673"/>
		<updated>2009-04-08T18:22:27Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Make an init file (Run03) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original .h and .in files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the .h file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the .in file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to ../out.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[ChangeTcline]Changing netCDF variables]&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application and make some changes.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
We are going to specify only one non-cohesive sediment class.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;    SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;If we had several sediment classes, we would need more (NNS) numbers arrayed across after each variable.&lt;br /&gt;
* Make several changes to the .in file, starting with the title.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;       TITLE = Latte Tutorial, Run03&amp;lt;/div&amp;gt;Specify the number of sediment tracers...in this case, one non-cohesive size.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NCS =  0             ! Number of cohesive (mud) sediment tracers&amp;lt;br&amp;gt;&lt;br /&gt;
         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;/div&amp;gt;Turn on additional output to appear in the .his output file.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;...br&amp;gt;Hout(idUbrs) == T                          ! bottom U-current stress&amp;lt;br&amp;gt;Hout(idVbrs) == T                          ! bottom V-current stress&amp;lt;br&amp;gt;Hout(idUbws) == T                          ! bottom U-wave stress&amp;lt;br&amp;gt;Hout(idVbws) == T                          ! bottom V-wave stress&amp;lt;br&amp;gt;Hout(idUbcs) == T                          ! bottom max wave-current U-stress&amp;lt;br&amp;gt;Hout(idVbcs) == T                          ! bottom max wave-current V-stress&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Hout(idUbot) == T                          ! bed wave orbital U-velocity&amp;lt;br&amp;gt;Hout(idVbot) == T                          ! bed wave orbital V-velocity&amp;lt;br&amp;gt;Hout(idUbur) == T                          ! bottom U-velocity above bed&amp;lt;br&amp;gt;Hout(idVbvr) == T                          ! bottom V-velocity above bed&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;Hout(idBott) == T T T T T T T T T F F F F F F F&amp;lt;br&amp;gt;...&amp;lt;/div&amp;gt;&lt;br /&gt;
* We will need to add more information to the initialization file (discussed in the next section), so we will point to that in the .in file&lt;br /&gt;
     ININAME == ../in/lattec_sed1_ini_94.nc&lt;br /&gt;
* We want to add some waves, so a wave forcing file (see below) is added to the list and NFFILES is increased.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;     NFFILES == 10                          ! number of forcing files&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     FRCNAME == ../in/frc_latte_wrf_Lwrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Pair.nc \&amp;lt;br&amp;gt;&lt;br /&gt;
                ../in/frc_latte_wrf_Qair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Swrf.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Tair.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Uwind.nc \&amp;lt;br&amp;gt;                ../in/frc_latte_wrf_Vwind.nc \&amp;lt;br&amp;gt;                ../in/roms_lattec_river.nc \&amp;lt;br&amp;gt;                ../in/frc_tides_lattec.nc \&amp;lt;br&amp;gt;                ../in/frc_lattec_small_waves.nc&amp;lt;br&amp;gt;&amp;lt;\div&amp;gt;&lt;br /&gt;
* Also, rename the output files&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ! Output NetCDF file names, [1:Ngrids].&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     GSTNAME == ocean_gst.nc&amp;lt;br&amp;gt;     RSTNAME == ../out/lattec_rst_run03.nc&amp;lt;br&amp;gt;     HISNAME == ../out/lattec_his_run03.nc&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3672</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3672"/>
		<updated>2009-04-08T17:57:49Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Make an init file (Run03) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original .h and .in files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the .h file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the .in file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to ../out.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[ChangeTcline]Changing netCDF variables]&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
* Change some of the parameters in sediment_lattec.in. We are going to specify only one non-cohesive sediment class.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt;SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3671</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3671"/>
		<updated>2009-04-08T17:56:46Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Make an init file (Run03) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original .h and .in files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the .h file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the .in file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to ../out.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[ChangeTcline]Changing netCDF variables]&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
* Change some of the parameters in sediment_lattec.in. We are going to specify only one non-cohesive sediment class.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt; SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3670</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3670"/>
		<updated>2009-04-08T17:56:04Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Make an init file (Run03) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original .h and .in files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the .h file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the .in file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to ../out.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[ChangeTcline]Changing netCDF variables]&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
* Copy the .h and .in files from Run01 to a directory called ../Latte/Run03&lt;br /&gt;
* Edit the .h file to activate sediment and the SSW version of the bottom boundary layer calculations.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* stuff needed for sediment */&amp;lt;br&amp;gt;#define SSW_BBL              /* Sherwood et al. BBL closure                    */&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT       /* Computing bottom roughness internally          */&amp;lt;br&amp;gt;# undef SSW_LOGINT           /* Logarithmic interpolation of (Ur,Vr)           */&amp;lt;br&amp;gt;# define SSW_CALC_UB         /* Computing bottom orbital velocity internally   */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient                 */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO           /* Biogenic bedform roughness from ripples        */&amp;lt;br&amp;gt;# undef  SSW_ZOBL            /* Bedload roughness for ripples                  */&amp;lt;br&amp;gt;# undef  SSW_ZORIP           /* Bedform roughness from ripples                 */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;br /&gt;
* Copy a sediment.in file from an example application.&lt;br /&gt;
cp ~/src/ROMS/External/sediment_sed_test1.in ./Run03/sediment_lattec.in&lt;br /&gt;
* Change some of the parameters in sediment_lattec.in. We are going to specify only one non-cohesive sediment class.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;    NEWLAYER_THICK == 0.01d0&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;! Non-cohesive Sediment Parameters, [1:NNS,1:Ngrids] values expected.&amp;lt;br&amp;gt;!------------------------------------------------------------------------------&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Median sediment grain diameter (mm).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SD50 == .150d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;!Sediment concentration (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_CSED == 0.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Sediment grain density (kg/m3).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_SRHO == 2650.0d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
! Particle settling velocity (mm/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   SAND_WSED == .20d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Surface erosion rate (kg/m2/s).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_ERATE == 5.0d-4&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
! Critical shear for erosion and deposition (N/m2).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; SAND_TAU_CE == 0.1d0&amp;lt;br&amp;gt; SAND_TAU_CD == 0.1d0&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;! Porosity (nondimensional: 0.0-1.0):  Vwater/(Vwater+Vsed).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  SAND_POROS == 0.5d0&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3669</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3669"/>
		<updated>2009-04-08T17:00:47Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Simplest possible case (Run 02) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original .h and .in files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the .h file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the .in file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to ../out.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[ChangeTcline]Changing netCDF variables]&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps. For now, skip to Run 03 and when this is working correctly, we&#039;ll describe it here.&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3668</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3668"/>
		<updated>2009-04-08T16:14:34Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Build and run the Latte example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original .h and .in files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you can either #UNDEF STATIONS in the .h file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the .in file to point to a valid stations file. Unless you change the path of the output file, it will be end up in stations.nc in the run directory, while other output goes to ../out.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[ChangeTcline]Changing netCDF variables]&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3667</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3667"/>
		<updated>2009-04-07T19:27:54Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Build and run the Latte example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original .h and .in files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
** If you get a complaint about a missing &#039;&#039;stations&#039;&#039; file, you ca either #UNDEF STATIONS in the .h file (and rebuild), or copy a valid stations file to the local (Run01) directory, or change the filename mentioned in the .in file to point to a valid stations file.&lt;br /&gt;
** If you get an error that T_cline or S_cline don&#039;t match the input file, follow the instructions here [[ChangeTcline]Changing netCDF variables]&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3666</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3666"/>
		<updated>2009-04-07T18:20:29Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Build and run the Latte example==&lt;br /&gt;
* Copy of the original .h and .in files into the ../Latte/Run01 directory.&lt;br /&gt;
* Try to build and run the Latte case.&lt;br /&gt;
** If you can use the &#039;&#039;&#039;build.bash&#039;&#039;&#039; script, set the correct entries for environment variables:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION=LATTE_C causes build.bash to look for the file latte_c.h in order to set the CPP options&amp;lt;br&amp;gt;MY_PROJECT_DIR=${HOME}/Projects/latte_c will instruct build.bash where to look for the latte_c.h file.&amp;lt;/div&amp;gt;&lt;br /&gt;
** No one has figured out how to use build.bash with the Intel (ifort) compiler under Cygwin on a Windows machine. If this is your set up, then edit the makefile in the src directory so that it finds and builds the application.&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ROMS_APPLICATION ?= LATTE_C&amp;lt;br&amp;gt;MY_HEADER_DIR ?= /cygdrive/d/crs/proj/CSTMS_Tutorial/Latte/run01&amp;lt;/div&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
* You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
* Modify the .h file &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3665</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3665"/>
		<updated>2009-04-07T17:40:42Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Set up and test the LATTE case==&lt;br /&gt;
These instructions differ a little from the Monday tutorial because we assume you are working on your own computer.&lt;br /&gt;
* If you have not already done so, check out a version of the code. We&#039;ll assume you keep it in a directory called ~/src. If you want to get the &#039;&#039;exact&#039;&#039; version used in this tutorial, then cd to the parent directory for your source code and then:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir src&amp;lt;br&amp;gt;svn checkout -r 342 --username bruce https://www.myroms.org/svn/src/trunk src&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &#039;&#039;&#039;bruce&#039;&#039;&#039; with your ROMS user name. Omitting the &#039;&#039;&#039;-r 342&#039;&#039;&#039; will get you the most current (HEAD) version of the code.&lt;br /&gt;
&lt;br /&gt;
* Make sure you can compile and run UPWELLING.&lt;br /&gt;
&lt;br /&gt;
* Make a directory structure that looks like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;../Latte&amp;lt;br&amp;gt;../Latte/original&amp;lt;br&amp;gt;../Latte/in&amp;lt;br&amp;gt;../Latte/out&amp;lt;br&amp;gt;../Latte/run01&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will add a few more directories later. Files for this case are at http://coast-enviro.er.usgs.gov/models/Latte/. Use your browser to copy the contents of &#039;&#039;&#039;original&#039;&#039;&#039; and &#039;&#039;&#039;in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Copy the Latte case to your local directory==&lt;br /&gt;
For this tutorial, we will work with a directory structure that looks like:&lt;br /&gt;
&lt;br /&gt;
./Lattec&amp;lt;br&amp;gt;./Latte/in&amp;lt;br&amp;gt;./Latte/out&amp;lt;br&amp;gt;./Latte/run01&lt;br /&gt;
etc for additional cases.&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
Start with a copy of the .h and .in files.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Latte/run01/latte_c.h run02&amp;lt;br&amp;gt;Latte/run01/ocean_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3664</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3664"/>
		<updated>2009-04-06T18:10:40Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April 2009, Chris Sherwood presented a tutorial for new ROMS users interested in sediments. The tutorial was held at the Sydney Institute of Marine Sciences as part of the ROMS/TOMS Asia-Pacific Workshop. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;UNDER CONSTRUCTION&#039;&#039; - I&#039;ll post a note on the forum when this provides a consistent, step-by-step approach. Until then, user beware.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Copy the Latte case to your local directory==&lt;br /&gt;
For this tutorial, we will work with a directory structure that looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./Lattec&amp;lt;br&amp;gt;./Latte/in&amp;lt;br&amp;gt;./Latte/out&amp;lt;br&amp;gt;./Latte/run01&amp;lt;br&amp;gt;./Latte/run02&amp;lt;/div&amp;gt;&lt;br /&gt;
etc for additional cases.&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
Start with a copy of the .h and .in files.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Latte/run01/latte_c.h run02&amp;lt;br&amp;gt;Latte/run01/ocean_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=sediment_cppdefs.h&amp;diff=3663</id>
		<title>sediment cppdefs.h</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=sediment_cppdefs.h&amp;diff=3663"/>
		<updated>2009-04-06T18:04:49Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* sediment CPPDEFS */&amp;lt;br&amp;gt;#define SEDIMENT&amp;lt;br&amp;gt;#ifdef SEDIMENT /* Chose one or all of these processes: */&amp;lt;br&amp;gt;# define SUSPLOAD&amp;lt;br&amp;gt;# undef  BEDLOAD_SOULSBY /* or BEDLOAD_MPM */&amp;lt;br&amp;gt;# undef  SED_MORPH&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#if defined SEDIMENT || defined SG_BBL || defined MB_BBL || defined SSW_BBL&amp;lt;br&amp;gt;# define ANA_SEDIMENT /* sediment initialization from Fortran routine */&amp;lt;br&amp;gt;# undef ANA_SEDIMENT  /* will require initialziation file */&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#if defined MB_BBL || defined SG_BBL || defined SSW_BBL /* will need wave input */&amp;lt;br&amp;gt;# define ANA_WWAVE /* or provide SWAN input */&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#define SSW_BBL /* or SG_BBL or MB_BBL */&amp;lt;br&amp;gt;#ifdef SG_BBL&amp;lt;br&amp;gt;# define SG_CALC_ZNOT&amp;lt;br&amp;gt;# undef  SG_LOGINT&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#ifdef MB_BBL&amp;lt;br&amp;gt;# define MB_CALC_ZNOT&amp;lt;br&amp;gt;# undef  MB_Z0BIO&amp;lt;br&amp;gt;# undef  MB_Z0BL&amp;lt;br&amp;gt;# undef  MB_Z0RIP&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT /* Compute bottom roughness internally */&amp;lt;br&amp;gt;# undef SSW_LOGINT     /* Logarithmic interpolation of (Ur,Vr) */&amp;lt;br&amp;gt;# define SSW_CALC_UB   /* Computing bottom orbital velocity internally */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO     /* Biogenic bedform roughness from ripples */&amp;lt;br&amp;gt;# undef  SSW_ZOBL      /* Bedload roughness for ripples */&amp;lt;br&amp;gt;# undef  SSW_ZORIP     /* Bedform roughness from ripples */&amp;lt;br&amp;gt;#endif&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=sediment_cppdefs.h&amp;diff=3662</id>
		<title>sediment cppdefs.h</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=sediment_cppdefs.h&amp;diff=3662"/>
		<updated>2009-04-06T18:04:09Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* sediment CPPDEFS */&amp;lt;br&amp;gt;#define SEDIMENT&amp;lt;br&amp;gt;#ifdef SEDIMENT /* Chose one or all of these processes: */&amp;lt;br&amp;gt;# define SUSPLOAD&amp;lt;br&amp;gt;# undef  BEDLOAD_SOULSBY /* or BEDLOAD_MPM */&amp;lt;br&amp;gt;# undef  SED_MORPH&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#if defined SEDIMENT || defined SG_BBL || defined MB_BBL || defined SSW_BBL&amp;lt;br&amp;gt;# define ANA_SEDIMENT /* sediment initialization from Fortran routine */&amp;lt;br&amp;gt;# undef ANA_SEDIMENT  /* will require initialziation file */&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#if defined MB_BBL || defined SG_BBL || defined SSW_BBL /* will need wave input */&amp;lt;br&amp;gt;# define ANA_WWAVE /* or provide SWAN input */&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#define SSW_BBL /* or SG_BBL or MB_BBL */&amp;lt;br&amp;gt;#ifdef SG_BBL&amp;lt;br&amp;gt;# define SG_CALC_ZNOT&amp;lt;br&amp;gt;# undef  SG_LOGINT&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#ifdef MB_BBL&amp;lt;br&amp;gt;# define MB_CALC_ZNOT&amp;lt;br&amp;gt;# undef  MB_Z0BIO&amp;lt;br&amp;gt;# undef  MB_Z0BL&amp;lt;br&amp;gt;# undef  MB_Z0RIP&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT /* Compute bottom roughness internally */&amp;lt;br&amp;gt;# undef SSW_LOGINT     /* Logarithmic interpolation of (Ur,Vr) */&amp;lt;br&amp;gt;# define SSW_CALC_UB   /* Computing bottom orbital velocity internally */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO     /* Biogenic bedform roughness from ripples */&amp;lt;br&amp;gt;# undef  SSW_ZOBL      /* Bedload roughness for ripples */&amp;lt;br&amp;gt;# undef  SSW_ZORIP     /* Bedform roughness from ripples */&amp;lt;br&amp;gt;# endif&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=sediment_cppdefs.h&amp;diff=3661</id>
		<title>sediment cppdefs.h</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=sediment_cppdefs.h&amp;diff=3661"/>
		<updated>2009-04-06T18:03:06Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: New page: &amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* sediment CPPDEFS */&amp;lt;br&amp;gt;#define SEDIMENT&amp;lt;br&amp;gt;#ifdef SEDIMENT /* Chose one or all of these processes: */&amp;lt;br&amp;gt;# define SUSPLOAD&amp;lt;br&amp;gt;# undef  BEDLOAD_SOULSBY /* or BEDLOAD_MPM...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;/* sediment CPPDEFS */&amp;lt;br&amp;gt;#define SEDIMENT&amp;lt;br&amp;gt;#ifdef SEDIMENT /* Chose one or all of these processes: */&amp;lt;br&amp;gt;# define SUSPLOAD&amp;lt;br&amp;gt;# undef  BEDLOAD_SOULSBY /* or BEDLOAD_MPM */&amp;lt;br&amp;gt;# undef  SED_MORPH&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#if defined SEDIMENT || defined SG_BBL || defined MB_BBL || defined SSW_BBL&amp;lt;br&amp;gt;# define ANA_SEDIMENT /* sediment initialization from Fortran routine */&amp;lt;br&amp;gt;# undef ANA_SEDIMENT  /* will require initialziation file */&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#if defined MB_BBL || defined SG_BBL || defined SSW_BBL /* will need wave input */&amp;lt;br&amp;gt;# define ANA_WWAVE /* or provide SWAN input */&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#define SSW_BBL /* or SG_BBL or MB_BBL */&amp;lt;br&amp;gt;#ifdef SG_BBL&amp;lt;br&amp;gt;# define SG_CALC_ZNOT&amp;lt;br&amp;gt;# undef  SG_LOGINT&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#ifdef MB_BBL&amp;lt;br&amp;gt;# define MB_CALC_ZNOT&amp;lt;br&amp;gt;# undef  MB_Z0BIO&amp;lt;br&amp;gt;# undef  MB_Z0BL&amp;lt;br&amp;gt;# undef  MB_Z0RIP&amp;lt;br&amp;gt;#endif&amp;lt;br&amp;gt;#ifdef SSW_BBL&amp;lt;br&amp;gt;# define SSW_CALC_ZNOT /* Compute bottom roughness internally */&amp;lt;br&amp;gt;# undef SSW_LOGINT     /* Logarithmic interpolation of (Ur,Vr) */&amp;lt;br&amp;gt;# define SSW_CALC_UB   /* Computing bottom orbital velocity internally */&amp;lt;br&amp;gt;# undef  SSW_FORM_DRAG_COR   /* Activate form drag coefficient */&amp;lt;br&amp;gt;# undef  SSW_ZOBIO     /* Biogenic bedform roughness from ripples */&amp;lt;br&amp;gt;# undef  SSW_ZOBL      /* Bedload roughness for ripples */&amp;lt;br&amp;gt;# undef  SSW_ZORIP     /* Bedform roughness from ripples */&amp;lt;br&amp;gt;&lt;br /&gt;
# endif&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3660</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3660"/>
		<updated>2009-04-06T17:54:56Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* External differences */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Copy the Latte case to your local directory==&lt;br /&gt;
For this tutorial, we will work with a directory structure that looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./Lattec&amp;lt;br&amp;gt;./Latte/in&amp;lt;br&amp;gt;./Latte/out&amp;lt;br&amp;gt;./Latte/run01&amp;lt;br&amp;gt;./Latte/run02&amp;lt;/div&amp;gt;&lt;br /&gt;
etc for additional cases.&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
Start with a copy of the .h and .in files.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Latte/run01/latte_c.h run02&amp;lt;br&amp;gt;Latte/run01/ocean_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file. A summary of sediment-related cppdefs is listed in [[sediment_cppdefs.h]]&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3659</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3659"/>
		<updated>2009-04-06T17:51:39Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Why so boring? Its the waves! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Copy the Latte case to your local directory==&lt;br /&gt;
For this tutorial, we will work with a directory structure that looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./Lattec&amp;lt;br&amp;gt;./Latte/in&amp;lt;br&amp;gt;./Latte/out&amp;lt;br&amp;gt;./Latte/run01&amp;lt;br&amp;gt;./Latte/run02&amp;lt;/div&amp;gt;&lt;br /&gt;
etc for additional cases.&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
Start with a copy of the .h and .in files.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Latte/run01/latte_c.h run02&amp;lt;br&amp;gt;Latte/run01/ocean_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
In most coastal sediment-transport applications, waves are critical. Waves are often responsible for mobilizing sediment when tidal or wind-generated currents are too weak...but currents are needed to mix sediment out of the wave boundary layer and transport it. Sometimes a time series of wave input is available, and can be passed to ROMS directly as a forcing file. To make use of the wave input, one of the three available wave-current bottom boundary layer routines must be enabled. These are [[SSW_BBL]], [[MB_BBL]], and [[SG_BBL]] (see https://www.myroms.org/wiki/index.php/Sediment_Model#Bottom_Stress).&lt;br /&gt;
&lt;br /&gt;
Wave input can be as simple as a single time series of wave height, period, and direction that applies to the whole model domain (handy for test cases and simplified models), or as complicated as calculated near-bottom orbital velocities and associated periods and directions that vary with time and space.&lt;br /&gt;
In the first instance, the near bottom wave-orbital velocities are calculated from &#039;&#039;H_s&#039;&#039; and &#039;&#039;T&#039;&#039; using linear wave theory, using #define SSW_CALC_UB&lt;br /&gt;
&lt;br /&gt;
Note that the linear wave calculations made using #define SSW_CALC_UB are seldom exactly correct (see, for example, Soulsby, 1997). A better representation of near-bottom wave-orbital velocities can be made from measured wave spectra, or from Hs and T with a parameterized spectra. Both methods are discussed, and Matlab procedure are provided by Wiberg and Sherwood (2008). These orbital velocities are e&lt;br /&gt;
&lt;br /&gt;
==Make and use a simple wave forcing file (Run04)==&lt;br /&gt;
In this section, we will use buoy data to make a simple wave forcing file.&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3658</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3658"/>
		<updated>2009-04-06T17:23:43Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Why so boring? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Copy the Latte case to your local directory==&lt;br /&gt;
For this tutorial, we will work with a directory structure that looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./Lattec&amp;lt;br&amp;gt;./Latte/in&amp;lt;br&amp;gt;./Latte/out&amp;lt;br&amp;gt;./Latte/run01&amp;lt;br&amp;gt;./Latte/run02&amp;lt;/div&amp;gt;&lt;br /&gt;
etc for additional cases.&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
Start with a copy of the .h and .in files.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Latte/run01/latte_c.h run02&amp;lt;br&amp;gt;Latte/run01/ocean_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Make an init file (Run03)==&lt;br /&gt;
&lt;br /&gt;
===Why so boring? Its the waves!===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3657</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3657"/>
		<updated>2009-04-06T17:21:45Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Change the advection scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Copy the Latte case to your local directory==&lt;br /&gt;
For this tutorial, we will work with a directory structure that looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./Lattec&amp;lt;br&amp;gt;./Latte/in&amp;lt;br&amp;gt;./Latte/out&amp;lt;br&amp;gt;./Latte/run01&amp;lt;br&amp;gt;./Latte/run02&amp;lt;/div&amp;gt;&lt;br /&gt;
etc for additional cases.&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme (Run01)==&lt;br /&gt;
Start with a copy of the .h and .in files.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Latte/run01/latte_c.h run02&amp;lt;br&amp;gt;Latte/run01/ocean_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. This will be the only change, so recompile and make sure it works again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3656</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3656"/>
		<updated>2009-04-06T16:48:01Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* A case study in troubleshooting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. It is a good idea to recompile and test again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==Simplest possible case (Run 02)==&lt;br /&gt;
It should be possible to turn sediment on by making the following simple changes. However, this did not work for the Latte case, and you will have take the additional steps (see Run 03).&lt;br /&gt;
&lt;br /&gt;
In the latte_c.h file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;br&amp;gt;#define sediment&amp;lt;br&amp;gt;#define ana_sediment&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ocean_lattec.in file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;         NNS =  1             ! Number of non-cohesive (sand) sediment tracers&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;     SPARNAM =  ./sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best way to get a template for the sediment input file is to copy one from the source code to your local directory.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/yoursourcedir/ROMS/External/sediment_sed_test1.in ./run02/sediment_lattec.in&amp;lt;/div&amp;gt;&lt;br /&gt;
then edit to suit.&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3655</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3655"/>
		<updated>2009-04-06T15:50:36Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Turn on sediment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. It is a good idea to recompile and test again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
== Turn on sediment ==&lt;br /&gt;
What is different about sediment?&lt;br /&gt;
=== External differences ===&lt;br /&gt;
The external differences are required changes in user input and output. They include:&lt;br /&gt;
* Switches in .h file&lt;br /&gt;
* Changes in .in file&lt;br /&gt;
* Need sediment.in file&lt;br /&gt;
* Need to modify (a copy of) ana_sediment.F&lt;br /&gt;
* New output in his.nc file&lt;br /&gt;
&lt;br /&gt;
Many applications also need&lt;br /&gt;
* More info in init.nc file (initial bed)&lt;br /&gt;
* Wave input&lt;br /&gt;
* River sediment input&lt;br /&gt;
* Boundary conditions&lt;br /&gt;
=== Internal differences ===&lt;br /&gt;
Components of the sediment model include:&lt;br /&gt;
* TS_MPDATA – Positive-definite advection scheme&lt;br /&gt;
* Wave model (as input via a forcing file, or directly coupled)&lt;br /&gt;
* Wave-current combined bottom stresses&lt;br /&gt;
* Erosion / deposition / bed model (sand)&lt;br /&gt;
* Settling&lt;br /&gt;
* Bedload transport and flux divergence&lt;br /&gt;
* Morphological evolution&lt;br /&gt;
* Wetting and drying&lt;br /&gt;
* Cohesive and mixed sediments&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3654</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3654"/>
		<updated>2009-04-06T15:39:00Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Change the advection scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?). [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection switches. It is a good idea to recompile and test again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3653</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3653"/>
		<updated>2009-04-06T15:36:54Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Change the advection scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
You need to use a &amp;quot;positive-definite&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?. [[TS_MPDATA]] is a Multidimensional Positive Definite Advection Transport Algorithm method based on the work of[[Bibliography#Smolark | Piotr Smolarkiewicz]]. See the [[https://www.myroms.org/wiki/index.php/cppdefs.h#Options_associated_with_momentum_equations]wiki discussion.] &lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#define TS_MPDATA&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection swithches.&lt;br /&gt;
&lt;br /&gt;
It is a good idea to recompile and test again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3652</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3652"/>
		<updated>2009-04-06T14:51:19Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Change the advection scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
You need to use a &amp;quot;positive-definate&amp;quot; advection scheme with sediment. The small over- and undershoots that occur with many advection algorithms will cause mass-conservation problems with sediment. (What, for example, is deposition of negative sediment concentrations? Erosion?)&lt;br /&gt;
&lt;br /&gt;
Anyway, make sure you &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#define MP_DATA&amp;lt;/div&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#undef TS_U3HADVECTION&amp;lt;br&amp;gt;#undef TS_SVADVECTION&amp;lt;/div&amp;gt;&lt;br /&gt;
(or remove) any other horizontal advection swithches.&lt;br /&gt;
&lt;br /&gt;
It is a good idea to recompile and test again after this small change...if something goes awry, it is good not to have accumulated lots of changes.&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tutorials&amp;diff=3649</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tutorials&amp;diff=3649"/>
		<updated>2009-04-01T00:21:28Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Sediment Tutorials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS Tutorials&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This page is for tutorials on using ROMS and other related software. If you create a tutorial please create a link to that tutorial in the list below.&lt;br /&gt;
&lt;br /&gt;
==Installing ROMS==&lt;br /&gt;
:*[[ROMS_Cygwin|Installing ROMS in Windows XP/Vista (via Cygwin)]]&lt;br /&gt;
:*[[ROMS_UNSW2008|Installing and Running ROMS for First Time Users. Tutorial at UNSW Computer Labs, 30 March 2009]]&lt;br /&gt;
&lt;br /&gt;
==Sediment Tutorials==&lt;br /&gt;
:*[[CSTMS_UNSW2008|Adding sediment to the Latte example. Tutorial at Sydney Institute of Marine Sciences, 3 April 2009]]&lt;br /&gt;
&lt;br /&gt;
==Utilities and Tools==&lt;br /&gt;
:*[[MEXNC|For Matlab users: Installing MEXNC, SNCTOOLS and ROMS-Matlab-toolkit]]&lt;br /&gt;
:*[[Plotting_Package_Installation|Installing and Using the ROMS/TOMS Plotting Package]]&lt;br /&gt;
&lt;br /&gt;
==Grid Generation Tutorials==&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3648</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3648"/>
		<updated>2009-03-26T14:22:39Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* Test the LATTE case */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
Make sure you can run the examples discussed in the Monday tutorial.&lt;br /&gt;
&lt;br /&gt;
Input files are at http://coast-enviro.er.usgs.gov/models/Latte/in&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3636</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3636"/>
		<updated>2009-03-25T02:10:09Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* SWAN - A Digression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. For many applications, one-way coupling (SWAN influences ROMS, but ROMS does not feed back to SWAN) captures the essential physics. So, before we couple ROMS and SWAN, we&#039;ll run SWAN indepedently. This effort won&#039;t be wasted because the coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;We can translate the frc_latte_wrf_Uwind.nc and frc_latte_wrf_Vwind.nc files to SWAN input using create_swan_wind.m. The resulting file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3635</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3635"/>
		<updated>2009-03-25T01:29:28Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. The coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
The file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;...&amp;lt;br&amp;gt;v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;...etc&amp;lt;/div&amp;gt;where the first indice is time step (1...nt), the second is x-direction (1...ni) and the third is y-direction (1...nj).&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3634</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3634"/>
		<updated>2009-03-25T01:24:22Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* SWAN - A Digression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. The coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
In the Latte example, we have good wind forcing files that work with ROMS, and we want to use the same files to force waves in SWAN. We will use the SWAN commands&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;NONSTATIONARY 20060405.000000 1 HR 20060608.230000&amp;lt;br&amp;gt;READINP WIND 1 &#039;swan_lattec_wind.dat&#039; 4 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
The file swan_lattec_wind.dat has sequences of u and v velocities written for each time step. The &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. The order in which they are written is determined by the &#039;layout&#039; parameter (in this case, 4), which means the &lt;br /&gt;
file looks like this.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&lt;br /&gt;
u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
v(1,1,1)  v(1,1,2) ... v(1,1,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
v(1,2,1)  v(1,2,2) ... v(1,2,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
v(1,ni,1) v(1,ni,2)... v(1,ni,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
u(1,1,1)  u(1,1,2) ... u(1,1,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
u(1,2,1)  u(1,2,2) ... u(1,2,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
u(1,ni,1) u(1,ni,2)... u(1,ni,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
v(2,1,1)  v(2,1,2) ... v(2,1,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
v(2,2,1)  v(2,2,2) ... v(2,2,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
...&amp;lt;br&amp;gt;&lt;br /&gt;
v(2,ni,1) v(2,ni,2)... v(2,ni,nj)&amp;lt;br&amp;gt;&lt;br /&gt;
...etc&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3621</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3621"/>
		<updated>2009-03-24T11:04:53Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. The coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
&#039;&#039;However&#039;&#039;, when COORDINATES SPHERICAL is specified and winds are supplied in files using commands like&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003&amp;lt;br&amp;gt;READINP WIND 1 SERIES &#039;./lattec_swan_wind_fnames.txt&#039; 4 0 FREE&amp;lt;/div&amp;gt;&lt;br /&gt;
the &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid. &#039;&#039;But the angles are in math convention, CCW from the  SWAN x-direction.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3618</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3618"/>
		<updated>2009-03-24T02:51:41Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* SWAN - A Digression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. The coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
&#039;&#039;However&#039;&#039;, when COORDINATES SPHERICAL is specified and winds are supplied in files using commands like&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003&amp;lt;br&amp;gt;READINP WIND 1 SERIES &#039;./lattec_swan_wind_fnames.txt&#039; 4 0 FREE&amp;lt;/div&amp;gt;&lt;br /&gt;
the &#039;&#039;u-&#039;&#039; and &#039;&#039;v-&#039;&#039; components are aligned with the &#039;&#039;x-&#039;&#039; and &#039;&#039;y-&#039;&#039;axes of the SWAN grid.&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3617</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3617"/>
		<updated>2009-03-24T02:48:16Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: /* SWAN - A Digression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
Getting SWAN set up correctly is easier if you do it separately. The coupling to ROMS is not seamless...you still have to specify the SWAN INPUT file, bathymetry, and some of the forcing for SWAN as separate files.&lt;br /&gt;
&lt;br /&gt;
Directions in SWAN can be tricky. For our purposes, we will use these commands in the INPUT file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;SET NAUTICAL&amp;lt;br&amp;gt;COORDINATES SPHERICAL&amp;lt;br&amp;gt;CGRID CURVILINEAR 145 81 EXC 9.999000e+003 &amp;amp;&amp;lt;br&amp;gt;CIRCLE 36 0.0418 1.0 24&amp;lt;br&amp;gt;READGRID COORDINATES 1 &#039;./lattec_swan.grd&#039; 4 0 0 FREE &amp;lt;/div&amp;gt;&lt;br /&gt;
NAUTICAL implies that directions are specified in degrees and (for wind and waves) indicate the direction &#039;&#039;from which&#039;&#039; the wind/waves are approaching,  For example, a uniform southwesterly wind (blowing toward the northeast) at 5 m/s for a stationary run would be specified as&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;WIND 5 225&amp;lt;/div&amp;gt;SWAN output in .mat files should be interpreted this way as well.&lt;br /&gt;
&#039;&#039;However&#039;&#039;, when COORDINATES SPHERICAL is specified and winds are supplied in files using commands like&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;INPGRID WIND CURVILINEAR 0 0 145 81 EXC 9.999000e+003&amp;lt;br&amp;gt;READINP WIND 1 SERIES &#039;./lattec_swan_wind_fnames.txt&#039; 4 0 FREE &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3616</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3616"/>
		<updated>2009-03-23T18:12:11Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101: Its the waves!===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3615</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3615"/>
		<updated>2009-03-23T18:05:18Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This tutorial continues using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101 Its the waves===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=ROMS_UNSW2008&amp;diff=3614</id>
		<title>ROMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=ROMS_UNSW2008&amp;diff=3614"/>
		<updated>2009-03-23T18:03:43Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Installing and Running ROMS for First Time Users&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A tutorial for new ROMS users will be held at the UNSW Computer Labs on Monday 30 March 2009, immediately prior to the ROMS Sydney 2009 User Workshop at the Sydney Institute of Marine Sciences, 31 March to 2 April 2009.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{note}}&#039;&#039;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;This tutorial is intended for complete newcomers to ROMS. It assumes basic knowledge of working in a UNIX environment, and that the essential components required to compile and execute ROMS are already installed on the host computer network. This wiki page borrows heavily from David&#039;s Robertson&#039;s excellent [[ROMS_Cygwin|Installing ROMS under Cygwin]] tutorial where you will find more information about setting up the required computing environment (compilers, libraries etc.) for ROMS.&amp;lt;/span&amp;gt;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
In this tutorial, we cover how to download the code, configure it for an application, and run the model. Error messages that arise during the configuration process will be explained so that these can better be debugged when users return to their home institutions and try to work through this process again.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A follow-on [[CSTMS_UNSW2008|tutorial discussing sediment in ROMS]] will be presented on Friday 03 April.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{note}}An important resource you should use as you get started is the [[Frequently_Asked_Questions | Frequently Asked Questions]] entry in [https://www.myroms.org/wiki WikiROMS].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Download ROMS==&lt;br /&gt;
&lt;br /&gt;
The disk space available on the UNSW Computer Lab machines is quite limited, so for the purposes of this tutorial we have downloaded the ROMS source code to &#039;&#039;&#039;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/srv/ckpt/roms/shared/src&amp;lt;/span&amp;gt;&#039;&#039;&#039; on host &#039;&#039;&#039;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;matht001&amp;lt;/span&amp;gt;&#039;&#039;&#039;. Instructions below will explain how to point the &#039;&#039;&#039;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;&#039;&#039;&#039; script that compiles ROMS to this directory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;To download the code to your own machine, these are the steps you would follow:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:*You must have already registered on the ROMS portal and obtained your ROMS username/password as indicated in the [[ROMS_Cygwin#Register|Register]]. If you are also interested in access to research branches of the sediment code, indicate an interest in the Community Sediment Transport Modeling System (CSTMS) while you are registering. Once your registration is accepted, or if you are already registered, ask Dave Robertson (&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;robertson at marine.rutgers.edu&amp;lt;/span&amp;gt;) to add you as a CSTMS user.&lt;br /&gt;
&lt;br /&gt;
:*Create a &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;src&amp;lt;/span&amp;gt; folder where you will keep the ROMS source code. You can place this wherever you wish in your directory tree (here we assume under your home directory &amp;quot;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;~&amp;lt;/span&amp;gt;&amp;quot;) and name it whatever you like.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~&amp;lt;br /&amp;gt;mkdir src&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Check out the ROMS source code replacing &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;bruce&#039;&#039;&amp;lt;/span&amp;gt; with the ROMS user name you registered with.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;svn checkout --username bruce &amp;lt;nowiki&amp;gt;https://www.myroms.org/svn/src/trunk src&amp;lt;/nowiki&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; Note the target directory &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;src&amp;lt;/span&amp;gt; at the end of the command. If your code ends up in the wrong place, you may have omitted this. &lt;br /&gt;
&lt;br /&gt;
You will see many lines stream by indicating the files that are being added to your src directory. When it finishes, you can type &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ls src&amp;lt;/span&amp;gt; to see the contents of the directory. &lt;br /&gt;
&lt;br /&gt;
To see the contents of the directory where the code is downloaded for this tutorial, type this:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd /srv/ckpt/roms/shared&amp;lt;br /&amp;gt;ls src&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Customize the [[build Script|Build Script]]==&lt;br /&gt;
The ROMS source code comes with a [[build Script|build script]] in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ROMS/Bin&amp;lt;/span&amp;gt; directory. Examples written with &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;bash&amp;lt;/span&amp;gt; (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;) and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;csh&amp;lt;/span&amp;gt; (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.sh&amp;lt;/span&amp;gt;) are provided. The UNSW Computer Lab machines are configured to use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;bash&amp;lt;/span&amp;gt; as the default login shell, so we will work with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;. A full description of the build script can be found [[build Script|here]].&lt;br /&gt;
&lt;br /&gt;
:*In your home directory (you can use some other directory to organize your ROMS projects if you wish) create a new folder named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; and change into it.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~&amp;lt;br /&amp;gt;mkdir Projects&amp;lt;br /&amp;gt;cd Projects&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
:*Create a folder named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling&amp;lt;/span&amp;gt; and change into it. ROMS is distributed with several [[Test Cases|Test Cases]] and the [[UPWELLING_CASE|Upwelling example]] is the default which we will compile and run here.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;mkdir upwelling&amp;lt;br /&amp;gt;cd upwelling&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Copy the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; file distributed with ROMS to your &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; directory.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/Bin/build.bash .&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we need to configure a few options inside &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; so that it finds the directories where the source code and your Project are located. &lt;br /&gt;
&lt;br /&gt;
:*Open the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; script you just copied into your &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling&amp;lt;/span&amp;gt; directory using your preferred text editor, e.g. vi.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;vi build.bash&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Scroll down until you find &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;. You will notice it is set as follows:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING&amp;lt;/div&amp;gt; We do not need to change this. But this is the first thing you will alter when starting your own project. This tells ROMS the name of an include file that will contain all the directives to the C-PreProcessor to configure your application at compile time. ROMS&#039; rule is change this string to lowercase and append a &amp;quot;.h&amp;quot;, so this will search for a file called &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt;. It must be in the directory specified by &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
:*Scroll down until you find &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt; and set it as follows:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;=${&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;HOME&amp;lt;/span&amp;gt;}/Projects/upwelling&amp;lt;/div&amp;gt; This obviously assumes you put &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; under your home directory.&lt;br /&gt;
  &lt;br /&gt;
If you frequently move your ROMS project between hosts where you have a different directory structure, e.g. a temporary scratch space, you can use the &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt; variable to minimize the changes you make to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*For example: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt;=/usr/scratch/bruce&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;=${&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt;}/Projects/upwelling&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we tell &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; where to find the ROMS source code downloaded from the svn repository (which you can keep up to date the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;svn update&amp;lt;/span&amp;gt; command - see more on this at LINK ). Note that most of the source code changes you make to customize ROMS will be made in your Projects space, and need not be made to the downloaded code directly. We will discuss exceptions to this during the tutorial, and how source code modifications interact with svn.&lt;br /&gt;
&lt;br /&gt;
:*Set &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to the location of the source code:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt;=/srv/ckpt/roms/shared/src&amp;lt;/div&amp;gt; In practise, you will probably do something more like this:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt;=${&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt;}/src&amp;lt;/div&amp;gt; assuming this is the relative path in which you keep your source code on the various machines you work on. &lt;br /&gt;
&lt;br /&gt;
Make sure that &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_CPP_FLAGS&amp;lt;/span&amp;gt; is &#039;&#039;&#039;not&#039;&#039;&#039; set. Sometimes this is set in the distributed build.bash exmaple. Comment out options with the # symbol like so:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#export MY_CPP_FLAGS=&amp;quot;-DAVERAGES&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UNSW Computer Lab machines are single core, so we need to tell &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; not to assume MPI parallel compilation. &lt;br /&gt;
&lt;br /&gt;
:*Comment out the options for &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_MPI&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_MPIF90&amp;lt;/span&amp;gt;&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#export USE_MPI=on &amp;lt;br&amp;gt;#export USE_MPIF90=on&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*If you were compiling in parallel you would leave the default entries in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;            &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_MPI&amp;lt;/span&amp;gt;=&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;         &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_MPIF90&amp;lt;/span&amp;gt;=&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*We leave the compiler option as the default because this says use the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ifort&amp;lt;/span&amp;gt; (Intel FORTRAN) compiler which is what we want on the UNSW machines. &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt;=ifort&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*In the interests of speed for this tutorial, we turn off compiler optimization by activating the debug option: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_DEBUG&amp;lt;/span&amp;gt;=on&amp;lt;/div&amp;gt;On the UNSW Lab machines compiling with optimization on will take over 15 minutes, but with optimization off (USE_DEBUG=on) it will be less than 60 seconds.&lt;br /&gt;
&lt;br /&gt;
Save and close the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Copy the input and CPPDEFS options files==&lt;br /&gt;
&lt;br /&gt;
We need three more files in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; to configure and run ROMS. We copy the versions downloaded with svn because these are files you will work with locally when you experiment with changes to the test case example configuration. &lt;br /&gt;
&lt;br /&gt;
:*Copy files &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in, varinfo.dat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; into the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; directory you just created.&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~/Projects/upwelling&amp;lt;br /&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/External/ocean_upwelling.in . &amp;lt;br&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/External/varinfo.dat . &amp;lt;br&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/Include/upwelling.h .&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt;.  It contains all the [[C_Preprocessor|C-Pre-Processor (CPP)]] options that the compiler interprets to activate certain source code options within ROMS.&lt;br /&gt;
&lt;br /&gt;
View the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt;. It contains the inputs options that ROMS [[ocean.in|reads from standard input]] at run time to set options that need not be fixed at compile time. &lt;br /&gt;
&lt;br /&gt;
View &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt;. The file [[varinfo.dat]] contains descriptions of the names and attributes of input and output variables that ROMS reads and writes from netcdf files. For most applications you will not need to change the entries in this file. If you need to know the default units assumed for different variables, those are noted in this file. (Before we run ROMS, we will need to tell it where to find this file). &lt;br /&gt;
&lt;br /&gt;
Now we are ready to compile ROMS by executing the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
==Compile ROMS==&lt;br /&gt;
&lt;br /&gt;
Before you run ROMS, you need to compile it to create an executable &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;oceanS&amp;lt;/span&amp;gt; file (&#039;&#039;&#039;S&#039;&#039;&#039; for serial or single processor computer), or &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;oceanM&amp;lt;/span&amp;gt; file (if using &#039;&#039;&#039;MPI&#039;&#039;&#039; on a parallel computer).&lt;br /&gt;
&lt;br /&gt;
:*Go to your upwelling project directory:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~/Projects/upwelling&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Then type:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build.bash&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*If lots of stuff comes on the screen then compilation is proceeding, and make take some time.  &lt;br /&gt;
&lt;br /&gt;
:*If the build process ends quickly with an error, then it is likely that &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; does not point to the correct location for the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; file, the FORTRAN compiler, or some libraries. We describe common &#039;&#039;getting started&#039;&#039; errors and solutions in the next section. &lt;br /&gt;
&lt;br /&gt;
:*You may give the option &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;-j&amp;lt;/span&amp;gt; to the build command to distribute the compilation to multiple processors if your host supports this, e.g.:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build.bash -j 8&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; to compile on 8 processor at once. &lt;br /&gt;
 &lt;br /&gt;
If your build was successful it will not have reported any errors, and there will be an executable file in your &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanG&amp;lt;/span&amp;gt;. The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;G&amp;quot;&amp;lt;/span&amp;gt; in the file name indicates &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; activated the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;USE_DEBUG&amp;lt;/span&amp;gt; option. &lt;br /&gt;
&lt;br /&gt;
If &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;USE_DEBUG&amp;lt;/span&amp;gt; were not selected, the executable would be &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanS&amp;lt;/span&amp;gt;, where the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;S&amp;quot;&amp;lt;/span&amp;gt; indicates &amp;quot;serial&amp;quot; or &amp;quot;single-processor&amp;quot; because we deactivated MPI. &lt;br /&gt;
&lt;br /&gt;
If you had activated MPI with the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;USE_MPI&amp;lt;/span&amp;gt; option the executable would be named &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanM&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(See also [[Frequently_Asked_Questions#My_build_finished_with_no_errors._Where_is_the_ROMS_executable.3F|FAQ: My build finished with no errors, where is the ROMS executable?]]). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Common &#039;&#039;getting started&#039;&#039; compile error messages===&lt;br /&gt;
&lt;br /&gt;
Getting past the first few errors with compilation is often tricky. Carefully read any error messages you get for clues on what might be wrong with your configuration. Here are some common difficulties new users encounter getting started when first executing the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Compilers/../ROMS/Include/cppdefs.h:709:22: &amp;lt;br&amp;gt;error: /student/0/a0000020/Projects/upwelling/upwelling.h: No such file or directory&amp;lt;/div&amp;gt; This says the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; is not where Build expects it to be, which is in &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;. You set this to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;~/Projects/upwelling&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp: cannot stat `/opt/intelsoft/netcdf/include/netcdf.mod&#039;: No such file or directory&amp;lt;/div&amp;gt; This says that netcdf is not where build.bash expects to find it. Locate where the netcdf include and lib directories with steps something like:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd /usr &amp;lt;br&amp;gt;find . -name netcdf.mod -print&amp;lt;br&amp;gt;&amp;lt;/span&amp;gt;  ./local/netcdf-3.6.2/include/netcdf.mod &amp;lt;br&amp;gt;  ./local/netcdf/intel/3.6.3/include/netcdf.mod&amp;lt;/div&amp;gt;This tells us the most recent (3.6.3) netcdf is in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/usr/local/netcdf/intel/3.6.3&amp;lt;/span&amp;gt;. Direct ROMS to this location by making two changes to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;. First, advise ROMS to read your changes to the default library path by uncommenting the option for &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_MY_LIBS&amp;lt;/span&amp;gt;.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;      &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_MY_LIBS&amp;lt;/span&amp;gt;=on&amp;lt;/div&amp;gt; Then specifiy the correct location for netcdf:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;      &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NETCDF_INCDIR&amp;lt;/span&amp;gt;=/usr/local/netcdf/intel/3.6.3/include&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;      &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NETCDF_LIBDIR&amp;lt;/span&amp;gt;=/usr/local/netcdf/intel/3.6.3/lib&amp;lt;/div&amp;gt; {{warning}} Be careful where you make this change. You need to make it for the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ifort&amp;lt;/span&amp;gt; compiler option, and NOT for the &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_NETCDF4&amp;lt;/span&amp;gt; option (we are using netcdf-3). If you&#039;ve done this correctly, your compilation with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; should now succeed.&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;error &amp;lt;br&amp;gt;error: &amp;lt;/div&amp;gt; Note here further errors we encounter during the tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Run ROMS==&lt;br /&gt;
&lt;br /&gt;
You run ROMS by executing the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanG&amp;lt;/span&amp;gt; (or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanS&amp;lt;/span&amp;gt;) binary, giving it the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt; file as UNIX standard input. &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./oceanS &amp;lt; ocean_upwelling.in&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; ROMS standard output will be typed to the screen. To save it a file instead, enter, e.g.:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./oceanS &amp;lt; ocean_upwelling.in &amp;gt; my_upwelling.log &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have compiled a parallel (MPI) executable, the syntax for running the mode is slightly &#039;&#039;&#039;but critically&#039;&#039;&#039; different. The &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt; file is no longer read from UNIX standard input (it has handled by all the MPI threads) so the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;&amp;lt;&amp;quot;&amp;lt;/span&amp;gt; disappears from the command, and you need the correct syntax on your UNIX host for running an MPI process. It is probably something like: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;mpirun -np 8 ./oceanM ocean_upwelling.in &amp;gt; my_upwelling.log&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; where the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;-np 8&amp;quot;&amp;lt;/span&amp;gt; indicates use 8 processors and this number of tiles must have been set by   &lt;br /&gt;
&lt;br /&gt;
(See also [[Frequently_Asked_Questions#What_do_I_have_to_do_to_run_an_application.3F | FAQ: What do I have to do to runs ROMS?]]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Common &#039;&#039;getting started&#039;&#039; run error messages===&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;bash: oceanG: command not found&amp;lt;/div&amp;gt;The working directory is not in your UNIX path. That&#039;s why we type &amp;quot;dot-slash&amp;quot; in front of the commands above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Successful execution==&lt;br /&gt;
&lt;br /&gt;
===Standard Output===&lt;br /&gt;
&lt;br /&gt;
When ROMS runs it will type a lot of information to UNIX standard output. This is the &amp;quot;logfile&amp;quot; you named following the &amp;quot;&amp;gt;&amp;quot;, or your terminal if you did not redirect stdout. &lt;br /&gt;
&lt;br /&gt;
STDOUT shows the following:&lt;br /&gt;
&lt;br /&gt;
:*UNIX process info, run time, run TITLE &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Process Information: &amp;lt;br&amp;gt; Thread #  0 (pid=    4449) is active. &amp;lt;br&amp;gt; Model Input Parameters:  ROMS/TOMS version 3.2 &amp;lt;br&amp;gt;        Monday - March 23, 2009 - 10:02:39 AM &amp;lt;br&amp;gt;----------------------------------------------------------- &amp;lt;br&amp;gt; Wind-Driven Upwelling/Downwelling over a Periodic Channel&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*OS, compiler information, SVN version, and your MY_ROMS_SRC, MY_HEADER_DIR and ROMS_APPLICATION settings&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Operating system : Linux&amp;lt;br&amp;gt;CPU/hardware     : i686&amp;lt;br&amp;gt;Compiler system  : ifort &amp;lt;br&amp;gt;Compiler command : /usr/local/intel/fc/10.1.021/bin/ifort &amp;lt;br&amp;gt;Compiler flags   : -heap-arrays -ip -O3 -pc80 -xW -free&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;SVN Root URL  : &amp;lt;nowiki&amp;gt;https://www.myroms.org/svn/src/trunk&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;SVN Revision  : 333&amp;lt;br&amp;gt;Local Root    : /srv/ckpt/roms/shared/src&amp;lt;br&amp;gt;Header Dir    : /student/0/a0000020/srv/Projects/upwelling&amp;lt;br&amp;gt;Header file   : upwelling.h&amp;lt;br&amp;gt;Analytical Dir: /student/0/a0000020/srv/Projects/upwelling&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Resolution, Grid 01: 0041x0080x016,  Parallel Threads:  1,  Tiling: 001x001&amp;lt;/div&amp;gt;Check that these are what you intended. In last line above&lt;br /&gt;
::*&amp;quot;Grid 01&amp;quot; pertains to future ROMS developments with multiple nested/connected grids, &lt;br /&gt;
::* 0041x0080x016 shows the grid size is 41 x 80 x 16 grid points in the K,J,I directions&lt;br /&gt;
::* The Parallel/Tiling message shows you are using a single process and a single domain tile. When using MPI, this message will describe how many tiles you are using and the MPI processes assigned. &lt;br /&gt;
&lt;br /&gt;
:*Input parameters set in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt;&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Physical Parameters, Grid: 01&amp;lt;br&amp;gt;=============================&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;        288  ntimes          Number of timesteps for 3-D equations.&amp;lt;br&amp;gt;    300.000  dt              Timestep size (s) for 3-D equations.&amp;lt;br&amp;gt;         30  ndtfast         Number of timesteps for 2-D equations between&amp;lt;br&amp;gt;                               each 3D timestep.&amp;lt;br&amp;gt;   ...&amp;lt;br&amp;gt;            Output Averages File:  ocean_avg.nc&amp;lt;br&amp;gt;         Output Diagnostics File:  ocean_dia.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Then some more about the tiling when running in parallel&lt;br /&gt;
&lt;br /&gt;
:*The C-PreProcessor (CPP) flags set in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; but &#039;&#039;&#039;AS MODIFIED&#039;&#039;&#039; by ROMS when interpreting and checking the selected CPP options.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Activated C-preprocessing Options:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  UPWELLING          Wind-Driven Upwelling/Downwelling over a Periodic Channel&amp;lt;br&amp;gt;  ANA_BSFLUX         Analytical kinematic bottom salinity flux.&amp;lt;br&amp;gt;  ANA_BTFLUX         Analytical kinematic bottom temperature flux.&amp;lt;br&amp;gt;  ANA_GRID           Analytical grid set-up.&amp;lt;br&amp;gt;  ANA_INITIAL        Analytical initial conditions.&amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;You should check that the CPP options displayed here agree with what you intended. For example, if you inadvertently specify more than one horizontal advection scheme option, ROMS will have chosen only one and reported that option here.&lt;br /&gt;
&lt;br /&gt;
:*The preamble in STDOUT continues with information about the space and time discretization: grid spacing, grid volume, Courant number (time step stability) and stiffness (related to s-coordinate accuracy).&lt;br /&gt;
&lt;br /&gt;
:*Then the model starts time stepping:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;NL ROMS/TOMS: started time-stepping: (Grid: 01 TimeSteps: 00000001 - 00000288)&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   STEP   Day HH:MM:SS  KINETIC_ENRG   POTEN_ENRG    TOTAL_ENRG    NET_VOLUME&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;      0     0 00:00:00  0.000000E+00  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;      DEF_HIS   - creating history file: ocean_his.nc&amp;lt;br&amp;gt;      WRT_HIS   - wrote history  fields (Index=1,1) into time record = 000000&amp;lt;br&amp;gt;      DEF_AVG   - creating average file: ocean_avg.nc&amp;lt;br&amp;gt;      DEF_DIAGS - creating diagnostics file: ocean_dia.nc&amp;lt;br&amp;gt;      1     0 00:05:00  3.268255E-13  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;      2     0 00:10:00  6.503587E-12  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;      3     0 00:15:00  4.592307E-11  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;This output indicates several things:&lt;br /&gt;
::*the run is programmed to run from time step 1 to 288&lt;br /&gt;
::*the run starts at time 00:00:0&lt;br /&gt;
::*netcdf output HISTORY, AVERAGES and DIAGNOSTICS files are created. Every time ROMS creates a new netcdf file, and writes to an existing file, it reports this to STDOUT&lt;br /&gt;
::*output is written to the HISTORY file&lt;br /&gt;
::*then global quantities related to the model KE, PE and domain volume are reported on each time step&lt;br /&gt;
&lt;br /&gt;
{{note}} In 99% of situations, &#039;&#039;getting started&#039;&#039; problems with model set-up and configuration can be diagnosed by carefully reading the STDOUT above. Things to look for are:&lt;br /&gt;
:*misconfigured CPP options (what you got is not what you thought you asked for)&lt;br /&gt;
:*parameter errors (e.g. you activated horizontal mixing but left the coefficient as zero)&lt;br /&gt;
:*misnamed output files (that&#039;s why the files from your last run got overwritten)&lt;br /&gt;
:*irrational choices of grid spacing or time step  &lt;br /&gt;
:*initial/boundary/forcing data being read from the wrong file, or not read at all (because you selected analytical conditions)&lt;br /&gt;
&lt;br /&gt;
At the conclusion of the run, ROMS reports information about run time:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Elapsed CPU time (seconds):&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; Thread #  0 CPU:     108.079&amp;lt;br&amp;gt; Total:               108.079&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Nonlinear model elapsed time profile:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  Initialization ...................................         0.016  ( 0.0148 %)&amp;lt;br&amp;gt;  Processing of input data .........................         0.028  ( 0.0259 %)&amp;lt;br&amp;gt;  Processing of output time averaged data ..........         4.312  ( 3.9899 %)&amp;lt;br&amp;gt;   ... &amp;lt;/div&amp;gt;&lt;br /&gt;
:*about the number of output records written to each file&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ROMS/TOMS - Output NetCDF summary for Grid 01: &amp;lt;br&amp;gt;             number of time records written in HISTORY file = 00000005 &amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;&lt;br /&gt;
:*and the analytical files included &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Analytical header files used:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     ROMS/Functionals/ana_btflux.h&amp;lt;br&amp;gt;     ROMS/Functionals/ana_grid.h&amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;If you used a modified analytical file in your &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_HEADER_DIR&amp;lt;/span&amp;gt; it will be reported here and is another thing you should check for consistency with your intentions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Netcdf file output===&lt;br /&gt;
&lt;br /&gt;
As reported above, ROMS created 4 output netcdf files when it ran. There are ocean_his.nc, ocean_avg.nc, ocean_dia.nc, and coean_rst.nc. These are, respectively:&lt;br /&gt;
:*history records or &#039;snapshots&#039; of the model state a selected time intervals&lt;br /&gt;
:*averages of the model state over selected intervals (not necessarily the same intervals as the history)&lt;br /&gt;
:*diagnostics of the model state, the precise contents of which are controlled by CPP options&lt;br /&gt;
:*a restart file with everything ROMS needs to restart a application. This is useful if your job crashes at some point and you want to recommence from a previous state without starting over. Typically the restart file is set to keep just 2 time records by continually over-writing the oldest as the run proceeds. This behaviour is controlled in ocean_upwelling.in. Also, when ROMS &amp;quot;blows up&amp;quot; it dumps the ocean state to a 3rd record in the restart file. &lt;br /&gt;
&lt;br /&gt;
You can browse the contents of netcdf files at the UNIX command line with the command ncdump, e.g. &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ncdump -h ocean_his.nc | more&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
Note the use of the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;-h&amp;quot;&amp;lt;/span&amp;gt; option. This restricts the output from ncdump to be just the header information, or metadata, in the netcdf file. Without the &amp;quot;-h&amp;quot; option you will get the entire contents of the file converted to ascii.  &lt;br /&gt;
&lt;br /&gt;
Things to notice when you ncdump the ocean_his.nc file are that it contains all the input parameters (time step, mixing coefficients, s-coordinate parameters, etc.) from ocean.in, the model grid coordinates (x, y, lon, lat, depth, Coriolis parameter, etc.) which may have been computed by the ANA_GRID option or read from an input grid netcdf file, in addition to the actual model output (ocean_time, zeta, u, v, temp, salt). &lt;br /&gt;
&lt;br /&gt;
There are netcdf &#039;&#039;&#039;global attributes&#039;&#039;&#039; that echo much of the information typed to STDOUT. This includes compiler, svn version, and project directory information, and all the CPP options. This is a valuable source of information when returning to a project and trying to figure out what you did!  The global attributes metadata show precisely which options were activated when creating the output in this netcdf file.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Changing the UPWELLING test case configuration==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Compile time changes: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Run time changes: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A &#039;&#039;Realistic&#039;&#039; model example: LaTTE==&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial assumes you have successfully compiled and run the UPWELLING example above. Key concepts you should be comfortable with to proceed are:&lt;br /&gt;
:*you need a new directory where you will keep the files specific to the new application&lt;br /&gt;
:*customize &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; for the new application (copy the build.bash from &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling&amp;lt;/span&amp;gt; because it has all the correct compiler and library settings)&lt;br /&gt;
:*set &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; to point to the directory for the new application&lt;br /&gt;
:*set &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; to the correct name for the new application&lt;br /&gt;
:*if you wish to customize any of the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; files, copy just the ones you need into the new project directory &lt;br /&gt;
:*you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; need to make a copy the source code a new application&lt;br /&gt;
&lt;br /&gt;
With these concepts in mind, we proceed by configuring ROMS to run a realistic coastal ocean application that includes open boundaries on 3 sides, open boundary tides and climatology velocity and tracer (temperature and salinity) conditions, surface meteorological forcing, and initial conditions, all provided by input netcdf files. The example is called LaTTE_C because it simulates ocean conditions during the &#039;&#039;&#039;Lagrangian Transport and Transformation Experiment&#039;&#039;&#039; conducted on the New Jersey inner shelf in the Spring of 2006. The &#039;_C&#039; denotes a coarse resolution configuration suitable for this training exercise. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Create a latte_c project directory===&lt;br /&gt;
&lt;br /&gt;
We have placed the CPP options file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;latte_c.h&amp;lt;/span&amp;gt;, standand input &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_lattec.in&amp;lt;/span&amp;gt;, and a modified &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/srv/ckpt/roms/shared/latte_c/Forward&amp;lt;/span&amp;gt;. Make a new Project directory for this new application and copy these 3 files. &#039;&#039;&#039;DO NOT&#039;&#039;&#039; copy all the netcdf files from &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/srv/ckpt/roms/shared/latte_c/in&lt;br /&gt;
&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Edit build.bash===&lt;br /&gt;
&lt;br /&gt;
Set the correct entries for ROMS_APPLICATION and MY_PROJECT_DIR&lt;br /&gt;
&lt;br /&gt;
===Edit ocean_lattec.in===&lt;br /&gt;
&lt;br /&gt;
Change the entries for GRDNAME etc so that ROMS finds the shared input files.&lt;br /&gt;
&lt;br /&gt;
Change the path for HISNAME and other outputs so that your output is written to your own work space.&lt;br /&gt;
&lt;br /&gt;
===Compile with build.bash===&lt;br /&gt;
&lt;br /&gt;
==Before we run latte_c==&lt;br /&gt;
&lt;br /&gt;
===Browse the latt_c.h options===&lt;br /&gt;
&lt;br /&gt;
===Browse input netcdf files===&lt;br /&gt;
&lt;br /&gt;
Use ncdump -h&lt;br /&gt;
&lt;br /&gt;
==Run the latte_c example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plotting netcdf outout with Matlab==&lt;br /&gt;
&lt;br /&gt;
===Basics of Matlab-Netcdf===&lt;br /&gt;
&lt;br /&gt;
===Using roms_wilkin routines===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=ROMS_UNSW2008&amp;diff=3613</id>
		<title>ROMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=ROMS_UNSW2008&amp;diff=3613"/>
		<updated>2009-03-23T18:02:45Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Installing and Running ROMS for First Time Users&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A tutorial for new ROMS users will be held at the UNSW Computer Labs on Monday 30 March 2009, immediately prior to the ROMS Sydney 2009 User Workshop at the Sydney Institute of Marine Sciences, 31 March to 2 April 2009.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{note}}&#039;&#039;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;This tutorial is intended for complete newcomers to ROMS. It assumes basic knowledge of working in a UNIX environment, and that the essential components required to compile and execute ROMS are already installed on the host computer network. This wiki page borrows heavily from David&#039;s Robertson&#039;s excellent [[ROMS_Cygwin|Installing ROMS under Cygwin]] tutorial where you will find more information about setting up the required computing environment (compilers, libraries etc.) for ROMS.&amp;lt;/span&amp;gt;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
In this tutorial, we cover how to download the code, configure it for an application, and run the model. Error messages that arise during the configuration process will be explained so that these can better be debugged when users return to their home institutions and try to work through this process again.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A follow-in tutorial covering sediment will be presented on [[CSTMS_UNSW2008| Friday 03 April]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{note}}An important resource you should use as you get started is the [[Frequently_Asked_Questions | Frequently Asked Questions]] entry in [https://www.myroms.org/wiki WikiROMS].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Download ROMS==&lt;br /&gt;
&lt;br /&gt;
The disk space available on the UNSW Computer Lab machines is quite limited, so for the purposes of this tutorial we have downloaded the ROMS source code to &#039;&#039;&#039;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/srv/ckpt/roms/shared/src&amp;lt;/span&amp;gt;&#039;&#039;&#039; on host &#039;&#039;&#039;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;matht001&amp;lt;/span&amp;gt;&#039;&#039;&#039;. Instructions below will explain how to point the &#039;&#039;&#039;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;&#039;&#039;&#039; script that compiles ROMS to this directory.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;To download the code to your own machine, these are the steps you would follow:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:*You must have already registered on the ROMS portal and obtained your ROMS username/password as indicated in the [[ROMS_Cygwin#Register|Register]]. If you are also interested in access to research branches of the sediment code, indicate an interest in the Community Sediment Transport Modeling System (CSTMS) while you are registering. Once your registration is accepted, or if you are already registered, ask Dave Robertson (&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;robertson at marine.rutgers.edu&amp;lt;/span&amp;gt;) to add you as a CSTMS user.&lt;br /&gt;
&lt;br /&gt;
:*Create a &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;src&amp;lt;/span&amp;gt; folder where you will keep the ROMS source code. You can place this wherever you wish in your directory tree (here we assume under your home directory &amp;quot;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;~&amp;lt;/span&amp;gt;&amp;quot;) and name it whatever you like.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~&amp;lt;br /&amp;gt;mkdir src&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Check out the ROMS source code replacing &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;bruce&#039;&#039;&amp;lt;/span&amp;gt; with the ROMS user name you registered with.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;svn checkout --username bruce &amp;lt;nowiki&amp;gt;https://www.myroms.org/svn/src/trunk src&amp;lt;/nowiki&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; Note the target directory &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;src&amp;lt;/span&amp;gt; at the end of the command. If your code ends up in the wrong place, you may have omitted this. &lt;br /&gt;
&lt;br /&gt;
You will see many lines stream by indicating the files that are being added to your src directory. When it finishes, you can type &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ls src&amp;lt;/span&amp;gt; to see the contents of the directory. &lt;br /&gt;
&lt;br /&gt;
To see the contents of the directory where the code is downloaded for this tutorial, type this:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd /srv/ckpt/roms/shared&amp;lt;br /&amp;gt;ls src&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Customize the [[build Script|Build Script]]==&lt;br /&gt;
The ROMS source code comes with a [[build Script|build script]] in the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ROMS/Bin&amp;lt;/span&amp;gt; directory. Examples written with &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;bash&amp;lt;/span&amp;gt; (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;) and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;csh&amp;lt;/span&amp;gt; (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.sh&amp;lt;/span&amp;gt;) are provided. The UNSW Computer Lab machines are configured to use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;bash&amp;lt;/span&amp;gt; as the default login shell, so we will work with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;. A full description of the build script can be found [[build Script|here]].&lt;br /&gt;
&lt;br /&gt;
:*In your home directory (you can use some other directory to organize your ROMS projects if you wish) create a new folder named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; and change into it.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~&amp;lt;br /&amp;gt;mkdir Projects&amp;lt;br /&amp;gt;cd Projects&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
:*Create a folder named &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling&amp;lt;/span&amp;gt; and change into it. ROMS is distributed with several [[Test Cases|Test Cases]] and the [[UPWELLING_CASE|Upwelling example]] is the default which we will compile and run here.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;mkdir upwelling&amp;lt;br /&amp;gt;cd upwelling&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Copy the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; file distributed with ROMS to your &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; directory.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/Bin/build.bash .&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we need to configure a few options inside &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; so that it finds the directories where the source code and your Project are located. &lt;br /&gt;
&lt;br /&gt;
:*Open the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; script you just copied into your &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling&amp;lt;/span&amp;gt; directory using your preferred text editor, e.g. vi.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;vi build.bash&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Scroll down until you find &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;. You will notice it is set as follows:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING&amp;lt;/div&amp;gt; We do not need to change this. But this is the first thing you will alter when starting your own project. This tells ROMS the name of an include file that will contain all the directives to the C-PreProcessor to configure your application at compile time. ROMS&#039; rule is change this string to lowercase and append a &amp;quot;.h&amp;quot;, so this will search for a file called &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt;. It must be in the directory specified by &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
:*Scroll down until you find &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt; and set it as follows:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;=${&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;HOME&amp;lt;/span&amp;gt;}/Projects/upwelling&amp;lt;/div&amp;gt; This obviously assumes you put &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; under your home directory.&lt;br /&gt;
  &lt;br /&gt;
If you frequently move your ROMS project between hosts where you have a different directory structure, e.g. a temporary scratch space, you can use the &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt; variable to minimize the changes you make to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*For example: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt;=/usr/scratch/bruce&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;=${&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt;}/Projects/upwelling&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we tell &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; where to find the ROMS source code downloaded from the svn repository (which you can keep up to date the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;svn update&amp;lt;/span&amp;gt; command - see more on this at LINK ). Note that most of the source code changes you make to customize ROMS will be made in your Projects space, and need not be made to the downloaded code directly. We will discuss exceptions to this during the tutorial, and how source code modifications interact with svn.&lt;br /&gt;
&lt;br /&gt;
:*Set &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to the location of the source code:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt;=/srv/ckpt/roms/shared/src&amp;lt;/div&amp;gt; In practise, you will probably do something more like this:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt;=${&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;MY_ROOT_DIR&amp;lt;/span&amp;gt;}/src&amp;lt;/div&amp;gt; assuming this is the relative path in which you keep your source code on the various machines you work on. &lt;br /&gt;
&lt;br /&gt;
Make sure that &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_CPP_FLAGS&amp;lt;/span&amp;gt; is &#039;&#039;&#039;not&#039;&#039;&#039; set. Sometimes this is set in the distributed build.bash exmaple. Comment out options with the # symbol like so:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#export MY_CPP_FLAGS=&amp;quot;-DAVERAGES&amp;quot;&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The UNSW Computer Lab machines are single core, so we need to tell &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; not to assume MPI parallel compilation. &lt;br /&gt;
&lt;br /&gt;
:*Comment out the options for &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_MPI&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_MPIF90&amp;lt;/span&amp;gt;&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;#export USE_MPI=on &amp;lt;br&amp;gt;#export USE_MPIF90=on&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*If you were compiling in parallel you would leave the default entries in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;            &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_MPI&amp;lt;/span&amp;gt;=&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;         &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_MPIF90&amp;lt;/span&amp;gt;=&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*We leave the compiler option as the default because this says use the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ifort&amp;lt;/span&amp;gt; (Intel FORTRAN) compiler which is what we want on the UNSW machines. &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt;=ifort&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*In the interests of speed for this tutorial, we turn off compiler optimization by activating the debug option: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_DEBUG&amp;lt;/span&amp;gt;=on&amp;lt;/div&amp;gt;On the UNSW Lab machines compiling with optimization on will take over 15 minutes, but with optimization off (USE_DEBUG=on) it will be less than 60 seconds.&lt;br /&gt;
&lt;br /&gt;
Save and close the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Copy the input and CPPDEFS options files==&lt;br /&gt;
&lt;br /&gt;
We need three more files in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; to configure and run ROMS. We copy the versions downloaded with svn because these are files you will work with locally when you experiment with changes to the test case example configuration. &lt;br /&gt;
&lt;br /&gt;
:*Copy files &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in, varinfo.dat&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; into the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; directory you just created.&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~/Projects/upwelling&amp;lt;br /&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/External/ocean_upwelling.in . &amp;lt;br&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/External/varinfo.dat . &amp;lt;br&amp;gt;cp /srv/ckpt/roms/shared/src/ROMS/Include/upwelling.h .&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
View the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt;.  It contains all the [[C_Preprocessor|C-Pre-Processor (CPP)]] options that the compiler interprets to activate certain source code options within ROMS.&lt;br /&gt;
&lt;br /&gt;
View the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt;. It contains the inputs options that ROMS [[ocean.in|reads from standard input]] at run time to set options that need not be fixed at compile time. &lt;br /&gt;
&lt;br /&gt;
View &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt;. The file [[varinfo.dat]] contains descriptions of the names and attributes of input and output variables that ROMS reads and writes from netcdf files. For most applications you will not need to change the entries in this file. If you need to know the default units assumed for different variables, those are noted in this file. (Before we run ROMS, we will need to tell it where to find this file). &lt;br /&gt;
&lt;br /&gt;
Now we are ready to compile ROMS by executing the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
==Compile ROMS==&lt;br /&gt;
&lt;br /&gt;
Before you run ROMS, you need to compile it to create an executable &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;oceanS&amp;lt;/span&amp;gt; file (&#039;&#039;&#039;S&#039;&#039;&#039; for serial or single processor computer), or &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;oceanM&amp;lt;/span&amp;gt; file (if using &#039;&#039;&#039;MPI&#039;&#039;&#039; on a parallel computer).&lt;br /&gt;
&lt;br /&gt;
:*Go to your upwelling project directory:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd ~/Projects/upwelling&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Then type:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build.bash&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*If lots of stuff comes on the screen then compilation is proceeding, and make take some time.  &lt;br /&gt;
&lt;br /&gt;
:*If the build process ends quickly with an error, then it is likely that &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; does not point to the correct location for the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; file, the FORTRAN compiler, or some libraries. We describe common &#039;&#039;getting started&#039;&#039; errors and solutions in the next section. &lt;br /&gt;
&lt;br /&gt;
:*You may give the option &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;-j&amp;lt;/span&amp;gt; to the build command to distribute the compilation to multiple processors if your host supports this, e.g.:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build.bash -j 8&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; to compile on 8 processor at once. &lt;br /&gt;
 &lt;br /&gt;
If your build was successful it will not have reported any errors, and there will be an executable file in your &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;Projects/upwelling&amp;lt;/span&amp;gt; directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanG&amp;lt;/span&amp;gt;. The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;G&amp;quot;&amp;lt;/span&amp;gt; in the file name indicates &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; activated the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;USE_DEBUG&amp;lt;/span&amp;gt; option. &lt;br /&gt;
&lt;br /&gt;
If &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;USE_DEBUG&amp;lt;/span&amp;gt; were not selected, the executable would be &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanS&amp;lt;/span&amp;gt;, where the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;S&amp;quot;&amp;lt;/span&amp;gt; indicates &amp;quot;serial&amp;quot; or &amp;quot;single-processor&amp;quot; because we deactivated MPI. &lt;br /&gt;
&lt;br /&gt;
If you had activated MPI with the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;USE_MPI&amp;lt;/span&amp;gt; option the executable would be named &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanM&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(See also [[Frequently_Asked_Questions#My_build_finished_with_no_errors._Where_is_the_ROMS_executable.3F|FAQ: My build finished with no errors, where is the ROMS executable?]]). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Common &#039;&#039;getting started&#039;&#039; compile error messages===&lt;br /&gt;
&lt;br /&gt;
Getting past the first few errors with compilation is often tricky. Carefully read any error messages you get for clues on what might be wrong with your configuration. Here are some common difficulties new users encounter getting started when first executing the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Compilers/../ROMS/Include/cppdefs.h:709:22: &amp;lt;br&amp;gt;error: /student/0/a0000020/Projects/upwelling/upwelling.h: No such file or directory&amp;lt;/div&amp;gt; This says the file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; is not where Build expects it to be, which is in &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt;. You set this to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;~/Projects/upwelling&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp: cannot stat `/opt/intelsoft/netcdf/include/netcdf.mod&#039;: No such file or directory&amp;lt;/div&amp;gt; This says that netcdf is not where build.bash expects to find it. Locate where the netcdf include and lib directories with steps something like:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cd /usr &amp;lt;br&amp;gt;find . -name netcdf.mod -print&amp;lt;br&amp;gt;&amp;lt;/span&amp;gt;  ./local/netcdf-3.6.2/include/netcdf.mod &amp;lt;br&amp;gt;  ./local/netcdf/intel/3.6.3/include/netcdf.mod&amp;lt;/div&amp;gt;This tells us the most recent (3.6.3) netcdf is in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/usr/local/netcdf/intel/3.6.3&amp;lt;/span&amp;gt;. Direct ROMS to this location by making two changes to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt;. First, advise ROMS to read your changes to the default library path by uncommenting the option for &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_MY_LIBS&amp;lt;/span&amp;gt;.&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;      &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;USE_MY_LIBS&amp;lt;/span&amp;gt;=on&amp;lt;/div&amp;gt; Then specifiy the correct location for netcdf:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;      &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NETCDF_INCDIR&amp;lt;/span&amp;gt;=/usr/local/netcdf/intel/3.6.3/include&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt;      &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;NETCDF_LIBDIR&amp;lt;/span&amp;gt;=/usr/local/netcdf/intel/3.6.3/lib&amp;lt;/div&amp;gt; {{warning}} Be careful where you make this change. You need to make it for the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ifort&amp;lt;/span&amp;gt; compiler option, and NOT for the &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;USE_NETCDF4&amp;lt;/span&amp;gt; option (we are using netcdf-3). If you&#039;ve done this correctly, your compilation with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; should now succeed.&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;error &amp;lt;br&amp;gt;error: &amp;lt;/div&amp;gt; Note here further errors we encounter during the tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Run ROMS==&lt;br /&gt;
&lt;br /&gt;
You run ROMS by executing the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanG&amp;lt;/span&amp;gt; (or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;oceanS&amp;lt;/span&amp;gt;) binary, giving it the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt; file as UNIX standard input. &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./oceanS &amp;lt; ocean_upwelling.in&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; ROMS standard output will be typed to the screen. To save it a file instead, enter, e.g.:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./oceanS &amp;lt; ocean_upwelling.in &amp;gt; my_upwelling.log &amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have compiled a parallel (MPI) executable, the syntax for running the mode is slightly &#039;&#039;&#039;but critically&#039;&#039;&#039; different. The &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt; file is no longer read from UNIX standard input (it has handled by all the MPI threads) so the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;&amp;lt;&amp;quot;&amp;lt;/span&amp;gt; disappears from the command, and you need the correct syntax on your UNIX host for running an MPI process. It is probably something like: &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;mpirun -np 8 ./oceanM ocean_upwelling.in &amp;gt; my_upwelling.log&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; where the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;-np 8&amp;quot;&amp;lt;/span&amp;gt; indicates use 8 processors and this number of tiles must have been set by   &lt;br /&gt;
&lt;br /&gt;
(See also [[Frequently_Asked_Questions#What_do_I_have_to_do_to_run_an_application.3F | FAQ: What do I have to do to runs ROMS?]]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Common &#039;&#039;getting started&#039;&#039; run error messages===&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;bash: oceanG: command not found&amp;lt;/div&amp;gt;The working directory is not in your UNIX path. That&#039;s why we type &amp;quot;dot-slash&amp;quot; in front of the commands above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Successful execution==&lt;br /&gt;
&lt;br /&gt;
===Standard Output===&lt;br /&gt;
&lt;br /&gt;
When ROMS runs it will type a lot of information to UNIX standard output. This is the &amp;quot;logfile&amp;quot; you named following the &amp;quot;&amp;gt;&amp;quot;, or your terminal if you did not redirect stdout. &lt;br /&gt;
&lt;br /&gt;
STDOUT shows the following:&lt;br /&gt;
&lt;br /&gt;
:*UNIX process info, run time, run TITLE &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Process Information: &amp;lt;br&amp;gt; Thread #  0 (pid=    4449) is active. &amp;lt;br&amp;gt; Model Input Parameters:  ROMS/TOMS version 3.2 &amp;lt;br&amp;gt;        Monday - March 23, 2009 - 10:02:39 AM &amp;lt;br&amp;gt;----------------------------------------------------------- &amp;lt;br&amp;gt; Wind-Driven Upwelling/Downwelling over a Periodic Channel&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*OS, compiler information, SVN version, and your MY_ROMS_SRC, MY_HEADER_DIR and ROMS_APPLICATION settings&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Operating system : Linux&amp;lt;br&amp;gt;CPU/hardware     : i686&amp;lt;br&amp;gt;Compiler system  : ifort &amp;lt;br&amp;gt;Compiler command : /usr/local/intel/fc/10.1.021/bin/ifort &amp;lt;br&amp;gt;Compiler flags   : -heap-arrays -ip -O3 -pc80 -xW -free&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;SVN Root URL  : &amp;lt;nowiki&amp;gt;https://www.myroms.org/svn/src/trunk&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;SVN Revision  : 333&amp;lt;br&amp;gt;Local Root    : /srv/ckpt/roms/shared/src&amp;lt;br&amp;gt;Header Dir    : /student/0/a0000020/srv/Projects/upwelling&amp;lt;br&amp;gt;Header file   : upwelling.h&amp;lt;br&amp;gt;Analytical Dir: /student/0/a0000020/srv/Projects/upwelling&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Resolution, Grid 01: 0041x0080x016,  Parallel Threads:  1,  Tiling: 001x001&amp;lt;/div&amp;gt;Check that these are what you intended. In last line above&lt;br /&gt;
::*&amp;quot;Grid 01&amp;quot; pertains to future ROMS developments with multiple nested/connected grids, &lt;br /&gt;
::* 0041x0080x016 shows the grid size is 41 x 80 x 16 grid points in the K,J,I directions&lt;br /&gt;
::* The Parallel/Tiling message shows you are using a single process and a single domain tile. When using MPI, this message will describe how many tiles you are using and the MPI processes assigned. &lt;br /&gt;
&lt;br /&gt;
:*Input parameters set in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt;&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Physical Parameters, Grid: 01&amp;lt;br&amp;gt;=============================&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;        288  ntimes          Number of timesteps for 3-D equations.&amp;lt;br&amp;gt;    300.000  dt              Timestep size (s) for 3-D equations.&amp;lt;br&amp;gt;         30  ndtfast         Number of timesteps for 2-D equations between&amp;lt;br&amp;gt;                               each 3D timestep.&amp;lt;br&amp;gt;   ...&amp;lt;br&amp;gt;            Output Averages File:  ocean_avg.nc&amp;lt;br&amp;gt;         Output Diagnostics File:  ocean_dia.nc&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*Then some more about the tiling when running in parallel&lt;br /&gt;
&lt;br /&gt;
:*The C-PreProcessor (CPP) flags set in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; but &#039;&#039;&#039;AS MODIFIED&#039;&#039;&#039; by ROMS when interpreting and checking the selected CPP options.  &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Activated C-preprocessing Options:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  UPWELLING          Wind-Driven Upwelling/Downwelling over a Periodic Channel&amp;lt;br&amp;gt;  ANA_BSFLUX         Analytical kinematic bottom salinity flux.&amp;lt;br&amp;gt;  ANA_BTFLUX         Analytical kinematic bottom temperature flux.&amp;lt;br&amp;gt;  ANA_GRID           Analytical grid set-up.&amp;lt;br&amp;gt;  ANA_INITIAL        Analytical initial conditions.&amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;You should check that the CPP options displayed here agree with what you intended. For example, if you inadvertently specify more than one horizontal advection scheme option, ROMS will have chosen only one and reported that option here.&lt;br /&gt;
&lt;br /&gt;
:*The preamble in STDOUT continues with information about the space and time discretization: grid spacing, grid volume, Courant number (time step stability) and stiffness (related to s-coordinate accuracy).&lt;br /&gt;
&lt;br /&gt;
:*Then the model starts time stepping:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;NL ROMS/TOMS: started time-stepping: (Grid: 01 TimeSteps: 00000001 - 00000288)&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   STEP   Day HH:MM:SS  KINETIC_ENRG   POTEN_ENRG    TOTAL_ENRG    NET_VOLUME&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;      0     0 00:00:00  0.000000E+00  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;      DEF_HIS   - creating history file: ocean_his.nc&amp;lt;br&amp;gt;      WRT_HIS   - wrote history  fields (Index=1,1) into time record = 000000&amp;lt;br&amp;gt;      DEF_AVG   - creating average file: ocean_avg.nc&amp;lt;br&amp;gt;      DEF_DIAGS - creating diagnostics file: ocean_dia.nc&amp;lt;br&amp;gt;      1     0 00:05:00  3.268255E-13  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;      2     0 00:10:00  6.503587E-12  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;      3     0 00:15:00  4.592307E-11  6.579497E+02  6.579497E+02  3.884376E+11&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;This output indicates several things:&lt;br /&gt;
::*the run is programmed to run from time step 1 to 288&lt;br /&gt;
::*the run starts at time 00:00:0&lt;br /&gt;
::*netcdf output HISTORY, AVERAGES and DIAGNOSTICS files are created. Every time ROMS creates a new netcdf file, and writes to an existing file, it reports this to STDOUT&lt;br /&gt;
::*output is written to the HISTORY file&lt;br /&gt;
::*then global quantities related to the model KE, PE and domain volume are reported on each time step&lt;br /&gt;
&lt;br /&gt;
{{note}} In 99% of situations, &#039;&#039;getting started&#039;&#039; problems with model set-up and configuration can be diagnosed by carefully reading the STDOUT above. Things to look for are:&lt;br /&gt;
:*misconfigured CPP options (what you got is not what you thought you asked for)&lt;br /&gt;
:*parameter errors (e.g. you activated horizontal mixing but left the coefficient as zero)&lt;br /&gt;
:*misnamed output files (that&#039;s why the files from your last run got overwritten)&lt;br /&gt;
:*irrational choices of grid spacing or time step  &lt;br /&gt;
:*initial/boundary/forcing data being read from the wrong file, or not read at all (because you selected analytical conditions)&lt;br /&gt;
&lt;br /&gt;
At the conclusion of the run, ROMS reports information about run time:&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Elapsed CPU time (seconds):&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; Thread #  0 CPU:     108.079&amp;lt;br&amp;gt; Total:               108.079&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Nonlinear model elapsed time profile:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  Initialization ...................................         0.016  ( 0.0148 %)&amp;lt;br&amp;gt;  Processing of input data .........................         0.028  ( 0.0259 %)&amp;lt;br&amp;gt;  Processing of output time averaged data ..........         4.312  ( 3.9899 %)&amp;lt;br&amp;gt;   ... &amp;lt;/div&amp;gt;&lt;br /&gt;
:*about the number of output records written to each file&lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; ROMS/TOMS - Output NetCDF summary for Grid 01: &amp;lt;br&amp;gt;             number of time records written in HISTORY file = 00000005 &amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;&lt;br /&gt;
:*and the analytical files included &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt; Analytical header files used:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;     ROMS/Functionals/ana_btflux.h&amp;lt;br&amp;gt;     ROMS/Functionals/ana_grid.h&amp;lt;br&amp;gt;   ...&amp;lt;/div&amp;gt;If you used a modified analytical file in your &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;MY_HEADER_DIR&amp;lt;/span&amp;gt; it will be reported here and is another thing you should check for consistency with your intentions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Netcdf file output===&lt;br /&gt;
&lt;br /&gt;
As reported above, ROMS created 4 output netcdf files when it ran. There are ocean_his.nc, ocean_avg.nc, ocean_dia.nc, and coean_rst.nc. These are, respectively:&lt;br /&gt;
:*history records or &#039;snapshots&#039; of the model state a selected time intervals&lt;br /&gt;
:*averages of the model state over selected intervals (not necessarily the same intervals as the history)&lt;br /&gt;
:*diagnostics of the model state, the precise contents of which are controlled by CPP options&lt;br /&gt;
:*a restart file with everything ROMS needs to restart a application. This is useful if your job crashes at some point and you want to recommence from a previous state without starting over. Typically the restart file is set to keep just 2 time records by continually over-writing the oldest as the run proceeds. This behaviour is controlled in ocean_upwelling.in. Also, when ROMS &amp;quot;blows up&amp;quot; it dumps the ocean state to a 3rd record in the restart file. &lt;br /&gt;
&lt;br /&gt;
You can browse the contents of netcdf files at the UNIX command line with the command ncdump, e.g. &lt;br /&gt;
::&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ncdump -h ocean_his.nc | more&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
Note the use of the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&amp;quot;-h&amp;quot;&amp;lt;/span&amp;gt; option. This restricts the output from ncdump to be just the header information, or metadata, in the netcdf file. Without the &amp;quot;-h&amp;quot; option you will get the entire contents of the file converted to ascii.  &lt;br /&gt;
&lt;br /&gt;
Things to notice when you ncdump the ocean_his.nc file are that it contains all the input parameters (time step, mixing coefficients, s-coordinate parameters, etc.) from ocean.in, the model grid coordinates (x, y, lon, lat, depth, Coriolis parameter, etc.) which may have been computed by the ANA_GRID option or read from an input grid netcdf file, in addition to the actual model output (ocean_time, zeta, u, v, temp, salt). &lt;br /&gt;
&lt;br /&gt;
There are netcdf &#039;&#039;&#039;global attributes&#039;&#039;&#039; that echo much of the information typed to STDOUT. This includes compiler, svn version, and project directory information, and all the CPP options. This is a valuable source of information when returning to a project and trying to figure out what you did!  The global attributes metadata show precisely which options were activated when creating the output in this netcdf file.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Changing the UPWELLING test case configuration==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Compile time changes: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Run time changes: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_upwelling.in&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A &#039;&#039;Realistic&#039;&#039; model example: LaTTE==&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial assumes you have successfully compiled and run the UPWELLING example above. Key concepts you should be comfortable with to proceed are:&lt;br /&gt;
:*you need a new directory where you will keep the files specific to the new application&lt;br /&gt;
:*customize &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; for the new application (copy the build.bash from &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;upwelling&amp;lt;/span&amp;gt; because it has all the correct compiler and library settings)&lt;br /&gt;
:*set &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;MY_PROJECT_DIR&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; to point to the directory for the new application&lt;br /&gt;
:*set &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;build.bash&amp;lt;/span&amp;gt; to the correct name for the new application&lt;br /&gt;
:*if you wish to customize any of the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; files, copy just the ones you need into the new project directory &lt;br /&gt;
:*you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; need to make a copy the source code a new application&lt;br /&gt;
&lt;br /&gt;
With these concepts in mind, we proceed by configuring ROMS to run a realistic coastal ocean application that includes open boundaries on 3 sides, open boundary tides and climatology velocity and tracer (temperature and salinity) conditions, surface meteorological forcing, and initial conditions, all provided by input netcdf files. The example is called LaTTE_C because it simulates ocean conditions during the &#039;&#039;&#039;Lagrangian Transport and Transformation Experiment&#039;&#039;&#039; conducted on the New Jersey inner shelf in the Spring of 2006. The &#039;_C&#039; denotes a coarse resolution configuration suitable for this training exercise. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Create a latte_c project directory===&lt;br /&gt;
&lt;br /&gt;
We have placed the CPP options file &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;latte_c.h&amp;lt;/span&amp;gt;, standand input &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ocean_lattec.in&amp;lt;/span&amp;gt;, and a modified &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/srv/ckpt/roms/shared/latte_c/Forward&amp;lt;/span&amp;gt;. Make a new Project directory for this new application and copy these 3 files. &#039;&#039;&#039;DO NOT&#039;&#039;&#039; copy all the netcdf files from &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;/srv/ckpt/roms/shared/latte_c/in&lt;br /&gt;
&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Edit build.bash===&lt;br /&gt;
&lt;br /&gt;
Set the correct entries for ROMS_APPLICATION and MY_PROJECT_DIR&lt;br /&gt;
&lt;br /&gt;
===Edit ocean_lattec.in===&lt;br /&gt;
&lt;br /&gt;
Change the entries for GRDNAME etc so that ROMS finds the shared input files.&lt;br /&gt;
&lt;br /&gt;
Change the path for HISNAME and other outputs so that your output is written to your own work space.&lt;br /&gt;
&lt;br /&gt;
===Compile with build.bash===&lt;br /&gt;
&lt;br /&gt;
==Before we run latte_c==&lt;br /&gt;
&lt;br /&gt;
===Browse the latt_c.h options===&lt;br /&gt;
&lt;br /&gt;
===Browse input netcdf files===&lt;br /&gt;
&lt;br /&gt;
Use ncdump -h&lt;br /&gt;
&lt;br /&gt;
==Run the latte_c example==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plotting netcdf outout with Matlab==&lt;br /&gt;
&lt;br /&gt;
===Basics of Matlab-Netcdf===&lt;br /&gt;
&lt;br /&gt;
===Using roms_wilkin routines===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3612</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3612"/>
		<updated>2009-03-23T17:38:57Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This will continue using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A case study in troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101 Its the waves===&lt;br /&gt;
===Analytical waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3611</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3611"/>
		<updated>2009-03-23T17:20:31Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This will continue using the LATTE example presented during the [[ROMS_UNSW2008|Monday tutorial]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A Case Study in Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101 Its the waves===&lt;br /&gt;
===Analytical Waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3610</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3610"/>
		<updated>2009-03-23T17:01:29Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This will which will continue using the LATTE example started on [[ROMS_UNSW2008|Monday]].&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we do. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A Case Study in Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
&lt;br /&gt;
===Sediment 101 Its the waves===&lt;br /&gt;
===Analytical Waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3609</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3609"/>
		<updated>2009-03-23T16:57:52Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This will which will continue using the LATTE example started on Monday.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we do. &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the LATTE case==&lt;br /&gt;
&lt;br /&gt;
==Change the advection scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A Case Study in Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
===Sediment 101: Its the waves, s...===&lt;br /&gt;
===Analytical Waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;br /&gt;
&lt;br /&gt;
==Wave-current coupling==&lt;br /&gt;
&lt;br /&gt;
==Realistic sediment==&lt;br /&gt;
&lt;br /&gt;
==Stuff not covered in the LATTE example==&lt;br /&gt;
&lt;br /&gt;
===Bedload===&lt;br /&gt;
&lt;br /&gt;
===Morphodynamics===&lt;br /&gt;
&lt;br /&gt;
===Wetting and drying===&lt;br /&gt;
&lt;br /&gt;
===Cohesive and Mixed Sediment===&lt;br /&gt;
&lt;br /&gt;
===&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3608</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3608"/>
		<updated>2009-03-23T16:51:14Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments. This will which will continue using the Latte example.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial, . &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Test the Latte Case==&lt;br /&gt;
&lt;br /&gt;
==Change the Advection Scheme==&lt;br /&gt;
&lt;br /&gt;
==Turn on Sediment==&lt;br /&gt;
&lt;br /&gt;
===Changes to the .h file===&lt;br /&gt;
===Additions to the init file===&lt;br /&gt;
&lt;br /&gt;
==A Case Study in Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
==Why so boring?==&lt;br /&gt;
===Sediment 101: Its the waves, s...===&lt;br /&gt;
===Analytical Waves===&lt;br /&gt;
&lt;br /&gt;
==SWAN - A Digression==&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3607</id>
		<title>CSTMS UNSW2008</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=CSTMS_UNSW2008&amp;diff=3607"/>
		<updated>2009-03-23T16:33:27Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: New page: &amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;  &amp;#039;&amp;#039;&amp;#039;A tutorial for new ROMS users will be held at the UNSW Computer Labs on Monday 30 March 2009, immediately prior to the ROM...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Adding Sediment to the Latte Example&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A tutorial for new ROMS users will be held at the UNSW Computer Labs on Monday 30 March 2009, immediately prior to the ROMS Sydney 2009 User Workshop at the Sydney Institute of Marine Sciences, 31 March to 2 April 2009. On Friday, 3 April, there will be a tutorial for new ROMS users interested in sediments which will continue using the Latte example.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial, . &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Download ROMS==&lt;br /&gt;
&lt;br /&gt;
The disk space available on the UNSW Computer Lab machines is quite limited, so for the purposes of this tutorial we have downloaded the ROMS so&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Tutorials&amp;diff=3606</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Tutorials&amp;diff=3606"/>
		<updated>2009-03-23T16:03:41Z</updated>

		<summary type="html">&lt;p&gt;Csherwood: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS Tutorials&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This page is for tutorials on using ROMS and other related software. If you create a tutorial please create a link to that tutorial in the list below.&lt;br /&gt;
&lt;br /&gt;
==Installing ROMS==&lt;br /&gt;
:*[[ROMS_Cygwin|Installing ROMS in Windows XP/Vista (via Cygwin)]]&lt;br /&gt;
:*[[ROMS_UNSW2008|Installing and Running ROMS for First Time Users. Tutorial at UNSW Computer Labs, 30 March 2009]]&lt;br /&gt;
&lt;br /&gt;
==Sediment Tutorials==&lt;br /&gt;
:*[[CSTMS_UNSW2008|Adding sediment to the Latte example. Tutorial at UNSW Computer Labs, 3 April 2009]]&lt;br /&gt;
&lt;br /&gt;
==Utilities and Tools==&lt;br /&gt;
:*[[MEXNC|For Matlab users: Installing MEXNC, SNCTOOLS and ROMS-Matlab-toolkit]]&lt;br /&gt;
:*[[Plotting_Package_Installation|Installing and Using the ROMS/TOMS Plotting Package]]&lt;br /&gt;
&lt;br /&gt;
==Grid Generation Tutorials==&lt;/div&gt;</summary>
		<author><name>Csherwood</name></author>
	</entry>
</feed>