skip to main content
Objects and Methods : Computational Subbasin : Computational Subbasin Functionality Guide
Computational Subbasin Functionality Guide
Following is a description of functionality associated with the Computational Subbasin (and therefore member objects) that spans multiple user methods. Presented is a description, how to define a model, configure objects, and an example case for each of the functionalities. The Computation Subbasin specific categories and methods are described above. Currently, the only functionality described is the RiverWare-MODFLOW connection.
RiverWare / MODFLOW Connection
Note:  RiverWare’s connection with MODFLOW is currently not functional. The methods have been disabled and cannot be selected. An error will be posted at model load if methods were previously selected. Contact CADSWES for help.
A dynamic link between RiverWare and MODFLOW 2000 (Harbaugh et al., 2000) allows the interaction between surface water and shallow groundwater to be incorporated into RiverWare. In RiverWare, the Reach, Water User, Aggregate Diversion Site (AggDiversion Site), and GroundWater Storage (GW) Objects each contain methods that, when selected, allow an object’s data to be exchanged with MODFLOW. Data from these RiverWare objects is used as input into the MODFLOW General Head Boundary (GHB), River (RIV), Streamflow-Routing (STR), and updated Stream Flow Routing (SFR) packages. In the model setup, the user specifies the RiverWare objects and MODFLOW cell(s) or segment(s) involved in data exchange using the Computational Subbasin object. The Computational Subbasin displays cell by cell values for exchanged data. The MODFLOW 2000 executable provided with RiverWare includes one non-standard MODFLOW package Riparian Evapotranspiration (RIP-ET) (Maddock and Baird, 2003). While no data is exchanged between the RIP-ET package and RiverWare, this package is incorporated since it is applicable to regions where interaction between surface water and groundwater is highly active. This section describes how to set up a RiverWare-MODFLOW linked model.
How a Dynamic Link Between RiverWare and MODFLOW Works
During a run in which RiverWare and MODFLOW are linked, the two models run in parallel, exchanging data at each timestep (the RiverWare timestep must match the MODFLOW stress period). To accomplish this interaction, when the user initiates a RiverWare-MODFLOW run RiverWare starts up a separate “MODFLOW server” process to perform the MODFLOW simulation. This executable is distributed and installed with RiverWare and contains all of the MODFLOW 2000 functionality, as well as the ability to communicate with RiverWare. This communication between RiverWare and the MODFLOW server is accomplished using an Interprocess Communication (IPC) mechanism appropriate for the platform on which RiverWare is running.
In RiverWare, the data exchange is defined and managed through the use of Computational Subbasins. The Computational Subbasin is a collection of objects that also contains methods and data used to define how information is exchanged between the two models. Figure 8.12 is a schematic of the overall data exchange managed by the Computational Subbasin.
Figure 8.12  Interactions among RiverWare objects, computational subbasin, slots, servers, and MODFLOW routines
MODFLOW Library
The MODFLOW algorithms incorporated into the MODFLOW server executable was taken directly from the MODFLOW 2000 source code with some minor modifications. MODFLOW2000 introduced the concept of a process, the computations associated with a particular set of equations. The Parameter Estimation Process requires several MODFLOW “simulations,” and this functionality was achieved by introducing an outermost iteration into the MAIN procedure. A model which uses this process would not fit into the current framework -- RiverWare requires a MODFLOW model that iterates through the stress periods just as RiverWare iterates through timesteps. Thus in the modified MODFLOW subroutines, the parameter estimation loop was removed. Figure 8.17, which is taken from the MODFLOW 2000 documentation, illustrates the main flow of control for the MODFLOW program.
The MODFLOW libraries contained within the RiverWare server includes the following subroutines, several of which are primarily based on MODFLOW’s MAIN procedure. They are listed in the order they will be called by RiverWare.
1. Initialize RiverWare - Beginning of Run behavior
2. Initialize: This creates shared data structures of the appropriate size and reads data that applies to all timesteps.
GLO DF, AL, and RP (DF = Define, AL = Allocate, RP = Read & Prepare)
GWF AL
OBS, SENS, and PES AL
GWF RP
OBS, SEN, and PES RP
PES RW
GWF AL and RP
3. “Begin Timestep” behavior in RiverWare
4. Begin MODFLOW Stress Period: Advance to the next stress period, read the appropriate data from RiverWare. Execute:
GWF ST
RP
5. Set RiverWare data: given data for the current stress period for a set of variables, use these values to override the values set by RiverWare during the “Begin Timestep” behavior.
6. Do MODFLOW Time Step Loop Period: perform the computation and output associated with the remainder of the current stress period. This is the timestep loop which is basically the remainder of the MAIN subroutine:
GWF AD
Iteration Loop
GWF FM
GWF AP
GWF OC, BD, OT
OBS FM
Parameter Sensitivity Loop
Iteration Loop
SEN FM
SEN AP
SEN OT
7. Get RiverWare data: get the MODFLOW values needed by RiverWare for the current timestep. Execute the RiverWare timestep; that is, alternate between dispatching objects and firing rules as necessary.
8. Continue to the next timestep and repeat starting at Step 3.
Data Exchange Slots
The Reach, GroundWater Storage, Water User and AggDiversion Site objects may all be linked with MODFLOW. Table 8.2 summarizes the data exchanged between the two models. Each RiverWare simulation object that contains exchanged data is listed by object type and slot name. The table indicates if the value shown on the Slot is a single value, a summed value, or an interpolated value (summed or interpolated values indicate that a RiverWare object may be associated with multiple MODFLOW cells). The direction of data exchange is noted and whether the data exchange is mandatory when linking the two models or if the data exchange is a user selectable option.
 
Table 8.2  Data exchanged between RiverWare and MODFLOW
Simulation Object
Slot
From
To
MODFLOW PACKAGE
MODFLOW Variable
Sum, Interpolation, or Single Value
MODFLOW Identifier
Reach
Total MODFLOW GainLoss
MODFLOW
RiverWare
RIV
River
Leakage
SUM
Multiple cells (Layer,Row, Column)
Reach
Inflow Stage and Outflow Stage
RiverWare
MODFLOW
RIV
Stage
Interpolation
Multiple cells (Layer,Row, Column)
GroundWater Storage
Lateral Flux from MODFLOW
MODFLOW
RiverWare
GHB
Head
Dep Bounds
SUM
Multiple cells (Layer,Row, Column)
GroundWater Storage
Previous Elevation
RiverWare
MODFLOW
GHB
Bhead
Interpolation
Multiple cells (Layer,Row, Column)
Reach
Local Inflow
MODFLOW Return
MODFLOW
RiverWare
STR or SFR
Stream Flow Out or Stream Leakage
(Flow Into Stream Reach)
Single Value
Segment #
Water User
Surface Return Flow
RiverWare
MODFLOW
STR or SFR
Flow
Single Value
Segment #
AggDivSite
Total Surface
Return Flow
RiverWare
MODFLOW
STR or SFR
Flow
Single Value
Segment #
Reach
Diversion
RiverWare
MODFLOW
STR or SFR
Flow
Single Value
Segment #
At the beginning of each timestep [t], RiverWare transfers the following variables to MODFLOW; see Table 8.2 for a detailed description.
1. Reach Object: Inflow Stage and Outflow Stage at [t-1] (disaggregated for each MODFLOW cell)
2. Reach Object: Diversion at [t-1] (if Diversion goes to riverside drains or low flow channel)
3. Water User Object: Surface Water Return Flow [t-1]
4. AggDiversion Site Object: Total Surface Water Return Flow [t-1]
5. GroundWater Storage Object: Previous Elevation at [t] (same as Elevation at t-1) (disaggregated for each MODFLOW cell)
After sending this data to MODFLOW, RiverWare waits for MODFLOW to execute its timestep [t]. MODFLOW then sends data to the subbasin which writes values to the following RiverWare slots:
1. Reach Object: Total MODFLOW GainLoss at [t] (aggregated for each object)
2. Reach Object: Local Inflow MODFLOW Return at [t]
3. GroundWater Storage Object: Lateral Flux From MODFLOW [t] (aggregated for each object)
RiverWare then solves for timestep t using these values. Then the controller moves to [t+1].
Note:  The simulation timestep/stress-period size must be the same in RiverWare and MODFLOW.
Configuring RiverWare: Environment Variables and Diagnostics
First, a few environment variables need to be defined. Since MODFLOW is started from RiverWare, an environment variable must be set containing the PATH to the directory containing the MODFLOW.nam file(s).
• From the Windows Start menu, select Control Panel, then System.
• Go to the Advanced tab and select Environment Variable. In the User Variables section, select New.
• Enter the following:
– Variable Name: RIVERWARE_MODFLOW_DIR
– Variable Path: Enter the path to the folder containing the MODFLOW.nam files; for example, C:\Temp\ModflowModels
To view the MODFLOW diagnostics in RiverWare, you must set another environment variable, as follows:
– Variable Name: MODFLOW_SERVER_DIAG
– Variable Path: 1, or any other non-zero value
• You must also enable diagnostics for the MODFLOW servers, as follows:
a. From the RiverWare workspace, select Utilities, then Diagnostics Manager, then Workspace.
b. In the Show Diagnostics For section, enable Client Server.
Model Setup
To begin, at least one MODFLOW model should be created and tested. Some MODFLOW modeling details as they pertain to the MODFLOW RiverWare connection are provided here; but in general, it is assumed that the user already knows how to set up and use a MODFLOW model. In RiverWare, the user must decide how many and the type of objects they need. Since MODFLOW and RiverWare model spatial resolutions may differ, more than one MODFLOW cell can be associated with a RiverWare object. The user must decide what MODFLOW cells are associated with each object. See Example for a simple example model.
Input instructions for each object involved in the data exchange are discussed in detail in the following sections. These sections are broken into mandatory and optional data exchange configurations.
Note:  In MODFLOW, the type and number of model cell boundary conditions should not change between stress periods. For example if 10 GHB cells are used in the first stress period the same 10 GHB cells must also be used in all stress periods in the model. This must be true of all boundary conditions in the model regardless if the boundary conditions are those that exchange data with RiverWare.
Computational Subbasin
A computational subbasin is a user-configured subbasin that allows you to specify a group of objects and the computations that should be performed on the objects.
Once you have set up a RiverWare simulation model, all simulation objects that are to exchange data with MODFLOW must be grouped into subbasins. See Subbasin Manager in User Interface for more information on creating subbasins and adding objects to them.
• Create a Computational Subbasin. The subbasin name must correspond to the MODFLOW model’s “.nam” file.
• Add Objects to a Subbasin. All objects that exchange data with MODFLOW must be included in the computational subbasin. Each computational subbasin should connect with only one MODFLOW model.
• Do either of the following to open and configure the computational subbasin object:
– Select Open in the Edit Subbasins dialog.
– In the RiverWare main menu, select Workspace then Open Computational Subbasin.
The Open Subbasin dialog has two views: Slots and Methods.
– The Slots view is empty until a method has been selected.
– In the Methods view, highlight the Groundwater Computation category and select the Link to MODFLOW 2000 RIP ET method. See Link to MODFLOW 2000 RIP ET for details.
Eight new categories are now available; select the desired methods from these categories:
Each of the eight dependent categories have “None” as the default method. The “None” method has no associated slots and performs no computations. The methods in each of these categories preform different computations but the slot associated with each method are very similar. Each method contains a Map slot and a Data Exchange slot (except the Groundwater Elevation category which contains two Map slots and a Data Exchange slot). For example when the Weighted Interpolation method is selected in the Reach Stage category, the Reach Stage and GainLoss Map slot and the Reach Stage to MODFLOW slot are enabled. The user must supply input for the Reach Stage and GainLoss Map. This slot maps a Reach object’s data to one or more cells in a MODFLOW model. See User Methods for details on these categories, methods, and slots.
The user must supply a list of the cells that exchange data with RiverWare. The Reach Stage and GainLoss Map slot contains five columns: Layer, Row, Column, Inflow Stage Weight, and Outflow Stage Weight (see Reach Stage and GainLoss Map). The Layer, Row, and Column correspond to the MODFLOW cell identification. The inflow and outflow stage weights are used in the interpolation equation; see Appendix A: MODFLOW Package Description for an explanation of the interpolation equation.
Note:  The two weights corresponding to a single cell must add up to 1.
Likely it will be easiest for the user to import data into the Map slots. Imported data may be tab or space-separated. Imported data is assumed to be in the same units as shown in the Edit Slot dialog. The entire precision of an imported value will be preserved, although only the selected display precision is shown.
Note:  The Import (Fixed Size) option truncates incoming data if the data file contains more rows than the slot, and leaves existing data if the data file contains fewer rows than the slot. The Import (Resize) option automatically resizes the slot to match incoming data. The data will not be imported if the number of columns in the data does not match the number of columns needed in the slot or the data file contains unnecessary characters. See File Menu in User Interface for more information on importing data.
Once the data is entered you must edit the row labels. The rows should be labeled with the name of the corresponding object.
1. From the Slot dialog select View, then Edit Row Labels.
2. In the Edit Row Labels dialog, highlight one or more rows and select Set Label(s) to an Object Name.
The Object Selector dialog opens, displaying the correct object type and only those objects in the subbasin.
3. In the Object Selector dialog, highlight the corresponding object title and select Ok.
4. When finished assigning row titles, select Ok in the Edit Row Labels Dialog.
Data must be arranged so that all the cells pertaining to one object appear in contiguous rows. For example, you cannot have rows 0–4 correspond to Reach 0, rows 4–8 correspond to Reach 1, and then row 9 also correspond to Reach 0. Instead you should have rows 0–5 correspond to Reach 0, and rows 5–9 correspond to Reach 1.
Once the user has set up the Map slots, the Data Exchange slot(s) units must be configured. The units in the Data Exchange slots must be consistent with the units used in MODFLOW models. To set the corresponding units, select Slot, then View, then Configure. Then set the units for all columns at once.
Units must be set for the following Data Exchange slots the Reach Stage, Reach GainLoss, GroundWater Elevation, GroundWater Lateral Flux, WaterUser Surface Return Flow, Agg Diversion Site Surface Return Flow, Reach Diversion, and Reach Local Inflow when in use.
• Enabling the subbasin. Once the subbasin has been configured, make sure it is enabled. To enable a subbasin select Subbasin, then Enable Subbasin in the open subbasin object.
Note:  The subbasin will not perform any computations if it is not enabled.
Reach Object
In RiverWare a river channel can be represented with a Reach object. When a MODFLOW model is connected with RiverWare the same river channel should be represented using a RIV type boundary condition in MODFLOW. As shown in Table 8.2, some of the data exchanged between the two models is mandatory and some optional. The first subsection below describes mandatory data, this data is necessary for the linked models to run and the user must select and assign values as described. The second subsection describes two optional data exchanges. None, one, or both of the optional exchanges may be assigned on a single Reach.
Mandatory Data Exchange: Reach Configuration
MODFLOW Link Category
For each Reach that is to transfer data between RiverWare and MODFLOW, the user must select the Link to MODFLOW method in the MODFLOW Link Category Reach (see Link to MODFLOW). The MODFLOW Link Category Reach is dependent upon selection of the No Routing, Time Lag, Variable Time Lag, or Muskingum Cunge method in the Routing category. When the Link to MODFLOW method is selected, the Total MODFLOW GainLoss slot becomes available. The MODFLOW RIV boundary condition calculates flow into or out of a cell from an external source in proportion to the difference between the head in the cell and the stage in the river. The value shown in the Total MODFLOW GainLoss slot is the sum of this flux over all the cells associated with a Reach. A negative flux on the Reach.Total MODFLOW GainLoss slot indicates flow out of the river to the aquifer. The user must assign MODFLOW cells to a Reach using the Computational Subbasin structure; see Reach Gain Loss.
The MODFLOW Link Category Reach also contains the method No Link to MODFLOW. This method should be selected when the user does not want to link a Reach with MODFLOW. See No Link to MODFLOW.
Note:  A RiverWare model may contain both Reach objects that are linked to MODFLOW and Reach objects that are not linked to MODFLOW
Stage
A Stage calculation method must be selected in the Stage category; see Stage. The MODFLOW RIV boundary condition calculates flow into or out of a cell from an external source in proportion to the difference between the head in the cell and the stage in the river. To calculate this gain/loss between the river and the underlying aquifer, MODFLOW must have a stage value for each corresponding RIV boundary cell. The user must assign an initial inflow and outflow, as well as, initial inflow stage and outflow stage to every Reach that is linked with MODFLOW. All inflow and outflow stages proceeding the initial input will be calculated from the previous timesteps inflow and outflow by RiverWare for each RIV boundary cell and transferred to MODFLOW. The user must assign MODFLOW cells to a Reach from the Computational Subbasin.
Note:  In MODFLOW the user must have the option flag (CBC) entered in Line 2 of the RIV package input file. If this flag is not turned on, space is not allocated for the RIV package in the MODFLOW internal array and RiverWare cannot access the exchanged variables
Optional Data Exchange Reach Configuration
A surface water body (that is, riverside drain) could be represented in MODFLOW using the STR or SFR packages. When a surface water body is defined in this manner it does not need to be explicitly represented in RiverWare. Flow between this type of MODFLOW surface water body, and a RiverWare Reach is optional. The user may choose to assign a return flow from a MODFLOW surface water body to a RiverWare Reach and/or a diversion from a RiverWare Reach to a MODFLOW surface water body.
Note:  In the MODFLOW STR and SFR package, stream/river/drain networks are assembled using reaches and segments. Reaches are joined together to form segments and all reaches in a segment share the same model properties. A reach can span up to one model cell, while segments can span multiple cells. Segments are numbered sequentially starting with the most upstream segment. The reaches in a segment are also numbered sequentially starting at the most upstream reach. Inflow and outflow along a MODFLOW stream network (STR or SFR) can only occur on the first and last reaches in a segment, respectively (with one exception in the SFR package, see Purdic et al., 2004). This must be considered when the user matches corresponding variables between a RiverWare Reach and a MODFLOW segment. It is suggested that the user create tributary and diversion segments that are to be used only for data exchange with RiverWare.
Local Inflow
A return flow from a surface water body represented in MODFLOW (for example, riverside drain) to a RiverWare Reach is optional. This return flow must be diverted from a MODFLOW STR or SFR segment and can be specified as a local inflow into a RiverWare Reach. The user needs to select the Local Inflow MODFLOW Return method in the Local Inflow and Solution Direction category; see Local Inflow MODFLOW Return. The slot Local Inflow MODFLOW Return, is associated with this method and displays the value transferred from MODFLOW. The STR or SFR segment in MODFLOW providing the return flow is assigned using the computational subbasin structure. To avoid potential issues with data transfer, one RiverWare Reach is limited to connect with one MODFLOW segment.
Note:  While a Reach that is assigned to receive a MODFLOW return flow may be linked with the MODFLOW RIV package (see Mandatory Data Exchange Reach Configuration) this is not required and the user may set the RiverWare Reach to receive only the Local Inflow MODFLOW Return. When this occurs the Reach.MF GainLoss slot will contain NaNs.
Diversions
A diversion from a Reach to a surface water body in MODFLOW (for example, riverside drain) is optional. The method selection for a diversion is the same whether or not the user intends to divert to another RiverWare Object or MODFLOW. The user needs to select a method in the Diversion from Reach category and input a value into the Diversion slot (shown to the right); see Diversion from Reach. The diversion from the Reach is assigned as inflow into a MODFLOW STR or SFR segment. The user assigns the MODFLOW segment to receive the inflow using the computational subbasin structure. If no MODFLOW segment is assigned to the diversion, the user may link the Diversion as an inflow into another RiverWare object. Flow may only be diverted from a Reach to one object at a time (for example, one Reach cannot divert flow to both a MODFLOW segment and a RiverWare Water User).
Note:  A Reach that has a Diversion to MODFLOW assigned may be linked with the MODFLOW RIV package (see Mandatory Data Exchange Reach Configuration) however this is not required and the user may set the Diversion as the only data exchange with MODFLOW. When this occurs the Reach.MF GainLoss slot will contain NaNs.
GroundWaterStorage Object
In a RiverWare-MODFLOW linked model, the GroundWater Storage (GW) object is used to incorporate boundary conditions into the RiverWare model and to manage GW return flows from RiverWare Water Users. Flux between the GW object’s head and head in the MODFLOW aquifer is computed for the lateral MODFLOW boundaries in MODFLOW. In addition to this flux, two other fluxes are calculated in RiverWare and are accounted for in the GW object’s storage equation. The second flux, is the flux between linked GW objects. The third flux, is a head-based flux between a GW object and a low-resolution MODFLOW model. The low resolution MODFLOW model head need to be input by the user into RiverWare using the Head Based Percolation method. As shown in Table 8.2 all data exchanged for the GW object is mandatory.
Note:  In MODFLOW, boundary conditions are a necessary component in the MODFLOW model. Information from a low-resolution regional-scale groundwater model may be interpolated in space and/or time, by the user for inclusion directly in both the RiverWare and MODFLOW models. Along the lateral MODFLOW boundaries in the first layer the user should assign GHB boundary conditions where the elevation from RiverWare GW objects is used as the external source head in the GHB calculations. All other MODFLOW model edge boundaries may be assigned as the user chooses, since they do not require an interaction between RiverWare and MODFLOW and are not discussed in this document.
Mandatory Data Exchange Reach Configuration
GW Solution Type
The user must select the Link to MODFLOW GW method in the Solution Type (see Link to MODFLOW GW), for the GW object to exchange data with MODFLOW. Six slots are associated with the Link to MODFLOW GW method:
• Aquifer Area
• Elevation
• Previous Water Table Elevation
• Inflow from Surface Water
• Specific Yield
• Lateral Flux from MODFLOW
The first five slots are also used by other Solution Type methods; see Solution Type. The last slot Lateral Flux from MODFLOW is specific to the Link to MODFLOW GW method. Cells associated with the first boundary type or lateral boundary should be represented in MODFLOW using the GHB boundary condition. The GHB package simulates flow into or out of a cell from an external source in proportion to the difference between the head in the cell and the head assigned to the external source. To calculate this flux, MODFLOW needs an external head value for each GHB boundary cell. The user is required to assign an initial Elevation to every GW object that is linked with MODFLOW. The initial elevation head for each corresponding GHB boundary cell is calculated by interpolating the elevation between two GW objects in RiverWare. The user can assign upstream and downstream GW objects to individual cells using the computational subbasin; see Groundwater Elevation. In addition to an initial Elevation, the user is required to assign an Aquifer Area and Specific Yield on each GW object. Optionally, the user may link a GW objects’ Inflow from Surface Water slot with another RiverWare object.
Two other methods are available in the Solution Type, these methods should be selected when the user does not want to link a GW object with MODFLOW.
Note:  One model may contain both GW objects linked to MODFLOW and GW objects that are not linked to MODFLOW.
Note:  In MODFLOW the user must have the option flag (CBC) entered in Line 2 of the GHB package input file. If this flag is not turned on space is not allocated for the GHB package in the MODFLOW internal array and RiverWare cannot access the exchanged variables.
Specify Connected Groundwater Objects
The second flux, is the flux between linked GW objects. The user may choose to link a GW object with none, one or two other GW objects. The methods available in the Lateral Link Direction category are: No Connected Groundwater Objects, Upstream, Downstream, and Upstream and Downstream; see Lateral Link Direction. When a method other than No Connected Groundwater Objects is selected, the following slots are available: Previous Adjacent Elevation, Conductance, and Groundwater Flow. The user is required to assign a Conductance between the two objects and must link the Previous Adjacent Elevation of one object to the Previous Elevation in the other object. For example if GW1 and GW2 are to be linked and GW1 is the upstream of GW2. Then the Previous Elevation slot on GW1 needs to be linked with the Previous Adjacent Elevation Upstream slot on GW2, and the Previous Elevation Downstream slot on GW1 needs to be linked with the Previous Elevation slot on GW2.
GW Deep Percolation
The third flux, is a head-based flux between the GW object elevation and a low-resolution MODFLOW model head elevation. This flux can be represented using the Head Based Percolation in the GW Deep Percolation category; see Head Based Percolation. The method contains three slots: Percolation, Deep Aquifer Conductance, and Deep Aquifer Elevation. The Deep Aquifer Elevation represents the MODFLOW head elevation (from a low-resolution MODFLOW model) and must be input by the user. The user also needs to input a Deep Aquifer Conductance value for each GW object.
Water User
Linking a Water User object to MODFLOW is optional. The user may link none, some, or all the water user objects in a RiverWare model to MODFLOW.
Optional Data Exchange Water User Configuration
A surface water body (for example, riverside drain) can be represented in MODFLOW using the STR or SFR packages. When a surface water body is defined in this manner it does not need to be explicitly represented in RiverWare. Flow between this type of MODFLOW surface water body and a RiverWare Water User is optional. The user may choose to assign a surface return flow from a Water User to a surface water body represented in MODFLOW (for example, riverside drain).
Note:  In the MODFLOW STR and SFR package, stream/river/drain networks are assembled using reaches and segments. Reaches are joined together to form segments and all reaches in a segment share the same model properties. A reach can span up to one model cell, while segments can span multiple cells. Segments are numbered sequentially starting with the most upstream segment. The reaches in a segment are also numbered sequentially starting at the most upstream reach. Inflow into a MODFLOW stream network (STR or SFR) can only occur on the first reach in a segment, respectively (with one exception in the SFR package). This must be considered when the user matches corresponding variables to the Water User. It is suggested that the user create tributary and diversion segments that are to be used only for data exchange with RiverWare.
Surface Return Flow
A surface return flow from a water user to a surface water body in MODFLOW (for example, riverside drain) is optional. The user needs to select the Link to MODFLOW WU method in the MODFLOW Link Category WU category; see Link to MODFLOW WU. The Surface Return Flow is calculated when methods are selected in both the Return Flow and Return Flow Split categories. The Surface Return Flow from the Water User is assigned as inflow into a MODFLOW STR or SFR segment. The user assigns the segment to receive the return flow using the computational subbasin structure. If no MODFLOW segment is assigned, the user may link the surface return flow as an inflow into another RiverWare object. The user may input a value for the Surface Return Flow at the initial timestep if desired, otherwise an initial inflow value of zero will be transferred to MODFLOW for use in the first timestep.
AggDiversion Site
Linking an AggDiversion Site object to MODFLOW is optional. The user may link none, some, or all the AggDiversion Site objects in a RiverWare model to MODFLOW.
Optional Data Exchange AggDiversion Site Configuration
A surface water body (for example, riverside drain) could be represented in MODFLOW using the STR or SFR packages. When a surface water body is defined in this manner, it does not need to be explicitly represented in RiverWare. Flow between this type of MODFLOW surface water body and a RiverWare AggDiversion Site is optional. The user may choose to assign the surface return flow from a AggDiverson Site to a surface water body represented in MODFLOW (for example, riverside drain).
Note:  In the MODFLOW STR and SFR packages, stream/river/drain networks are assembled using reaches and segments. Reaches are joined together to form segments and all reaches in a segment share the same model properties. A reach can span up to one model cell, while segments can span multiple cells. Segments are numbered sequentially starting with the most upstream segment. The reaches in a segment are also numbered sequentially starting at the most upstream reach. Inflow into a MODFLOW stream network (STR or SFR) can only occur on the first reach in a segment, respectively (with one exception in the SFR package). This must be considered when the user matches corresponding variables between a RiverWare Water User and a MODFLOW segment. It is suggested that the user create tributary and diversion segments that are to be used only for data exchange with RiverWare.
Total Surface Return Flow
It is optional to link the Total Surface Return Flow from all the Water User elements on an AggDiversion Site as inflow into a surface water body in MODFLOW (for example, riverside drain). The user needs to select the Sequential Structure as the AggDiversion Site Link Structure and the Link to MODFLOW WU method in the MODFLOW Link Category AggDiv category; see Link to MODFLOW WU. The Total Surface Return Flow is calculated as the sum of the individual element’s Surface Return Flow slot. The Total Surface Return Flow on the AggDiversion Site may be assigned as inflow into a MODFLOW STR or SFR segment using the computational subbasin structure. If no MODFLOW segment is assigned the user may link the total surface return flow as an inflow into another RiverWare object. The user may input a value for the Total Surface Return flow at the initial timestep if desired, otherwise an inflow value of zero will be transferred to MODFLOW for use in the first timestep.
Example
A simple example model is shown below. This example does not fully detail the setup of either a MODFLOW or RiverWare model. Instead it highlights the variables exchanged between the two model and shows how the user might match up MODFLOW cells with RiverWare objects.
Figure 8.13 is a schematic of a RiverWare model. Figure 8.14 is a schematic of how one RiverWare model matches up with two MODFLOW models and the variables that are passed between RiverWare and MODFLOW.
Figure 8.13  RiverWare Example Model
Figure 8.14  MODEL Interaction Overview: RiverWare Model with MODFLOW data exchanges
Figure 8.15 is a schematic of how MODFLOW Model A matches up with the RiverWare model. In the MODFLOW model the blue cells represent RIV boundary conditions, green cells represent GHB boundary conditions, and the pink/purple cells indicate STR or SFR boundary conditions. The purple cells indicate the beginning a MODFLOW STR or SFR segment. The blue cells are partitioned into regions by black dividers, these regions represent all the cells corresponding to a given Reach and each region is labeled with the Reach name. The variables exchanged between the Reach and the blue cells are river Stage, as an elevation, and MF GainLoss (see Table 8.3). For each RiverWare Reach, the Stage (interpolation) and MF GainLoss (summation) equations use the same MODFLOW cell to Reach correspondence. The division between GW objects is slightly more complicated than for the Reach, only one GW object is needed for summation of the “Lateral Flux from MODFLOW” from each cell, while two GW objects are needed to interpolate a GW head “Elevation” for each cell. The green cells (GHB) between the black dividers are summed to obtain the “Lateral Flux from MODFLOW” for the indicated RiverWare GW object. “Elevation” heads are interpolated for all green cells (GHB) between the gray dividers.
Figure 8.15  MODEL Interaction Overview: MODFLOW Grid with RiverWare object affiliations shown
• Green = GHB - Model Boundary
• Blue = RIV - Main River Channel
• Pink/Purple = STR - Riverside Drains, Purple indicates the first reach in a segment the segment number is shown
• White = Cells not associated with the GHB, RIV, or STR packages - cells that will that will not communicate with RiverWare.
Figure 8.14 shows the flow between a surface water body in MODFLOW and a surface water body in RiverWare. Figure 8.15 shows the same flows as corresponding to either the first (purple) or last reach in a MODFLOW segment.
All objects corresponding to MODFLOW Model A are grouped into a subbasin named ModelA, those associated with MODFLOW Model B are grouped into a subbasin named ModelB.
 
Subbasin name: ModelA
Subbasin name: ModelB
Reach 0
Reach 3
Reach 1
Reach 4
Reach 2
GW 10
GW 0
Water User 2
GW 1
 
GW 2
 
GW 3
 
GW 4
 
GW 5
 
GW 6
 
GW 7
 
GW 8
 
Water User 0
 
Agg Diversion 0
 
Table 8.3 is for use in the Reach Stage, Weighted Interpolation and Reach Gain Loss, Summation methods; see Groundwater Computation. This is used to assign RIV boundary cells to a Reach object. Stage and river GainLoss variables will be communicated between the two models. Inflow and Outflow Stage Weights are used in the interpolation equation. The user will input the layer, row, column, the inflow stage weight and outflow stage weight of each cell. The user will need to define the row heading as the appropriate Reach from one included on the subbasin.
 
Table 8.3  Example Reach Stage and GainLoss Map slot
 
Layer
Row
Column
Inflow Stage Weight
Outflow Stage Weight
Reach0
1
1
4
0.8
0.2
Reach0
1
2
4
0.5
0.5
Reach0
1
2
5
0.5
0.5
Reach0
1
3
5
0.8
0.2
Reach0
1
3
6
0.8
0.2
Reach0
1
3
7
0.8
0.2
Reach1
1
4
6
0.7
0.3
Reach1
1
4
7
0.7
0.3
Reach1
1
5
6
0.5
0.5
Reach1
1
5
7
0.5
0.5
Reach1
1
6
7
0.3
0.7
Reach1
1
6
8
0.3
0.7
Reach2
1
7
7
0.9
0.1
Reach2
1
7
8
0.9
0.1
Reach2
1
8
8
0.8
0.2
Reach2
1
9
8
0.5
0.5
Reach2
1
10
8
0.3
0.7
Reach2
1
10
9
0.3
0.7
Reach2
1
10
10
0.3
0.7
Reach2
1
11
9
0.1
0.9
Reach2
1
11
10
0.1
0.9
Table 8.4 is used in the Groundwater Elevation, Weighted Interpolation method to map GHB boundary cells to a GW object; see Groundwater Computation. The upstream weight is used in the elevation interpolation equation. The user will input the layer, row, and column of each cell and the upstream elevation weight. The user will also need to define the row heading as the appropriate GW object from one included in the subbasin. This table should contain the same list of cells as the GroundWater Downstream Map
 
Table 8.4  Example GroundWater Elevation Upstream Map slot
 
Layer
Row
Column
Upstream Elevation Weight
GW 0
1
1
1
0.9
GW 0
1
2
1
0.7
GW 0
1
3
1
0.5
GW 0
1
4
1
0.3
GW 0
1
5
1
0.1
GW 1
1
6
1
0.7
GW 1
1
7
1
0.5
GW 1
1
8
1
0.3
GW 2
1
9
1
0.8
GW 2
1
10
1
0.6
GW 2
1
11
1
0.4
GW 2
1
12
1
0.2
GW 5
1
1
20
0.9
GW 5
1
2
20
0.7
GW 5
1
3
20
0.5
GW 5
1
4
20
0.3
GW 5
1
5
20
0.1
GW 6
1
6
20
0.7
GW 6
1
7
20
0.5
GW 6
1
8
20
0.3
GW 7
1
9
20
0.8
GW 7
1
10
20
0.6
GW 7
1
11
20
0.4
GW 7
1
12
20
0.2
Table 8.5 is used in the Groundwater Elevation, Weighted Interpolation method to map GHB boundary cells to a GW object; see Groundwater Computation. The downstream weight is used in the elevation interpolation equation. The user will input the layer, row, and column of each cell and the downstream elevation weight. The user will also need to define the row heading as the appropriate GW object from one included in the subbasin. This table should contain the same list of cells as the GroundWater Upstream Map
 
Table 8.5  Example GroundWater Elevation Downstream Map slot
 
Layer
Row
Column
Downstream Elevation Weight
GW 1
1
1
1
0.1
GW 1
1
2
1
0.3
GW 1
1
3
1
0.5
GW 1
1
4
1
0.7
GW 1
1
5
1
0.9
GW 2
1
6
1
0.3
GW 2
1
7
1
0.5
GW 2
1
8
1
0.7
GW 3
1
9
1
0.2
GW3
1
10
1
0.4
GW3
1
11
1
0.6
GW 3
1
12
1
0.8
GW 6
1
1
20
0.1
GW 6
1
2
20
0.3
GW 6
1
3
20
0.5
GW 6
1
4
20
0.7
GW 6
1
5
20
0.9
GW 7
1
6
20
0.3
GW 7
1
7
20
0.5
GW 7
1
8
20
0.7
GW 8
1
9
20
0.2
GW 8
1
10
20
0.4
GW 8
1
11
20
0.6
GW 8
1
12
20
0.8
Table 8.6 is used to map GHB boundary cells to a GW object. The user will input the layer, row, and column for each cell. The user will also need to assign the appropriate GW from one included on the subbasin as the row heading.
 
Table 8.6  Example GroundWater Lateral Flux Map slot for the Groundwater Lateral Flux, Summation Method
 
Layer
Row
Column
GW 0
1
1
1
GW 0
1
2
1
GW 0
1
3
1
GW 1
1
4
1
GW 1
1
5
1
GW 1
1
6
1
GW 1
1
7
1
GW 2
1
8
1
GW 2
1
9
1
GW 3
1
10
1
GW 3
1
11
1
GW 3
1
12
1
GW 5
1
1
20
GW 5
1
2
20
GW 5
1
3
20
GW 5
1
4
20
GW 6
1
5
20
GW 6
1
6
20
GW 6
1
7
20
GW 7
1
8
20
GW 7
1
9
20
GW 8
1
10
20
GW 8
1
11
20
GW 8
1
12
20
 
Table 8.7  Additional slots that exchange data between RiverWare and MODFLOW
Simulation Object
Slot Value Received
MODFLOW Segment
Reach 2
Diversion
4
Water User 0
Surface Return Flow to MODFLOW
2
AggDiversion 0
Total Surface Return Flow
7
Reach 1
Local Inflow from MODFLOW
6
References
Harbaugh, A.W., Banta, E.R., Hill, M.C. and McDonald, M.G., 2000. MODFLOW-2000, The U.S. Geological Survey Modular Ground-Water Model - User Guide to Modularization Concepts and the Ground-Water Flow Process: U.S. Geological Survey Open File Report 00–92.
Maddock, T. and Baird, K.J, 2003. A Riparian Evapotranspiration Package for MODFLOW‑96 and MODFLOW‑2000. Department of Hydrology and Water Resources University of Arizona Research Laboratory for Riparian studies, University of Arizona, December 2003.
Prudic, D.E., Konikow, L.F., and Banta, E.R., 2004. A New Streamflow-Routing (SFR1) Package to Simulate Stream-Aquifer Interaction with MODFLOW‑2000. U.S. Geological Survey Open File Report 2004–1042.
Appendix A: MODFLOW Package Description
Figure 8.16, which is from the MODFLOW 2000 documentation, illustrates the MODFLOW process.
Note:  A Parameter-Estimation Loop is not performed in the RiverWare-MODFLOW library.
Figure 8.16  MODFLOW Control Flow (from MODFLOW 2000 documentation)
GHB and RIV Packages
The MODFLOW input files are similar for the GHB and RIV packages. Each cell that is designated in the GHB or RIV package is identified by Layer, Row, and Column. The Stage or the Bhead must be assigned in each time-step/period and for each qualifying cell. For example, the Stage parameter in MODFLOW corresponds to the value interpolated for a particular cell from the Inflow and Outflow Stages on the RiverWare Reach. An example of the input items lines in the GHB and RIV package that contain the variables of interest are shown below. The variable of interest is indicated in bold text (in this case the river stage and elevation).
Note:  Data transferred from RiverWare to MODFLOW may not necessarily be directly input into the input file, here the input file configuration is shown to clearly identify the variable of interest.
MODFLOW Input:
GHB Package
Item 4b or Item 6 (Layer Row Column Bhead Cond(fact) [xyz])
RIV Package
Item 4b or Item 6 (Layer Row Column Stage Cond(fact) Rbot [xyz])
Figure 8.17  GHB Package Flux Equation
Figure 8.18  RIV Package Gain/Loss Equation
After the Bhead or Stage are assigned in each time-step/period and for each qualifying cell. The fluxes will be calculated by MODFLOW and transferred to RiverWare. The MODFLOW output files identify the fluxes (gain/loss and lateral flux) as a rate for each specified cell by layer, row, and column. An example of the of the standard formatted MODFLOW output file (.lst) is shown below. The variables of interest are indicated in bold text.
Note:  Data from MODFLOW to be transferred to RiverWare or vice versa may not necessarily be taken directly from the Output file or input directly into the input file, however the configurations for these files shown to clear identify the variable of interests.
MODFLOW Output:
.lst File for GHB
Head Dep Bounds Peroid # Step # (Titles included)
Boundary # Layer # Row # Col # Rate # (Titles included, one row for each boundary cell, Boundary number is sequential order from input file, the Boundary number is not included in the input File)
.lst File for Riv
River Leakage Peroid # Step # (Titles included)
Reach # Layer # Row # Col # Rate # (Titles included, one row for each reach, Reach number is sequential ordering from input file, the Reach number is not included in the input File)
STR and SFR Packages
Inflow into a Segment
The STR or SFR packages in MODFLOW will be used to represent the riverside or interior drains. In these packages the surface return flow from the Water User must be specified as inflow into a segment. Inflow may only be specified into the first reach of a segment. There are two scenarios for inflow entering a segment: a single headwater inflow (there is no other source of flow into the segment) or multiple inflows (tributary inflow). The value entered for Flow (see input description below) in the STR and SFR packages differs slightly.
Note:  The instructions below are meant to define what parameters in MODFLOW will receive a value from RiverWare and are not full input instructions for the STR and SFR packages.
In STR the value entered for Flow can be one of the following
• headwater stream - Flow is the total inflow into the segment
• stream with tributaries - Flow must be -1 to indicate that inflow into the segment is the outflow of one or more tributary segments
• diversion stream - Flow is the total inflow into the segment.
In SFR the value entered for Flow can be one of the following
• headwater stream - Flow is the total inflow into the segment
• stream with tributaries - Flow is additional specified inflow or withdraw from the segment
Note:  This additional flow does not interact with the ground-water system in this segment.
• diversion stream - value entered for Flow is not necessarily a flow quantity, the input changes depending on the diversion option chosen
For both STR and SFR, if the return flow enters a headwater stream segment then the surface return flow can be entered as the Flow value. For STR, if the return flow is in addition to another inflow then a tributary segment must be defined to handle the return flow. The surface return flow can then be entered as the Flow value in the tributary segment. For SFR, if the surface return flow is in addition to another inflow then the surface return flow can be entered as the Flow value in the segment or can be entered as the Flow value in a tributary segment. The surface return flow will be transferred from RiverWare to MODFLOW and input as Flow into the specified segment. The STR and SFR packages input configurations are different. The item/line numbers in the packages that contain the Flow value are shown below. The variable of interest (in this case surface return flow or surface water inflow) and the critical segment identification are indicated in bold text.
MODFLOW Input:
STR Package
Item 4b or Item 6: Layer Row Column Seg Reach Flow Stage Cond(fact) Sbot Stop
Note:  Stage, Sbot, Stop are all elevations
SFR Package
Item 2 (KRCH IRCH JRCH ISEG IREACH RCHLEN)
Item 4b or Item 6a: NSEG ICALC OUTSEG IUPSEG {IPRIOR} {NSTRPTS} FLOW RUNOFF ETSW PPTSW {ROUGHCH} {ROUGHBK} {CDPTH} {FDPTH} {AWDTH} {BWDTH}
Note:  Variables in {brackets} are not always specified in the input file. NSEG=segment #, NSEG is the same as ISEG which is entered in Item 2 and contains the layer, row, and column designation.
Diversion From a Segment
The return flow from a riverside or interior drain can be specified as a diversion in MODFLOW. No leakage can occur along a diversion segment. The diversion options available in each package are described below.
In STR, only one diversion option is available, a specified diversion. A segment must be declared as a diversion segment, the value entered as Flow (see STR input below) is the total flow diverted into the segment from the upstream segment.
Note:  If he Flow value in this segment is greater than the upstream segment outflow then no flow will be diverted. This diversion is removed from the last reach in the segment.
In SFR, there are several diversion options available. All diversions are taken out of the last reach in a segment, expect for the first option below. In the first option flow is diverted by specifying the a negative flow value for Flow in item 4b or 6a. In options 2 through 5, a segment must be declared as a diversion segment, the value entered for Flow changes depending on the option chosen. The diversion option is specified in MODFLOW using the IPRIOR flag.
• Specified diversion, flow diverted using this option is subtracted from the first reach in a segment.
• Specified diversion, flow diverted using this option is subtracted from the last reach in a segment and any remaining flow is routed as tributary inflow at the beginning of the next segment. This diversion option assumes that all flow in the segment can be diverted. IPRIOR = 0.
• Specified diversion, same as second option except, if the specified diversion is greater than flow in the segment then no flow will be diverted. IPRIOR=-1
• A specified fraction of the flow in the segment is diverted. IPRIOR=-2
• All excess flow beyond a given threshold is diverted. IPRIOR=-3
The item/line numbers corresponding to the input and output for the STR and SFR packages in MODFLOW for diversion flow are described below. An example excerpt from the MODFLOW input file and standard formatted output file (.lst) are shown below. Depending on which option is chosen the diversion may be easier to obtain from the input or the output file. For Option 1 the Flow value in item 4b or 6a is the amount diverted. For options 2-5 the value entered for Flow is not necessarily the amount diverted (for more detailed instructions on this value refer to USGS 2004-1042 p.44-45). The flow diverted to the segment can be read more easily from the output file as Flow Into the Stm Rch. The variable of interest (in this case diverted flow) and the critical segment identification are indicated in bold text.
Note:  Data from MODFLOW to be transferred to RiverWare or vice versa may not necessarily be taken directly from the Output file or input directly into the input file, however the configurations for these files shown to clear identify the variable of interests.
MODFLOW Input:
STR Package
Item 4b or Item 6: Layer Row Column Seg Reach Flow Stage Cond Sbot Stop
Note:  Stage, Sbot, Stop are all elevations
SFR Package
Item 2 (KRCH IRCH JRCH ISEG IREACH RCHLEN)
Item 4b or Item 6a: NSEG ICALC OUTSEG IUPSEG {IPRIOR} {NSTRPTS} FLOW RUNOFF ETSW PPTSW {ROUGHCH} {ROUGHBK} {CDPTH} {FDPTH} {AWDTH} {BWDTH}
Note:  Variables in {brackets} are not always specified in the input file
NSEG=segment #, NSEG is the same as ISEG which is entered in Item 2 and contains the layer, row, and column designation.
MODFLOW Output:
.lst File for STR
Stream Flow Out, Time Step #, Stress Peroid #
Layer, Row, Column, Stream-Number, Reach Number, Flow Into Stream Reach, Flow Into Aquifer, Flow out of Stream Reach, Head in Stream (Column Headings)
.lst File for SFR
Stream Leakage Peroid # Step #
Layer, Row, Col, Stream Seg. No., Rch Number, Flow Into Strm. Rch., Flow Into Aquifer, Flow out of Stm. Rch., Ovrlnd. Runoff, Direct Precip, Stream ET, Stream Head, Stream Depth, Stream Width, Streambed Conductnc., Streambed Gradient (Column Headings)
 
Revised: 07/17/2020