MODFLOW Link Technical Details

When properly linked, data and results flow back and forth between WEAP and MODFLOW for each calculation timestep.  The following description provides details of exactly what information is passed between WEAP and MODFLOW, and how the process happens.

WEAP reads information from the MODFLOW packages before calculations begin, along with the linkage information that links MODFLOW cells to WEAP objects.  Thereafter, at each calculation timestep, WEAP will write out a new set of MODFLOW package files, run MODFLOW, then read the results from the MODFLOW output files.  (If you select the option to save all MODFLOW input and output files, the new MODFLOW package files created will be named with !MF! as a prefix and a suffix unique for each scenario, year and timestep.  For example, if the original Recharge filename is Zabadani.rch, the new Recharge file written for the Current Accounts (scenario number 1) for March 2000 would be !MF!Zabadani_S01_2000_03.rch.  This allows you to inspect or modify the input files and rerun MODFLOW yourself, outside of WEAP.  This could be an aid in debugging.  However, keep in mind that all these files (any filename starting with !MF!) will be deleted and recreated the next time WEAP calculates results.)

A MODFLOW model consists of many different "packages," most of which are optional. However, not all packages are used or allowed by WEAP.

The following describes how WEAP interacts with the MODFLOW packages from the "Used by WEAP" group:

Name (NAM):

The Name File specifies the names of the input and output files, associates each file name with a unit number and identifies the packages that will be used in the model.  WEAP reads the name file first to know which packages are used and which file each one is in.  WEAP will write a new NAM file for each timestep it calculates, and include in it new entries for an initial head file, output head file, and a cell-to-cell-flow (CCF) file.

Discretization (DIS):

WEAP reads the following information from the Discretization file:

Models with more than one stress period are allowed, but only data from the first stress period will be used by WEAP, with the exception of the GHB package (see below).  Time-varying parameters and multiple stress periods are fundamentally opposed to the WEAP-MODFLOW linkage approach, which is that MODFLOW will be run for one stress period, then the results will go back to WEAP, which will write new MODFLOW input files, and then run MODFLOW for the next stress period.  When WEAP writes the new DIS package, the length of the stress period will be changed to match the length of the WEAP timestep being calculated.  The number of MODFLOW timesteps is not changed.  Tip: If the original MODFLOW stress period length is much longer than the WEAP timestep (e.g., annual vs. monthly), you probably want to reduce the number of MODFLOW timesteps per stress period -- it will calculate faster and create smaller files.  For example, if the MODFLOW stress period is 365 days and the number of timesteps per stress period is 12 (one per month), because WEAP will change the stress period length to monthly, you probably want to reduce the number of timesteps per stress period to 1 so that it is still monthly.

Which layers have Quasi-3D confining beds below.  This information is only used to initially establish individual aquifers in a multi-aquifer system.  However, it is up to the user to decide how many aquifers exist and which layers are in which aquifers.

A MODFLOW model can be either transient or steady state.  A steady state model is not a good fit to link to WEAP, because it cannot fully capture the changes from the WEAP model.

Basis (BAS6):

WEAP reads from the Basic package the locations of active, inactive, and specified head cells and the initial heads in all cells.  In addition, BAS specifies if FREE or FIXED formats are used in other packages, and the numeric code to use for no-flow cells (e.g., -999).  WEAP writes the initial cell heads to a new binary file, for use in the first WEAP timestep as the initial head for the simulation, and changes the BAS file to refer to this EXTERNAL file.  Thereafter, the head results from one WEAP timestep will be used in the next timestep as the initial heads, and the BAS file will be changed to refer to the newly created head file.

The XSECTION tag is not allowed.

Well (WEL):

The Well package is used to simulate a specified flux to individual cells and specified in units of volume/time.  (Values greater than 0 represent flux into the cell (recharge); values less than 0 represent flux out of the cell (pumping).)  WEAP reads from the Well package the number and location of well cells, to which it adds any other cells that are linked to land use or demand site pumping or return flow injection in WEAP but not already included in the Well file.  You may choose to model some or all pumping, such as pumping for irrigation, as negative recharge (specify 0 as the Pump Layer) in the Recharge package instead of as pumping in the Well package.  Conversely, you may choose to model recharge as negative pumping in the Well package instead of as recharge in the Recharge package (specify the layer(s) as the Injection Layer, for demand sites only).  When writing the pumping flows in the new Well file for each WEAP timestep, cells that are linked to land use or demand site pumping will have pumping rates calculated by WEAP, whereas cells that are not linked will have the flow rate as specified in the original Well file.  The Well package is also modified so that cell-by-cell flow terms will be written to the new CCF file.  It is OK if the Well package does not exist in the original MODFLOW model -- WEAP will create a new one.

A demand site cannot pump from a cell that is dry.  If all of a demand site's linked cells are dry, then it will not be able to pump any water.  If some of the cells are dry and some are not dry, it will automatically pump from the non-dry cells. In the timestep that a cell becomes dry, WEAP will be inconsistent with MODFLOW: WEAP assumes that it is able to pump water from that cell in that timestep, whereas MODFLOW assumes no pumping.  (Both are probably incorrect -- there will be some pumping from the cell in that timestep but likely less than the full demand.)  If you have linked a demand site's sub-branches to different cells, only those sub-branches linked to dry cells will have their pumping affected.

When linking sub-branches, the abstraction rates for each sub-branch will be proportional to the demand for the sub-branch and the area of cells linked.  For example, there are 2 branches A and B.  A is linked to 10 cells and B to 4 cells (each cell has equal area).  The demand for A is 20; B is 2.  A will pump 20 from its 10 cells, while B will only pump 2 from its 4 cells.  Therefore, the abstraction rate for A’s cells (2 per cell) will be four times as high as B’s cells (0.5 per cell).

Recharge (RCH):

The Recharge package is used to simulate a specified flux distributed over the top of the model and specified in units of length/time.  (Values greater than 0 represent flux into the cell (recharge); values less than 0 represent flux out of the cell (pumping).)  Within MODFLOW, these rates are multiplied by the horizontal area of the cells to which they are applied to calculate the volumetric flux rates.  You may choose to model some or all pumping, such as pumping for irrigation, as negative recharge (specify 0 as the Pump Layer) in the Recharge package instead of as pumping in the Well package.  Conversely, you may choose to model recharge as negative pumping in the Well package instead of as recharge in the Recharge package (specify the layer(s) as the Injection Layer, for demand sites only).  Initial values of recharge from the Recharge package are ignored, to be replaced by recharge values calculated by WEAP.  The Recharge package is also modified so that cell-by-cell flow terms will be written to the new CCF file.   It is OK if the Recharge package does not exist in the original MODFLOW model -- WEAP will create a new one.  In this case, the recharge will be applied to the highest active cell in each vertical column.

Demand Site return flows and Catchment infiltration become recharge in the Recharge package, to the cells linked to the demand sites (or their sub-branches) or land use branches, in the same proportion (among cells if more than one linked to a demand site or branch) as pumping for demand.

Drain (DRN):

The Drain package is used to simulate head-dependent flux boundaries.  In the Drain package if the head in the cell falls below a certain threshold, the flux from the drain to the model cell drops to zero.  WEAP reads from the Drain package the number and location of drain cells.  The only change made to the Drain package is to specify the new CCF file that cell-by-cell flow terms will be written to.

River (RIV):

The River package is used to simulate head-dependent flux boundaries.  In the River package if the head in the cell falls below a certain threshold, the flux from the river to the model cell is set to a specified lower bound.  The River package includes stage height and river bottom elevation, which are used by MODFLOW to calculate fluxes.  In each timestep, WEAP will calculate the stage in the river at each reach linked to a river cell and write a new River file with this new stage value.  WEAP's flow-stage-width curve can either specify the stage in relative (where 0 is the river bottom) or absolute terms.  If in relative terms, WEAP will add the elevation of the river bottom (RBOT) from the original River file to the calculated stage to derive the absolute stage level.  River cells that are not linked to WEAP reaches are written back out unchanged.  The River package is also modified so that cell-by-cell flow terms will be written to the new CCF file.

General Head Boundary (GHB):

The General-Head Boundary package is used to simulate head-dependent flux boundaries.  In the General-Head Boundary package the flux is always proportional to the difference in head. WEAP reads from the GHB package the number and location of general head boundary cells.  

By default, as with all MODFLOW packages, WEAP will only use the first stress period of data from the GHB file.  However, the GHB package has the option of using some or all of the subsequent stress period data.  This could be useful in cases where there are measured or modeled variations in these parameters over time.  To use these stress period data, insert one or more comments at the top of the GHB file, using the following syntax.  (All MODFLOW comments start with # in column one, and must be the first lines in the file.)

# WEAPOPTION:STRESSPERIOD:FIRST:<stress period number>
This option tells WEAP to start with the stress period number listed.  

# WEAPOPTION:STRESSPERIOD:LAST:<stress period number>
This option tells WEAP to stop with the stress period number listed.  Use -1 to indicate the last stress period in the file.

# WEAPOPTION:STRESSPERIOD:ALL
Use data from every stress period in the file.  If there are fewer stress periods than WEAP timesteps in the full planning horizon (Base Year to End Year), WEAP will default to using the last stress period's data for all subsequent WEAP timesteps (defaults to REPEATLAST option).  This is equivalent to FIRST:1  and  LAST:-1

# WEAPOPTION:STRESSPERIOD:ANNUAL
Use data from the first twelve stress periods in the file (or however many WEAP timesteps are in one year), and repeat it for each year (defaults to CYCLE option).  This is equivalent to FIRST:1  and  LAST:12  and   CYCLE    (for a monthly model)

# WEAPOPTION:STRESSPERIOD:CYCLE
This option tells WEAP to repeat the stress periods' data, in conjunction with the ALL or ANNUAL or FIRST or LAST options.  

# WEAPOPTION:STRESSPERIOD:REPEATLAST
This option tells WEAP to use the final stress period's data for all subsequent WEAP timesteps if there are fewer stress periods of data in the file than WEAP timesteps.  This is the default setting (except if using ANNUAL).  

The ALL and ANNUAL options are mutually exclusive, as are the CYCLE and REPEATLAST options.

Some examples and the resulting sequences of stress period data to use (all assuming 18 stress periods of data, and a monthly WEAP model from 2020-2023):

No options specified.  Note: this is equivalent to FIRST:1  and  LAST:1
1,1,1,1,1,1,...

# WEAPOPTION:STRESSPERIOD:ALL
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,18,18,18,...
 (defaults to REPEATLAST)

# WEAPOPTION:STRESSPERIOD:ALL
# WEAPOPTION:STRESSPERIOD:CYCLE
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,1,2,3,4,5,6,7,8,9,...

# WEAPOPTION:STRESSPERIOD:ANNUAL
1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,...
  (defaults to CYCLE)

# WEAPOPTION:STRESSPERIOD:ANNUAL
# WEAPOPTION:STRESSPERIOD:REPEATLAST
1,2,3,4,5,6,7,8,9,10,11,12,12,12,12,12,12,...

# WEAPOPTION:STRESSPERIOD:FIRST:7
7,8,9,10,11,12,13,14,15,16,17,18,18,18,18,18,...

# WEAPOPTION:STRESSPERIOD:LAST:6
1,2,3,4,5,6,6,6,6,6,6,...

# WEAPOPTION:STRESSPERIOD:FIRST:7
# WEAPOPTION:STRESSPERIOD:LAST:12
7,8,9,10,11,12,12,12,12,12,12,...

# WEAPOPTION:STRESSPERIOD:FIRST:7
# WEAPOPTION:STRESSPERIOD:LAST:12
# WEAPOPTION:STRESSPERIOD:CYCLE
7,8,9,10,11,12,7,8,9,10,11,12,7,8,9,...

# WEAPOPTION:STRESSPERIOD:FIRST:7
# WEAPOPTION:STRESSPERIOD:LAST:-1
# WEAPOPTION:STRESSPERIOD:CYCLE
7,8,9,10,11,12,13,14,15,16,17,18,7,8,9,10,11,12,13,14,15,16,17,18,7,8,...

Block-Centered Flow (BCF6), Hydrogeologic Unit Flow (HUF2), Layer Property Flow (LPF) and Upstream Weighting (UPW):

One and only one of these packages may be used.  The only information that WEAP needs from these files is the numeric code for dry cells, e.g., -888.  The only change made is to specify the new CCF file that cell-by-cell flow terms will be written to.  The UPW package requires MODFLOW-NWT, and if used, the CCF file will automatically be assigned file unit 740.  When using the UPW package, MODFLOW will reduce the amount that can be pumped from a cell as the cell's head approaches the bottom of the cell, according to the setting of the PHIRAMP parameter in the WEL package.  If the setting (in General, Basic Parameters) for "MODFLOW Pumping if Dry or Inactive Cells" is "Reapportion pumping from dry or inactive cells," then WEAP will ignore these pumping reductions; if the setting is "Do not reapportion," then the reductions will cause WEAP to pump less, resulting in Unmet Demands for the Demand Site or Catchment pumping from the cell.  See the Pumping Reduction by Demand Site and Pumping Reduction by Groundwater Node reports to see how much pumping has been reduced due to dry or drying cells.

Evapotranspiration (EVT) and Evapotranspiration Segments (ETS):

When an EVT or ETS package is included in a linked MODFLOW model, WEAP will read the evapotranspiration flows from the cell-to-cell flow results file, modify the groundwater mass balance for the linked groundwater nodes accordingly, and include these flow in the Groundwater Inflows  and Outflow results.  There are also two new MODFLOW results in the Results View: MODFLOW Evapotranspiration Volume and MODFLOW Evapotranspiration Depth.  Note: do not link WEAP’s catchment objects to any groundwater cells that are included in the EVT or ETS packages because this will double count the evapotranspiration.

Seawater Intrusion (SWI2):

The seawater intrusion (SWI2) Package allows modeling of three-dimensional vertically integrated variable-density groundwater flow and seawater intrusion in coastal multi-aquifer systems.  WEAP reads from this package the number of active surfaces and the initial elevations (Zeta) of these active surfaces  (Each surface separates different variable density zones.)  WEAP writes the initial elevations to new binary files (one for each surface), for use in the first WEAP timestep as the initial elevations for the simulation, and changes the SWI2 file to refer to these files using OPEN/CLOSE.  Thereafter, the elevation results from one WEAP timestep will be used in the next timestep as the initial elevations, and the SWI2 file will be changed to refer to the newly created elevations files (one for each surface).  WEAP will adjust the fluxes in the cell-by-cell flow file by the terms SWIADDTOFLF, SWIADDTOFRF, and SWIADDTOFFF (which are computed by the SWI2 package), for the lower face (LF), right face (RF), and front face (FF), respectively.  Also, the volumetric budget for the entire model includes one new term, SWIADDTOCH, which WEAP will add to the CONSTANT HEAD term, to obtain the correct value for constant head.  The results for the Zeta Surface Elevations are available in the Results View as 3-D surface charts.  Note: the SWI2 package cannot be used with MODFLOW 2000.

Output Control (OC):

WEAP ignores the original Output Control package (if it exists) and instead creates a new Output Control file, specifying that head and budget results should be saved (for the final MODFLOW timestep), and the file unit to which they are saved.

General Notes on Packages

Parameters are handled in all packages, but will not be written to the new package files.  This is because time-varying parameters and multiple stress periods are fundamentally opposed to the WEAP-MODFLOW linkage approach, which is that MODFLOW will be run for one stress period, then the results will go back to WEAP, which will write new MODFLOW input files, and then run MODFLOW for the next stress period.

All MODFLOW format options are supported: FREE and FIXED formats, as well as CONSTANT, INTERNAL, EXTERNAL, LOCAT (fixed) and OPEN/CLOSE.