Pages

Monday, May 19, 2014

Exploring HEC-RAS: XS Interpolation Within a Reach

Written by Christopher Goodell, P.E., D.WRE  |  WEST Consultants

Copyright © The RAS Solution 2014.  All rights reserved.

I’m starting a new series called “Exploring HEC-RAS”.  Each post will discuss a feature in the menu items, starting with the Tools menu item in the Geometry Schematic.  Today’s topic is “XS Interpolation Within a Reach”.

image

There are two options for interpolating cross sections in HEC-RAS:  “Within a Reach…”, let’s call this Option A, and “Between 2 XS’s…”, Option B.  First, let’s briefly review why you may need to interpolate cross sections in HEC-RAS.  Cross Sections should be selected early on in your project to adequately define changes in geometry, roughness, bed slope, and discharge.  Also, cross sections are needed to properly define the expansion and contraction zones around bridges, culverts, and inline structures.  Additional cross sections are needed in areas of rapidly varying flow and/or significant grade breaks to avoid overestimation of energy loss (http://hecrasmodel.blogspot.com/2010/01/another-reason-for-interpolated-cross.html).  There’s also that pesky warning message that seems to always pop up:    

image 

Each of these warning messages suggest that more cross sections will provide a better solution.  Finally, in unsteady flow modeling, there’s a relationship between cross section spacing, wave speed, and computational time step that minimizes errors and numerical instabilities (Courant Condition).  Interpolating cross sections is a quick and convenient way to satisfy this relationship. 

The first interpolation method, Option A, is called Interpolation “Within a Reach…”.  This is also called “blind” interpolation, because you cannot see nor control how HEC-RAS interpolates new cross sections.  They are interpolated based on the internal interpolation scheme, with no user interaction, except for entering a maximum spacing value.   This method is good for testing whether the spacing of cross sections will help produce a more numerically stable simulation.  You can choose to interpolate over an entire river/reach, or a segment of a reach, based on your selection of the Upstream River Station and Downstream River Station. 

image

Here you can see there’s a single input box for the Maximum Distance between XS’s.  RAS will then determine the number of interpolated cross sections necessary between each set of original cross sections so that the main channel reach lengths never exceed that maximum distance.  There are a couple of other options to be aware of in this window:  Cut Line GIS Coordinates allows you to control whether HEC-RAS interpolates the cut line coordinates of the original cross sections, or simply displays the interpolated cross sections as perpendicular segments along the reach centerline.  Whatever you select here will have no bearing on the computations, but will only change how the cross sections are displayed in the geometry schematic.  If you have a georeferenced project with adequate initial spacing, the first option should display the interpolated cross sections just fine.  However, if you have a very sinuous river and the original cross sections are spaced too coarsely, the interpolated cross sections may not follow the stream centerline very well, sometimes resulting in interpolated cross sections laying off center or completely away from the stream centerline (see below). 

imageimage

In this case, to better display the layout of the interpolated cross sections, select the “Generate for display as perpendicular segments…” option.  This will lay the interpolated cross sections centered on their bank stations and perpendicular to the stream centerline.

image

Notice how the interpolated cross sections now follow the stream centerline.  However, be aware that these new interpolated cross sections are NOT georeferenced.  If you will be mapping your results on inundation maps, it would be better to cut new original cross sections around the bend section of the reach and use the “Linearly Interpolate cut lines…” option. 

The dropdown box “Decimal Places in interpolated Sta/Elev” simply directs HEC-RAS to how many decimal places to carry out the station elevation points for the interpolated cross sections.  The default is 2 and is generally left alone.  One case where you may want more precision in the decimal places is with extremely shallow reaches, where the resulting bed profile may look “stair stepped” due to rounding off of the channel invert point.  Adding more precision will help to smooth this out. 

A word of warning about Interpolation Option A, “Within a Reach…”.  The interpolated cross sections under this method are generated by built-in interpolation routines, that simply linearly interpolate station elevation points based on their proportional stationing within a subsection.  You have no control over the interpolation.  As such, it is very important that before you use these interpolated cross sections for your final RAS model, you verify that they accurately describe the geometry of the reach.  If important geometric features are not captured or are improperly defined, you’ll want to get real cross sections, or interpolate using Option B, “Between 2 XS’s”.  It is advised that blind interpolation (Option A) only be used to test the numerical adequacy of the cross section spacing.  More on Option B in the next post.  Stay tuned. 

Tuesday, May 13, 2014

Tuesday Tip of the Week–Axis Zooming for True Peak Discharge

Written by Christopher Goodell, P.E., D.WRE  |  WEST Consultants

Copyright © The RAS Solution 2014.  All rights reserved.

Another simple, yet very convenient tool not found discussed in the manuals is the ability to zoom in on one of the axes of a graphical plot.  This is especially useful when trying to determine if you’ve captured the true peak discharge in a steeply rising hydrograph.  Take the following example: an unsteady flow dam breach output flow hydrograph.

image

Here we have a steeply rising flow hydrograph from a breach at the inline structure that appears to have a peak discharge of about 35,000 cfs.  To visually inspect whether or not this hydrograph captures the true peak, we can zoom in on the x axis by clicking and dragging a “bar” on the axis itself.  Simply place your cursor just below the x axis line, on the axis labels (in this plot, the time, in hours), then click and drag a red bar bracketing the portion of the hydrograph you wish to zoom in to.

image

Once you release the mouse button, the plot zooms in only on the x axis, in effect “spreading” out the hydrograph so that the peak is more apparent.  Notice that the full range of discharges still appear in the plot, we’ve simply truncated the time window to a more visually convenient range. 

image

Now notice we can see that because the hydrograph output interval is set too coarse (in this case every 10 minutes), we miss out on the true peak of the discharge hydrograph.  It happens somewhere between 1950 hours and 2000 hours.  By rerunning the model with a smaller hydrograph output interval, we can capture a better representation of the true peak discharge.  In the next figure, the discharge hydrograph is shown for the same location with a 2 minute hydrograph output interval.

image

After zooming in again on the x axis, we can see that we have a much better representation of the true peak of the discharge hydrograph, which is closer to 42,000 cfs, versus the 35,000 cfs shown in the first simulation:

image

The axis zooming feature works on any plot (input or output) and you can zoom on either the x or y axis.  So next time you’re evaluating hydrographs, or simply wish to have a better view of a curve in any of the plots, give the axis zooming feature a try.

Friday, May 9, 2014

The Measuring Tool

Written by Christopher Goodell, P.E., D.WRE  |  WEST Consultants

Copyright © The RAS Solution 2014.  All rights reserved.

I don’t think you’ll find this anywhere in the manuals, but HEC-RAS has a very convenient tool for measuring lengths and slopes in the Geometry window and just about any graphical plot.  It only works in the geometry window if your RAS model is georeferenced, as it measures distances based on coordinates.  However, in the graphical plots, it works great whether your model is georeferenced or not. 

While in the Geometry window or any graphical plot, push and hold the Ctrl key on your keyboard.  You’ll see your cursor change from a pointer to a crosshair with a measuring square like this:

image

While keeping the Ctrl key pressed, mouse click and move the measuring tool.  You’ll see a line drawn on the plot. 

image

When you release the Ctrl key, you’ll see a window pop up with the line length, as well as the x direction length (dx) and the y direction length (dy).  dy/dx gives you the slope of the line.  This is very useful for getting river bed slopes for using the normal depth boundary condition or for calculating n values using Jarrett’s equation.  You’ll notice that Polygon Area is also provided.  This works if you click multiple times in the plot, making a polygon.  This is useful if you’re interested in measuring surface area of a storage area in the geometry window. 

image

You’ll notice that Polygon Area is also provided.  This works if you click multiple times in the plot, making a polygon.  This is useful if you’re interested in measuring surface area of a storage area in the geometry window.  Just be sure to keep the Ctrl key depressed while making your “clicks” to define the polygon. 

image

Thursday, May 8, 2014

Controlling HEC-RAS

Written by Christopher Goodell, P.E., D.WRE  |  WEST Consultants
Copyright © The RAS Solution 2014.  All rights reserved.

So you want to control HEC-RAS from a external program.  Perhaps, you have a lot of plans to run and want to run in batch mode.  Maybe you wish to run HEC-RAS, evaluate the results, make some changes, and rerun HEC-RAS-all automatically, on its own, while you’re at home with the family.  The good news is it can be done.  The bad news is there is really no documentation on how to do this. However I will be publishing a book on this topic this year, so keep checking back for more information on that.  The book, "Breaking the HEC-RAS Code" is now available here.

In the meantime, here’s a quick way to open HEC-RAS, select the plan you want to run, and then run it, all through Visual Basic for Applications in Excel.  If you have HEC-RAS, and you have Excel, you can do this. 

To begin, open Excel and enter the VBA Environment by pressing Alt-F11 or by clicking on the Visual Basic button under the DEVELOPER tab. If the DEVELOPER tab is not already present in your list of menu items, you can add it by accessing the Excel Options under the File menu item and selecting Customize Ribbon. Check the box next to the Developer tab so that it shows up on in your list of menu items. The DEVELOPER tab provides quick access to the VBA Code Editor as well as a host of other programming options and tools. The VBA editor will look like this when it’s opened for the first time.

image
Visual Basic for Applications Editor.
 
If a module doesn’t already exist, add one by clicking INSERT…Module from the Visual Basic Editor. A new module will be added and the space to the right of the window will be ready for programming code. You can change the name of the module if you like in the properties window (see figure below).

image
Visual Basic for Applications Editor with a New Module.

Before you can begin accessing the RAS Dynamic Link Library (RAS DLL), it must be added as a reference. In the Visual Basic for Applications window, select Tools…References from the menu items. A window that lists all of the available reference libraries will come up as shown in the “Add Reference” window. Look for the HEC River Analysis System reference and check the box next to it.

image
Add Reference Window.

If you don’t see a reference for HEC River Analysis System, you need to install HEC-RAS on your computer. If you have multiple versions of HEC-RAS installed on your computer, you’ll see multiple entries for HEC River Analysis System. Make sure to check the one for the version of HEC-RAS you wish to use.

Now that you’ve added the RAS DLL as a reference, you have access to it’s library of commands that can control HEC-RAS.  Click on the module (Module 1) and type the following code:

image

Now, it should open and run whatever project you have listed in cell C4 on your Excel Sheet. 
Next, you might want to explore the RC.Plan_SetCurrent() subroutine and a Do-Loop block in your code to run through multiple plans in batch mode. 

Have Fun!







Wednesday, May 7, 2014

Cross Section Points Filter

Written by Christopher Goodell, P.E., D.WRE  |  WEST Consultants

Copyright © The RAS Solution 2014.  All rights reserved.

As RAS model development is done more and more through GIS, using the HEC-GeoRAS extension, cross section point filtering is becoming a standard part of the HEC-RAS model development exercise.  It’s not too uncommon for a model created in GIS to have multiple hundreds of cross section station elevation points.  This is normally not a problem, as long as you don’t exceed 500 points (the maximum allowed for any cross section in HEC-RAS.  However, do an interpolation with bounding cross sections that have more than 255 points each, and you will have interpolated sections with more than 500 points.  Try to run that model and HEC-RAS will give you a message like this:

image

Fortunately, this is easily remedied.  Simply use the Cross Section Points Filter tool located in the Tools menu item in the Geometry schematic:

image

In this tool, you can filter a single cross section, or do multiple cross sections together.  For a single cross section, either go to the cross section indicated in the error message, or scroll through the river station dropdown box until you find one with more than 500 points.

image

Once you’ve selected your cross section(s), you have a number of different ways to filter.  Near and Colinear filtering will remove points that are either very close to another point, or that are in line with other points.  You just provide the tolerances (tell RAS how close is too close, etc.) . Once you enter the tolerance values, press the “Filter Points on Selected XS”, and check to see if you removed enough points to get below 500.  If not, you’ll have to tighten your tolerances.  This can take a little bit of trial and error as you figure out what tolerance levels will remove enough points. 

My preferred method for filtering is to use the “Minimum Area Change” method.

image

Here, all you do is enter in the desired number of cross section points you wish to have in the cross section (500 or less), and then HEC-RAS will remove points until it gets to that number.  No trial and error necessary.  BUT, you do not have control on which points are removed.  HEC-RAS uses a built-in scheme to remove points while minimizing the change in cross section area.  At first I was a bit reluctant to use this feature, thinking that it might drastically alter the shape of my cross section.  However, when comparing the original and filtered cross sections, I’ve never noticed a visual difference.  The “minimum area change” scheme that is used by HEC-RAS does a very good job at preserving the shape and hydraulic characteristics.  Give it a try next time you need to filter. 

Friday, February 28, 2014

Software to check downstream boundary conditions.

Although I don't typically use The RAS Solution to promote software other than HEC-RAS, this utility by Mr. Vladimir Moya is free and some of you may find it useful for testing the effects of different boundary conditions in steady flow, when using normal depth.  Enjoy!

http://sciengsustainability.blogspot.jp/2014/02/boundary-conditions-in-hec-ras.html

Monday, February 10, 2014

Vertical Datum Adjustments in HEC-RAS

Written by Daniela Todesco, P.E.  |  WEST Consultants

Copyright © The RAS Solution 2014.  All rights reserved.

If you have built enough HEC-RAS models, you’ve probably discovered that having data in different vertical datums is a bit of a pain. RAS lets you adjust the vertical datum of individual cross sections (under “Geometric Data”, “Cross Section”, “Options”, “Adjust Elevations”) or portions of the model (“Geometric Data”, “Tools”, “Datum Adjustment”). However, I have to confess this: datum adjustments are always a little bit puzzling to me. I need pen and paper and a little numbering conversion to make sure that I’m doing things right when moving from one vertical datum to the next. And I recently had a “eureka” moment when I finally realized that the sentence “NAVD88 is higher than NGVD29 (for most of the locations we work on)” is actually wrong. Let me step back a moment and I’ll explain why.

The two most common vertical datums used in the U.S. are the North American Vertical Datum of 1988 (NAVD88) and the National Geodetic Vertical Datum of 1929 (NGVD29). NOAA’s VERTCON program can be used to compute the conversion factors from one datum to the other.

Tidal datums are, in general, confusing. Vertical elevations can refer to NAVD88, the station datum, Mean High Water, Mean Low Water, Mean Range of Tide, and a variety of other datums. In recent years, NOAA has been updating its reference tables with excellent graphs showing how the different datums relate to each other (like the one below for Astoria, OR - http://tidesandcurrents.noaa.gov/datums.html?id=9439040 -, where all elevations presented are related to the station datum, which is the Columbia River Datum or CRD).

clip_image002

Let’s say that you download data in the Astoria station datum and you want to convert the data in NAVD88. Since the NAVD88 datum is 2.02 ft above the station datum, you need to subtract 2.02 ft from the station datum to obtain elevations in NAVD88. Or, to make it easier to remember, if the data you obtain is in datum X and you want to convert it to datum Y, you need to ADD the vertical distance between the two datums if X is ABOVE Y (or SUBTRACT if X is below Y). In our case, X is the Astoria station datum, Y is NAVD88, X is below Y, and you subtract 2.02 ft to the Astoria datum to obtain elevations in NAVD88 (the distance between the two). Makes sense, right? This also explains why for most locations on the West Coast USA, the elevation in NAVD88 of a certain location is always higher than the elevation in NGVD29 of the same location (that’s because the NGVD29 datum is actually above the NAVD88 datum). For example, in Astoria, you need to subtract 3.4 ft to elevations in NAVD88 to obtain elevations in NGVD29.

Now, to confuse things even more, gage locations along the Columbia River follow an intrinsic datum that actually changes as you move upstream from the river’s mouth. For example, at Astoria, the station datum is BELOW NGVD29, while at Vancouver, the station datum is ABOVE NGVD29 (see graph below, at http://www.thsoa.org/hy05/09_1.pdf).

clip_image004

The USGS sent us a nice graph (see below) that helped me clear things up when reading datum-related station description information. This one is for the Columbia River at Vancouver gage in WA. The short station description reads: “Datum of gage: 1.82 ft above NGVD29”. The long version reads: “Datum of gage is Columbia River Datum (add 1.82 ft to correct to NGVD29)”. Remember: X is the station datum, Y is NGVD 29, X is ABOVE Y, so you need to add the distance to go from X to Y. To add something more to this graph, I would say that in CRD, the 0 of the NGVD29 datum is 1.82 ft below the 0 of the CDR datum, which reflects the previous graph. Hope this helps!

clip_image005