Tuesday, December 30, 2008

Extra Precision in Interpolated Cross Sections

Written by Chris Goodell, P.E., D. WRE | WEST Consultants
Copyright © 2008. All rights reserved.

Here's a question I got recently:

"When interpolating cross-sectional data, HEC-RAS truncates after 4 decimal places. We have a very flat system and this is causing problems with our model because every time it truncates, there is a step discontinuity in the results which manifests itself as an instability in the energy gradient. How can I extend the precision in HEC-RAS to 6 digits after the decimal place?"

try this: Perform a datum adjustment for all the geometry (cross sections, bridges, inline structures, etc.). Adjust by a factor of 100. Or 1000, whatever works. This can be done very quickly in the geometry schematic under Tools…Datum Adjustment. So let’s say you have an invert of 5.432615 meters at River Station X. You now have an invert of 543.2615 (and all the other elevations in the geometry will change as well). You have now bought yourself another 2 decimal places to work with when you interpolate. Then after interpolating with a precision of 4 decimal points, datum shift again, by a factor of 0.01 to get back to the real elevations-make sure you maintain enough decimal points during the datum shift to avoid rounding off the extra precision you just obtained.

A potential problem is when you go to save the data. I believe RAS uses double-precision floating point numbers for elevations when storing data to internal memory (RAM)-this gives you LOT of decimal places. However, once the data is written to a file, it is reduced to a single precision number-which is limited to 7 digits and a decimal point (or 8 digits without a decimal point). So if you have an elevation of 1234.56789 ft, it will be reduced to 1234.568 when written to the geometry file. You'll also see this in the cross section editor. Values are reduced to single-precision floating point numbers. I imagine this will only be a problem if you’re working with high elevation streams. Again, this can be avoided by setting an arbitrary datum near the downstream end of the model so that smaller numbers can be used.


  1. I know this is 3 years later and I'm not sure if anybody would even read this but...

    In what real-world situation would 6 digits after the decimal be applicable to modeling or design?. In feet, that's one-one millionth of a foot. Most survey data is only accurate to a tenth of a foot. Plus, this example is using interpolated cross sections. Unless, there's some strange velocity changes and the cross sections are far apart they may not even be necessary. It sounds like interpolated cross sections are being placed way too close together in an area with very little grade.

    I can understand that tweaks may be necessary to stabilize the model, but this seems a little bit extreme to me. The area could just as well be modeled as flat. In fact, given the error in survey, it could technically be slightly uphill.

    The advice in this post IS a valid solution to this problem. I'm just confused on how this problem could actually present itself. Perhaps in my limited experience I'm missing something.

  2. Wow, 0.000,001 computation precision? Just curious what the units are; miles?

    Survey shots may be recorded to the 0.01 foot but the actual ground surface will likely be +/-0.1 foot if its a mowed lawn. +/- 1.0 foot if its a relatively flat overbank area. HEC-RAS does straight line interpolation between those shots.

    A natural channel may scour and re-fill several feet as a hydrograph peaks and then recedes back to base flow.

    PLEASE, do not encourage GIGO modeling.

    1. The HEC-RAS Bloggery officially discourages GIGO modeling.

  3. What is the precision of HEC-RAS version 5? In HEC-RAS 5 we can select different elevation precisions (1/32, 1/128 ...). Do those precisions mean that 1/32 rounds to the second decimal and 1/128 rounds to the third decimal?

    1. The rounding options for terrain development that are base 2 (1/16, 1/32, 1/128, etc) are just another way of defining the precision in addition to the conventional base 10 options (1/10, 1/00, 1/1000, etc.). 1/10 means you are rounding to the nearest 0.1 meter (or foot). 1/16 means you are rounding to the nearest 0.0625 meter (or foot). Base 2 options are included because they are actually more computationally efficient than base 10 options. Many times you'll find 1/16 goes faster and takes less storage space than 1/10, even though it has more precision.


Note: Only a member of this blog may post a comment.