<?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=Wilkin</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=Wilkin"/>
	<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/Special:Contributions/Wilkin"/>
	<updated>2026-04-27T13:47:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=River_Runoff&amp;diff=6692</id>
		<title>River Runoff</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=River_Runoff&amp;diff=6692"/>
		<updated>2026-04-27T03:55:47Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* River (Point Sources) Input */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Description of River Input&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==River (Point Sources) Input==&lt;br /&gt;
&lt;br /&gt;
To configure point sources (typically rivers) or sinks and their associated concentrations of tracers (temperature, salt, inert tracers, ecosystem, and sediment constituents, etc.), it is necessary to specify information on the locations of the sources, their transport as a volume flux, how the volume flux is to be distributed over vertical s-coordinate levels, flow direction, and tracer concentrations. The information can be provided analytically or in a forcing NetCDF file.&lt;br /&gt;
&lt;br /&gt;
To provide the information analytically, you need to define the [[Options|CPP option]] [[ANA_PSOURCE]] and configure the sources in the [[ana_psource.h]] Functional. This procedure is described later below. If [[ANA_PSOURCE]] is not defined, the default is to look for the information in a source/sink forcing NetCDF file. You can&#039;t mix analytical sources and netcdf inputs. It has to be one or the other. &lt;br /&gt;
&lt;br /&gt;
Regardless of how the source locations and conditions are provided (whether by [[ANA_PSOURCE]] or a NetCDF file), the point source code is activated by two sets of logical flags in [[roms.in]].&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; In versions of ROMS prior to November 2013 point sources were activated with CPP options [[UV_PSOURCE]] (or [[Q_PSOURCE]]) and [[TS_PSOURCE]]. Those options have been eliminated (see ticket https://www.myroms.org/projects/src/ticket/616) to allow nesting. All grids run the same executable in nesting, so code that might execute in one grid but not all must be activated selectively using logical flags.&lt;br /&gt;
&lt;br /&gt;
The relevant section of [[roms.in]] is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;! Logical switches (TRUE/FALSE) to activate horizontal momentum transport&amp;lt;br/&amp;gt;! point Sources/Sinks (like river runoff transport) and mass point &amp;lt;br/&amp;gt;! Sources/Sinks (like volume vertical influx), [1:Ngrids].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;       LuvSrc == T                         ! horizontal momentum transport&amp;lt;br/&amp;gt;       LwSrc == F                          ! volume vertical influx&amp;lt;br/&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; option imposes sources/sinks via the horizontal velocity that crosses a u-face or v-face of a cell. The advection operator then diverges the associated volume and tracer fluxes.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; option imposes sources by directly adding to the volume and tracer divergence terms. &lt;br /&gt;
&lt;br /&gt;
Only one of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; or &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; can be true and this selection applies to all sources in the model set-up. &lt;br /&gt;
&lt;br /&gt;
Prior to July 2020 the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; option was coded incorrectly and the majority of ROMS users opted for the LuvSrc approach when specifying river inflows. The &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; option is now corrected (see ticket https://www.myroms.org/projects/src/ticket/860) and both options are valid choices.&lt;br /&gt;
&lt;br /&gt;
The principal difference between these options is that LuvSrc adds horizontal momentum to the system at the inflow cell, whereas LwSrc does not. &lt;br /&gt;
&lt;br /&gt;
With LuvSrc it can happen that at very high river discharge the inflow velocity violates CFL stability because the inflow cell area is small (narrow width and/or small height &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;h+ζ&amp;lt;/span&amp;gt;). In this situation, &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; should still be stable because it does not affect the horizontal momentum equations. &lt;br /&gt;
&lt;br /&gt;
With &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt;, the rivers must be placed at cells on the land/sea boundary. With &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt;, they can in principle be located at any ocean cell.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; You may not be able to simply switch between &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; options in [[roms.in]] without modifying the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Eposition&amp;lt;/span&amp;gt; information. This is explained below.&lt;br /&gt;
&lt;br /&gt;
The introduction of tracer fluxes at point sources/sinks is activated with a second set of logical flags.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;! Logical switches (TRUE/FALSE) to activate tracers point Sources/Sinks&amp;lt;br/&amp;gt;! (like river runoff) and to specify which tracer variables to consider:&amp;lt;br/&amp;gt;! [1:NAT+NPT,Ngrids].  See glossary below for details.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;  LtracerSrc == F T                        ! temperature, salinity, inert ...&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example says to impose salinity but not temperature conditions in the river inflow. This requires that variable &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_salt&amp;lt;/span&amp;gt; is present in the river forcing NetCDF, or is set in [[ana_psource.h]].&lt;br /&gt;
&lt;br /&gt;
If passive tracers are being used, by having set #define [[T_PASSIVE]] and the associated options in [[roms.in]], then for those tracers to flow in at a point source the LtracerSrc must also be set to True:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;  &amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;LtracerSrc == F T F T                    ! temperature, salinity, inert ...&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example says impose the concentration of passive tracer 2, but not passive tracer 1, in all the rivers. (Remember, the first two flags are for temp and salt). In this case, variable &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_dye_02&amp;lt;/span&amp;gt; must be in the river forcing NetCDF (or set in [[ana_psource.h]]). If you want &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;dye_02&amp;lt;/span&amp;gt; to enter through some rivers but not all, then you set the concentration of &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_dye_02&amp;lt;/span&amp;gt; to zero in the appropriate rivers in the forcing file.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LtracerSrc&amp;lt;/span&amp;gt; logical switches replace and eliminate the variable &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_flag(river)&amp;lt;/span&amp;gt; in the input rivers forcing NetCDF file.&lt;br /&gt;
&lt;br /&gt;
In applications where point sources of biogeochemical or sediment tracers are to be imposed there are corresponding logical flags in &#039;&#039;e.g.&#039;&#039; [[bio_Fennel.in]] and [[sediment.in]].&lt;br /&gt;
&lt;br /&gt;
For example, in [[bio_Fennel.in]]:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;! Logical switches (TRUE/FALSE) to activate biological tracers point&amp;lt;br/&amp;gt;! Sources/Sinks (like river runoff) and to specify which tracer variables&amp;lt;br/&amp;gt;! to consider: [NBT,Ngrids] values are expected. See glossary below for&amp;lt;br/&amp;gt;! details.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;  LtracerSrc == T T 10*F&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example says impose concentrations of the first two Fennel model biogeochemical tracers (dissolved nitrate and ammonium) in the rivers but do not impose inflows for any of the other biological model tracers. In this case, variables river_NO3 and river_NH4 must be in the river forcing NetCDF file (or set in ana_psource.h).&lt;br /&gt;
&lt;br /&gt;
The name of the river forcing file is set by its own keyword &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;SSFNAME&amp;lt;/span&amp;gt; in [[roms.in]]. &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;! Input Sources/Sinks forcing (like river runoff) filename.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;     SSFNAME == ocean_rivers.nc&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039;This is a change from versions before 11/25/2013 in which the river file was included in the [[FRCNAME]] list with other forcing files (meteorology, tides, etc.).&lt;br /&gt;
&lt;br /&gt;
The rivers NetCDF forcing file format is presented in the template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;frc_rivers.cdl&amp;lt;/span&amp;gt; file (in the Data/ROMS/CDL section of the svn distribution).&lt;br /&gt;
&lt;br /&gt;
== River NetCDF template ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;dimensions:&amp;lt;br/&amp;gt;	s_rho = 30 ;&amp;lt;br/&amp;gt;	river = 4  ;&amp;lt;br/&amp;gt;	river_time = UNLIMITED ; // (0 currently)&amp;lt;br/&amp;gt;variables:&amp;lt;br/&amp;gt;	double river(river) ;&amp;lt;br/&amp;gt;		river:long_name = &amp;quot;river runoff identification number&amp;quot; ;&amp;lt;br/&amp;gt;	double river_direction(river) ;&amp;lt;br/&amp;gt;		river_direction:long_name = &amp;quot;river runoff grid-cell face flag&amp;quot; ;&amp;lt;br/&amp;gt;                river_direction:flag_values = &amp;quot;0, 1, 2&amp;quot; ;&amp;lt;br/&amp;gt;                river_direction:flag_meanings = &amp;quot;flow across u-face, flow across v-face, flow across w-face&amp;quot; ;&amp;lt;br/&amp;gt;	double river_Xposition(river) ;&amp;lt;br/&amp;gt;		river_Xposition:long_name = &amp;quot;river XI-position&amp;quot; ;&amp;lt;br/&amp;gt;                river_Xposition:LuvSrc_meaning = &amp;quot;i-index grid-cell of u- or v-face source/sink&amp;quot; ;&amp;lt;br/&amp;gt;                river_Xposition:LwSrc_meaning = &amp;quot;i-index grid-cell of w-face source/sink&amp;quot; ; &amp;lt;br/&amp;gt;	double river_Eposition(river) ;&amp;lt;br/&amp;gt;		river_Eposition:long_name = &amp;quot;river ETA-position&amp;quot; ;&amp;lt;br/&amp;gt;                river_Xposition:LuvSrc_True_meaning = &amp;quot;j-index grid-cell of u- or v-face source/sink&amp;quot; ;&amp;lt;br/&amp;gt;                river_Xposition:LwSrc_True_meaning = &amp;quot;j-index grid-cell of w-face source/sink&amp;quot; ;&amp;lt;br/&amp;gt;	double river_Vshape(s_rho, river) ;&amp;lt;br/&amp;gt;		river_Vshape:long_name = &amp;quot;river runoff mass transport vertical profile&amp;quot; ;&amp;lt;br/&amp;gt;		river_Vshape:requires = &amp;quot;must sum to 1 over s_rho coordinate&amp;quot; ;&amp;lt;br/&amp;gt;	double river_time(river_time) ;&amp;lt;br/&amp;gt;		river_time:long_name = &amp;quot;river runoff time&amp;quot; ;&amp;lt;br/&amp;gt;		river_time:units = &amp;quot;days since 2001-01-01 00:00:00&amp;quot; ;&amp;lt;br/&amp;gt;	double river_transport(river_time, river) ;&amp;lt;br/&amp;gt;		river_transport:long_name = &amp;quot;river runoff vertically integrated mass transport&amp;quot; ;&amp;lt;br/&amp;gt;		river_transport:units = &amp;quot;meter3 second-1&amp;quot; ;&amp;lt;br/&amp;gt;                river_transport:positive = &amp;quot;LuvSrc=T flow in positive u,v direction, LwSrc=T flow into grid-cell&amp;quot; ;&amp;lt;br/&amp;gt;                river_transport:negative = &amp;quot;LuvSrc=T flow in negative u,v direction, LwSrc=T flow out of grid-cell&amp;quot; ;&amp;lt;br/&amp;gt;		river_transport:time = &amp;quot;river_time&amp;quot; ;&amp;lt;br/&amp;gt;	double river_temp(river_time, s_rho, river) ;&amp;lt;br/&amp;gt;		river_temp:long_name = &amp;quot;river runoff potential temperature&amp;quot; ;&amp;lt;br/&amp;gt;		river_temp:units = &amp;quot;Celsius&amp;quot; ;&amp;lt;br/&amp;gt;		river_temp:time = &amp;quot;river_time&amp;quot; ;&amp;lt;br/&amp;gt;	double river_salt(river_time, s_rho, river) ;&amp;lt;br/&amp;gt;		river_salt:long_name = &amp;quot;river runoff salinity&amp;quot; ;&amp;lt;br/&amp;gt;		river_salt:time = &amp;quot;river_time&amp;quot; ;&amp;lt;br/&amp;gt;// global attributes:&amp;lt;br/&amp;gt;		:rivers = &amp;quot;(1) Connecticut River at Hartford, CT, (2) Hudson River at Green Island NY, (3) Penobscot River at Eddington, ME, (4) Delaware River at Trenton NJ &amp;quot; ;&amp;lt;br/&amp;gt;}&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Creating a river NetCDF file ==&lt;br /&gt;
&lt;br /&gt;
One approach to generating a rivers NetCDF file is to edit the CDL template above to reflect the number of rivers you have, the number of vertical levels (s_rho), and any other supporting metadata for your convenience. Then the unix command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;   ncgen -b -o myrivers.nc frc_rivers.cdl&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will create an empty netcdf file you can subsequently fill with data (e.g. inside Matlab). Another tool for creating rivers files is in Python as part of the [https://github.com/kshedstrom/pyroms pyroms package] under the examples/rivers directory. Other users can suggest other tools or approaches.&lt;br /&gt;
&lt;br /&gt;
== Function and interpretation of river forcing file variables == &lt;br /&gt;
&lt;br /&gt;
=== river_direction ===&lt;br /&gt;
&lt;br /&gt;
The NetCDF variable &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_direction&amp;lt;/span&amp;gt; is a flag indicating the grid-cell face where the point source or sink is specified for a particular application. Its values are read into ROMS variable [[Dsrc]]. A value of &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_direction=0&amp;lt;/span&amp;gt; corresponds for flow across the &#039;&#039;&#039;u&#039;&#039;&#039;-face, &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_direction=1&amp;lt;/span&amp;gt; corresponds for flow across the &#039;&#039;&#039;v&#039;&#039;&#039;-face, and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_direction=2&amp;lt;/span&amp;gt; corresponds for flow across the &#039;&#039;&#039;w&#039;&#039;&#039;-face, as shown in the diagram below.&lt;br /&gt;
&lt;br /&gt;
[[File:RiversDsrc.png|460px|none|thumb|Point Source/Sink grid-cell face entry/exit: &amp;lt;span class=&amp;quot;orange&amp;quot;&amp;gt;Dsrc=0&amp;lt;/span&amp;gt; flow across &#039;&#039;&#039;u&#039;&#039;&#039;-face, &amp;lt;span class=&amp;quot;green&amp;quot;&amp;gt;Dsrc=1&amp;lt;/span&amp;gt; flow across &#039;&#039;&#039;v&#039;&#039;&#039;-face, and &amp;lt;span class=&amp;quot;cyan&amp;quot;&amp;gt;Dsrc=2&amp;lt;/span&amp;gt; flow across &#039;&#039;&#039;w&#039;&#039;&#039;-face.]]&lt;br /&gt;
&lt;br /&gt;
There are two different methods to impose the point Source/Sink forcing in ROMS:&lt;br /&gt;
&lt;br /&gt;
* As a flux tern to the horizontal advection operator using input switch &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc = T&amp;lt;/span&amp;gt;. The point source enters the cell through the &#039;&#039;&#039;u&#039;&#039;&#039;-face or &#039;&#039;&#039;v&#039;&#039;&#039;-face at the specified &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j,k)&amp;lt;/span&amp;gt; location.&lt;br /&gt;
 &lt;br /&gt;
* As a volumetric flux term to horizontal mass divergence and horizontal tracer divergence operators using input switch &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc = T&amp;lt;/span&amp;gt;. The point source enters the cell through the &#039;&#039;&#039;w&#039;&#039;&#039;-face at the specified &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j,k)&amp;lt;/span&amp;gt; location.&lt;br /&gt;
&lt;br /&gt;
Notice that advection and divergence operators center the point Source/Sink effect at the ρ-point (cell center) for all values of [[Dsrc]], as shown in the above figure.&lt;br /&gt;
&lt;br /&gt;
Starting update [https://www.myroms.org/projects/src/ticket/905 src:ticket:905 (Jan 2022)], both &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; methods are allowed in an application. &amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;However, applying both methods to the same grid location is incorrect.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== river_Xposition and river_Eposition ===&lt;br /&gt;
&lt;br /&gt;
When using option &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc = T&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Eposition&amp;lt;/span&amp;gt; refer to the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; index of the &#039;&#039;&#039;u&#039;&#039;&#039;-face or &#039;&#039;&#039;v&#039;&#039;&#039;-face the flow crosses - NOT the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; index of the &#039;&#039;&#039;ρ&#039;&#039;&#039;-cell it flows into. The &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; values must follow ROMS Fortran numbering convention for the appropriate &#039;&#039;&#039;u&#039;&#039;&#039;-point or &#039;&#039;&#039;v&#039;&#039;&#039;-point on the ROMS staggered grid.&lt;br /&gt;
&lt;br /&gt;
This numbering convention is shown in the figure below for flow crossing a &#039;&#039;&#039;u&#039;&#039;&#039;-face into a cell from either the left or the right. This makes it more obvious why the index of the &#039;&#039;&#039;u&#039;&#039;&#039;-face must be specified because to give the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; indices of the receiving &#039;&#039;&#039;ρ&#039;&#039;&#039;-cell would be ambiguous.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;u&#039;&#039;&#039;-face or &#039;&#039;&#039;v&#039;&#039;&#039;-face should be a land/sea mask boundary (&#039;&#039;i.e.&#039;&#039;, a coastline). If the cell face is placed wholly in the land you get nothing because there is no wet cell for the flow to enter. If the face is in the middle of open water you have a situation where the flow at that cell face computed by the advection algorithm is &#039;&#039;&#039;REPLACED&#039;&#039;&#039;, not augmented, by the source.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RomsRiversLuvSrc.jpg|600px|none|thumb|&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; river point source position indexing. &#039;&#039;&#039;Case (a)&#039;&#039;&#039; river flows into rho cell &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; from the &#039;&#039;&#039;u&#039;&#039;&#039;-face to the left, here &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition = i&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Eposition = j&amp;lt;/span&amp;gt;. &#039;&#039;&#039;Case (b)&#039;&#039;&#039; river flows into rho cell &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; from the &#039;&#039;&#039;u&#039;&#039;&#039;-face to the right, here &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition = i+1&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Eposition = j&amp;lt;/span&amp;gt;.]] &lt;br /&gt;
&lt;br /&gt;
When using option &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc = T&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Eposition&amp;lt;/span&amp;gt; refer to the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; index of the rho cell it flows into. The &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; values must follow ROMS Fortran numbering convention appropriate to rho-points on the ROMS staggered grid. This is illustrated in the figure below. &lt;br /&gt;
&lt;br /&gt;
[[File:RomsRiversLwSrc.jpg|600px|none|thumb|&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; option river point source position indexing. &#039;&#039;&#039;Case (c)&#039;&#039;&#039; river flows into rho cell &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; directly. Here &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition = i&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Eposition = j&amp;lt;/span&amp;gt;. Contrast with the figure of &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; to see why for &#039;&#039;&#039;Case (b)&#039;&#039;&#039; sources it is necessary to subtract &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition&amp;lt;/span&amp;gt; if changing between &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; options.]]&lt;br /&gt;
&lt;br /&gt;
Comparing the two figures shows that you may not be able to simply switch between &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt; options in [[roms.in]] without modifying the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Eposition&amp;lt;/span&amp;gt; information. If all the inflows are &#039;&#039;&#039;Case (a)&#039;&#039;&#039;, and enter the cell from the left then it so happens that the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;(i,j)&amp;lt;/span&amp;gt; index of the receiving rho cell is the same, and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition&amp;lt;/span&amp;gt; does not need to be modified (likewise for &#039;&#039;&#039;v&#039;&#039;&#039;-direction inflows at &amp;lt;math&amp;gt;v_{i,j}&amp;lt;/math&amp;gt;). But if the inflow is &#039;&#039;&#039;Case (b)&#039;&#039;&#039; and enters from the right, then the &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;i&amp;lt;/span&amp;gt;-index of the rho-cell will be one less and the rivers file needs modification. A change to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_transport&amp;lt;/span&amp;gt; is also required. &lt;br /&gt;
&lt;br /&gt;
It is very easy to misconfigure source/sink positions so caution and&lt;br /&gt;
careful checking is required.&lt;br /&gt;
&lt;br /&gt;
=== river_transport ===&lt;br /&gt;
&lt;br /&gt;
This is very important and very confusing:&lt;br /&gt;
&lt;br /&gt;
The direction of the flow across a &#039;&#039;&#039;u&#039;&#039;&#039;-face or &#039;&#039;&#039;v&#039;&#039;&#039;-face source is controlled by the sign of the variable &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_transport&amp;lt;/span&amp;gt;, not by the variable &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_direction&amp;lt;/span&amp;gt;. In the figure above for &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt;, if the flow is through the left-hand &#039;&#039;&#039;u&#039;&#039;&#039;-face so as to add water to the &#039;&#039;&#039;ρ&#039;&#039;&#039;-cell immediately to the right, then that flow is in the positive &#039;&#039;&#039;u&#039;&#039;&#039;-direction and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_transport&amp;lt;/span&amp;gt; should be positive.&lt;br /&gt;
&lt;br /&gt;
If the flow is through the right-hand &#039;&#039;&#039;u&#039;&#039;&#039;-face so as to add water to the &#039;&#039;&#039;ρ&#039;&#039;&#039;-cell immediately to the left, then that flow is in the negative &#039;&#039;&#039;u&#039;&#039;&#039;-direction and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_transport&amp;lt;/span&amp;gt; should be negative.&lt;br /&gt;
&lt;br /&gt;
Likewise for a &#039;&#039;&#039;v&#039;&#039;&#039;-face source.&lt;br /&gt;
&lt;br /&gt;
This is a confusing sign convention, but it exists because in principle one could use the contrary sign for &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_transport&amp;lt;/span&amp;gt; to create a sink that removes volume from a cell. There is not a lot of experience using this option, but it&#039;s there.&lt;br /&gt;
&lt;br /&gt;
For &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt;, an inflowing source always has positive &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_transport&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
So if you want to modify a river-forcing file to switch from using &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt;, then if you had sources flowing in the negative &#039;&#039;&#039;u&#039;&#039;&#039;- or &#039;&#039;&#039;v&#039;&#039;&#039;-direction, in addition to the changes to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Xposition&amp;lt;/span&amp;gt; or &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Eposition&amp;lt;/span&amp;gt; you will need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_transport&amp;lt;/span&amp;gt; of those sources to be positive.&lt;br /&gt;
&lt;br /&gt;
=== river_Vshape ===&lt;br /&gt;
&lt;br /&gt;
Variable &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Vshape&amp;lt;/span&amp;gt; sets the fractional distribution of the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_transport&amp;lt;/span&amp;gt; among the vertical cells and must sum to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1.0&amp;lt;/span&amp;gt; over the vertical. If the sum over &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;k&amp;lt;/span&amp;gt; is not &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1.0&amp;lt;/span&amp;gt;, then the actual volume flux will depart from the value given in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_transport&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Vshape&amp;lt;/span&amp;gt; variable can be also used to &amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;specify the vertical location of the point Source/Sink&amp;lt;/span&amp;gt;. The point Source/Sink can be distributed over the entire water column or be confined to a particular vertical level like surface, bottom, or other levels in between. The only constraint is that the non-dimensional shape function must sum to &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1.0&amp;lt;/span&amp;gt; over the vertical range &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;k=1:N&amp;lt;/span&amp;gt; for each Source/Sink.&lt;br /&gt;
&lt;br /&gt;
If the river source is in shallow water several grid cells up a river tributary then a simple uniform vertical distribution (all &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Vshape&amp;lt;/span&amp;gt; values = &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;1/s_rho&amp;lt;/span&amp;gt;) usually works well. ROMS generates an estuarine circulation to mix the river water with the open ocean. You can manufacture a short tributary in the land/sea mask to do this.&lt;br /&gt;
&lt;br /&gt;
Some users set inflows directly into a deep cell along a coast and use &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;river_Vshape&amp;lt;/span&amp;gt; to weigh the inflow toward the sea surface. Use caution if you do this because it can generate 2-grid-point noise at the source and lead to tracer concentration overshoot and undershoot, which can introduce negative salinities.&lt;br /&gt;
&lt;br /&gt;
== Configuring point sources/sinks with ana_psource.h ==&lt;br /&gt;
&lt;br /&gt;
To configure point sources and sinks analytically instead of via a NetCDF file, set the following variables in ana_psource.h&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;Nsrc         ! Number of sources.&amp;lt;br/&amp;gt;Dsrc(is)     ! river_direction for each source is = 1:Nsrc&amp;lt;br/&amp;gt;Isrc(is)     ! river_Xposition i-coordinate (u or v point) for each source&amp;lt;br/&amp;gt;Jsrc(is)     ! river_Eposition j-coordinate (u or v point) for each source&amp;lt;br/&amp;gt;Qbar(is)     ! river_transport for each source following sign conventions noted above&amp;lt;br/&amp;gt;Qshape(is,k) ! river_Vshape distribution of the flow for each source, &amp;lt;br/&amp;gt;             ! and for every s-coordinate level k = 1:N&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example code in ana_psource.h for the test cases [[RIVERPLUME2]] and [[SED_TEST1]] illustrate how to compute Qshape using the vertical layer thicknesses (by differencing &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;z_w(i,j,k)&amp;lt;/span&amp;gt;) to achieve an inflow velocity profile that is uniform with depth.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;twilightBlue&amp;quot;&amp;gt;Tsrc(is,k,itemp)  ! temperature values for each source, at all vertical levels.&amp;lt;br/&amp;gt;Tsrc(is,k,isalt)  ! salinity values (usually zero for rivers), for each source and all levels.&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To include this code for analytical point sources/sinks, you must define [[ANA_PSOURCE]]. However, we discourage such practice in realistic applications because of shared-memory or distributed-memory parallel bugs. We recommend always creating the point source/sink NetCDF file. It is easy to check and modify and not subject to parallel bugs.&lt;br /&gt;
&lt;br /&gt;
The logical flags that activate the analytical sources/sink code at runtime (&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LuvSrc&amp;lt;/span&amp;gt; or &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LwSrc&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;LtracerSrc&amp;lt;/span&amp;gt;) must still be set in [[roms.in]], [[sediment.in]] and/or the appropriate biological model parameter file.&lt;br /&gt;
&lt;br /&gt;
If passive (biology, inert, sediment) tracers are being used, then their concentrations for each river and all vertical levels must also be set in [[ana_psource.h]] or in the input NetCDF file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--You can find examples on how to write such a river forcing file with the &amp;quot;&#039;&#039;&#039;Matlab&#039;&#039;&#039;&amp;quot; package &lt;br /&gt;
[https://www.myroms.org/index.php?page=Processing here]. You may also be interested in &lt;br /&gt;
[https://www.myroms.org/forum/viewtopic.php?t=63 this] forum post.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here are some forum discussions about the vertical profile of the flow.&lt;br /&gt;
#[https://www.myroms.org/forum/viewtopic.php?t=60 Treatment of rivers]&lt;br /&gt;
#[https://www.myroms.org/forum/viewtopic.php?t=79 More on rivers, ROMS2.0 to 2.1?]&lt;br /&gt;
&lt;br /&gt;
{{note}} Note that there may be information in these posts that is no longer relevant.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6659</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6659"/>
		<updated>2024-03-22T01:38:56Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Getting the files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example simulates tidal variability in a simple funnel shaped estuary. The estuary is triangular in width. Depth shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039; (the line of local maximum depth along the estuary axis). There are shallow flanks along the coast on either side of the thalweg. There is a simple linear increase in depth at the open ocean.&lt;br /&gt;
&lt;br /&gt;
There are 128 by 32 points in the horizontal. The grid, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
At the head of the estuary there is a steady river transport inflow with a value set using the USER parameters at run time in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary the inflow velocity is specified as the sum of 2 simple harmonic tidal constituents with amplitude and period set by the user at run time in file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. Uniform initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_fsobc.h, ana_m2obc.h&amp;lt;/span&amp;gt; These impose tidal forcing at the eastern boundary.&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_psource.h&amp;lt;/span&amp;gt; This imposes the river inflow.&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script, e.g. &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/span&amp;gt; (to use 4 processors at once while compiling)&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6658</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6658"/>
		<updated>2024-03-22T01:38:32Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Getting the files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example simulates tidal variability in a simple funnel shaped estuary. The estuary is triangular in width. Depth shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039; (the line of local maximum depth along the estuary axis). There are shallow flanks along the coast on either side of the thalweg. There is a simple linear increase in depth at the open ocean.&lt;br /&gt;
&lt;br /&gt;
There are 128 by 32 points in the horizontal. The grid, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
At the head of the estuary there is a steady river transport inflow with a value set using the USER parameters at run time in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary the inflow velocity is specified as the sum of 2 simple harmonic tidal constituents with amplitude and period set by the user at run time in file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. Uniform initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_fsobc.h, ana_m2obc.h&amp;lt;/span&amp;gt; These impose tidal forcing at the eastern boundary.&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; This imposes the river inflow.&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script, e.g. &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/span&amp;gt; (to use 4 processors at once while compiling)&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6657</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6657"/>
		<updated>2024-03-22T01:36:19Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Experimental design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example simulates tidal variability in a simple funnel shaped estuary. The estuary is triangular in width. Depth shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039; (the line of local maximum depth along the estuary axis). There are shallow flanks along the coast on either side of the thalweg. There is a simple linear increase in depth at the open ocean.&lt;br /&gt;
&lt;br /&gt;
There are 128 by 32 points in the horizontal. The grid, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
At the head of the estuary there is a steady river transport inflow with a value set using the USER parameters at run time in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary the inflow velocity is specified as the sum of 2 simple harmonic tidal constituents with amplitude and period set by the user at run time in file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. Uniform initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; (river inflow ... this is for later)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script, e.g. &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/span&amp;gt; (to use 4 processors at once while compiling)&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6656</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6656"/>
		<updated>2024-03-22T01:34:17Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Experimental design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example simulates tidal variability in a simple funnel shaped estuary. The estuary is triangular in width. Depth shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039; (the line of local maximum depth along the estuary axis). There are shallow flanks along the coast on either side of the thalweg. There is a simple linear increase in depth at the open ocean.&lt;br /&gt;
&lt;br /&gt;
There are 128 by 32 points in the horizontal. The grid, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary the inflow velocity is specified as the sum of 2 simple harmonic tidal constituents with amplitude and period set by the user at run time in file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. Uniform initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; (river inflow ... this is for later)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script, e.g. &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/span&amp;gt; (to use 4 processors at once while compiling)&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6655</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6655"/>
		<updated>2024-03-22T01:33:08Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Experimental design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example simulates tidal variability in a simple funnel shaped estuary. The estuary is triangular in width. Depth shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039; (the line of local maximum depth along the estuary axis). There are shallow flanks along the coast on either side of the thalweg. There is a simple linear increase in depth at the open ocean.&lt;br /&gt;
&lt;br /&gt;
There are 128 by 32 points in the horizontal. The grid, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary the inflow velocity is specified as the sum of 2 simple harmonic tidal constituents with amplitude and period set by the user at run time in file roms_cod_estuary.in.  &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. Uniform initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; (river inflow ... this is for later)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script, e.g. &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/span&amp;gt; (to use 4 processors at once while compiling)&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6653</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6653"/>
		<updated>2024-03-06T14:48:47Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Getting the files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; (river inflow ... this is for later)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script, e.g. &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/span&amp;gt; (to use 4 processors at once while compiling)&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6652</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6652"/>
		<updated>2024-03-06T14:48:11Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Getting the files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; (river inflow ... this is for later)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script, e.g. ./build_roms.sh -j 4 (to use 4 processors at once while compiling)&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6651</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6651"/>
		<updated>2024-03-06T14:47:56Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Getting the files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; (river inflow ... this is for later)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script, e.g. ./build_roms.sh - j 4 (to use 4 processors at once while compiling)&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6650</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6650"/>
		<updated>2024-03-06T14:46:49Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Getting the files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; (river inflow ... this is for later)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt;=COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6649</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6649"/>
		<updated>2024-03-06T14:46:18Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Getting the files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; (river inflow ... this is for later)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6648</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6648"/>
		<updated>2024-03-05T18:59:47Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Getting the files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;rivers_pcoord_estuary.nc&amp;lt;/span&amp;gt; (river inflow ... this is for later)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6647</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6647"/>
		<updated>2024-03-05T18:58:46Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Example COD_ESTUARY */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature, salinity and velocity on all 3 open boundaries. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;tides_pcoord_estuary_S2.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_estuary.in and edit your &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file accordingly&lt;br /&gt;
# Also modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_long.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;grid_pcoord_estuary_short.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6645</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6645"/>
		<updated>2024-02-06T16:12:52Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Obtaining the source code for examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_HUNTER_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid was designed by Eli Hunter, and has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature and salinity on all 3 boundaries. The velocity is &#039;&#039;periodic&#039;&#039; in the north-south direction. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_hunter_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_regular_grid.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_tides.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_HUNTER_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_hunter_estuary.in and edit your SLURM script, i.e. the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file, accordingly&lt;br /&gt;
# Modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_long_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_short_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6644</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6644"/>
		<updated>2024-02-06T16:12:27Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Obtaining the source code for examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h.&lt;br /&gt;
You don&#039;t want ALL the files because you will copy across some very big NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
The dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_HUNTER_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid was designed by Eli Hunter, and has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature and salinity on all 3 boundaries. The velocity is &#039;&#039;periodic&#039;&#039; in the north-south direction. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_hunter_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_regular_grid.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_tides.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_HUNTER_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_hunter_estuary.in and edit your SLURM script, i.e. the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file, accordingly&lt;br /&gt;
# Modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_long_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_short_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6643</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6643"/>
		<updated>2024-02-06T16:11:04Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Obtaining the source code for examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp -p /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp -p /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-p&#039;&#039;&#039; option preserves the timestamp on the file. This is helpful as a clue to whether you have changed the file or not. &lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h, and the dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. You don&#039;t want ALL the files becuase you will copy across some very gib NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_HUNTER_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid was designed by Eli Hunter, and has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature and salinity on all 3 boundaries. The velocity is &#039;&#039;periodic&#039;&#039; in the north-south direction. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_hunter_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_regular_grid.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_tides.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_HUNTER_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_hunter_estuary.in and edit your SLURM script, i.e. the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file, accordingly&lt;br /&gt;
# Modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_long_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_short_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6642</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6642"/>
		<updated>2024-02-06T16:00:16Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Python Jupyter notebook: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect instead of &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh fakeruser@amarel.rutgers.edu&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or we recommend you just leave it blank twice for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selection for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt;) hours&lt;br /&gt;
# Set the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (I suggest &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; for now)&lt;br /&gt;
# Set &#039;&#039;&#039;memory&#039;&#039;&#039; (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;8&amp;lt;/span&amp;gt; GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt;&lt;br /&gt;
# Leave &#039;&#039;Reservation&#039;&#039; blank&lt;br /&gt;
# For &#039;&#039;Slurm feature&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cascadelake&amp;lt;/span&amp;gt; so your session starts on our older nodes and does not interfere take the larger, faster cores being used by OMG&lt;br /&gt;
# For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt;&lt;br /&gt;
# For &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using. &lt;br /&gt;
&lt;br /&gt;
These settings are remembered the next time you access OnDemand. &lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes. &lt;br /&gt;
&lt;br /&gt;
You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
&lt;br /&gt;
Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
&lt;br /&gt;
This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
&lt;br /&gt;
Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
&lt;br /&gt;
At present the &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import&amp;lt;/span&amp;gt;&#039;&#039;&#039; steps are quite slow ... 30 seconds ... so be patient and don&#039;t re-run those cells in your notebook if you don&#039;t have to.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6641</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6641"/>
		<updated>2024-02-06T15:58:28Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Python Jupyter notebook: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect instead of &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh fakeruser@amarel.rutgers.edu&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or we recommend you just leave it blank twice for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selection for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt;) hours&lt;br /&gt;
# Set the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (I suggest &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; for now)&lt;br /&gt;
# Set &#039;&#039;&#039;memory&#039;&#039;&#039; (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;8&amp;lt;/span&amp;gt; GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt;&lt;br /&gt;
# Leave &#039;&#039;Reservation&#039;&#039; blank&lt;br /&gt;
# For &#039;&#039;Slurm feature&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cascadelake&amp;lt;/span&amp;gt; so your session starts on our older nodes and does not interfere take the larger, faster cores being used by OMG&lt;br /&gt;
# For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt;&lt;br /&gt;
# For &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using. &lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
&lt;br /&gt;
You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
&lt;br /&gt;
Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
&lt;br /&gt;
This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
&lt;br /&gt;
Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
&lt;br /&gt;
At present the &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import&amp;lt;/span&amp;gt;&#039;&#039;&#039; steps are quite slow ... 30 seconds ... so be patient and don&#039;t re-run those cells in your notebook if you don&#039;t have to.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6640</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6640"/>
		<updated>2024-02-06T15:55:11Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Python Jupyter notebook: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect instead of &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh fakeruser@amarel.rutgers.edu&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or we recommend you just leave it blank twice for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selection for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt;) hours&lt;br /&gt;
# Set the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (I suggest &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; for now)&lt;br /&gt;
# Set &#039;&#039;&#039;memory&#039;&#039;&#039; (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;8&amp;lt;/span&amp;gt; GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt;&lt;br /&gt;
# Leave &#039;&#039;Reservation&#039;&#039; blank&lt;br /&gt;
# For &#039;&#039;Slurm feature&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cascadelake&amp;lt;/span&amp;gt; so your session starts on our older nodes and does not interfere take the larger, faster cores being used by OMG&lt;br /&gt;
# For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt;&lt;br /&gt;
# For &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
&lt;br /&gt;
You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6639</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6639"/>
		<updated>2024-02-06T15:54:38Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Python Jupyter notebook: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect instead of &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh fakeruser@amarel.rutgers.edu&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or we recommend you just leave it blank twice for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selection for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt;) hours&lt;br /&gt;
# Set the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (I suggest &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; for now)&lt;br /&gt;
# Set &#039;&#039;&#039;memory&#039;&#039;&#039; (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;8&amp;lt;/span&amp;gt; GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt;&lt;br /&gt;
# Leave &#039;&#039;Reservation&#039;&#039; blank&lt;br /&gt;
# For &#039;&#039;Slurm feature&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cascadelake&amp;lt;/span&amp;gt; so your session starts on our older nodes and does not interfere take the larger, faster cores being used by OMG&lt;br /&gt;
# For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt;&lt;br /&gt;
# For &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6638</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6638"/>
		<updated>2024-02-06T15:54:18Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Python Jupyter notebook: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect instead of &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh fakeruser@amarel.rutgers.edu&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or we recommend you just leave it blank twice for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selection for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;3 hours&amp;lt;/span&amp;gt;)&lt;br /&gt;
# Set the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (I suggest &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt; for now)&lt;br /&gt;
# Set &#039;&#039;&#039;memory&#039;&#039;&#039; (&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;8&amp;lt;/span&amp;gt; GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt;&lt;br /&gt;
# Leave &#039;&#039;Reservation&#039;&#039; blank&lt;br /&gt;
# For &#039;&#039;Slurm feature&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cascadelake&amp;lt;/span&amp;gt; so your session starts on our older nodes and does not interfere take the larger, faster cores being used by OMG&lt;br /&gt;
# For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt;&lt;br /&gt;
# For &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6637</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6637"/>
		<updated>2024-02-06T15:53:27Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Python Jupyter notebook: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect instead of &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh fakeruser@amarel.rutgers.edu&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or we recommend you just leave it blank twice for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selection for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours)&lt;br /&gt;
# Set the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (I suggest 1 for now)&lt;br /&gt;
# Set &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt;&lt;br /&gt;
# Leave &#039;&#039;Reservation&#039;&#039; blank&lt;br /&gt;
# For &#039;&#039;Slurm feature&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cascadelake&amp;lt;/span&amp;gt; so your session starts on our older nodes and does not interfere take the larger, faster cores being used by OMG&lt;br /&gt;
# For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt;&lt;br /&gt;
# For &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6636</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6636"/>
		<updated>2024-02-06T15:52:15Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Python Jupyter notebook: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect instead of &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh fakeruser@amarel.rutgers.edu&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or we recommend you just leave it blank twice for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selection for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours)&lt;br /&gt;
# Set the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (I suggest 1 for now)&lt;br /&gt;
# Set &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt;&lt;br /&gt;
# Leave &#039;&#039;Reservation&#039;&#039; blank&lt;br /&gt;
# For &#039;&#039;Slurm feature&#039;&#039; enter &#039;&#039;cascadelake&#039;&#039; so your session starts on our older nodes and does not interfere take the larger, faster cores being used by OMG&lt;br /&gt;
# For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt;&lt;br /&gt;
# For &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6635</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6635"/>
		<updated>2024-01-30T21:02:40Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Mac OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect instead of &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh fakeruser@amarel.rutgers.edu&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or we recommend you just leave it blank twice for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6634</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6634"/>
		<updated>2024-01-30T21:00:51Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Mac OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect instead of ssh fakeuser@amarel.rutgers.edu.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6633</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6633"/>
		<updated>2024-01-30T20:57:07Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Mac OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6632</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6632"/>
		<updated>2024-01-30T20:55:49Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Mac OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering :&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/div&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6631</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6631"/>
		<updated>2024-01-30T20:54:55Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Mac OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/div&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6630</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6630"/>
		<updated>2024-01-25T16:37:11Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Using the SLURM batch job scheduler */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/cod/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6629</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6629"/>
		<updated>2024-01-25T16:36:35Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Using the SLURM batch job scheduler */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6628</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6628"/>
		<updated>2024-01-25T16:36:01Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Working with UNIX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/cod/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6627</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6627"/>
		<updated>2024-01-25T16:22:11Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Obtaining the source code for examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*.h&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod that end in .h, and the dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in. You don&#039;t want ALL the files becuase you will copy across some very gib NetCDF input and output files that you don&#039;t need (yet). &lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_HUNTER_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid was designed by Eli Hunter, and has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature and salinity on all 3 boundaries. The velocity is &#039;&#039;periodic&#039;&#039; in the north-south direction. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_hunter_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_regular_grid.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_tides.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_HUNTER_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_hunter_estuary.in and edit your SLURM script, i.e. the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file, accordingly&lt;br /&gt;
# Modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_long_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_short_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6626</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6626"/>
		<updated>2024-01-25T16:21:02Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Obtaining the source code for examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
cp /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod, and the dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in.&lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_HUNTER_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid was designed by Eli Hunter, and has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature and salinity on all 3 boundaries. The velocity is &#039;&#039;periodic&#039;&#039; in the north-south direction. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_hunter_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_regular_grid.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_tides.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_HUNTER_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_hunter_estuary.in and edit your SLURM script, i.e. the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file, accordingly&lt;br /&gt;
# Modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_long_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_short_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6625</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6625"/>
		<updated>2024-01-25T16:20:50Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Obtaining the source code for examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/*.h . &amp;lt;/br&amp;gt;&lt;br /&gt;
                 cp /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod, and the dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in.&lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_HUNTER_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid was designed by Eli Hunter, and has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature and salinity on all 3 boundaries. The velocity is &#039;&#039;periodic&#039;&#039; in the north-south direction. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_hunter_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_regular_grid.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_tides.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_HUNTER_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_hunter_estuary.in and edit your SLURM script, i.e. the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file, accordingly&lt;br /&gt;
# Modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_long_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_short_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6624</id>
		<title>COD Class Examples</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=COD_Class_Examples&amp;diff=6624"/>
		<updated>2024-01-25T16:20:02Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Obtaining the source code for examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;ROMS examples for Coastal Ocean Dynamics&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 &#039;&#039;Coastal Ocean Dynamics&#039;&#039; to illustrate various aspects of ocean dynamics studied in lectures. &lt;br /&gt;
&lt;br /&gt;
==Obtaining the source code for examples==&lt;br /&gt;
In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC &#039;&#039;Amarel&#039;&#039; cluster amarel.rutgers.edu in directory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. Users must be a member of UNIX group dmcs_1 to access these files.&lt;br /&gt;
&lt;br /&gt;
To get started, copy all the files in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to the working directory where you are locally compiling and running ROMS&amp;gt;. This is the directory where you ran the UPWELLING test case. &lt;br /&gt;
&lt;br /&gt;
Verify you are in your working directory with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;pwd&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then copy the .h and .in files with commands like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/*.h .&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/cod/*.in .&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;*&#039;&#039;&#039; is the wildcard for all files in /projects/dmcs_1/courses/cod, and the dot &#039;&#039;&#039;.&#039;&#039;&#039; signifies that the target directory is the directory you are in.&lt;br /&gt;
&lt;br /&gt;
Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don&#039;t want to overwrite files you have modified for your own work.&lt;br /&gt;
&lt;br /&gt;
==What are these files?==&lt;br /&gt;
&lt;br /&gt;
===cod_*.h files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file that will be activated to control compilation by setting ROMS_APPLICATION in your personal &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script. For example, for &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;, you will edit &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to set:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;COD_1DMIX&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
instead of the case &#039;&#039;&#039;UPWELLING&#039;&#039;&#039; that you had when you first ran ROMS.&lt;br /&gt;
&lt;br /&gt;
Once you have copied the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_*.h&amp;lt;/span&amp;gt; file to your working directory, and modified build_roms.sh, recompile by running the build script as you did before, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create a new &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;romsM&amp;lt;/span&amp;gt; executable file to run the COD example. &lt;br /&gt;
&lt;br /&gt;
===ana_*.h files===&lt;br /&gt;
The &#039;&#039;analytical&#039;&#039; files are new versions of files in the &#039;&#039;&#039;ROMS/Functionals&#039;&#039;&#039; subdirectory that you downloaded with &#039;&#039;&#039;svn&#039;&#039;&#039; that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#ifdef COD_1DMIX &amp;lt;/br&amp;gt; ... &amp;lt;/br&amp;gt;#endif&amp;lt;/div&amp;gt; &lt;br /&gt;
which will cause that section of code to be compiled when option &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039; is defined. &lt;br /&gt;
&lt;br /&gt;
This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;ana_*.h&amp;lt;/span&amp;gt; file because the code segments are selectively activated with CPP directives. &lt;br /&gt;
&lt;br /&gt;
Some of the class examples use default settings in the analytical files and do not need special instructions. &lt;br /&gt;
&lt;br /&gt;
===cod_*.in files===&lt;br /&gt;
Each class example has its own &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file that ROMS will read at run-time. This is equivalent to the file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; that you used when you first ran ROMS. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; script you use to submit the class examples to the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduler with the command  &#039;&#039;&#039;sbatch job.sh&#039;&#039;&#039; will have to be modified (at the srun command) to use the appropriate &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod*.in&amp;lt;/span&amp;gt; file. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;srun --mpi=pmi2 ./romsM roms_cod_1dmix.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuring your working directory files==&lt;br /&gt;
For each class example you will go through the following steps to start.&lt;br /&gt;
&lt;br /&gt;
Refer back to the instructions above for guidance: &lt;br /&gt;
&lt;br /&gt;
# Copy the necessary &#039;&#039;&#039;COD&#039;&#039;&#039; example case files to your working directory.&lt;br /&gt;
# Modify build_roms.sh to set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION=&amp;lt;/span&amp;gt; for example &#039;&#039;&#039;COD_1DMIX&#039;&#039;&#039;&lt;br /&gt;
# Compile ROMS, i.e. run &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;&lt;br /&gt;
# Modify your job.sh script to pass the correct input file, for example &#039;&#039;&#039;roms_cod_1dmix.in&#039;&#039;&#039;, to the srun command on the last line &amp;lt;/br&amp;gt; {{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; You must also modify &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to request the appropriate number of &#039;&#039;&#039;ntasks&#039;&#039;&#039; and &#039;&#039;&#039;ntasks-per-node&#039;&#039;&#039;. Review the entries for &#039;&#039;&#039;NtileI&#039;&#039;&#039; and &#039;&#039;&#039;NtileJ&#039;&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; file and determine the correct values to use.&lt;br /&gt;
# Submit the job to SLURM with sbatch.&lt;br /&gt;
# Check for the creation of the netcdf output files.&lt;br /&gt;
# View the output and error log files, i.e. the files named something like &#039;&#039;&#039;out.hal0007.12345678.log&#039;&#039;&#039; and &#039;&#039;&#039;err.hal0007.12345678.log&#039;&#039;&#039; to verify the run was successful, or diagnose the problem.&lt;br /&gt;
&lt;br /&gt;
In these examples, certain parameters are set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.&lt;br /&gt;
&lt;br /&gt;
==Example COD_1DMIX==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical. &lt;br /&gt;
&lt;br /&gt;
Review the parameters of the configuration set in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_1dmix.in&amp;lt;/span&amp;gt; in the block of code headed &#039;&#039;&#039;Generic User parameters&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! Generic User parameters, [1:NUSER].&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;        NUSER =  8&amp;lt;/br&amp;gt;!       user parameters for COD 1DMIX case&lt;br /&gt;
!              Coriolis  depth    wind     heat   strat     press    tidal    wave&lt;br /&gt;
!                  f       h     stress    flux    dTdz      grad   period  dissip&lt;br /&gt;
! simple steady wind&lt;br /&gt;
        USER =  0.0d-04  20.0d0  0.06d0   0.0d0   0.5d0     0.0d0  12.42d0  0.01d0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comment header lines indicate briefly what easy USER parameter sets:&lt;br /&gt;
&lt;br /&gt;
* USER(1) = Coriolis frequency (s&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(2) = water depth (m)&lt;br /&gt;
* USER(3) = steady surface wind stress (Pa)&lt;br /&gt;
* USER(4) = surface heat flux (W m&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(5) = initial temperature stratification (&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;C m&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;)&lt;br /&gt;
* USER(6) = magnitude of the oscillating body force pressure gradient forcing&lt;br /&gt;
* USER(7) = period of the oscillating body force pressure gradient forcing (hours)&lt;br /&gt;
* USER(8) = added turbulence at the sea surface due to wave breaking&lt;br /&gt;
&lt;br /&gt;
The default configuration has an initial thermal stratification and imposes a steady wind stress starting at time = 0. This causes turbulent mixing from the surface downward into the water column, working against the thermal and hence density stratification. Once the stress reaches the seafloor, bottom drag begins to drive turbulent mixing in a bottom boundary layer.&lt;br /&gt;
&lt;br /&gt;
Other parameters in any &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_*.in&amp;lt;/span&amp;gt; you might want to alter are:&lt;br /&gt;
&lt;br /&gt;
* NTIMES which sets the number of time steps to run for&lt;br /&gt;
* Hout and Aout, etc. logical flags that control what output is written to the NetCDF files&lt;br /&gt;
* GLS_* generic length-turbulence closure parameters. See the (long) GLOSSARY at the bottom of the file for guidance on how to set these for a different closure scheme.&lt;br /&gt;
* HISNAME, AVGNAME, etc. which set the names of the output files&lt;br /&gt;
&lt;br /&gt;
===Working with 1DMIX output in a Jupyter notebook===&lt;br /&gt;
&lt;br /&gt;
If you are a novice user of Python and Jupyter notebooks, you might find it useful to consult some of the resources collected by the Pythia Project in the Pythia Foundations Book &#039;&#039;[https://foundations.projectpythia.org/landing-page.html A community learning resource for Python-based computing in the geosciences]&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xroms&#039;&#039;&#039; package greatly facilitates working with ROMS output because it interprets the coordinate information that is recorded inside ROMS NetCDF files following CF (Climate-Forecasting) and CDM (Common Data Model) metadata conventions.&lt;br /&gt;
&lt;br /&gt;
You can get started with this minimal example of using xroms to plot a time versus depth ribbon of the temperature.&lt;br /&gt;
&lt;br /&gt;
These are more packages than you need import at first, but they are listed here for future reference:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;import xarray as xr&amp;lt;/br&amp;gt;import numpy as np&amp;lt;/br&amp;gt;import hvplot.xarray&amp;lt;/br&amp;gt;import matplotlib.pyplot as plt&amp;lt;/br&amp;gt;import matplotlib.cm as cm&amp;lt;/br&amp;gt;import matplotlib&amp;lt;/br&amp;gt;%matplotlib inline&amp;lt;/br&amp;gt;import xroms&amp;lt;/br&amp;gt;import cmocean.cm as cmo&lt;br /&gt;
import xcmocean &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF &amp;quot;history&amp;quot; file with &#039;&#039;&#039;xroms&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;hfile = &#039;his_cod_1dmix.nc&#039; &amp;lt;/br&amp;gt;ds = xroms.open_netcdf(hfile)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot a 2-D ribbon in time versus depth of temperature, at just one i,j grid cell. It would make no difference to choose &#039;&#039;xi_rho&#039;&#039; or &#039;&#039;eta_rho&#039;&#039; index of = 0, 1 or 2. &lt;br /&gt;
&lt;br /&gt;
Here, the x,y, plot coordinates are given explicitly, otherwise Python chooses to plot them the other way around, which is not very physical to an oceanographer.&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.isel(xi_rho=1,eta_rho=1).plot(x=&amp;quot;ocean_time&amp;quot;,y=&amp;quot;s_rho&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is still somewhat unsatisfactory because the vertical coordinate, &#039;&#039;s_rho&#039;&#039;, is the non-dimensional ROMS s-coordinate, whereas we want to see this in physical space, z, in meters. &lt;br /&gt;
&lt;br /&gt;
If you examine the description of this DataArray for variable &#039;&#039;temp&#039;&#039; (temperature)&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.describe()&amp;lt;/div&amp;gt;&lt;br /&gt;
you will see that &#039;&#039;&#039;xroms&#039;&#039;&#039; has created generic CF Axes X, Y, Z, T and generic CF Coordinates appropriate to the data; here, &#039;&#039;vertical&#039;&#039; and &#039;&#039;time&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Remember, ROMS uses a staggered grid such that temperature, u and v are at different coordinate locations that have different names (&#039;&#039;x_rho, x_u, x_v,&#039;&#039; etc.). &#039;&#039;&#039;xroms&#039;&#039;&#039; is making it easy for you so you don&#039;t have to use different coordinate names every time you plot a different variable. &lt;br /&gt;
&lt;br /&gt;
So, you can plot like this:&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ds.temp.cf.isel(X=1,Y=1).cf.plot(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;) &amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Notice:&#039;&#039;&#039; To use the generic Axes X,Y there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;isel&#039;&#039;&#039;, and to use the generic Coordinates there is a &#039;&#039;&#039;.cf&#039;&#039;&#039; before &#039;&#039;&#039;plot&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
If you change &#039;&#039;temp&#039;&#039; to some other variable, this should also work.&lt;br /&gt;
&lt;br /&gt;
===Analysis exercise===&lt;br /&gt;
&lt;br /&gt;
Explore the dynamics of this mixing example by plotting time series and vertical profiles of some of the output, especially the netcdf variables named:&lt;br /&gt;
&lt;br /&gt;
* temperature (temp), &lt;br /&gt;
* velocity (u,v), &lt;br /&gt;
* bottom stress (bustr,bvstr), &lt;br /&gt;
* vertical turbulent viscosity (AKv), &lt;br /&gt;
* vertical turbulent diffusivity (AKt), &lt;br /&gt;
* turbulent kinetic energy (tke), &lt;br /&gt;
* GLS closure length scale parameter (gls) - figure out how to get length scale from &#039;&#039;gls&#039;&#039; and &#039;&#039;tke&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example, try plotting time series of temperature at two different depths, say &#039;&#039;s_rho = 29&#039;&#039; (the surface) and &#039;&#039;s_rho = 18&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You should see the curves approach each other and become identical. &lt;br /&gt;
&lt;br /&gt;
Plot time series also for velocity &#039;&#039;u&#039;&#039; and viscosity &#039;&#039;AKv&#039;&#039;. What&#039;s going on? What is the cause of the sudden, brief increase in eddy viscosity. &lt;br /&gt;
&lt;br /&gt;
Plot &#039;&#039;&#039;sustr&#039;&#039;&#039; and &#039;&#039;&#039;bustr&#039;&#039;&#039; versus time.. Notice that they reach an equal and opposite equilibrium when the solution becomes &#039;&#039;steady&#039;&#039;, i.e. not changing in time.&lt;br /&gt;
&lt;br /&gt;
An example iPython notebook that makes these sorts of plots, and demonstrates some of the features of xroms, is on &#039;&#039;Amarel&#039;&#039; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;plot_1dmix_steady.ipynb&amp;lt;/span&amp;gt; which you can copy to your working directory, edit, and experiment with.&lt;br /&gt;
&lt;br /&gt;
===More features of &#039;&#039;xroms&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
To advance beyond simply plotting ROMS output to dynamical analysis, &#039;&#039;xroms&#039;&#039; provides many built-in functions for computing derivatives and integrals, and mapping variables between the staggered vertical grid coordinates. &lt;br /&gt;
&lt;br /&gt;
For a list of the features, run this in your notebook:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;help(xroms.utilities)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, you can compute vertical derivatives of ROMS outputs using &#039;&#039;&#039;xroms.ddz&#039;&#039;&#039;. To do this you need to obtain, for the variable you wish to differentiate, its &#039;&#039;&#039;grid&#039;&#039;&#039; object that describes its coordinates. For example, vertical shear in velocity would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;utmp = ds.u &amp;lt;/br&amp;gt;ugrid = utmp.attrs[&amp;quot;grid&amp;quot;] &amp;lt;/br&amp;gt;dudz = xroms.ddz(utmp,ugrid)&amp;lt;/br&amp;gt;ds[&amp;quot;dudz&amp;quot;] = dudz&amp;lt;/br&amp;gt;ds.dudz.cf.isel(X=1,Y=1).cmo.cfpcolormesh(x=&amp;quot;time&amp;quot;,y=&amp;quot;vertical&amp;quot;)&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Read more about &#039;&#039;xroms&#039;&#039; capabilities by browsing the examples at https://github.com/xoceanmodel/xroms/tree/master/examples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example COD_HUNTER_ESTUARY==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example is designed to simulate tidal variability in a simple version of a funnel shaped estuary. The estuary is triangular in width, with depth that shallows linearly from 20 m the mouth to 5 m at the head along the &#039;&#039;thalweg&#039;&#039;, which is the name given to the line of local maximum depth along the estuary axis. There are shallow flanks along the coast on either side of the thalweg, and there a simple continental shelf at the open ocean.&lt;br /&gt;
&lt;br /&gt;
The model grid was designed by Eli Hunter, and has 128 by 32 points in the horizontal. The grid coordinates, bottom depth and land/sea mask are set in a netcdf grid file&lt;br /&gt;
&lt;br /&gt;
The open ocean boundary conditions are &#039;&#039;radiation&#039;&#039; on temperature and salinity on all 3 boundaries. The velocity is &#039;&#039;periodic&#039;&#039; in the north-south direction. At the eastern boundary, sea level is set to vary as a simple tide with harmonics (frequency and amplitude) that are set in a netcdf tide forcing file. &lt;br /&gt;
&lt;br /&gt;
The experiment starts from rest, i.e. u = v = zeta = 0. The initial temperature and salinity are uniform based on values set in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Since this grid is much larger than the previous 1D example, it will be desirable to run this in parallel using multiple cores on the &#039;&#039;Amarel&#039;&#039; cluster.&lt;br /&gt;
&lt;br /&gt;
===Getting the files===&lt;br /&gt;
&lt;br /&gt;
As for the previous COD_1DMIX example, you need a set of configuration files. These are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_hunter_estuary.h&amp;lt;/span&amp;gt; which sets the compile time ROMS code options&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt; which sets the run time parameters&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_regular_grid.nc&amp;lt;/span&amp;gt; (the grid file)&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_tides.nc&amp;lt;/span&amp;gt; (the boundary tidal forcing harmonics file)&lt;br /&gt;
&lt;br /&gt;
Copy these files from &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; to your working directory. &lt;br /&gt;
&lt;br /&gt;
To run this example you need to follow similar steps to the COD_1DMIX example:&lt;br /&gt;
&lt;br /&gt;
# In &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt;, set the &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; to COD_HUNTER_ESTUARY &lt;br /&gt;
# Compile ROMS using the build script&lt;br /&gt;
# Note the NtileI and NtileJ values in roms_cod_hunter_estuary.in and edit your SLURM script, i.e. the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file, accordingly&lt;br /&gt;
# Modify the srun command in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; to use the correct roms.in file&lt;br /&gt;
# Run the model&lt;br /&gt;
&lt;br /&gt;
As configured, this run takes about 3 minutes on 16 cores. If several students are running this at once, you may find the job waits for available resources before starting. You can monitor the status of your job in the queue with the &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;squeue&amp;lt;/span&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
To explore the role of estuary length in tidal response, there are two further grid files:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_long_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;hunter_estuary_short_grid.nc&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
These have estuary lengths that are, respectively, twice and half the length of the regular grid.&lt;br /&gt;
&lt;br /&gt;
To run this model with these alternative grids, you need to modify the input parameter &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;GRDNAME&amp;lt;/span&amp;gt; in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_hunter_estuary.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Example COD_CTW==&lt;br /&gt;
&lt;br /&gt;
===Experimental design===&lt;br /&gt;
&lt;br /&gt;
This example sets up ROMS to illustrate the response, in the form of Coastal Trapped Waves, of a coastal ocean to an along-shelf wind that blows for a few days in an isolated along-shelf band. Once the winds cease, the waves generated disperse at their inherent free CTW speeds and spatial patterns. &lt;br /&gt;
&lt;br /&gt;
The model bathymetry is the simple exponentially increasing depth profile presented in class following the pioneering work of Buchwald and Adams (1968). The domain is a long periodic channel, so eventually the CTWs generated by the wind exit from one end and re-enter the domain, so keep that in mind in any interpretation of what is going on. &lt;br /&gt;
&lt;br /&gt;
You can discover the particular configuration choices for this case by searching the analytical functionals (files ana_*.h) for the C-preprocessor (CPP) option COD_CTW. You can do this using the UNIX &#039;&#039;grep&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;grep COD_CTW ana*.h&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will list the files that have customized code for this case. You can then use UNIX commands &#039;&#039;more&#039;&#039; (or &#039;&#039;less&#039;&#039;) or the &#039;&#039;&#039;nano&#039;&#039;&#039; editor to browse the code if you want to see what goes into configuring ROMS. It&#039;s not required you do this, but if what we&#039;ve been doing is too much of a black box for you this might be of interest. For example, you will see in &#039;&#039;&#039;ana_grid.h&#039;&#039;&#039; how the bathymetry is set, and in &#039;&#039;&#039;ana_smflux.h&#039;&#039;&#039; how the wind stress is switched on and off, and where spatially in the domain the stress is applied.&lt;br /&gt;
&lt;br /&gt;
===Getting the Files===&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt; folder you need to copy across the files &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;cod_ctw.h&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Configuring the Example===&lt;br /&gt;
&lt;br /&gt;
The CPP option that activates this example is &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;COD_CTW&amp;lt;/span&amp;gt;. Hopefully, by now, you have a pretty good idea of the steps to follow to instruct &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to compile this example. &lt;br /&gt;
&lt;br /&gt;
So, do that, and compile the model.&lt;br /&gt;
&lt;br /&gt;
Next, modify or create a &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;job.sh&amp;lt;/span&amp;gt; file to run this example. Remember what you have to check to match up the number of compute cores requested to the number of tiles in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Run the model.&lt;br /&gt;
&lt;br /&gt;
You should have output files named &#039;&#039;&#039;*_ctw.nc&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Modifying the CTW input parameters===&lt;br /&gt;
&lt;br /&gt;
The configuration parameters that can be adjusted in this example are set, as always, by the USER options in the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_cod_ctw.in&amp;lt;/span&amp;gt; file. Here, these are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;! COD_CTW user parameters&lt;br /&gt;
       NUSER =  9&lt;br /&gt;
!      Coriolis lambdaL  L    null   dTdz   dims (km)  xwind ywind&lt;br /&gt;
!           f           (km)                 e-w n-s   stress (Pa)&lt;br /&gt;
  USER = 8.4e-5   2.7   80.0   0.0 0.00   4000.0 200.0  0.03 0.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User(2) is &#039;&#039;lambda*L&#039;&#039; in the Buchwald and Adams (1968) idealized CTW problem presented in lectures.&lt;br /&gt;
&lt;br /&gt;
User(3) is &#039;&#039;L&#039;&#039;, the shelf width in km. The code in &#039;&#039;ana_grid.h&#039;&#039; adjusts the minimum depth so that &#039;&#039;lambdaL&#039;&#039; changes both the width and steepness of shelf to match a uniform depth open ocean. &lt;br /&gt;
&lt;br /&gt;
User(5) will introduce temperature stratification so that we can explore the effect of this on the speed of the CTWs generated. &lt;br /&gt;
&lt;br /&gt;
User(8) sets the magnitude of the along-shelf wind stress.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6623</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6623"/>
		<updated>2024-01-25T16:11:38Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Running the ROMS Upwelling Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.yaml&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6622</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6622"/>
		<updated>2024-01-25T16:10:25Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Running the ROMS Upwelling Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.yaml&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6621</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6621"/>
		<updated>2024-01-25T16:09:46Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Requesting a specific class of compute node */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;then enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. It is highly recommended that you use the GitHub myroms repository to obtain the ROMS source code. The &#039;&#039;Subversion (SVN)&#039;&#039; repository is being phased out and will no longer be available after &#039;&#039;&#039;December 31, 2024&#039;&#039;&#039;. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS|Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Obtaining the ROMS source code===&lt;br /&gt;
There is nothing special about obtaining the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git clone command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. You can also omit &amp;lt;my_src_dir&amp;gt; and git will automatically name the folder &#039;&#039;&#039;roms&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It can take a couple of minutes to download all of ROMS, but you only do this once. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (&#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed to your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file.&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (&#039;&#039;i.e.&#039;&#039; Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120) Note: These will be reclaimed for general use in Feb 2024&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 -- hal0302 and hal0346 -- hal0351)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, &#039;&#039;e.g.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, &#039;&#039;e.g.&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using &#039;&#039;e.g.&#039;&#039; &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (&#039;&#039;i.e.&#039;&#039; delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, &#039;&#039;i.e.&#039;&#039; 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and, in this case, &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (&#039;&#039;e.g.&#039;&#039; 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter &#039;&#039;e.g.&#039;&#039; &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_matlab&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6610</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6610"/>
		<updated>2024-01-18T21:48:25Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Checking out the ROMS source code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;Subversion (SVN)&#039;&#039; repository available but the &#039;&#039;git&#039;&#039; repository is now our recommended way to obtain the ROMS source code. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git MyDir &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called.&lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120)&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 through hal0302)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, e.g.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, e.g. &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6609</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6609"/>
		<updated>2024-01-18T21:47:52Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Checking out the ROMS source code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;Subversion (SVN)&#039;&#039; repository available but the &#039;&#039;git&#039;&#039; repository is now our recommended way to obtain the ROMS source code. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git MyDir &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called, e.g. &#039;&#039;myroms&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120)&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 through hal0302)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, e.g.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, e.g. &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6608</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6608"/>
		<updated>2024-01-18T21:47:29Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Checking out the ROMS source code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;Subversion (SVN)&#039;&#039; repository available but the &#039;&#039;git&#039;&#039; repository is now our recommended way to obtain the ROMS source code. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The git commands are the same as on any UNIX host. &lt;br /&gt;
Navigate to the directory where you want your ROMS source code to reside and execute this git checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;git clone https://github.com/myroms/roms.git MyDir &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called, e.g. myroms. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120)&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 through hal0302)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, e.g.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, e.g. &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6607</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6607"/>
		<updated>2024-01-18T21:43:09Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Register as a ROMS user */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;Subversion (SVN)&#039;&#039; repository available but the &#039;&#039;git&#039;&#039; repository is now our recommended way to obtain the ROMS source code. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git#Downloading_ROMS]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The svn commands are the same as on any UNIX host. &lt;br /&gt;
The first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username (do not add any angle brackets &amp;lt; &amp;gt;) and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
 &lt;br /&gt;
After typing your &#039;&#039;ROMS&#039;&#039; password (the one you registered with) it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039;. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120)&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 through hal0302)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, e.g.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, e.g. &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6606</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6606"/>
		<updated>2024-01-18T21:41:57Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Register as a ROMS user */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;Subversion (SVN)&#039;&#039; repository available but the &#039;&#039;git&#039;&#039; repository is now our recommended way to obtain the ROMS source code. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[Git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The svn commands are the same as on any UNIX host. &lt;br /&gt;
The first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username (do not add any angle brackets &amp;lt; &amp;gt;) and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
 &lt;br /&gt;
After typing your &#039;&#039;ROMS&#039;&#039; password (the one you registered with) it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039;. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120)&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 through hal0302)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, e.g.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, e.g. &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6605</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6605"/>
		<updated>2024-01-18T21:40:53Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Register as a ROMS user */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form found [https://www.myroms.org/register here] and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;Subversion (SVN)&#039;&#039; repository available but the &#039;&#039;git&#039;&#039; repository is now our recommended way to obtain the ROMS source code. If you manage your own software projects using GitHub, the concepts for software version control may already be familiar to you.  Detailed directions can be found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The svn commands are the same as on any UNIX host. &lt;br /&gt;
The first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username (do not add any angle brackets &amp;lt; &amp;gt;) and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
 &lt;br /&gt;
After typing your &#039;&#039;ROMS&#039;&#039; password (the one you registered with) it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039;. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120)&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 through hal0302)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, e.g.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, e.g. &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6567</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6567"/>
		<updated>2023-03-21T20:55:07Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Requesting a specific class of compute node */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form (found [https://www.myroms.org/register here]) and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;git&#039;&#039; repository available but Subversion (SVN) is our recommended way to obtain the ROMS source code. If you prefer git, the initial process is a little more involved but you can follow the directions found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The svn commands are the same as on any UNIX host. &lt;br /&gt;
The first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username (do not add any angle brackets &amp;lt; &amp;gt;) and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
 &lt;br /&gt;
After typing your &#039;&#039;ROMS&#039;&#039; password (the one you registered with) it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039;. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes) (nodes hal0116 through hal0120)&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes) (nodes hal0159 through hal0163)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes) (nodes hal0299 through hal0302)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, e.g.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t specifically request a class of nodes the SLURM scheduler will make its own choice on the most appropriate resources to use given your request. We don&#039;t know the basis of that choice. &lt;br /&gt;
&lt;br /&gt;
If you request a class of node that is fully assigned to other users in your partition, your job will wait for the others users jobs to complete. So, coordinate with your colleagues if resource use is at a premium. You can use the &#039;&#039;&#039;squeue -p partition_name&#039;&#039;&#039; command to see what resources are being used by other users, e.g. &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ squeue -p p_omg_1 &amp;lt;br&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON) &amp;lt;br&amp;gt;   26975473    p_omg_1                  fwd   levinj  R     17:15:42  14-00:00:00   80      2 hal[0159,0162]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6566</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6566"/>
		<updated>2023-03-21T20:45:12Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Using the SLURM batch job scheduler */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form (found [https://www.myroms.org/register here]) and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;git&#039;&#039; repository available but Subversion (SVN) is our recommended way to obtain the ROMS source code. If you prefer git, the initial process is a little more involved but you can follow the directions found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The svn commands are the same as on any UNIX host. &lt;br /&gt;
The first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username (do not add any angle brackets &amp;lt; &amp;gt;) and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
 &lt;br /&gt;
After typing your &#039;&#039;ROMS&#039;&#039; password (the one you registered with) it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039;. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
====Requesting a specific class of compute node====&lt;br /&gt;
&lt;br /&gt;
For large jobs it makes sense to use all available cores on a node, and for low priority jobs to use older less fast nodes. You can do this by requesting a specific node number, but it is better to request a particular class of nodes so you don&#039;t unwittingly pick a node already in use. The classes available from oldest to newest nodes are:&lt;br /&gt;
&lt;br /&gt;
# skylake (32 cores) (Phase I nodes)&lt;br /&gt;
# cascadelake (40 cores) (Phase II nodes)&lt;br /&gt;
# icelake (64 cores) (Phase V.B nodes)&lt;br /&gt;
&lt;br /&gt;
Make the node class request in the SLURM script and choose the maximum number of cores to match, e.g.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#SBATCH --constraint=cascadelake               # Run on Phase II nodes (40 cores) &amp;lt;br&amp;gt;#SBATCH --ntasks=40                            # Total number of tasks to launch (like -np to mpirun) &amp;lt;br&amp;gt;#SBATCH --ntasks-per-node=40                   # Number of tasks to launch on each node&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6545</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6545"/>
		<updated>2023-01-17T19:27:08Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* What partitions can you run on? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form (found [https://www.myroms.org/register here]) and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;git&#039;&#039; repository available but Subversion (SVN) is our recommended way to obtain the ROMS source code. If you prefer git, the initial process is a little more involved but you can follow the directions found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The svn commands are the same as on any UNIX host. &lt;br /&gt;
The first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username (do not add any angle brackets &amp;lt; &amp;gt;) and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
 &lt;br /&gt;
After typing your &#039;&#039;ROMS&#039;&#039; password (the one you registered with) it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039;. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you have permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users.&lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6544</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6544"/>
		<updated>2023-01-17T19:26:27Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Running on the Amarel Compute Nodes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form (found [https://www.myroms.org/register here]) and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;git&#039;&#039; repository available but Subversion (SVN) is our recommended way to obtain the ROMS source code. If you prefer git, the initial process is a little more involved but you can follow the directions found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The svn commands are the same as on any UNIX host. &lt;br /&gt;
The first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username (do not add any angle brackets &amp;lt; &amp;gt;) and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
 &lt;br /&gt;
After typing your &#039;&#039;ROMS&#039;&#039; password (the one you registered with) it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039;. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===What &#039;&#039;partitions&#039;&#039; can you run on?===&lt;br /&gt;
&lt;br /&gt;
Access to Amarel resources is controlled by &#039;&#039;partitions&#039;&#039;. You can find out the partitions you are permission to access with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;sinfo -s&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show the partitions that everyone has access to. See the cluster guide [https://sites.google.com/view/cluster-user-guide#h.oeejy9yf80e4 entry on partitions] for an explanation of these. &lt;br /&gt;
&lt;br /&gt;
If you belong to a research group that own a partition you should also see that listed, for example &#039;&#039;&#039;p_omg_1&#039;&#039;&#039; for the Ocean Modeling Group. This is the partition you want to use most of the time as your job will not get pre-empted by other owner users. &lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6543</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6543"/>
		<updated>2023-01-17T19:08:35Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Matlab: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form (found [https://www.myroms.org/register here]) and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;git&#039;&#039; repository available but Subversion (SVN) is our recommended way to obtain the ROMS source code. If you prefer git, the initial process is a little more involved but you can follow the directions found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The svn commands are the same as on any UNIX host. &lt;br /&gt;
The first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username (do not add any angle brackets &amp;lt; &amp;gt;) and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
 &lt;br /&gt;
After typing your &#039;&#039;ROMS&#039;&#039; password (the one you registered with) it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039;. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; (or your own group name) in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
	<entry>
		<id>https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6542</id>
		<title>Amarel</title>
		<link rel="alternate" type="text/html" href="https://www.myroms.org/wiki/index.php?title=Amarel&amp;diff=6542"/>
		<updated>2023-01-17T19:07:53Z</updated>

		<summary type="html">&lt;p&gt;Wilkin: /* Python Jupyter notebook: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Using Amarel&amp;lt;/div&amp;gt;&lt;br /&gt;
==Getting Started==&lt;br /&gt;
This wiki page is a brief &amp;quot;Getting Started&amp;quot; introduction to running the ROMS ocean model and analyzing model output on the Rutgers University Office of Advanced Research Computing (OARC) cluster computer &#039;&#039;Amarel&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
===Amarel help ===&lt;br /&gt;
There is an OARC supported user guide at https://sites.google.com/view/cluster-user-guide to which you can refer for a lot of detailed guidance.&lt;br /&gt;
&lt;br /&gt;
===Working with UNIX===&lt;br /&gt;
To work effectively on &#039;&#039;Amarel&#039;&#039; you need at least a beginner level of competency with the UNIX operating system. &lt;br /&gt;
If you are a total newcomer to UNIX computers you might find it useful to work through a structured tutorial; for example [https://ryanstutorials.net/linuxtutorial/ Ryan&#039;s Linux Tutorial].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Basic UNIX commands&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does !! Example&lt;br /&gt;
|-&lt;br /&gt;
| ls || list contents of a directory &amp;lt;/br&amp;gt; files ending in .nc &amp;lt;/br&amp;gt; long format list and hidden files || ls &amp;lt;/br&amp;gt; ls *.nc &amp;lt;/br&amp;gt; ls -al  &lt;br /&gt;
|-&lt;br /&gt;
| cd || change directory || cd /projects/dmcs_1/courses/cod&lt;br /&gt;
|-&lt;br /&gt;
| pwd || print working directory to see where you are || pwd&lt;br /&gt;
|-&lt;br /&gt;
| cp || copy a file || cp source_file target_file&lt;br /&gt;
|-&lt;br /&gt;
| mv || rename a file &amp;lt;/br&amp;gt; move file to new directory || mv file_name new_name &amp;lt;/br&amp;gt; mv file_name dir1/dir2/new_name&lt;br /&gt;
|-&lt;br /&gt;
| rm || delete (remove) a file || rm filename&lt;br /&gt;
|-&lt;br /&gt;
| more || type contents of a file to screen one page at a time || more .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| less || like &#039;&#039;more&#039;&#039; only with more features (unix geeks are so funny) &amp;lt;/br&amp;gt;Read the man page for help || less .bashrc&lt;br /&gt;
|-&lt;br /&gt;
| man || get the manual page (help) for a command || man less&lt;br /&gt;
|-&lt;br /&gt;
| . || the directory you are in || cp /projects/dmcs_1/courses/job.sh &#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| .. || the directory above the one you are in || cd &#039;&#039;&#039;..&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| grep || find a string in a file &amp;lt;/br&amp;gt; &#039;&#039;get regular expression and print (!)&#039;&#039; || grep COD_1DMIX *.h&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your default UNIX &#039;&#039;shell&#039;&#039; (the &amp;quot;flavor&amp;quot; of your UNIX environment) is &#039;&#039;&#039;bash&#039;&#039;&#039;, so for more advanced help it is often good to include &amp;quot;bash&amp;quot; as one of your search terms in a google search for help.&lt;br /&gt;
&lt;br /&gt;
===Editing files===&lt;br /&gt;
One of the things that stumps newcomers to UNIX is making simple edits to files. Ryan&#039;s Linux Tutorial goes over the basics of the &#039;&#039;&#039;vi&#039;&#039;&#039; editor [https://ryanstutorials.net/linuxtutorial/vi.php here], but it can be a beast to get comfortable with. &lt;br /&gt;
&lt;br /&gt;
A more intuitive editor for new users is &#039;&#039;&#039;nano&#039;&#039;&#039;, the basics of which you can read about [https://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/ here].&lt;br /&gt;
&lt;br /&gt;
There is also a way to edit files in the web browser based &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service that is described later in this guide.&lt;br /&gt;
&lt;br /&gt;
==Rutgers VPN==&lt;br /&gt;
If you are not on campus, you will need to connect to the Rutgers VPN. To use Rutgers VPN, you must first enroll in Duo 2 Factor Authentication (2FA) (NetID+). Most users have probably already done this. If not, navigate to https://netid.rutgers.edu/setupTwoFactorAuthentication.htm and follow the instructions.&lt;br /&gt;
&lt;br /&gt;
Once you are enrolled in NetID+ you will need to activate the VPN service, if you have not already. Navigate to https://soc.rutgers.edu/vpn/ and click the gray button titled &#039;&#039;&#039;Service Activation&#039;&#039;&#039;. If you are not already logged in you may be asked to login and/or approve your login with the Duo Mobile app. To activate the VPN service, click the checkbox next to &#039;&#039;&#039;Remote Access VPN, Cisco AnyConnect Access for Rutgers&#039;&#039;&#039; and click the &#039;&#039;&#039;Activate Services&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
You are now ready to download the Cisco VPN client and connect to the Rutgers VPN. Complete instructions can be found [https://soc.rutgers.edu/vpn/ here] by clicking the red button titled &#039;&#039;&#039;General VPN Instructions&#039;&#039;&#039; to download the PDF. The instructions are geared towards Windows so if you are using a Mac you might find [https://soc.rutgers.edu/vpn/apple/ this page] more helpful. In most cases, regardless of your operating system, pointing your browser to https://vpn.rutgers.edu/ and logging in with your NetID will lead you to downloading the correct VPN client.&lt;br /&gt;
&lt;br /&gt;
Once installed, open the &#039;&#039;&#039;Cisco AnyConnect&#039;&#039;&#039; client and type &#039;&#039;&#039;vpn.rutgers.edu&#039;&#039;&#039; in the box and click &#039;&#039;&#039;Connect&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Connect.png]]&lt;br /&gt;
&lt;br /&gt;
In the next window, shown below, &#039;&#039;&#039;Username&#039;&#039;&#039; will be your NetID.&lt;br /&gt;
&lt;br /&gt;
In the second line &#039;&#039;&#039;Password&#039;&#039;&#039; is the password for your NetID. &lt;br /&gt;
&lt;br /&gt;
The third line is the &#039;&#039;&#039;Duo Action&#039;&#039;&#039; to complete the 2FA, which can be accomplished in one of 4 possible ways:&lt;br /&gt;
&lt;br /&gt;
# Enter a 6 digit Duo Passcode. These are generated either by a Hard Token, by showing the passcode in the Duo Mobile App, or from a previous “SMS” request. Simply type in the 6 numbers and hit OK.&lt;br /&gt;
# Type the word “push”. This will send a push notification to the primary device you have enrolled with Duo through NetID+ with the option to Accept or Deny.&lt;br /&gt;
# Type the word “phone”. You will receive a phone call to the primary device you have enrolled with Duo through NetID+ with touch tone options to Accept or Deny.&lt;br /&gt;
# Type the word “sms”. You will receive a text message to the primary device you have enrolled with Duo through NetID+ containing passcodes you can use to login.&lt;br /&gt;
&lt;br /&gt;
[[Image:AnyConnect_Credentials.png]]&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;OK&#039;&#039;&#039; and you should be connected to Rutgers VPN. You should have a small AnyConnect icon with a lock on it in the task tray (Windows [[Image:AnyConnect_win_connected.jpg]]) or in the menu bar (Mac OS [[Image:AnyConnect_mac_connected.png|25px]]).&lt;br /&gt;
&lt;br /&gt;
==Connecting to Amarel with SSH==&lt;br /&gt;
In order to connect to &#039;&#039;Amarel&#039;&#039; and compile and run ROMS you will need an SSH/terminal client. If you already use an SSH/terminal application you are comfortable with then stick with that and adapt the instructions below accordingly. For these instructions to work you need to either be on campus or connected to the Rutgers VPN.&lt;br /&gt;
&lt;br /&gt;
===Mac OS===&lt;br /&gt;
If you are on a Mac, open the &#039;&#039;&#039;Terminal&#039;&#039;&#039; app (found in the Applications -&amp;gt; Utilities folder) or &#039;&#039;&#039;iTerm&#039;&#039;&#039; app and type:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ssh fakeuser@amarel.rutgers.edu&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;fakeuser&amp;lt;/span&amp;gt; with your NetID. When it asks if you want to continue connecting enter &#039;&#039;&#039;yes&#039;&#039;&#039;, then enter your NetID password. &lt;br /&gt;
&lt;br /&gt;
Having to type the above command and netid password every time you login is moderately tedious, but this username/password authentication can become annoying and time consuming when repeatedly using the &#039;&#039;&#039;scp&#039;&#039;&#039; command to copy files to &#039;&#039;Amarel&#039;&#039;. Passwordless access and file transfer can be enabled using &#039;&#039;&#039;SSH keys&#039;&#039;&#039; by following the instructions below, or for more detail see the [https://sites.google.com/view/cluster-user-guide#h.jgwrkm9e9rwg OARC User Guide on this topic].&lt;br /&gt;
&lt;br /&gt;
# If you are still connected to &#039;&#039;Amarel&#039;&#039;, disconnect by entering &#039;&#039;&#039;exit&#039;&#039;&#039;&lt;br /&gt;
# At the prompt for your local machine, enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;nano ~/.ssh/config&amp;lt;/span&amp;gt;&#039;&#039;&#039; and paste the block below at the end of the file:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;Host amarel&amp;lt;br /&amp;gt;Hostname amarel.rutgers.edu&amp;lt;br /&amp;gt;HostKeyAlias amarel&amp;lt;br /&amp;gt;User NetID&amp;lt;/div&amp;gt; replacing &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;NetID&amp;lt;/span&amp;gt; with your own NetID. Save and exit (Ctrl+o Ctrl+x). This allows you to type &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; to connect.&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ls ~/.ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If there is a file listed called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;id_rsa.pub&amp;lt;/span&amp;gt; skip to 5&lt;br /&gt;
# Enter &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh-keygen -t rsa&amp;lt;/span&amp;gt;&#039;&#039;&#039;, then hit return to accept the default location, enter a passphase twice (or leave blank for no passphrase)&lt;br /&gt;
# Copy the public portion of the key to &#039;&#039;Amarel&#039;&#039; by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scp ~/.ssh/id_rsa.pub amarel:.&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
# SSH to &#039;&#039;Amarel&#039;&#039; (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039;) and check if you already have a .ssh folder:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;[rjdave@amarel1 ~]$ ls -l .ssh&amp;lt;br /&amp;gt;total 33&amp;lt;br /&amp;gt;-rw-------  1 rjdave rjdave  1069 Sep  8  2017 authorized_keys&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave   434 Jun  4  2021 config&amp;lt;br /&amp;gt;-rw-r--r--  1 rjdave rjdave  5992 Dec  2 13:47 known_hosts&amp;lt;/div&amp;gt; You probably won&#039;t have all the files above but if you instead get the message &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls: cannot access .ssh: No such file or directory&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/div&amp;gt;the enter the following command:&amp;lt;/br&amp;gt;&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;mkdir .ssh &amp;amp;&amp;amp; chmod 700 .ssh&amp;lt;/span&amp;gt;&#039;&#039;&#039;. &amp;lt;/br&amp;gt;These two commands (combined on one line) will create the .ssh folder and set the required permissions. Setting private user-only permissions (&#039;&#039;&#039;chmod 700 ...&#039;&#039;&#039;) is important, because the system will not allow you to have your keys viewable by others users. &lt;br /&gt;
# Once you have a .ssh folder with the proper permissions, enter the following commands&amp;lt;/br&amp;gt; &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys &amp;amp;&amp;amp; chmod 640 ~/.ssh/authorized_keys&amp;lt;/span&amp;gt;&#039;&#039;&#039;&amp;lt;/br&amp;gt;then exit back to your local machine and execute &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;ssh amarel&amp;lt;/span&amp;gt;&#039;&#039;&#039; again. It should no longer ask for your password.&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, we recommend [https://mobaxterm.mobatek.net/download-home-edition.html MobaXterm] installer edition. &lt;br /&gt;
# Once installed open it, choose light or dark theme and click the &#039;&#039;&#039;Session&#039;&#039;&#039; button in the upper left.&lt;br /&gt;
# Choose &#039;&#039;&#039;SSH&#039;&#039;&#039; and enter &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; for &#039;&#039;&#039;Remote host&#039;&#039;&#039;, check the &#039;&#039;&#039;Specify username&#039;&#039;&#039; box and enter your NetID in the box and click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
# You will be asked to type your NetID password and then asked if you want to save the password. If you choose yes you will be asked to set a master password to encrypt all your saved passwords.&lt;br /&gt;
# In the future you can click &#039;&#039;&#039;Sessions&#039;&#039;&#039; (not Session) and select &#039;&#039;&#039;amarel.rutgers.edu&#039;&#039;&#039; and not have to enter your password.&lt;br /&gt;
&lt;br /&gt;
==Setting up your .bashrc==&lt;br /&gt;
The default software setup by OARC on &#039;&#039;Amarel&#039;&#039; does not include everything needed to compile and run ROMS. Ocean Modeling Group computing specialist David Robertson has configured, and maintains and updates, a repository of what you need for ROMS and other models that will be automatically loaded for every login session once you add a some lines to the login script (.bashrc, .cshrc, etc.) in your home directory. Log in to &#039;&#039;Amarel&#039;&#039; with &#039;&#039;&#039;Terminal&#039;&#039;&#039;, &#039;&#039;&#039;iTerm2&#039;&#039;&#039; or &#039;&#039;&#039;MobaXterm&#039;&#039;&#039; and edit your login script as described below.&lt;br /&gt;
&lt;br /&gt;
Unless otherwise requested your default shell will be bash and the following lines shown below in &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;red&amp;lt;/span&amp;gt; and green&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Colored text here&amp;lt;/span&amp;gt; should be added (with nano or your preferred editor) near the top of your .bashrc after the import of the global definitions as shown:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;# Source global definitions&amp;lt;br /&amp;gt;if [ -f /etc/bashrc ]; then&amp;lt;br /&amp;gt;	. /etc/bashrc&amp;lt;br /&amp;gt;fi&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit -s unlimited&amp;lt;br /&amp;gt;export MODULEPATH=/projects/dmcs_1/sw/modulefiles/Core:${MODULEPATH}&amp;lt;br /&amp;gt;export SQUEUE_FORMAT=&amp;quot;%.18i %.9P %.8j %.8u %.2t %.10M %.10l %.4C %.6D %R&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;# Automatically load the roms module&amp;lt;br /&amp;gt;module load roms&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The line with &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;ulimit&amp;lt;/span&amp;gt; allows you to take full advantage of computing resources (may be obsolete now but it won&#039;t hurt anything). &lt;br /&gt;
&lt;br /&gt;
The first &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line will tell &#039;&#039;&#039;Lmod&#039;&#039;&#039; where to find the modules that will load the custom software. &lt;br /&gt;
&lt;br /&gt;
The second &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;export&amp;lt;/span&amp;gt; line makes the &#039;&#039;&#039;squeue&#039;&#039;&#039; command (explained later) more useful. &lt;br /&gt;
&lt;br /&gt;
The lines in &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; are optional and will load the &#039;&#039;&#039;roms&#039;&#039;&#039; module automatically every time you login to &#039;&#039;Amarel&#039;&#039;. They must be &#039;&#039;&#039;after&#039;&#039;&#039; the line that sets the &#039;&#039;&#039;MODULEPATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once you have added these lines, log out and back in for them to take effect.&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... then you may need to logout and login again so that .bashrc sets MODULEPATH as instructed above. If the error persists, you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Accessing the ROMS Source Code==&lt;br /&gt;
&lt;br /&gt;
===Register as a ROMS user===&lt;br /&gt;
If you are not already a ROMS user, you will need to fill out the registration form (found [https://www.myroms.org/register here]) and wait for approval. Once approved, you will be able to checkout the ROMS source code. There is a &#039;&#039;git&#039;&#039; repository available but Subversion (SVN) is our recommended way to obtain the ROMS source code. If you prefer git, the initial process is a little more involved but you can follow the directions found on the WikiROMS [[git]] page.&lt;br /&gt;
&lt;br /&gt;
===Checking out the ROMS source code===&lt;br /&gt;
There is nothing special about checking out the ROMS source code on &#039;&#039;Amarel&#039;&#039;. The svn commands are the same as on any UNIX host. &lt;br /&gt;
The first time you check the code out you will need to use the ‘--username’ flag unless your NetID matches you ROMS username. Navigate to the directory where you want your ROMS source code to reside and execute this svn checkout command:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;svn --username &amp;lt;user&amp;gt; co https://www.myroms.org/svn/src/trunk &amp;lt;my_src_dir&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
replacing &amp;lt;user&amp;gt; with your &#039;&#039;&#039;ROMS&#039;&#039;&#039; username (do not add any angle brackets &amp;lt; &amp;gt;) and &amp;lt;my_src_dir&amp;gt; with what you want the source code directory to be called. &lt;br /&gt;
&lt;br /&gt;
It will take a couple of minutes to download all of ROMS, but you only do this once. You will see the list of all the files being downloaded typed to your screen. &lt;br /&gt;
&lt;br /&gt;
Many users simply run this command from their home directory and use &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;&#039;&#039;&#039;myroms&#039;&#039;&#039;&amp;lt;/span&amp;gt; for &amp;lt;my_src_dir&amp;gt;, but the choice is yours depending on how you want to manage your &#039;&#039;Amarel&#039;&#039; space and how many ROMS projects you think you might end up working on.&lt;br /&gt;
 &lt;br /&gt;
After typing your &#039;&#039;ROMS&#039;&#039; password (the one you registered with) it will ask you if you want to store your password. We recommend answering &#039;&#039;&#039;yes&#039;&#039;&#039;. If you answer &#039;&#039;&#039;no&#039;&#039;&#039; you will have to type your ROMS password every time you do an &#039;&#039;&#039;svn checkout&#039;&#039;&#039; or &#039;&#039;&#039;svn update&#039;&#039;&#039;.&lt;br /&gt;
After your first checkout you will no longer need the &#039;&#039;&#039;&#039;&#039;--username&#039;&#039;&#039;&#039;&#039; flag for svn operations to any of the myroms.org subversion repositories.&lt;br /&gt;
&lt;br /&gt;
==Loading and Unloading Modules==&lt;br /&gt;
Like many clusters, &#039;&#039;Amarel&#039;&#039; uses environment modules to load and unload software and configure the environment. Some commands you will find useful are:&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&#039;&#039;&#039;module help&#039;&#039;&#039;               Display help message&amp;lt;br /&amp;gt;&#039;&#039;&#039;module help &amp;lt;m1&#039;&#039;&#039;&amp;gt;          Show help information for module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module available&#039;&#039;&#039;	  Show all modules currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module whatis &amp;lt;m1&amp;gt;&#039;&#039;&#039;        Show brief information about module &amp;lt;m1&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;module spider&#039;&#039;&#039;             List all possible modules even if not currently available&amp;lt;br /&amp;gt;&#039;&#039;&#039;module list&#039;&#039;&#039;               List currently loaded modules&amp;lt;br /&amp;gt;&#039;&#039;&#039;module load&#039;&#039;&#039;               Load the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module unload&#039;&#039;&#039;             Unload the specified module(s)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module swap &amp;lt;m1&amp;gt; &amp;lt;m2&amp;gt;&#039;&#039;&#039;     Unload &amp;lt;m1&amp;gt; and then load &amp;lt;m2&amp;gt; (for switching versions of the same software)&amp;lt;br /&amp;gt;&#039;&#039;&#039;module purge&#039;&#039;&#039;              Unload all loaded modules&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Loading the ROMS Module===&lt;br /&gt;
If you &#039;&#039;&#039;did not&#039;&#039;&#039; add the optional lines from the [[#Setting_up_your_.bashrc|Setting up your .bashrc]] section, you can easily set up your environment to compile and run ROMS by manually loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module.&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;module load roms&amp;lt;br /&amp;gt;module list&amp;lt;br /&amp;gt;Currently Loaded Modules:&amp;lt;br /&amp;gt;  1) intel/17.0.4     2) mvapich2/2.2      3) mct-roms/2.6.0   4) netcdf/4.6.2&amp;lt;br /&amp;gt;  5) esmf/8.0.0_nc4   6) parpack-roms/2.1  7) hdf5/1.10.4      8) roms/intel_nc4&amp;lt;/div&amp;gt;&lt;br /&gt;
Notice that loading the &#039;&#039;&#039;roms&#039;&#039;&#039; module will actually load 7 other modules. &lt;br /&gt;
&lt;br /&gt;
This will setup your environment to use the Intel compiler so remember to set &#039;&#039;&#039;FORT&#039;&#039;&#039; to &#039;&#039;&#039;ifort&#039;&#039;&#039; in your build script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note}} &#039;&#039;&#039;Note:&#039;&#039;&#039; If you see the error ...&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;Lmod has detected the following error:&amp;lt;/span&amp;gt;  The following module(s) are unknown: &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Please check the spelling or version number. Also try &amp;quot;module spider ...&amp;quot;&amp;lt;br /&amp;gt;It is also possible your cache file is out-of-date; it may help to try:&amp;lt;br /&amp;gt;  $ module --ignore_cache load &amp;quot;roms&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Also make sure that all modulefiles written in TCL start with the string #%Module&amp;lt;/div&amp;gt;&lt;br /&gt;
... you may not have been properly added to the &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; Linux group. To check if you are part of &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; type the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;id&amp;lt;/span&amp;gt;&#039;&#039;&#039; and if &#039;&#039;&#039;dmcs_1&#039;&#039;&#039; is not listed, let us know and we will get you added to the group.&lt;br /&gt;
&lt;br /&gt;
==Your project/coursework working directory space==&lt;br /&gt;
&lt;br /&gt;
We recommend you create a subdirectory of your home directory in which to work, so you can keep each ROMS project separate and organized.  &lt;br /&gt;
&lt;br /&gt;
You might call this &#039;&#039;&#039;working directory&#039;&#039;&#039; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;CoastalDynamics&amp;lt;/span&amp;gt;, or &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, or simply &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;cod&amp;lt;/span&amp;gt; (for coastal ocean dynamics). You will be typing this a lot, so keep it simple.&lt;br /&gt;
&lt;br /&gt;
To make a new directory called &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt;, enter this command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;mkdir Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to this working directory with the command&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd Projects &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In instructions that follow, when we refer to your &#039;&#039;&#039;working directory&#039;&#039;&#039; we mean this workspace.&lt;br /&gt;
&lt;br /&gt;
==Configuring and Compiling ROMS==&lt;br /&gt;
You will compile and run ROMS in your project/coursework &#039;&#039;&#039;working directory&#039;&#039;&#039;, so change to that directory first.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cd &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;Projects&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the build script &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; is the recommended method for compiling ROMS on &#039;&#039;Amarel&#039;&#039;. For any given project you will likely only need to change &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; to reset &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;ROMS_APPLICATION&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; and make sure &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;FORT&amp;lt;/span&amp;gt; is set to &#039;&#039;&#039;ifort&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{{warning}} &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;It is important to make sure &#039;&#039;&#039;USE_MY_LIBS&#039;&#039;&#039; is set to &#039;&#039;no&#039;&#039; or your compilation will fail.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A template &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; script is in subdirectory &#039;&#039;&#039;ROMS/Bin&#039;&#039;&#039; of &#039;&#039;&#039;&amp;lt;my_src_dir&amp;gt;&#039;&#039;&#039; that you created when you downloaded the code. For example, if you created &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; in your home directory the copy command would be&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Bin/build_roms.sh . &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;build_roms.sh&amp;lt;/span&amp;gt; with an editor (e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) and modify the line &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;MY_ROMS_SRC&amp;lt;/span&amp;gt; to point to your choice for &amp;lt;my_src_dir&amp;gt;. So, you will have something like ...&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export MY_ROMS_SRC=&amp;lt;/span&amp;gt;{$HOME}/&amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if the name you chose for &amp;lt;my_src_dir&amp;gt; was &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If this is your first time working with ROMS, a good starting place is to compile the default UPWELLING test case that is indicated in build_roms.sh with the default setting &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;export ROMS_APPLICATION&amp;lt;/span&amp;gt;=UPWELLING.  &lt;br /&gt;
&lt;br /&gt;
To compile the UPWELLING example, you need to copy the configuration file &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;upwelling.h&amp;lt;/span&amp;gt; to your working directory. This is in subdirectory &#039;&#039;&#039;ROMS/Include&#039;&#039;&#039; of your source code. For example, the command might be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/Include/upwelling.h .&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once your build script is configured and you have upwelling.h in your working directory you can compile ROMS by typing:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;./build_roms.sh -j 4&amp;lt;/div&amp;gt;&lt;br /&gt;
where the number after -j indicates the number of compute cores to use in parallel to execute the compilation. The greater the number, the faster it goes.&lt;br /&gt;
&lt;br /&gt;
However, the login node you will be compiling on is shared for the entire &#039;&#039;Amarel&#039;&#039; system. If you use a number larger than &#039;&#039;&#039;4&#039;&#039;&#039;, or omit it altogether (which says use &#039;&#039;all&#039;&#039; cores on the login node) your build might be terminated by an administrator. Be a considerate user and keep the number low.&lt;br /&gt;
&lt;br /&gt;
If compilation is processing successfully you will see a lot of information typed t your screen as each component of the source code is compiled. It will take a minute or so to complete.&lt;br /&gt;
&lt;br /&gt;
If compilation ends quickly with errors like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;$ ./build_roms.sh -j 4 &amp;lt;/br&amp;gt;rm -f -r core *.ipo /home/jwilkin/cod/Projects/Build_roms...&amp;lt;/br&amp;gt;which: &amp;lt;span class=&amp;quot;red&amp;quot;&amp;gt;no mpif90&amp;lt;/span&amp;gt; in (/usr/lpp/mmfs/bin:/usr/local/bin:/us...&amp;lt;/br&amp;gt;cp -f /opt/intelsoft/serial/netcdf3/include/netcdf.mod /h...&amp;lt;/br&amp;gt;cp: cannot stat ‘/opt/intelsofo... No such file or directory&amp;lt;/br&amp;gt;make: *** No rule to make target netcdf.mod needed by ... Stop. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... this means you have not run the &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;module load roms&amp;lt;/span&amp;gt; command. Go back to the notes on [[Amarel#Loading_the_ROMS_Module]].&lt;br /&gt;
&lt;br /&gt;
If compilation was successful, there will be a file named &#039;&#039;&#039;romsM&#039;&#039;&#039; that is the model executable. You can check for the file with this command:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see: &lt;br /&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;Build_roms&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;forestGreen&amp;quot;&amp;gt;build_roms.sh romsM&amp;lt;/span&amp;gt; upwelling.h &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;Build_roms&amp;lt;/span&amp;gt; is a folder that build_roms.sh created to hold all the temporary files that the FORTRAN compilation process makes to combine into the romsM executable file&lt;br /&gt;
&lt;br /&gt;
==Running on the Amarel Compute Nodes==&lt;br /&gt;
When you &#039;&#039;&#039;ssh&#039;&#039;&#039; to &#039;&#039;Amarel&#039;&#039; you are connected to one of the login nodes. These nodes are to be used for file editing, transfering output and input files to/from your local computer, and modest code compiling tasks and analysis, but not for compute intensive tasks. Here we explain how to connect to the compute nodes for these larger tasks.&lt;br /&gt;
&lt;br /&gt;
Note: Consult the Amarel status page (https://oarc.rutgers.edu/amarel-system-status/) before scheduling a job. Amarel is down for maintenance monthly. &lt;br /&gt;
&lt;br /&gt;
===Using the SLURM batch job scheduler===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Amarel&#039;&#039; uses SLURM workload manager to schedule compute intensive tasks. The user configures a SLURM job script for each model run and submits this script with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. The job script declares the resources required, such as number of CPUs for parallel jobs, maximum memory required, etc.&lt;br /&gt;
&lt;br /&gt;
We have configured a simple template job script (for the ROMS UPWELLING example) that you can copy from &#039;&#039;&#039;/projects/dmcs_1/courses/job.sh&#039;&#039;&#039; into your working directory. &lt;br /&gt;
&lt;br /&gt;
The UNIX command to copy a file is &#039;&#039;&#039;cp source_file target_file&#039;&#039;&#039;. So, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp /projects/dmcs_1/courses/job.sh .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses a &#039;&#039;dot&#039;&#039; (&#039;&#039;&#039;.&#039;&#039;&#039;) for the target_file, which causes the source_file (job.sh) to be copied to the present working directory without changing its name.&lt;br /&gt;
&lt;br /&gt;
When typing this, or any, UNIX command, you can start typing just the beginning few characters of the path then press TAB to autocomplete the filename. If the completion is ambiguous, you can continue typing more characters and press TAB again. Pressing TAB twice in a row will show you the set of possible completions. This trick can save you a lot of tedious (mis)typing.&lt;br /&gt;
&lt;br /&gt;
The contents of &#039;&#039;&#039;job.sh&#039;&#039;&#039; are shown below:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;#!/bin/bash&amp;lt;br &amp;gt;#SBATCH --partition=p_omg_1             # Partition. If you are not a member of OMG enter your own partition&amp;lt;br /&amp;gt;#SBATCH --job-name=upwelling            # Assign a short name to your job&amp;lt;br/&amp;gt;#SBATCH --nodes=1                       # Number of nodes you require&amp;lt;br /&amp;gt;#SBATCH --ntasks=4                      # Total number of tasks you&#039;ll launch&amp;lt;br /&amp;gt;#SBATCH --ntasks-per-node=4             # Number of tasks you&#039;ll launch on each node&amp;lt;br /&amp;gt;#SBATCH --cpus-per-task=1               # Cores per task (&amp;gt;1 if multithread tasks)&amp;lt;br /&amp;gt;#SBATCH --mem=6400                      # Real memory (RAM) required (MB) per node&amp;lt;br /&amp;gt;#SBATCH --time=00-00:05                 # Total run time limit (DD-HH:MM)&amp;lt;br /&amp;gt;#SBATCH --output=out.%N.%j              # STDOUT output file&amp;lt;br /&amp;gt;#SBATCH --error=err.%N.%j               # STDERR output file (optional but recommended)&amp;lt;br /&amp;gt;#SBATCH --export=ALL                    # Export you current env to the job env&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;## It is important to have --mpi=pmi2 here or ROMS will not run&amp;lt;br /&amp;gt;srun --mpi=pmi2 ./romsM roms_upwelling.in&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The maximum run time is 14-00:00 (14 days). It is tempting to set this to the maximum in order to avoid a job ending too early. (i.e. Slurm stopping a ROMS run before it is finished) However, if there is maintenance scheduled during that time period the job will not start until maintenance is complete. So a runtime as close as possible to the actual run time is recommended.&lt;br /&gt;
&lt;br /&gt;
===Running the ROMS Upwelling Example===&lt;br /&gt;
You may have noticed that the srun command above includes a file named &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt;. You will need to copy this file and &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;varinfo.dat&amp;lt;/span&amp;gt; from the ROMS/External directory of your &amp;lt;my_src_dir&amp;gt; ROMS source code to the directory where you compiled ROMS. &lt;br /&gt;
&lt;br /&gt;
If, for example, you chose &#039;&#039;&#039;myroms&#039;&#039;&#039; as the name of your &amp;lt;my_src_dir&amp;gt; when you downloaded the code, you would enter&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;cp ~/myroms/ROMS/External/roms_upwelling.in .&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The syntax here uses &#039;&#039;tilde&#039;&#039; (~) as shorthand for your home directory,&lt;br /&gt;
&lt;br /&gt;
After you copy the files, you will need to make a couple of small edits (using e.g. &#039;&#039;&#039;nano&#039;&#039;&#039;) to &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_upwelling.in&amp;lt;/span&amp;gt; to get this to work. &lt;br /&gt;
&lt;br /&gt;
# Change the line with VARNAME to read &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;VARNAME = varinfo.dat&amp;lt;/span&amp;gt; (i.e. delete the ROMS/External part)&lt;br /&gt;
# Set &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileI == 2&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;sandyBrown&amp;quot;&amp;gt;NtileJ == 2&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The product of NtileI and NtileJ, i.e. 2 x 2 = 4, is the number of cores the model will run on in parallel. This number must match the number in the SLURM job script options &#039;&#039;&#039;--ntasks&#039;&#039;&#039; and &#039;&#039;&#039;--ntasks-per-node&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Now you can submit your job to &#039;&#039;&#039;sbatch&#039;&#039;&#039; with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;sbatch job.sh&amp;lt;/span&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ROMS configurations for &#039;&#039;Coastal Ocean Dynamics&#039;&#039; class===&lt;br /&gt;
The files that will configure the examples we will study in class will be located in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/courses/cod&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
You will find instructions for configuring and running the examples at a separate Wiki page [[COD_Class_Examples]]&lt;br /&gt;
&lt;br /&gt;
===Checking Job Status with squeue===&lt;br /&gt;
Detailed documentation for monitoring your SLURM jobs can be found [https://sites.google.com/view/cluster-user-guide#h.4bsndqufii8p here]. The easiest way to check whether your job is running is with the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;squeue -p p_omg_1&amp;lt;/span&amp;gt;&#039;&#039;&#039; (or your own partition name if it is not p_omg_1). &lt;br /&gt;
&lt;br /&gt;
You should see output something like this:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;      JOBID  PARTITION                 NAME     USER ST         TIME   TIME_LIMIT CPUS  NODES NODELIST(REASON)&amp;lt;br /&amp;gt;   17197219     dmcs_1            watl_psas   rjdave  R   3-04:07:00   3-20:00:00    4      1 hal0035&amp;lt;br /&amp;gt;   17146609     dmcs_1            upwelling   rjdave  R     00:01:10     00:05:00    4      1 hal0035&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the job is running (the ‘R’ under ‘ST’), has been running for 1 minute, 10 seconds, and is running on node 35.&lt;br /&gt;
&lt;br /&gt;
===Checking Progress with tail===&lt;br /&gt;
You can check ROMS progress by using the tail command on the &#039;&#039;&#039;output&#039;&#039;&#039; file. For the upwelling job above the file would be called &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; so the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039; will show you the most recent 10 lines written to the output log and will most likely tell you what time-step the model is on. Using the -f option (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;tail -f out.hal0035.17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;) will output appended data as the file grows. Ctrl-C will escape the display.&lt;br /&gt;
&lt;br /&gt;
===Did my UPWELLING job run?===&lt;br /&gt;
If the UPWELLING test case was successful there should be an output log file named something like &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;out.hal0035.17146609&amp;lt;/span&amp;gt; that shows no errors, and there should be 4 output NetCDF files ...&lt;br /&gt;
:&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;ls -l *.nc &amp;lt;/br&amp;gt;roms_avg.nc &amp;lt;/br&amp;gt;roms_dia.nc &amp;lt;/br&amp;gt;roms_his.nc &amp;lt;/br&amp;gt;roms_rst.nc &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cancelling a Job===&lt;br /&gt;
To safest way cancel a queued or running job is to use its jobid. A job can be canceled by name but that is not recommended. To cancel the upwelling job in the example above you would issue the command &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;scancel 17146609&amp;lt;/span&amp;gt;&#039;&#039;&#039;. If the job has not yet started, it will be removed from the queue. If it is running, all child processes will be killed and the job will be removed from the queue. You are only able cancel jobs that you own.&lt;br /&gt;
&lt;br /&gt;
===Running an interactive session on a compute node===&lt;br /&gt;
It is possible to conduct your work interactively on one of the compute nodes (instead of the login node). For most work we will be doing in class this is not necessary, but if for some reason you have a job that needs many processors or a large amount of memory, and you want to run it interactively - say, to simply check that everything is in order for it to start correctly - there are instructions in the Cluster User Guide [https://sites.google.com/view/cluster-user-guide#h.26x9sbburvsg here].&lt;br /&gt;
&lt;br /&gt;
For compute intensive interactive work, such as model analysis using Python or MATLAB, we recommend using the OnDemand interface to launch an interactive session on a set of compute nodes.&lt;br /&gt;
&lt;br /&gt;
==Using the OnDemand desktop environment==&lt;br /&gt;
The &#039;&#039;&#039;OnDemand&#039;&#039;&#039; service allows you to connect to &#039;&#039;Amarel&#039;&#039; using a graphical desktop environment in a web browser. One of the most useful features of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that it allows you to analyze model output by Python or Matlab on the cluster compute nodes. &lt;br /&gt;
&lt;br /&gt;
You need to be running a Rutgers VPN to use OnDemand. &lt;br /&gt;
&lt;br /&gt;
Navigate your browser to https://ondemand.hpc.rutgers.edu/pun/sys/dashboard and login with your NetID and password. At the top of the page click &#039;&#039;&#039;Interactive Apps&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Python Jupyter notebook:===&lt;br /&gt;
# Select &#039;&#039;&#039;Personal Jupyter&#039;&#039;&#039; from the list on the left&lt;br /&gt;
# Make your selections for &#039;&#039;&#039;number of hours&#039;&#039;&#039; your session can remain active (e.g. 3 hours), the &#039;&#039;&#039;number of cores&#039;&#039;&#039; to run on (1), and &#039;&#039;&#039;memory&#039;&#039;&#039; (8 GB is an OK choice)&lt;br /&gt;
# For &#039;&#039;Partition&#039;&#039; enter e.g. &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;p_omg_1&amp;lt;/span&amp;gt; if you are in OMG. Leave &#039;&#039;Reservation&#039;&#039; and &#039;&#039;Slurm feature&#039;&#039; blank. For &#039;&#039;conda path&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/miniconda3&amp;lt;/span&amp;gt; and for &#039;&#039;conda environment&#039;&#039; enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/xroms/py38&amp;lt;/span&amp;gt;. Click [[Media:Amarel Jupyter config.png | here]] to see what the completed launch page looks like.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# You should see sub-window of the web page like this &amp;lt;/br&amp;gt; [[Image:JupyterStarting.png|600px]] &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;When the session is ready it changes to this: &amp;lt;/br&amp;gt; [[Image:JupyterRunning.png|600px]]&lt;br /&gt;
# Start your notebook by clicking the &#039;&#039;&#039;Connect to Jupyter, Anaconda version 5.1.0&#039;&#039;&#039; button: (If this does not appear, check that you correctly entered the &#039;&#039;&#039;conda path&#039;&#039;&#039; and &#039;&#039;&#039;conda environment&#039;&#039;&#039; at step 3 above.) &amp;lt;/br&amp;gt;[[Image:JupyterConnect.png|400px]]&lt;br /&gt;
# This should place you in a file browse window from which you can navigate to one of your existing Jupyter notebooks, or, to start a new Untitled notebook, select &#039;&#039;Python 3 (ipykernel)&#039;&#039; from the &#039;&#039;New&#039;&#039; pull-down menu on the right side of the page [[Image:NewPythonNotebook.png]]&lt;br /&gt;
# Once your notebook is running, you can import the xroms package as you would any other toolbox, by entering &#039;&#039;&#039;&amp;lt;span style=&amp;quot;font-family: monospace;&amp;quot;&amp;gt;import xroms&amp;lt;/span&amp;gt;&#039;&#039;&#039; then hold down the shift key and hit the return/enter key. You will see an asterisk [&#039;&#039;&#039;*&#039;&#039;&#039;] in the square brackets.&lt;br /&gt;
# Once that asterisk changes to a &#039;&#039;&#039;1&#039;&#039;&#039;, the xroms python module has been loaded.&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;conda&#039;&#039;&#039; environment built for DMCS_1 makes available many of the Python modules you are used to using.&lt;br /&gt;
&lt;br /&gt;
===Matlab:===&lt;br /&gt;
# Select MATLAB from the list on the left &lt;br /&gt;
# As for Step 2 above for Python, choose time, cores, and memory&lt;br /&gt;
# Select MATLAB version, and enter &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;dmcs_1&amp;lt;/span&amp;gt; in partition.&lt;br /&gt;
# Click &#039;&#039;&#039;Launch&#039;&#039;&#039; and wait. This can take a couple minutes.&lt;br /&gt;
# Once the &#039;&#039;&#039;Launch noVNC in New Tab&#039;&#039;&#039; button appears, click it and a MatLab GUI will open.&lt;br /&gt;
&lt;br /&gt;
You are running in a graphical desktop environment, so by default Matlab will look in Documents/MATLAB/startup.m for your personal Matlab configuration file. &lt;br /&gt;
&lt;br /&gt;
Popular MATLAB utilities for working with ROMS output are in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;/projects/dmcs_1/sw/packages/matlab-tools&amp;lt;/span&amp;gt;. These include the myroms.org utilities in subdirectory &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;myroms&amp;lt;/span&amp;gt;, and John Wilkin&#039;s toolbox in &amp;lt;span class=&amp;quot;blue&amp;quot;&amp;gt;roms_wilkin&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reconnecting to an interactive session===&lt;br /&gt;
A particularly nifty feature of &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is that your interactive session is independent of the browser window instance. &lt;br /&gt;
&lt;br /&gt;
Say you are working on your office computer using a Jupyter notebook via &#039;&#039;&#039;OnDemand&#039;&#039;&#039; but haven&#039;t finished all you want to do by the end of the day. If you leave that session running, you can go home and connect once again to &#039;&#039;&#039;OnDemand&#039;&#039;&#039; and you will see your session in the list of Interactive Sessions. Launch that session and you will be placed right back where you were. &#039;&#039;&#039;OnDemand&#039;&#039;&#039; is simply a web interface to code running on &#039;&#039;Amarel&#039;&#039;, so you can connect from any browser. &lt;br /&gt;
&lt;br /&gt;
Of course, this only works if you selected a &#039;&#039;&#039;number of hours&#039;&#039;&#039; in Step 2 above that will allow your session to remain open. &lt;br /&gt;
&lt;br /&gt;
As long as the session is active the &#039;&#039;Amarel&#039;&#039; resources (cores and memory) are reserved for you and no one else. So, be respectful of other users and close out an interactive session once you are done.&lt;/div&gt;</summary>
		<author><name>Wilkin</name></author>
	</entry>
</feed>