How to Add HEC-RAS Model to CHPS

How to Add HEC-RAS Model to CHPS

How to add HECRAS models to CHPS

Configuration Manual

Prepared for:

National Weather Service

How to add HECRAS models to CHPS

Configuration Manual

J.M. Lemans

Report

January 2010

1002089

1

Title
How to add HEC-RAS model to CHPS
Client
National Weather Service / Project
1002089 / Pages
48

Keywords

HEC-RAS, manual, How to

Summary

This manual describes how an existing HEC-RAS model can be added to a CHPS configuration

Version / Date / Author / Initials / Review / Initials / Approval / Initials
1.0 / 11-20-2009 / Matthijs Lemans
2.0 / 01-13-2010 / Matthijs Lemans
3.0 / 09-11-2010 / Matthijs Lemans
3.1 / 9-13-2010 / Seann Reed
3.2 / 02-28-2011 / Seann Reed
3.3 / 05-31-2011 / Seann Reed
3.4 / 08-17-2011 / Matthijs Lemans
3.5 / 09-20-2011 / Seann Reed

Contents

1Introduction

1.1Versioning for HEC-RAS Adapter

2HEC-RAS environment

2.1Interface between FEWS and HEC-RAS

2.2Local dependent Linux libraries

2.3Environment variable JAVA_HOME

2.4Directory structure

3From HEC-RAS GUI to CHPS

3.1Run HEC-RAS model in the HEC-RAS GUI

3.1.1Open HEC-RAS

3.1.2Initial conditions.

3.1.3Output locations

3.1.4Write restart file

3.1.5Run simulation

3.2Copy the HEC-RAS data to the CHPS environment

3.3General Adapter file in the /Config/ModuleConfigFiles

3.4HECRAS State Management in CHPS

3.4.1Coldstate directory for the HEC-RAS model

3.4.2State Management

3.5IdMapFiles with new HEC-RAS locations

3.6Parameter File in the /Config/ModuleParFiles

3.7UnitConversionsFiles; add conversions for HEC-RAS

3.8HEC-RAS preprocess file and model instability

3.8.1Minimum flow

3.8.2Burn-in profile

3.9HEC-RAS workflows

3.10Register new files and location in the RegionConfigFiles

3.11Add a new directory in /Models

3.12Topology files for Interactive Forecast Display

3.13ModifierTypes

3.14Filters

3.15Longitudinal Profiles

3.15.1Additions to General Adapter

3.15.2Branches.xml file

3.15.3Additions to IdImportHECRAS.xml

3.15.4Addtitions to Filters.xml or DisplayGroups.xml

3.16Add global properties for hecras model and binaries

3.17HEC-RAS Model Performance when run from CHPS on Linux

Appendix 1: Description of HEC-RAS data files

Appendix 2: General adapter file

Appendix 3: Parameter File

Appendix 4: Preprocessing

Appendix 5: Filters

1Introduction1

2HEC-RAS environment2

2.1Interface between FEWS and HEC-RAS2

2.2Local dependent Linux libraries2

2.3Environment variable JAVA_HOME2

2.4Directory structure3

3From HEC-RAS GUI to CHPS5

3.1Run HEC-RAS model in the HEC-RAS GUI6

3.1.1Open HEC-RAS6

3.1.2Initial conditions.6

3.1.3Output locations7

3.1.4Write restart file8

3.1.5Run simulation9

3.2Copy the HEC-RAS data to the CHPS environment11

3.3General Adapter file in the /Config/ModuleConfigFiles12

3.4HECRAS State Management in CHPS15

3.4.1Coldstate directory for the HEC-RAS model15

3.4.2State Management15

3.5IdMapFiles with new HEC-RAS locations16

3.6Parameter File in the /Config/ModuleParFiles17

3.7UnitConversionsFiles; add conversions for HEC-RAS17

3.8HEC-RAS preprocess file and model instability19

3.8.1Minimum flow19

3.8.2Burn-in profile19

3.9HEC-RAS workflows20

3.10Register new files and location in the RegionConfigFiles20

3.11Add a new directory in /Models20

3.12Topology files for Interactive Forecast Display21

3.13ModifierTypes22

3.14Filters22

3.15Add global properties for hecras model and binaries22

Appendix 1: Description of HEC-RAS data files23

Appendix 2: General adapter file24

Appendix 3: Parameter File27

Appendix 4: Preprocessing32

Appendix 5: Filters35

September 2010 - How to add HECRAS models to CHPS

1Introduction

This manual describes how an existing HEC-RAS model can be added to a CHPS configuration. The assumption is that the HEC-RAS model runs in the HEC-RAS GUI without any errors. From there, the several steps to include the model in CHPS are explained. Since the HEC-RAS GUI is Windows based, it is required to have a Windows machine available.

The manual starts with a overview of the HEC-RAS environment.

More information can be found on the Deltares wiki:

1.1Versioning for HEC-RAS Adapter

The first official release of the CHPS HEC-RAS Adapter was delivered to OHD on July 29, 2010. This was version 1.0. A fix to the treatment of “IB Stage/Flow” (a.k.a. “Observed Stage and Flow Hydrograph”) was included in a new version delivered on 2/1/2011. This version is 1.01.

Version 1.02 of the adapter will be released in June 2011. This document describes fixes included in version 1.02. These fixes (1) allow for an internal boundary to properly switch from observed stage data to a rating curve when specified, (2) correct the treatment of case for locationIDs in output.xml to be consistent with the HECRAS Unsteady Flow File, and (3) correctly the implementation of inflow multipliers specified in the Unsteady Flow File.

2HEC-RAS environment

The HEC-RAS model provides the compute engine for running a hydraulic model schematization for a section of a river or a part of a river system. Two adapters, the FEWS General Adapter and the HEC-RAS Model Adapter form the interface between the FEWS Forecasting Shell and the HEC-RAS model.

The HEC-RAS compute engine is, as its name suggests, the component that actually performs the HEC-RAS simulation. This simulation is controlled from the adapters, and all run time data such as initial and boundary conditions, and parameter settings are passed through the adapters from and to the FEWS Forecasting Shell.

2.1Interface between FEWS and HEC-RAS

The Adapters for HEC-RAS form the interface between the FEWS Forecasting Shell and the HEC-RAS model. The FEWS General Adapter of the Forecasting Shellprovides the required run-time data to run HEC-RAS, and calls the HEC-RAS Module Adapter. The data is provided in a standardized XML interface format, the FEWS Published Interface.The HEC-RAS Model Adapter transfers the XML-data into the native HEC-RAS file formats.

Once a HEC-RAS run has been completed, relevant results are passed back by the HEC-RAS Module Adapter to the Forecasting Shell (FEWS General Adapter) in the form of the standardized XML interface format.

A schematic representation of the communication between the Forecasting Shell and the HEC-RAS model via the FEWS Adapter is shown in the Figure 1.

2.2Local dependent Linux libraries

The following libraries are required when running on Linux:

  • Linux-gate.so.1
  • Libmtsk.so.1
  • Libc.so.6
  • Libpthread.so.0
  • Libm.so.6
  • Librt.so.1
  • Libdl.so.2

2.3Environment variable JAVA_HOME

The HEC-RAS adapter uses the environment variable $JAVA_HOME. For Operator Client and Stand Alone this is set when starting FEWS. For the Forecasting Shell Server please ensure this is set in the environment and that refers to the correct Java version.


Figure 1: Data flows involved during run of HEC-RAS model FEWS adapter

The FEWS Adapter allows running of HEC-RAS by FEWS. The FEWS Adapter should be considered as a thin communication (software) layer on top the existing HEC-RAS engine. The adapter is tightly connected to the model engine.

2.4Directory structure

The directory structure of HEC-RAS in CHPS looks as follows:

+---bin

| <FEWS binaries>

\---nerfc_sa

|

+---Config

| +---ColdStateFiles

| | HECRAS_CONNECTICTUT_UpdateStates Default.zip...... cold state files

| |

| +---IdMapFiles

| | IdExportHECRAS.xml...... mapping between ras and fews

| |

| +---ModuleConfigFiles

| | HECRAS_CONNECTICTUT_Forecast.xml...... general adapter file

| |

| +---ModuleParFiles

| | HECRAS_CONNECTICUT_UpdateStates...... parameter file for mods

| |

| +---ModuleDataSetFiles

| HECRAS_CONNECTICUT_UpdateStates...... initial hecras files

| +…..

\---Models

\---hec\hecras

+---bin...... all hec-ras executables

| DSSWriter.exe...... generates binary file

| dss_writer

| GeomPreprocessor.exe...... converts geometry files

| geo_pre

| Steady.exe...... steady flow simulations

| steady

| Unsteady.exe...... performs unsteady flow

| unsteady

| DFORMD.DLL

| DFORMDD.DLL

| MSVCRTD.DLL

| libmtsk.so.1

| module-adapter-hec-ras.jar...... pre- and pos- adapter

| nwsras.jar...... main library used by the adapter

| heclib6-pc.dll

| javaHeclib.dll

libwldelft_native.so

| castor-0.9.5p.jar......

the rest of the files below are FEWS dependencies used by adapter

| commons-cli-1.1.jar

| Delft_FEWS_castor.jar

| Delft_FEWS_schemas.jar

| Delft_PI.jar

| Delft_PI_castor.jar

| Delft_Util.jar

| jaxp-api-1_3.jar

| jaxp-dom-1-3.jar

| jaxp-sax-1_3.jar

| jaxp-xalan-1_3.jar

| jaxp-xercesImpl-1_3.jar

| log4j-1.2.14.jar

| serializer.jar

| TimeSeriesImport.jar

| xalan.jar

| xerces-c_2_8.dll

| xercesImpl.jar

| xml-apis.jar

|

\---connecticut...... example, could be any river segment

| run_info.xml...... generated by FEWS containing paths, run options

|

+---input...... input directory of the adapter (PI timeseries)

| inputs.xml

|

+---log...... log messages written by the hec-ras adapter

| adapter.xml

|

+---output...... contains HEC-RAS output

| output.xml

|

\---work...... working directory of the adapters, containing eg.ctfld2ras.b01, .b02, .c02, .f04, .g02, .p01, .p05, prj, .r01, .u01, .x02

3From HEC-RAS GUI to CHPS

In short, the approach to add a HEC-RAS model in CHPS is as follows.

1Run HEC-RAS model in its GUI.

2Copy the hecras file from the HEC-RAS work directory to the CHPS environment

3Make a new General Adapter file in the /Config/ModuleConfigFiles

4Make a new Coldstate directory for the HEC-RAS model

5Extend the IdMapFiles with new hecras locations

6Make a new Parameter File in the /Config/ModuleParFiles (required for run-time mods)

7Add correct unit conversions

8HEC-RAS preprocessing and model instability

9Add new HEC-RAS workflows

10Register new files and location in the RegionConfigFiles

11Add a new directory in /Models/hec/hecras (or your preferred file output location).

12Add files for Interactive Forecast Display

13Create Filters for time series and longitudinal profiles

14Add global properties for HEC-RASmodel and binaries

The steps will be explained in more detail in the following paragraphs.

3.1Run HEC-RAS model in the HEC-RAS GUI

As a first step, the HEC-RAS model should be run in its own GUI. Make sure the version is up to date. Be aware that the previous hecras version, 4.01 beta, is replaced by version 4.1. This HEC-RAS version can be downloaded for free at the HEC website.Using HEC-RAS version 4.1 executables in CHPS requires the recent IO library made by RMA. Of particular note is that the new unsteady compute program is NOT compatible with the 4.0.1 beta restart files (*.rst). This means new restart have to be created in the HEC-RAS GUI 4.1, to be used in CHPS when the HEC-RAS 4.1 version is used there.

It is recommended to store the HEC-RAS files in a local directory, separated from the CHPS configuration.

3.1.1Open HEC-RAS

Open the project file in the work directory, see Figure 2.

Figure 2:Open HEC-RAS model in the GUI

3.1.2Initial conditions.

Open the unsteady flow data display (see Figure 2) and select the initial condition tab. Make sure the model doesstart with a restart.The name of the restart file is like ctdamlevee.p02.rst. The name of the restart files from HECRAS 4.1 includes date information, but for warm state handling reasons, that part of the name is removed by the HECRAS model adapters after each run. This means that a restart file generated in Windows with a date (e.g. ctdamlevee.p02.29APR2008 2400.rst) should be renamed to something without a date (e.g. ctdamlevee.p02.rst) for use in Linux. The General Adapter File (Section 3.3) will reference the name without the date.

Note that if you do not have a restart file in Windows, you can first make a run using the “Enter Initial Flow Distribution” option; however, be sure that the last unsteady flow file saved prior to transition to Linux has the option to “Use a Restart File” selected.

Select the ‘Boundary Conditions’ tab.

IMPORTANT: Enter the boundary conditions in the tables, not in dss files. Although inconvenient for large models, this is required for the HEC-RAS Adapter to work.

Figure 3: Initial Conditions

3.1.3Output locations

Open the Unsteady flow simulation display (see Figure 2) and select ‘Options/Stage and Flow Output Locations’. You will see a display that looks like Figure 4.

Figure 4: Output locations

Check if the locations in the display are all the desired output locations. HEC-RAS will only write results to those locations (in addition to boundary locations). If not, add more locations and press ‘OK’ and save the unsteady flow file.

3.1.4Write restart file

Open the Unsteady flow simulation display (see Figure 2) and select ‘Output Options’. The following display appears.

Figure 5: Write restart file

Make sure there is a mark for ‘Write Initial Conditions file at the end of the simulation’. FEWS needs this .rst file for state handling. It needs to be copied to the ColdStateFiles directory (see Paragraph 3.4). FEWS will not use additional initial condition files written during the simulation, so there is no need to choose the option “Write Initial Condition file(s) during simulation.”

3.1.5Run simulation

Open the Unsteady flow simulation display, see Figure 2. Check if the Geometry Preprocessor, Unsteady Flow Simulation and Post Processor are selected, see Figure 6.

The Post Processor is required when variables other than flow or stage that only get written to theflat ‘binary’ output file (‘*.0*’) are desired (e.g. velocity, conveyance, etc.). It is recommended to turn on this option in Windows. A CHPS parameter can override this selection once the model is configured on Linux.

Choose a simulation period that covers the boundary data. Choose the desired computational interval and output interval.

Click ‘Compute’ to run the model.

Check if no errors occur. If errors exist about missing values, check if the simulation period matches the data in the unsteady flow data boundary conditions.

Save the project.

Figure 6: Run Simulation

3.2Copy the HEC-RASdata to the CHPS environment

The HEC-RAS files in the local work directory must be copied to the CHPS environment. These file are:

•.prj

•.p01

•.g01

•.u01

•.b01

•.x01

•.r01

•.c01

The numbering can be different. Since the HEC-RAS GUI is Windows based, these files are Windows based as well.

Transfer these files to Linux, convert the files form DOS to UNIX file format (applies to ASCII files only), and create a new zip file in the CHPS/Linux environment /Config/ModuleDataSetFiles, eg. HECRAS_KENNEBEC_UpdateStates.zip.

One method for DOS to UNIX conversion is using the ‘dos2unix <filename>’ command.

To use the command, simply type the command followed by the name of the file you wish to convert, and the name of a file which will contain the converted results. Thus, to convert a Windows file to a Unix file, at the Unix prompt, enter:

dos2unix winfile.txt unixfile.txt.

To convert all files in a directory, use

dos2unix *.

The command ‘hexdump –cb <filename>,” can be used to check if the file is UNIX or PC. If Windows, you see many /n and /r characters in the file. If the file is UNIX, you see only /n.

IMPORTANT NOTE: If you generate these files using HEC 4.1, you will need to be sure that the *.b01 and *.u01 files reference the same restart file name used in the General Adapter file/ModuleConfigFiles directory (see section 3.12 for discussion of restart file names). It is recommended to edit the restart file names in *.b01 and *.u01 produced by Windows HECRAS to eliminate the data time stamp after transferring the files to Linux.For example, ‘ctdamlevee.p29.01FEB2008 0100.rst’ would be changed to ‘ctdamlevee.p29.’

3.3General Adapter file in the /Config/ModuleConfigFiles

The General Adapter is part of DELFT-FEWS. It is responsible for the data exchange with the models and for executing the models and their adapters, see Figure 7. The General Adapter module can be configured to carry out a sequence of five types of tasks;

•Startup Activities. These activities are run prior to a module run and any export import of data. The activities defined are generally used to remove files from previous runs that may implicate the current run.

•Export Activities. These activities defined all items to be exported through the published interface XML formats to the external module, prior to the module or the module adapters being initialized.

•Execute Activities. The execute activities define the external executables or Java classes to be run. Tracking of diagnostics from these external activities is included in this section.

•Import Activities: These activities define all items to be imported following successful completion of the module run.

•Shutdown Activities. These activities are run following completion of all other activities The activities defined are generally used to remove files no longer required.

The general part administrates the needed files for the general adapter in terms of file names and locations.

Figure 7: Schematic overview of General Adapter tasks

An example of a general adapter for executing a HEC-RAS model is shown in Appendix 2.This is a UpdateStates file. Also a Forecast file has to be created. The main difference is that the Forecast file does not have an importStateActivity (See Section 3.4.2). Furthermore, all time series types are forecasting instead of historical and use a relative view period with addition endOverrulable="true".Another difference is the warm state search period, this should be set to 0 (for a Forecast file) instead of -1 (UpdateStates). The UpdateStates search period is set to -1 because the forecast length for UpdateStates is 0 and FEWS will crash if a state at T0 is used because the simulation time is empty.

By the way, in operational systems, you will hardly see problems for update runs if you have a state search period till T0, because T0 is most of the times ahead of the most recent state in the database. You will get problems if you do the same update run again, if the first run was already succesful and provided as state.

In the example of Appendix 2, during the Startup Activities the “work” (exportDataSetDir) directory is cleaned out prior to each HECRAS run. Data files that were transferred from Wiindows are then copied from the ModuleDataSets directory to “work” and unzipped. The appropriate state (restart) file is then copied to the work directory. If a ColdState is specified in the CHPS GUI, then the restart file is copied from the ColdStates directory (see Section 3.4.1). If a warm state is specified, then CHPS copies the appropriate restart file stored in the CHPS database to the work directory. In either case, the name of the state file in the “work” directory is the same. See Section 3.4.2 for more discussion on State Management.