Repository for Ideas & Research
Open Source GIS, Hydrologic Modeling, Optimization

HEC-RAS

1   How to sort steady flows

#!/usr/bin/env perl
use strict;
die "Usage: sort_flow.pl flow_file" if($#ARGV == -1);
my $file = $ARGV[0];
die "Cannot open $file" unless(open FH, $file);
my $started = 0;
my ($start, $end);
my %flows;
while(<FH>){
	if(m/^(River Rch & RM=.*,)(.*)$/){
		$started = 1;
		$flows{$1}{$2} = <FH>;
	}elsif(!$started){
		$start .= $_;
	}else{
		$end .= $_;
	}
}
close FH;

print $start;
foreach my $river (sort keys %flows){
	foreach my $station (reverse sort { $a <=> $b } keys %{$flows{$river}}){
		print "$river$station\n$flows{$river}{$station}";
	}
}
print $end;

2   How to create a steady flow data file from a CSV file

  1. Run the following script:

    mk_flow.sh:

    #!/bin/sh
    cat<<EOT
    Flow Title=$1
    Program Version=5.00
    Number of Profiles= 7 
    Profile Names=EX5YR,EX10YR,EX25YR,EX50YR,EX100YR,EX500YR,EX1PCTPLUS
    EOT
    
    awk -F, '
    {
    	if(NR == 1) next;
    
    	printf "River Rch & RM=%s,1               ,%-8.7g\n", $8, $9;
    	printf "%8.0f%8.0f%8.0f%8.0f%8.0f%8.0f%8.0f\n", $1, $2, $3, $4, $5, $6, $7
    }
    END{
    }
    ' $2
    
    cat<<EOT
    DSS Import StartDate=
    DSS Import StartTime=
    DSS Import EndDate=
    DSS Import EndTime=
    DSS Import GetInterval= 0 
    DSS Import Interval=
    DSS Import GetPeak= 0 
    DSS Import FillOption= 0 
    EOT

    sample.csv:

    Q20PCT,Q10PCT,Q4PCT,Q2PCT,Q1PCT,Q02PCT,Q1PCTPLUS,RiverCode,ChangeLoc
    69.00626342180,89.03857740680,115.67889174700,136.72709779900,158.37663858100,213.87265635600,209.21553956600,River 1,12366.09472660000
    81.64921108840,105.84198827500,138.25640989200,164.03212698300,190.64444884100,258.28762136800,251.84131691900,River 1,11166.09472660000
    86.85958834660,112.79881502000,147.65283458600,175.43700146900,204.16380580800,276.96413978600,269.70038747200,River 1,10266.09472660000

    Usage:

    mk_flow.sh "River name in HEC-RAS" sample.csv > name.f01
  2. Open the project file (*.prj) in a text editor and add Flow File=f01 if it isn’t already there.
  3. Open the project in HEC-RAS => View/edit steady flow data => File => Open Flow Data... => Select the above flow file.

3   Weir equations in HEC-RAS

The discharge coefficient is dimensionless and therefore it is the same in both English (U.S. Customary) Units and SI Units. The weir coefficient, since it is a function of the gravitational constant, is not dimensionless and therefore has different values depending on which unit system you are using. For example, a weir coefficient (C) of 3.00 in English Units would be 1.66 in SI units. But both share the same discharge coefficient (Cd) of 0.56. For convenience, to convert an English weir coefficient to an equivalent SI weir coefficient, multiply the English weir coefficient by 0.552.

Be very cautious when considering C versus Cd. They are different but are often mistakenly used interchangeably. In fact, you’ll see the coefficient Cd labeled occasionally in the HEC-RAS software and literature when discussing weir coefficient.

...

keep in mind that the weir width is not used at all in the computations (weir or 2D equations). It is purely there for graphical purposes.

4   Problems with bridges and culverts

Yes, you use the exact same cross section layout. The only difference is that instead of contracting flow to go through a bridge opening or culvert, you’re squeezing it through gates, or low level outlets, or spillways, turbine units, etc. If you have multiple outlet locations, you may need to use multiple blocked ineffective flow areas. Any cross sections placed between XS3 and XS4 (the contraction reach) should have ineffective flow areas defined. Same thing for any cross sections placed between XS1 and XS2 (the expansion reach). Also, make sure you have your ineffective flow trigger elevations set so that they turn off once the ineffective flow is activated (i.e.spilling over an emergency spillway, or overtopping a dam). Good luck! @RASModel

5   When to use permanent ineffective flow areas

I attended a HEC-RAS class given by the National Highway Institute, and I asked the instructors about this permanent ineffective areas business. They said that it was not applicable to steady-state modeling, and they would never recommend using it in a steady-state model. “Absolutely not” was one instructor’s reply.

The reason that permanent ineffective areas are included in RAS is for use in unsteady flow applications, when a model is crashing or otherwise acting squirrelly and you need to ‘put your thumb on it’ in order to make it resolve.

Straight from the horse’s mouth. ;)

6   HEC-RAS ineffective flow areas

An option is available to make the defined ineffective flow area “permanent” where it does not change into effectively carrying flow when the computed water surface elevation is above the defined ineffective flow area elevation.

This option is generally used only for unsteady flow models to dampen the oscillation that can occur when the software is attempting to converge to a water surface elevation and the computed water surface elevation is iterating and advancing simulation time steps. For example, if the computed water surface elevation is just above the defined ineffective flow area elevation for one time step, and then in the next time step the computed water surface elevation is just below the defined elevation, the available effective flow area will begin to oscillate. This may cause the unsteady flow computations to fail to converge to a solution. By making the ineffective flow areas “permanent”, this ineffective flow area oscillation is eliminated.

7   HEC-RAS culvert shapes & dimensions

8   Riser above dam

You’ll want to use User Defined Curves for your gate type to make use of the rating curve you computed in Hydrocad. First enter in a gate of any size/shape. The size and shape is inconsequential, since you’ll be using a rating curve. Make sure that the invert elevation is correct though. Then, select Gate type as User Defined Curves. Then enter in your family of rating curves. It’s a family of curves because you must enter in a rating curve for each gate opening. If you just have a overflow riser, then you only need to put in one opening (this too, can be anything-just make sure that you use the same gate opening when you set up your gate boundary condition in the unsteady flow editor).

9   A bug with floodway encroachments in HEC-RAS 5.0.1

I submitted a bug report to HEC and received a reply acknowledging there is a bug with floodway encroachments in 5.0.1. They suggest using version 4.1 for floodways until the next update.

10   High flow methods for culverts

You had mentioned that the equations for modeling bridges and culverts are quite different. Does the “Bridge Modeling Approach” (i.e. high and low flow methods) apply to culverts as well?

Not for low flow conditions. HEC-RAS will use the inlet or outlet culvert equations for low flow conditions. If the upstream energy surpasses the minimum weir flow elevation, RAS will use the weir flow equation along with the culvert equations (and balance the energies at the upstream end) if the high flow method “pressure and weir” is selected. If the energy method is selected for high flow conditions, I think RAS will still use the weir equation with the culvert equations, but I’m not sure about that. You can easily check that if you have a data set with an overtopping culvert. Just check the culvert detailed output table and see if it lists weir flow.

Tue Jan 10 12:59:50 2017 EST by Unknown
Parsing time: 0.077 seconds
XHTML . CSS . Powered by Uniqki!