U.S. Department of the Interior

U.S. Geological Survey

Techniques and Methods 6–A28

Prepared in Cooperation with the Colorado Water Conservation Board and the Colorado Division 

of Water Resources

User Guide and Documentation for Five MODFLOW 

Ground-Water Modeling Utility Programs

User Guide and Documentation for Five 

MODFLOW Ground-Water Modeling Utility 

Programs

By Edward R. Banta, Suzanne S. Paschke, and David W. Litke

Prepared in Cooperation with the Colorado Water Conservation Board and the 

Colorado Division of Water Resources

Techniques and Methods 6–A28

U.S. Department of the Interior

U.S. Geological Survey
U.S. Department of the Interior

DIRK KEMPTHORNE, Secretary

U.S. Geological Survey

Mark D. Myers, Director

U.S. Geological Survey, Reston, Virginia: 2008

For product and ordering information:

World Wide Web: http://www.usgs.gov/pubprod

Telephone: 1-888-ASK-USGS

For more information on the USGS—the Federal source for science about the Earth,

its natural and living resources, natural hazards, and the environment:

World Wide Web: http://www.usgs.gov

Telephone: 1-888-ASK-USGS

Any use of trade, product, or firm names is for descriptive purposes only and does not imply endorsement by the 

U.S. Government.

Although this report is in the public domain, permission must be secured from the individual copyright owners to 

reproduce any copyrighted materials contained within this report.

Suggested citation:

Banta, E.R., Paschke, S.S., and Litke, D.W., 2008, User guide and documentation for five MODFLOW ground-water 

modeling utility programs: U.S. Geological Survey Techniques and Methods 6–A28, 24 p.
iii

Preface

This report documents five utility computer programs that extract and process information from 

input files prepared for, and output files generated by, MODFLOW, the U.S. Geological Survey’s 

three-dimensional ground-water flow model. The documentation presented herein describes the 

programs, the input requirements, and the output.

The performance of these programs has been tested in a variety of applications. Future applications, however, might reveal errors that were not detected in the test simulations. Users 

are requested to notify the U.S. Geological Survey of any errors found in this document or the 

computer programs. Updates might occasionally be made to this document and to the programs. 

Users can download the software and check for updates on the Internet at http://water.usgs.

gov/software/FiveModflowUtilities/.
iv

Contents

Preface ...........................................................................................................................................................iii

Abstract...........................................................................................................................................................1

Introduction.....................................................................................................................................................1

Obtaining and Installing the Software...............................................................................................2

Program GRID2GRIDFLOW for Transferring Flow Values Between Models .......................................2

Method....................................................................................................................................................2

Sources of Error....................................................................................................................................4

Input for GRID2GRIDFLOW..................................................................................................................5

Explanation of Variables Read from the GRID2GRIDFLOW Main Input File.......................6

Input Instructions for the Zone File...........................................................................................7

Steps for Producing a Grid Coefficient File .............................................................................9

Executing GRID2GRIDFLOW .............................................................................................................10

Output from GRID2GRIDFLOW..........................................................................................................11

Program CBC2RASTER for Converting Boundary Flow Values to Rasters.........................................11

Input for CBC2RASTER.......................................................................................................................12

Executing CBC2RASTER ....................................................................................................................12

Output from CBC2RASTER.................................................................................................................12

Program DIS2RASTER for Converting Layer Top and Bottom Elevation Arrays to Rasters ............13

Input for DIS2RASTER........................................................................................................................13

Executing DIS2RASTER .....................................................................................................................14

Output from DIS2RASTER..................................................................................................................14

Program MFBIN2RASTER for Converting Head or Drawdown Arrays to Rasters............................14

Input for MFBIN2RASTER..................................................................................................................14

Executing MFBIN2RASTER ...............................................................................................................15

Output from MFBIN2RASTER............................................................................................................15

Program MULT2RASTER for Converting Multiplier Arrays to Rasters................................................16

Input for MULT2RASTER....................................................................................................................16

Executing MULT2RASTER..................................................................................................................16

Output from MULT2RASTER..............................................................................................................17

References Cited..........................................................................................................................................17

Appendix 1: GRID2GRIDFLOW Example...................................................................................................18

Appendix 2: Conversion from MODFLOW Array to Raster....................................................................23

Model-Data File...................................................................................................................................23

Raster Text File ....................................................................................................................................24
v

Figures

1. Detail of model-intersection area..............................................................................................3

2. Excerpts from a grid coefficient file. .......................................................................................10

A1–1. Grids for source and target models and aquifer area for the example.............................19

Tables

1. Flow handling for polygons in active and inactive source- and target-model

cells for program GRID2GRIDFLOW...........................................................................................4

Abstract

This report documents five utility programs designed for 

use in conjunction with ground-water flow models developed 

with the U.S. Geological Survey’s MODFLOW ground-water 

modeling program. One program extracts calculated flow 

values from one model for use as input to another model. The 

other four programs extract model input or output arrays from 

one model and make them available in a form that can be used 

to generate an ArcGIS raster data set. The resulting raster data 

sets may be useful for visual display of the data or for further 

geographic data processing.

The utility program GRID2GRIDFLOW reads a 

MODFLOW binary output file of cell-by-cell flow terms for 

one (source) model grid and converts the flow values to input 

flow values for a different (target) model grid. The spatial 

and temporal discretization of the two models may differ. 

The four other utilities extract selected 2-dimensional 

data arrays in MODFLOW input and output files and write 

them to text files that can be imported into an ArcGIS geographic information system raster format. These four utilities require that the model cells be square and aligned with 

the projected coordinate system in which the model grid is 

defined. The four raster-conversion utilities are

•	 CBC2RASTER, which extracts selected stress-package 

flow data from a MODFLOW binary output file of 

cell-by-cell flows;

•	 DIS2RASTER, which extracts cell-elevation data from 

a MODFLOW Discretization file; 

•	 MFBIN2RASTER, which extracts array data from a 

MODFLOW binary output file of head or drawdown; 

and

•	 MULT2RASTER, which extracts array data from a 

MODFLOW Multiplier file.

Introduction

This report documents five utility programs designed for 

use with ground-water flow models developed with the U.S. 

Geological Survey’s MODFLOW ground-water modeling 

program. One program extracts values of flow between userdefined zones from output of one model for use as input to 

another model. The other four programs extract model input or 

output arrays for a model and make them available in a form 

that can be used to generate an ArcGIS (ESRI, Inc., 2005a) 

raster data set. The resulting raster data sets may be useful for 

visual display of the data or for further geographic data processing. The utilities work with MODFLOW-2000 (Harbaugh 

and others, 2000) and with MODFLOW-2005 (Harbaugh, 

2005). Development of the utilities was done in cooperation 

with the Colorado Water Conservation Board and the Colorado 

Division of Water Resources and was supported in part by the 

U.S. Geological Survey Ground-Water Resources Program.

GRID2GRIDFLOW is a utility that provides a means for 

transferring interzone flow values from one model to another, 

where the domains of the two models overlap. Of the two 

models, one is designated as the “source” model in that it is set 

up to calculate flow between two zones, for example, between 

one aquifer and an overlying aquifer. A second model is designated as the “target” model, for which the flow values calculated by the source model are to be used as specified flow.

Conceptually, GRID2GRIDFLOW facilitates specification of inflow rates across a boundary into the domain of 

the target model. The source model domain is divided on a 

cell-by-cell basis into two zones identified by the integers 1 

and 2. Cell-by-cell flow values calculated by the source model 

between the zones are used to generate the specified inflow 

rates for the target model. The design of GRID2GRIDFLOW 

assumes (1) that the domain of the source model can be 

subdivided into two zones, where one zone generally overlies 

the other; (2) that values of flow between zones calculated by 

the source model are to be used as specified flow into some 

User Guide and Documentation for Five MODFLOW 

Ground-Water Modeling Utility Programs

By Edward R. Banta, Suzanne S. Paschke, and David W. Litke
2 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

part of the target model, part or all of which geographically 

overlaps the source model; and (3) that the start date and time 

of the target model does not precede the start date and time of 

the source model. The source- and target-model grids need not 

be aligned with each other, and the discretization of their grids 

may be either uniform or nonuniform in their specification of 

row and column dimensions; however, GRID2GRIDFLOW 

cannot be used if the Local Grid Refinement Package (Mehl 

and Hill, 2005) is used for either model.

CBC2RASTER extracts data of a specified stress package 

from a MODFLOW binary file of cell-by-cell flow and creates 

one or more text files containing numeric values that can be 

used to generate ArcGIS raster data sets. CBC2RASTER can 

extract values of evaporation, recharge, flow between streams 

and ground water, or well discharge.

DIS2RASTER extracts layer top and bottom elevation 

data from a MODFLOW Discretization file and creates text 

files containing the elevation values, which can be used to 

generate ArcGIS raster data sets. DIS2RASTER reads the 

MODFLOW IBOUND data and writes a specified NO DATA 

value at inactive cell locations.

MFBIN2RASTER extracts one or more 2-dimensional 

arrays from a MODFLOW binary output file of head or 

drawdown and creates one or more files containing numeric 

values that can be used to generate ArcGIS raster data sets. 

MFBIN2RASTER reads the MODFLOW IBOUND data and 

writes a specified NO DATA value at inactive cell locations.

MULT2RASTER extracts one or more 2-dimensional 

multiplier arrays from MODFLOW input file(s) and creates text files containing numeric values that can be used to 

generate ArcGIS raster data sets. MULT2RASTER reads the 

MODFLOW IBOUND data and writes a specified NO DATA 

value at inactive cell locations.

Obtaining and Installing the Software

The utility programs documented in this report may be 

downloaded from the URL listed in the Preface of this report. 

The download is a self-extracting archive file that contains 

executable files for the Windows operating system, Fortran 

source-code files, and example data sets. 

Executable files for operating systems other than Windows may be generated by compiling and linking the sourcecode files in the “src” subdirectory for each utility using a 

Fortran-90 compiler that supports the operating system of 

interest.

Once extracted or compiled, the executable files may 

be invoked as described in the following sections. Users are 

encouraged to invoke the utilities from the operating-system 

command prompt at first, to gain familiarity with the input 

requirements of each utility and to aid in identifying input 

errors. The utilities also may be invoked from a user-written 

command script, batch file, or other program.

Program GRID2GRIDFLOW for 

Transferring Flow Values Between 

Models

GRID2GRIDFLOW is designed to extract flow values 

calculated by one model (the source model) and generate flow 

values to be used as specified flow in another model (the target 

model). Before GRID2GRIDFLOW is run, a GIS-based intersection procedure is required, to define areas where the domains 

of the two models overlap and to establish the correspondence 

of cells in one model to cells in the other. Time-discretization 

specifications define the time interval during which the models 

overlap. The method used to apportion flows is general in that it 

supports intersection of two grids that may differ in orientation 

and in row and column discretization. This method also allows 

the time-discretization schemes for the two models to differ.

Method

The method for apportioning flow is based on the 

assumptions: (1) that the domain of the source model can be 

subdivided into two zones, where one zone overlies the other; 

(2) that values of flow between zones calculated by the source 

model are to be used as specified flow into some area of the 

target model; and (3) that the start date and time of the target 

model does not precede the start date and time of the source 

model. If the end date and time of the target model is later 

than the end date and time of the source model, the program 

will run to normal completion, but data will not be generated for stress periods not encompassed by the source-model 

simulation time. 

The flow values required by GRID2GRIDFLOW are read 

from a MODFLOW cell-by-cell budget (CBC) file (Harbaugh 

and others, 2000; Harbaugh, 2005) generated by the source 

model. Time discretization data are read from the Discretization file (Harbaugh and others, 2000; Harbaugh, 2005) applicable to each model. All stress periods in the target model, 

including steady-state stress periods, must have period length 

(PERLEN in the Discretization file) greater than zero. A start 

date and time are defined for each model. The CBC file must 

include cell-by-cell internal flow data for every time step of 

the source model from the first stress period and time step to 

the time step that includes the end date and time of the target 

model, or to the end date and time of the source model, whichever is earlier. The internal flow data are generated by the flow 

package used in the source model; budget components for 

other packages, if present, are ignored. Supported flow packages include the Layer-Property Flow (LPF), Block-Centered 

Flow (BCF), and Hydrogeologic-Unit Flow (HUF) Packages.

Required input includes a file called the grid coefficient file, which contains information on the geographic 
Program GRID2GRIDFLOW for Transferring Flow Values Between Models 3

relation between cells in the source-model grid and cells 

in the target-model grid. The grid coefficient file is created 

by a geographic information system (GIS) intersection of 

data sets representing the two model grids (see Appendix 1 

at the back of the report). The file should contain a record 

for each polygon resulting from the intersection procedure 

in the area where the model domains overlap. Each record 

contains information about the cell in each of the model grids 

from which the polygon is derived. Detailed instructions for 

preparing a grid coefficient file are provided in the “Input for 

GRID2GRIDFLOW” section.

Program GRID2GRIDFLOW is similar in nature to the 

MODFLOW post-processing program ZONEBUDGET (Harbaugh, 1990), and much of the GRID2GRIDFLOW source 

code is derived from ZONEBUDGET. A benefit of this similarity is that a zone file prepared for GRID2GRIDFLOW can 

be used without modification by ZONEBUDGET. Users can 

corroborate GRID2GRIDFLOW results with those obtained 

using ZONEBUDGET. Additionally, GRID2GRIDFLOW 

produces an output file (see the “Output from GRID2GRIDFLOW” section) that can be read as a ZONEBUDGET 

file by the GW_Chart program (Winston, 2000) to create a 

water-budget chart. As in ZONEBUDGET, zones are identified by integers assigned to individual cells; however, in 

GRID2GRIDFLOW only two zones are supported, and the 

zones must be identified by the integers 1 and 2. Also as in 

ZONEBUDGET, flow between zones is calculated anywhere 

two adjacent cells have differing zone numbers; interzone flow 

is calculated between vertically adjacent cells and between 

horizontally adjacent cells. The desired output can be considered as a 2-dimensional array of flows into the target model; to 

accomplish this, interzone flow is accumulated in the vertical 

dimension for each horizontal (row, column) cell location in 

the source model. Depending on the configuration of the two 

zones, at any given horizontal cell location, the total interzone 

flow may have contributions due to horizontal flow in one or 

in multiple layers, and it also may have a contribution due to 

vertical flow.

Intersection of the two grids produces polygons derived 

from the two sets of grid cells. Each polygon is considered 

to be a child of two parent cells: one belonging to the sourcemodel grid and one belonging to the target-model grid. Figure 

1 shows part of the intersection of two model grids; the 

source-model grid, shown in blue, is angled, and the targetmodel grid, shown in pink, is aligned with the page. Polygons 

labeled “c” and “d” are child polygons of the same parent 

source-model cell; polygons “a” and “c” are child polygons 

of the same target-model cell. The example to which figure 1 

applies is documented in Appendix 1.

A source-model cell is considered active if any of the cell 

faces form part of the boundary between zones 1 and 2 and 

if the CBC file contains nonzero flow values for any of those 

faces. A target-model cell is considered active if, in the grid 

coefficient file (see the “Steps for Producing a Grid Coefficient 

File” section), the TACTIVE_CODE entries for the cell are 

not 0. For a given polygon, there are four possible relations 

EXPLANATION

Intersection Parent Cell Status

polygons Source model Target model

a Active Active

b Active Inactive

c Inactive Active

d Inactive Inactive

Figure 1. Detail of model-intersection area. Shading shows active 

cells in source (blue) and target (pink) models. Intersection polygons 

described in text are labeled a, b, c, and d. For clarity the aquifer 

boundary is omitted. Appendix 1 (at the back of the report) contains 

descriptions of the models.

between the parent source- and target-grid cells (letters refer to 

polygons labeled on fig. 1): (a) The source-model cell and the 

target-model cell are active; (b) the source-model cell is active 

and the target-model cell is inactive; (c) the source-model 

cell is inactive and the target-model cell is active; and (d) the 

source-model cell and the target-model cell are inactive.

Flow values for the target-model grid cells are generated 

from the cell-by-cell flow values produced by the source 

model by a method that accounts for the area of intersection of 

source and target cells and for the length of source-model time 
4 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

steps that correspond to target-model stress periods. For each 

source-model time step, the accumulated interzone flow for 

each source-model cell is divided by the cell area to obtain an 

interzone flow per unit area (L/T): 

SourceCellArea

SourceCellInterzoneFlow InterzoneFlowPerUnitArea =

Each intersection polygon within a particular source-grid 

cell is assigned this interzone flow per unit area. Cumulative 

flow volume (TVolume, L3) for each target-model grid cell for 

each target-model stress period is then calculated by summing 

the products of the interzone flow per unit area multiplied by 

polygon area for all polygons in each target-model cell and by 

time-step length for all source-model time steps in the targetmodel stress period as follows:

i t

C

i

M

t i TVolume= InterzoneFlowPerUnitArea ×PolyArea ×STSL =1 =1  

where C is the number of child polygons in a parent target 

cell, M is the number of source-model time steps corresponding to the target-model stress period, PolyArea is the area of 

the polygon, and STSL is the source-model time-step length 

that is within the stress period. The flow rate for the cell for 

the target-model stress period then is calculated as TVolume

divided by the stress-period length. When a source-model 

time step overlaps more than one target-model stress period, 

the contribution to TVolume for each stress period is prorated 

among the stress periods.

Results are written to output file FLOW_TARGET for 

active target-model cells and to output file EXCLUDED_

TARGET for inactive target-model cells (table 1). For inactive source-model cells, no CBC flow terms are available 

from the source model, and no flows are generated for the 

target-model grid.

Table 1. Flow handling for polygons in active and inactive source- and target-model cells for program GRID2GRIDFLOW.

Source-model parent

cell status

Target-model parent

cell status Flow handling Output location Example polygonin fig. 1

Active Active

Flow computed by source 

model contributes to 

active target-model cell

Flow written to output file 

FLOW_TARGET – one 

record per target-grid cell

a

Active Inactive

Flow computed by source 

model DOES NOT 

contribute to active 

target-model cell

Flow written to output file EXCLUDED_TARGET – one 

record per target-grid cell

b

Inactive Active

No flow in source model; 

no contribution to 

target model

No output c

Inactive Inactive

No flow in source model; 

no contribution to 

target model

No output d

Source-model time-step start and end times are used to 

determine the temporal relation between target-model stress 

periods and source-model time steps, and target-model flow 

terms are calculated only for target-model stress periods that 

occur within the source-model time. If the target-model simulation time exceeds the source-model simulation time, no flow 

terms are calculated for the target-model stress periods that 

lack corresponding source-model time steps.

Sources of Error

The user should be aware of three potential sources of 

error inherent in the method implemented in GRID2GRIDFLOW: two in the spatial realm and one in the temporal realm. 

Errors can arise when the discretization, either spatial or 

temporal, of the two models differ.

Error type 1: Nonalignment of cell boundaries. If the grid 

cells of the two models in the area of overlap do not coincide, 

the flow calculated for a source-model cell is assigned to 

target-model cells whose combined area does not correspond 

exactly to the area of the source-model cell. This error can 

be eliminated by ensuring that, in the area of overlap, the 

boundaries of each source-model cell coincide exactly with 

the boundaries of one target-model cell or a rectangular group 

of target-model cells. In situations where the boundaries do 

not coincide, the error can be reduced by refining the spatial 

discretization of the target model.

Error type 2: Nonalignment of active cell areas. When the 

discretization of the two model grids differs, the areal coverage of cells designated as active may not match. Wherever an 

active source-model cell is not overlapped by an active targetmodel cell, interzone flow for the part of the source-model 

cell that does not have an overlapping, active target-model cell 

will not be represented in the file of flows intended for use by 
Program GRID2GRIDFLOW for Transferring Flow Values Between Models 5

the target model. This part of the interzone flow is considered 

excluded and is reported in a separate file. This error can be 

eliminated by ensuring that (1) the target-model grid encloses 

all cells of the source model subject to interzone flow; and 

(2) in the area subject to interzone flow, all target-model cells 

that overlap active source-model cells are active. In situations 

where the error cannot be eliminated, it can be reduced by 

refining the spatial discretization of the target model. The file 

of excluded flows is provided to enable the user to evaluate the 

magnitude and location of errors of this type.

Error type 3: Nonalignment of temporal discretization.

This type of error is the temporal analog to error type 1. Errors 

arise when the time steps of the source model do not coincide 

exactly with the stress periods of the target model. In this situation, flows intended for use in the target model do not correspond exactly in time to the source model. This type of error 

can be eliminated by defining the target-model stress periods 

to coincide with the time steps of the source model. In situations where defining the temporal discretization of the two 

models in this way is impractical, the error can be reduced (1) 

by refining the stress-period discretization of the target model, 

or (2) by limiting the discrepancy between source-model time 

steps and target-model stress periods.

Input for GRID2GRIDFLOW

The program GRID2GRIDFLOW reads a main input file 

that specifies the names of input and output files and other 

data. The main input file is a text file containing the following 

items. An example main input file for GRID2GRIDFLOW is 

shown in Appendix 1.

1: TITLE

2: MESSNAME

3: DIS_SOURCE

4: CBC_SOURCE

5: ZONE_SOURCE

6: DIS_TARGET

7: COEFNAME

8: FLOW_TARGET

9: EXCLUDED_TARGET

10: ZONBUD_SOURCE

11: LUPOLY

12: STARTDATE_SOURCE

13: STARTDATE_TARGET
6 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

Explanation of Variables Read from the GRID2GRIDFLOW Main Input File

TITLE — Text to be used for identification in output.

MESSNAME — Name of an output file for messages generated by GRID2GRIDFLOW.

DIS_SOURCE — Name of the source-model Discretization file.

CBC_SOURCE — Name of the source-model CBC file; file must include data for all source-model time steps. The CBC file 

may be either a compact or noncompact budget file.

ZONE_SOURCE — Name of an input file containing zone arrays for the source model. Note that this file does NOT use the 

same format as a zone array file prepared for MODFLOW.

DIS_TARGET — Name of the target-model Discretization file.

COEFNAME — Name of the grid coefficient file relating source-model grid to target-model grid.

FLOW_TARGET — Name of the output file of flow data for active cells in the target grid; if this file exists, it will be overwritten.

EXCLUDED_TARGET — Name of the output file of flow data for inactive cells (excluded) from the target grid; if this file 

exists, it will be overwritten.

ZONBUD_SOURCE — Name of the output file documenting input of zone arrays and volumetric-budget calculations; if this 

file exists, it will be overwritten. This file can be read as a ZONEBUDGET file by the GW_Chart program (Winston, 

2000) to generate water-budget charts.

LUPOLY — Length unit used for the POLYAREA column of the grid coefficient file, one of: “FEET,” “METERS,” or “CM” 

(centimeters).

STARTDATE_SOURCE — Start date and time for the source model (format: ‘YYYY/MM/DD[.ddd]’)

STARTDATE_TARGET — Start date and time for the target model (format: ‘YYYY/MM/DD[.ddd]’ )

In the format used for STARTDATE_SOURCE and STARTDATE_TARGET, if the optional specification “.ddd” is omitted, the 

start time is assumed to be the beginning of the day specified as ‘YYYY/MM/DD.’ If “.ddd” is included, it is the fractional part 

of a day. So, the entry ‘1776/07/04.5’ would refer to 12:00 noon, July 4, 1776.

Five input files are listed in the GRID2GRIDFLOW main input file and must be available for the program to successfully 

execute:

•	 MODFLOW Discretization file for the source model

•	 MODFLOW Discretization file for the target model

•	 MODFLOW cell-by-cell budget file generated by the source model

•	 Zone file for the source model

•	 Grid coefficient file relating the source-model grid to the target-model grid

MODFLOW Discretization file – The Discretization file is a file required by MODFLOW that contains data to define the spatial 

and temporal discretization of a model. These data include the number of model rows, columns, and layers; model cell 

dimensions; the presence of quasi-3D confining beds; and model time discretization. See Harbaugh and others (2000) or 

Harbaugh (2005) for details on Discretization file construction. For each model (source and target) a Discretization file is 

read by GRID2GRIDFLOW to determine the grid geometry and time discretization.

MODFLOW cell-by-cell budget (CBC) file – A CBC file is a binary file containing cell-by-cell flow terms output from a given 

MODFLOW simulation. In addition to internal (cell-to-cell) flow values, the CBC file may contain flow terms for any 

boundary condition specified in MODFLOW package input files. GRID2GRIDFLOW uses the internal flow values and 

ignores the boundary flows. GRID2GRIDFLOW requires that the CBC file contain internal flow values for time steps of 

the source model from the start time of the target model to the end of the model with the earlier end time. See Harbaugh 

and others (2000) or Harbaugh (2005) for details on how to create a CBC file during MODFLOW simulations. 

Zone file – The zone file defines two zones in the source-model grid; each cell in the grid must be assigned as being in zone 1 

or zone 2. Flow between zones in the source model is mapped to corresponding cells of the target model. The assignment 

of zone 1 or 2 in the source-model grid determines the sign convention for flow values written to files FLOW_TARGET 

and EXCLUDED_TARGET. Positive flow values are written where net flow is simulated in the source model from zone 

2 to zone 1; negative flow values are written where net flow is from zone 1 to zone 2. Inactive cells, as defined in the 

MODFLOW Basic Package input file, do not affect the results of GRID2GRIDFLOW and may be assigned to either 

zone. The zone file should contain one 2-dimensional (NCOL by NROW) array for each layer in the source model, starting with layer 1. The structure of the zone file is described in the section entitled “Input Instructions for the Zone File.” 
Program GRID2GRIDFLOW for Transferring Flow Values Between Models 7

Grid coefficient file – The grid coefficient file relates the source-model grid to the target-model grid. The grid coefficient file 

may be generated in ArcMap (ESRI, Inc., 2005b) following the processing steps described in the section entitled “Steps 

for Producing a Grid Coefficient File.” 

Input Instructions for the Zone File

The zone file contains records that define a zone value for 

each source-model cell. A 2-dimensional (NCOL by NROW) 

array is defined for each model layer. Four record types may 

be included in the file as defined in this section. The first 

record in the file must be of type 1; the following records 

define the arrays. The definition of each array begins with 

a record of type 2. Depending on the contents of the type-2 

record, record types 3 and 4 may not be used. Arrays are input 

in order, starting with the array for layer 1.

Each record type contains one or more input values. 

Fixed format and free format are used. For fixed format, the 

data values must be in a specific range of columns called a 

field. Numeric values may appear anywhere in the field; character values need to be left justified. A blank may represent 

a 0 in a fixed-format numeric field. For free format, there are 

no absolute field sizes. Values are separated by one or more 

spaces or by a comma plus optional spaces. Because a space is 

a delimiter that can separate values, a space cannot be used to 

indicate 0 where free format is used.

Values to be input are given symbolic item names. Each 

item name is the name of a program variable or array in 

GRID2GRIDFLOW. When an item is an array, the dimensions of the array are included as part of the item name. For 

example, IZONE(NCOL,NROW) is a matrix of values with 

NROW rows and NCOL columns. For each item, the required 

format is specified. “Free” indicates free format. “Ix” indicates 

fixed-format integer values, where x is the width of the field. 

Multiple integer fields are indicated by “nIx,” where n is the 

number of fields. “Ax” indicates fixed-format character values, 

where x is the field width.
8 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

Record type 1

Item: NLAY NROW NCOL

Format: Free Free Free

Where:

NLAY is the number of layers in the source-model grid; 

NROW is the number of rows; and 

NCOL is the number of columns. NLAY, NROW, and NCOL must match the corresponding values in the DIS_SOURCE file.

Record type 2

Item: LOCAT ICONST FMTIN IPRN

Format: A10 I10 A20 I10

Where:

LOCAT indicates the source or location of the zone data for the layer.

•	 A LOCAT value of “CONSTANT” indicates that all cells in the layer have the same zone value, which is the value of 

item ICONST. In this case, there will be no record types 3 and 4.

•	 A LOCAT value of “INTERNAL” indicates that the zone data for the layer are contained within the zone file. In this 

case, there will be no record type 3, so record type 4 follows record type 2.

•	 A LOCAT value of “EXTERNAL” indicates that the zone data for the layer are contained in a file other than the zone 

file. The name of this file is contained in record type 3.

ICONST is the zone value that is assigned to each cell in the layer if LOCAT has the value “CONSTANT.” If LOCAT is other 

than “CONSTANT,” then ICONST is not used. The zone value must be either 1 or 2. 

FMTIN is the Fortran format of the data in record type 4. If LOCAT has the value “CONSTANT,” then FMTIN is not used. 

FMTIN must be a standard Fortran format specification for reading integer data. The format must include parentheses. 

An example is “(20I4),” which indicates that 20 integers will be read from each record, and each integer occupies a field 

of 4 columns. If the FMTIN value is blank, free format is used.

IPRN is a flag that determines if record type 4 values are printed in the listing file. If IPRN is greater than or equal to 0, the 

values are printed. If IPRN is less than 0, values are not printed. If LOCAT has the value “CONSTANT,” then IPRN is 

not used.

Record type 3

Item: NAME

Format A80

Where:

NAME is the name of a file that contains zone values for a layer of the model. Include record type 3 only if LOCAT has the 

value “EXTERNAL.”

Record type 4

Item: IZONE(NCOL,NROW)

Format: Defined by Record Type 1

Where:

IZONE contains the zone values for each cell in a layer. IZONE is read only if LOCAT has the value “EXTERNAL” or 

“INTERNAL.” If LOCAT is “INTERNAL,” then include the data within the zone file. If LOCAT is “EXTERNAL,” then 

include the data in the file that is named by the item NAME. The format of the data is defined by FMTIN. Data are read a 

row at a time, starting with row 1. If a row of the data contains more values than one record holds, then additional records 

will be read using the same format until all values for one row have been read. Each row of data must start on a new 

record. The zone values must be 1 or 2.
Program GRID2GRIDFLOW for Transferring Flow Values Between Models 9

Steps for Producing a Grid Coefficient File

The grid coefficient file defines the spatial relation 

between cells of the source-model grid and cells of the targetmodel grid; it generally is produced by a GIS intersect operation. Before a grid coefficient file can be created by ArcGIS 

(ESRI, Inc., 2005a), a polygon feature class for each grid must 

be available. Either ESRI shapefiles or geodatabase files may 

be used. The feature class for the source-model grid needs to 

include integer attributes populated with: (1) the row number, 

and (2) the column number. The feature class for the targetmodel grid needs to include integer attributes populated with: 

(1) the row number; (2) the column number; and (3) a cellstatus indicator; for the cell status, a nonzero value indicates 

an active cell and 0 indicates an inactive cell. The indicator 

scheme for cell status is similar to that used for the IBOUND 

arrays of MODFLOW, except that negative integers confer no 

special status in GRID2GRID flow. The cell status is used to 

determine if flow may be assigned to each target-model cell. 

When the feature classes for the two model grids have been 

created and populated with the required attributes, a grid coefficient file can be generated by performing the following steps:

1. Open a new ArcMap file.

2. Add the two polygon feature classes containing the 

source-model grid and the target-model grid to the 

map file.

3. Intersect the target- and source-model grids (polygon feature classes) using the “Intersect_analysis” 

tool. To access this tool in Arc Toolbox (ESRI, Inc., 

2005a), select Analysis Tools, Overlay, Intersect. 

Use Intersect to operate on two input features: specify the target-model grid first, then the source-model 

grid. The target-model grid must be specified first to 

ensure that the polygons are sorted by target-model 

cell in the resulting attribute table. Provide a name 

for the output feature class of intersection polygons; 

this feature class will be used in the next step. For 

“JoinAttributes” specify ALL; leave “XY Tolerance” 

blank; and specify “Output Type” as INPUT.

4. Add a field for polygon area to the attribute table 

for the feature class containing the intersection 

polygons generated in the previous step by using 

the “CalculateAreas_stats” tool. To access this 

tool in Arc Toolbox, select Spatial Statistics Tools, 

Utilities, Calculate Areas. Provide a name for 

the output feature class; this feature class will be 

used in the next step. If Python (Python Software 

Foundation, 2008) scripting is used, the area field 

can be calculated directly by accessing the Area 

property of the Geometry object for the Row object 

of the SearchCursor object of the ArcGIS object 

model.

5. Export the attribute table for the feature class generated in step 4 to an ASCII comma-delimited file. 

There are no built-in ArcToolbox tools to accomplish this, but it can be done using any ArcGIScompatible scripting language, for example, in 

the Python scripting language (Python Software 

Foundation) by using a SearchCursor. In the export 

process, several unneeded fields in the attribute 

table should not be exported. In the ArcMap 

interface, these operations can be done by opening 

the attribute table for the feature class generated 

in step 4 in ArcMap. Only the attributes shown in 

figure 2 need to be exported; other attributes can 

be “turned off” by right-clicking on the column 

name and selecting “Turn Field Off.” To turn fields 

back on, click on Options and “Turn All Fields 

On.” When the Attributes window shows only the 

attributes corresponding to those shown in figure 

2, export the data by selecting Options...Export. 

In the Export dialog, select the icon to the right of 

the “Output table” text box, and for “Save as type” 

select “Text file” and provide a name. The output 

file will be formatted as a comma-separated values 

file; you may find it helpful to name the file with 

the extension “.csv” to indicate the file type.
The first line of a grid coefficient file is ignored by 

GRID2GRIDFLOW; it can be used as a header line to label 

column contents, as illustrated in figure 2. Each subsequent 

line is a record corresponding to one intersection polygon. The 

file should contain one record for each intersection polygon 

in the area of overlap between the two model grids. Polygons 

in areas where the grids do not overlap or in areas that are 

inactive in both the source and target models may be omitted. 

Polygons that share the same parent target-model cell must 

be listed consecutively. The following six data values are read 

from each record:

Figure 2. Excerpts from a grid coefficient file. Data are from the GRID2GRIDFLOW example described 

in Appendix 1 at the back of the report.

TROW TCOL TACTIVE_CODE SROW SCOL POLYAREA

 38 29 0 12 20 1935.838021

 38 30 0 12 20 71331.159855

 38 30 0 12 21 24477.183583

...

 37 32 0 11 21 57916.344120

 37 33 1 12 21 35424.222421

 37 33 1 12 22 15040.840253

...

TROW — Target-model grid row number, integer.

TCOL — Target-model grid column number, integer.

TACTIVE_CODE — Target-model grid cell status, integer (0=inactive, nonzero=active).

SROW — Source-model grid row number, integer.

SCOL — Source-model grid column number, integer.

POLYAREA — Area of intersection polygon, floating-point number. The units for POLYAREA need to be consistent with the 

length unit specified in variable LUPOLY of the main input file.

Executing GRID2GRIDFLOW

The program GRID2GRIDFLOW may be invoked from the operating-system command prompt.

Usage: GRID2GRIDFLOW <MAIN_INPUT_FILE>

Where:

<MAIN_INPUT_FILE> is the name of the GRID2GRIDFLOW main input file.

10 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs
Program CBC2RASTER for Converting Boundary Flow Values to Rasters 11

Output from GRID2GRIDFLOW

Four ASCII output files are listed in the GRID2GRIDFLOW main input file and are generated by executing 

GRID2GRIDFLOW:

•	 Messages output file (file MESSNAME as specified 

in the main input file)

•	 Output file (FLOW_TARGET) of flow data corresponding to active cells in the target-model grid

•	 Output file (EXCLUDED_TARGET) of flow data 

corresponding to inactive cells in the target-model 

grid

•	 Output file (ZONBUD_SOURCE) of zone-based 

flow information for the source model, which is 

similar in form and content to the output generated by 

ZONEBUDGET (Harbaugh, 1990)

The messages file lists the file names specified in the 

main input file, model-timing correspondence between the 

source and target models, and a summary of flows between 

zones 1 and 2 for each target-model stress period. The summary table includes columns for flows corresponding to active 

target-model cells and for excluded flows. Depending on the 

spatial discretization and areas of active cells of the two models and on the zonation of the source model, the total flows 

(sums of all positive flows and all negative flows) calculated 

for use by the target model may be substantially smaller in 

absolute value than totals calculated from values contained 

in the CBC file. Two files are generated to allow the user to 

determine if the active cells in the target model satisfactorily 

capture the flow simulated in the source model. Net flows 

corresponding to active target-model cells are stored in file 

FLOW_TARGET, and net flows corresponding to inactive 

target-model cells are stored in file EXCLUDED_TARGET. 

For each target-model stress period, the output files of flow 

data corresponding to active and inactive target-model cells 

contain one record per target-model cell intersected by a 

source-model cell. Each record contains the row, column, and 

net flow for the cell. In FLOW_TARGET and EXCLUDED_

FLOW, records are ordered as cells are ordered in the grid 

coefficient file.

Program CBC2RASTER for Converting 

Boundary Flow Values to Rasters

The Fortran program CBC2RASTER is a raster-conversion utility that reads a MODFLOW binary CBC file, extracts 

flow terms (dimensions of L3/T) for a specified boundarystress package, and generates one or more raster text files 

that can be converted to ArcGIS rasters. See Appendix 2 (at 

the back of the report) for usage information common to all 

raster-conversion utilities. In the current (2008) version of 

CBC2RASTER, flow terms for the Evapotranspiration (EVT), 

Evapotranspiration Segments (ETS; Banta, 2000), Recharge 

(RCH), Streamflow-Routing (SFR2; Niswonger and Prudic, 2006), and Well (WEL) Packages may be extracted for 

conversion. One or more raster text files are written for each 

time step for which data of the specified package are stored in 

the CBC file. Flow values extracted from the CBC file for the 

EVT, ETS, and RCH Packages are divided by cell area before 

being written; output values for these packages are volumetric 

flux values and accordingly have dimensions of length per 

time. For the SFR2 Package, flow values for stream reaches in 

all layers are summed to generate one raster text file per time 

step. For the WEL Package, a raster text file is generated for 

each layer for each time step; however, raster text files are not 

generated for layers in which no wells are simulated. For all 

packages, an optional multiplier specified on the command 

line allows for the conversion of units.
12 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

Input for CBC2RASTER

Four input files are required for CBC2RASTER execution:

•	 A file containing model data named modeldata.txt (see Appendix 2)

•	 MODFLOW Name file (Harbaugh and others, 2000; Harbaugh, 2005) for the model run of interest

•	 MODFLOW Discretization file for the model run of interest

•	 MODFLOW CBC file produced during the model run of interest

MODFLOW Name file – The Name file is a file required by MODFLOW that contains the names of most input and output 

files used in a model simulation and that controls which MODFLOW packages are active. See Harbaugh and others 

(2000) or Harbaugh (2005) for details on Name file construction and MODFLOW packages. The Name file is read by 

CBC2RASTER to determine the name of the Discretization file.

MODFLOW Discretization file – The Discretization file is a file required by MODFLOW that contains data to define the spatial 

and temporal discretization of a model. These data include: the number of model rows, columns, and layers; model cell 

dimensions; the presence of quasi-3D confining beds; and model time discretization. See Harbaugh and others (2000) 

or Harbaugh (2005) for details on Discretization file construction. The Discretization file is read by CBC2RASTER to 

determine the model grid geometry.

MODFLOW CBC file – A CBC file is a binary file produced by MODFLOW that contains cell-by-cell flow terms from a given 

MODFLOW simulation. The CBC file may contain cell-by-cell flow terms for any boundary condition as specified in 

the MODFLOW input files. See Harbaugh and others (2000) or Harbaugh (2005) for details on how to create a CBC file 

during a MODFLOW simulation. The CBC file may be either a compact or noncompact budget file. The CBC file is read 

by CBC2RASTER to process cell-by-cell flow terms for the EVT, ETS, RCH, SFR, and WEL Packages. Processing of 

cell-by-cell flow terms for boundary-condition packages other than EVT, ETS, RCH, SFR, and WEL is not supported by 

CBC2RASTER in the present (2008) version.

Executing CBC2RASTER

The program CBC2RASTER may be invoked from the operating-system command prompt.

Usage: CBC2RASTER NAME_FILE CBC_FILE PID [CONVFACTOR]

Where:

NAME_FILE is the name of the MODFLOW Name file;

CBC_FILE is the name of the CBC file; and

PID is a three-character package identifier for the MODFLOW package for which data are to be extracted. PID must be one of 

EVT, ETS, RCH, SFR, or WEL.

CONVFACTOR is an optional units-conversion factor. If present, all flow or flux values will be multiplied by CONVFACTOR 

before being written to output.

Output from CBC2RASTER

Two types of text files are generated by CBC2RASTER: 

(1) a file named cbc2rasterout.txt, which is a text file that lists 

data header records read from the CBC file; and (2) one or 

more raster text files. One or more raster text files are generated for each time step in each stress period for which data 

for the selected package are stored in the CBC file. When PID 

is specified as EVT, ETS, RCH, or SFR, the raster text files 

are named PID_SPppp_TSsss.asc, where PID is the package 

identifier specified on the command line, ppp is a stress period 

number, and sss is a time-step number. When PID is specified 

as WEL, the raster text files are named WEL_SPppp_TSsss_

Lnnn.asc, where nnn is a layer number. See Appendix 2 for 

instructions for converting a raster text file to an ArcGIS raster. For the EVT, ETS, RCH, and SFR options, the flow values 

extracted from the CBC file are stored as raster-cell values in 
Program DIS2RASTER for Converting Layer Top and Bottom Elevation Arrays to Rasters 13

the resulting rasters. For the WEL option, flow values (L3/T) 

extracted from the CBC file are divided by cell area (L2) to 

obtain equivalent flux values (L/T); the flux values are stored 

as raster-cell values in the resulting rasters.

Program DIS2RASTER for Converting 

Layer Top and Bottom Elevation Arrays 

to Rasters

The Fortran program DIS2RASTER is a raster-conversion utility that reads a MODFLOW Discretization file, 

extracts the Top (system top elevation) and BOTM (layer and 

quasi-3D confining-bed bottom elevation) arrays, and generates a raster text file for each elevation array. See Appendix 

2 for usage information common to all raster-conversion 

utilities. For the Top array, the NO_DATA value is written 

for cell positions where all layers are inactive according to 

the IBOUND arrays, which are read from the Basic Package input file. For other arrays, assignment of NO_DATA 

values depends on the type of surface defined by the array. If 

the array defines the top of a quasi-3D confining bed or the 

bottom of the lowermost model layer, the NO_DATA value is 

written where IBOUND is zero for the cell immediately above 

the surface. If the array defines the bottom of a quasi-3D 

confining bed, the NO_DATA value is written where IBOUND 

is zero for the cell immediately below the surface. If the array 

defines the bottom of a layer (other than the bottommost layer) 

not underlain by a quasi-3D confining bed, the NO_DATA 

value is written where IBOUND is zero for the cell above the 

surface and for the cell below the surface. 

Input for DIS2RASTER

Four input files are required for DIS2RASTER execution:

•	 A file containing model data named modeldata.txt (see Appendix 2)

•	 MODFLOW Name file for the model run of interest

•	 MODFLOW Discretization file for the model run of interest

•	 MODFLOW Basic Package input file for the model run of interest

MODFLOW Name file – The Name file is a file required by MODFLOW, which contains the names of most input and output files used in a model simulation and controls which MODFLOW packages are active. See Harbaugh and others 

(2000) or Harbaugh (2005) for details on Name file construction and MODFLOW packages. The Name file is read by 

DIS2RASTER to determine the names of the Discretization and Basic Package input files.

MODFLOW Discretization file – The Discretization file is a file required by MODFLOW that contains data to define the spatial 

and temporal discretization of a model. These data include the number of model rows, columns, and layers; model cell 

dimensions; the presence of quasi-3D confining beds; and model time discretization. See Harbaugh and others (2000) or 

Harbaugh (2005) for details on Discretization file construction. The Discretization file is read by DIS2RASTER to determine the model grid geometry and top and bottom elevations.

MODFLOW Basic Package input file – The Basic Package input file is a file required by MODFLOW that is used to specify 

certain data used in a MODFLOW model. These include locations of active, inactive, and specified-head cells; the head 

value stored for inactive cells; and initial heads in all cells. See Harbaugh and others (2000) or Harbaugh (2005) for 

details on construction of the file. The Basic Package input file is read by DIS2RASTER to determine the locations of 

active cells in each model layer, as specified in the IBOUND arrays.
14 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

Executing DIS2RASTER

The program DIS2RASTER is executed from a MS-DOS window command line.

Usage: DIS2RASTER <NAME_FILE>

Where:

<NAME_FILE> is the name of the MODFLOW Name file.

Output from DIS2RASTER

Output files from DIS2RASTER include one raster text 

file for each elevation array specified in the MODFLOW 

Discretization file. Each output file contains an array of top or 

bottom elevations from the Discretization file. Output filenames are BOTM_nnnn.asc where nnnn is the array number. 

The Top array is array number 0000 and the bottom of layer 

1 is array number 0001; additional arrays are numbered in 

sequence in the order entered in the Discretization file, which 

is from the top down. See Appendix 2 for instructions for 

converting a raster text file to an ArcGIS raster. The elevation 

values in the arrays read from the Discretization file are stored 

as raster-cell values in the resulting raster.

Program MFBIN2RASTER for 

Converting Head or Drawdown Arrays 

to Rasters

The Fortran program MFBIN2RASTER is a rasterconversion utility that reads a MODFLOW binary output file 

containing head or drawdown arrays and generates one or 

more raster text files that can be converted to ArcGIS rasters. 

See Appendix 2 for usage information common to all rasterconversion utilities.

Input for MFBIN2RASTER

Five input files are required for MFBIN2RASTER execution:

•	 A file containing model data named modeldata.txt (see Appendix 2)

•	 MODFLOW Name file for the model run of interest

•	 MODFLOW Discretization file for the model run of interest

•	 MODFLOW Output Control file (Harbaugh and others, 2000; Harbaugh, 2005) for the model run of interest

•	 MODFLOW binary head or drawdown output file for the model run of interest

MODFLOW Name file – The Name file is a file required by MODFLOW that contains the names of most input and output files 

used in a model simulation and controls which MODFLOW packages are active. See Harbaugh and others (2000) or 

Harbaugh (2005) for details on Name file construction and MODFLOW packages. The MODFLOW Name file is read by 

MFBIN2RASTER to determine the file names for the Discretization, Output Control, binary head, and binary drawdown 

files.

MODFLOW Discretization file – The Discretization file is a file required by MODFLOW that contains data to define the spatial 

and temporal discretization of a model. These data include the number of model rows, columns, and layers; model cell 

dimensions; the presence of quasi-3D confining beds; and model time discretization. See Harbaugh and others (2000) or 

Harbaugh (2005) for details on Discretization file construction. The Discretization file is read by MFBIN2RASTER to 

determine the model grid geometry and time discretization.
Program MFBIN2RASTER for Converting Head or Drawdown Arrays to Rasters 15

MODFLOW Output Control file – The Output Control file is an optional input file used by MODFLOW that allows the user 

to customize head, drawdown, and budget output generated by MODFLOW. MFBIN2RASTER expects to read modelcalculated head or drawdown arrays from a binary file associated in the Name file, using the DATA(BINARY) file type, 

with a specified unit number. The contents of the binary head and drawdown files are determined by specifications in 

the Output Control file. If heads or drawdowns from a model run are to be converted to rasters by MFBIN2RASTER, an 

Output Control file must have been listed in the Name file when the run was made. The Name and Output Control files 

should be constructed so the binary head or drawdown file contains the desired data (head or drawdown) for the desired 

layer(s) for the desired time step(s). Heads and drawdowns should not be mixed in the same file; if heads and drawdowns 

are generated from a given model run, the heads need to be in one file, and the drawdowns need to be in another file. 

The Output Control file is read by MFBIN2RASTER to determine the unit numbers associated with the binary head and 

drawdown files.

MODFLOW head or drawdown binary file(s) – These MODFLOW output files contain arrays of model-calculated heads or 

drawdowns for model layers and time steps specified in the Output Control file. See Harbaugh and others (2000) or Harbaugh (2005) for details on how to create binary head and drawdown files during MODFLOW simulations.

Executing MFBIN2RASTER

The program MFBIN2RASTER is executed from an MS-DOS window command line.

Usage: MFBIN2RASTER <NAME_FILE>

Where:

<NAME_FILE> is the name of the MODFLOW Name file.

On invocation, MFBIN2RASTER reads the modeldata.txt file, the Name file, the Discretization file, and the Output 

Control file. If the Output Control file indicates that both a head file and a drawdown file were generated during the model run, 

MFBIN2RASTER prompts the user to enter “H” to process heads or “D” to process drawdowns. MFBIN2RASTER then displays the available arrays in the order in which they appear in the binary file; the arrays are sequentially numbered and identified 

by stress period, time step, simulation time, and layer. The user then is prompted to select one array or a range of arrays by their 

sequential number(s). For each array that is selected, a raster text file is generated. An example of the prompt and user response 

follows.

Prompt:

Select array(s) to use by number or range of numbers.

Press <Enter> to stop or enter -1 for all arrays.

Response:

5 10

This response would select the six arrays numbered 5 through 10 (assuming at least 10 arrays are stored in the binary head or 

drawdown file) and would cause six raster text files containing those arrays to be generated. After these arrays are generated, the 

prompt for array number(s) is repeated. Entering a blank line in response to the prompt ends the program.

Output from MFBIN2RASTER

Output files from MFBIN2RASTER consist of one raster 

text file for each array selected by the user for conversion. 

Output filenames are of the form: tt_Lnnn_SPppp_TSsss.asc 

where tt is “HD” for a head array or “DD” for a drawdown 

array, nnn is layer number, ppp is stress-period number, and 

sss is the time-step number. See Appendix 2 for instructions 

for converting a raster text file to an ArcGIS raster. The head 

or drawdown values in the arrays read from the binary file are 

stored as pixel values in the resulting raster.
16 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

Program MULT2RASTER for Converting 

Multiplier Arrays to Rasters

The Fortran program MULT2RASTER is a raster-conversion utility that reads data from a MODFLOW Multiplier file 

(Harbaugh and others, 2000; Harbaugh, 2005) and generates 

one or more raster text files that can be converted to ArcGIS 

rasters. See Appendix 2 for usage information common to all 

raster-conversion utilities.

Input for MULT2RASTER

Five input files are required for MULT2RASTER execution:

•	 A file containing model data named modeldata.txt (see Appendix 2)

•	 MODFLOW Name file for the model run of interest

•	 MODFLOW Discretization file for the model run of interest

•	 MODFLOW Basic Package input file for the model run of interest

•	 MODFLOW Multiplier file for the model run of interest

MODFLOW Name file – The Name file is a file required by MODFLOW that contains the names of most input and output files used in a model simulation and controls which MODFLOW packages are active. See Harbaugh and others 

(2000) or Harbaugh (2005) for details on Name file construction and MODFLOW packages. The Name file is read by 

MULT2RASTER to determine the names of the Discretization, Multiplier, and Basic Package input files.

MODFLOW Discretization file – The Discretization file is a file required by MODFLOW that contains data to define the spatial 

and temporal discretization of a model. These data include the number of model rows, columns, and layers; model cell 

dimensions; the presence of quasi-3D confining beds; and model time discretization. See Harbaugh and others (2000) 

or Harbaugh (2005) for details on Discretization file construction. The Discretization file is read by MULT2RASTER to 

determine the model grid geometry.

MODFLOW Basic Package input file – The Basic Package input file is a file required by MODFLOW that is used to specify 

certain data used in all MODFLOW models. These data include locations of active, inactive, and specified-head cells; the 

value of head stored in inactive cells; and initial heads in all cells. See Harbaugh and others (2000) or Harbaugh (2005) 

for details on construction of the file. The Basic Package input file is read by MULT2RASTER to determine the locations 

of active cells in each model layer (IBOUND arrays).

MODFLOW Multiplier file – The Multiplier file is an optional input file used by MODFLOW, which is used to define multiplier 

arrays that can be used to calculate layer variables from parameter values (for example, layer hydraulic conductivity). See 

Harbaugh and others (2000) or Harbaugh (2005) for details on Multiplier file construction. The Multiplier file is read by 

MULT2RASTER to determine the multiplier array values.

Executing MULT2RASTER

The program MULT2RASTER is executed from a MS-DOS window command line.

Usage: MULT2RASTER <NAME_FILE>

Where:

<NAME_FILE> is the name of the MODFLOW Name file.
References Cited 17

Output from MULT2RASTER

Output files from MULT2RASTER consist of one raster 

text file for each array read from the Multiplier file, except that 

for any cell location where IBOUND values for all model layers are zeroes, a NODATA value is written. Output filenames 

are of the form MULT_**.asc where ** is the name of the 

multiplier array as read from the MODFLOW Multiplier file. 

The program also calculates and displays the average multiplier value for the model domain. See Appendix 2 for instructions for converting a raster text file to an ArcGIS raster. The 

multiplier values in the arrays read from the binary file are 

stored as raster-cell values in the resulting raster, except that 

the NO_DATA value is written for cell locations where all 

model layers are inactive, as indicated by the IBOUND arrays 

read from the Basic Package input file.

References Cited

Anderman, E.R., and Hill, M.C., 2000, MODFLOW-2000, 

the U.S. Geological Survey modular ground-water model—

Documentation of the Hydrogeologic-Unit Flow (HUF) 

Package: U.S. Geological Survey Open-File Report 

2000–342, 89 p. (available at http://water.usgs.gov/nrp/

gwsoftware/modflow2000/modflow2000.html).

Banta, E.R., 2000, MODFLOW-2000, the U.S. Geological 

Survey modular ground-water model—Documentation 

of packages for simulating evapotranspiration with a 

segmented function (ETS1) and drains with return flow 

(DRT1): U.S. Geological Survey Open-File Report 

2000–466, 127 p. (available at http://pubs.er.usgs.gov/pubs/

ofr/ofr00466)

ESRI, Inc., 2005a, ArcGISTM, Version 9.1 (available at http://

www.esri.com/software/arcgis/).

ESRI, Inc., 2005b, ArcMapTM, Version 9.1 (available at http://

www.esri.com/software/arcgis/).

Harbaugh, A.W., 1990, A computer program for calculating subregional water budgets using results from the U.S. 

Geological Survey modular three-dimensional ground-water 

flow model: U.S. Geological Survey Open-File Report 

90–392, 46 p. (available at http://water.usgs.gov/nrp/

gwsoftware/zonebud2/zonebudget2.html).

Harbaugh, A.W., 2005, MODFLOW-2005, the U.S. Geological Survey modular ground-water model—The GroundWater Flow Process: U.S. Geological Survey Techniques 

and Methods, book 6, chap. A16, variously paginated (available at http://water.usgs.gov/nrp/gwsoftware/modflow2005/

modflow2005.html).

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 2000–92, 121 

p., (available at http://water.usgs.gov/nrp/gwsoftware/

modflow2000/modflow2000.html).

Mehl, S.W., and Hill, M.C., 2005, MODFLOW-2005, the U.S. 

Geological Survey modular ground-water model—Documentation of shared node Local Grid Refinement (LGR) 

and the Boundary Flow and Head (BFH) Package: U.S. 

Geological Survey Techniques and Methods, book 6, chap. 

A12, 68 p. (available at http://water.usgs.gov/nrp/

gwsoftware/modflow2005_lgr/mflgr.html).

Niswonger, R.G., and Prudic, D.E., 2006, Documentation of 

the Streamflow-Routing (SFR2) Package to include unsaturated flow beneath streams—A modification to SFR1: U.S. 

Geological Survey Techniques and Methods, book 6, chap. 

A13, Version 1.10, April 2006, 48 p. (available at http://

pubs.usgs.gov/tm/2006/tm6A13/).

Python Software Foundation, 2008, Python Programming 

Language (available at http://www.python.org/).

Winston, R.B., 2000, Graphical user interface for MODFLOW, Version 4: U.S. Geological Survey Open-File 

Report 2000–315, 27 p. (available at http://water.usgs.gov/

nrp/gwsoftware/mfgui4/modflow-gui.html).
18 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

Appendix 1: GRID2GRIDFLOW Example

Two simple models were developed to demonstrate 

the use of GRID2GRIDFLOW. Source- and target-model 

grids were defined to encompass an area to be simulated 

(fig. A1–1). The source-model grid has 2 confined layers, 

12 rows, and 26 columns; the row and column spacings are 

1,000 feet (ft); and the grid is angled relative to the coordinate 

system. The target-model grid has 1 confined layer (corresponding to layer 1 of the source model), 38 rows, and 47 

columns; the row and column spacings are 500 ft; and the 

grid is aligned with the coordinate system. Both models use 

five stress periods to simulate one 1-day steady-state period 

and four 30-day transient periods. The vertical discretization 

of the source model is shown here:

Elevation, in feet

Layer 1 top 200.0

Layer 1 bottom 100.0

Quasi-3D confining bed bottom 90.0

Layer 2 bottom 0.0
Appendix 1: GRID2GRIDFLOW Example 19

Figure A1–1. Grids for source (blue lines) and target (pink lines) models for the example. Shading shows active cells in source 

(blue) and target (pink) models. The two model grids overlap in the area enclosed in the heavy black line; the aquifer area is

enclosed in the green line.
20 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

The single layer of the target model has the top and bottom elevations of source model layer 1. The hydraulic properties of the 

models are shown here:

Model layer Hydraulic property Source model Target model

Layer 1

Horizontal hydraulic conductivity 50.0 ft/day 50.0 ft/day

Vertical hydraulic conductivity 1.0 ft/day 1.0 ft/day

Specific storage 1.0×10–6 ft–1 1.0×10–6 ft–1

Vertical hydraulic conductivity of underlying quasi3D confining bed 1.0 ft/day Not applicable

Layer 2

Horizontal hydraulic conductivity 5.0 ft/day

Vertical hydraulic conductivity 1.0 ft/day Not applicable

Specific storage 1.0×10–6 ft–1

In both models, uniform recharge of 0.001 ft/day is specified. General head boundaries, labeled as Stream and River in figure 

A1–1, serve as head-dependent boundary conditions in layer 1 of both models. The general-head boundary labeled Stream 

is defined as having an external head of 180 ft and a conductance parameter of 20 ft/day per linear foot, and the general-head 

boundary labeled River has an external head of 150 ft and a conductance parameter of 10 ft/day per linear foot. One well is 

specified in layer 2 of the source model; it is inactive in stress periods 1, 2, and 5; in stress period 3 the stress is specified as 

–86,400 cubic feet per day (ft3/day), and in stress period 4 the stress is –200,000 ft3/day. Model input was prepared using the 

MODFLOW graphical user interface (Winston, 2000).

The example uses GRID2GRIDFLOW to adapt the cell-by-cell flows calculated by the source model between layers 1 and 

2 to be used to generate input for the target model. Text input files for the example include:

Main input file:

Demo for GRID2GRIDFLOW utility

g2g_messages.txt Item 2: MESSNAME

demo1.dis Item 3: DIS_SOURCE

demo1.bud Item 4: CBC_SOURCE

demo1.zon Item 5: ZONE_SOURCE

demo2.dis Item 6: DIS_TARGET

gridcoef.csv Item 7: COEFNAME

grid2_flow.txt Item 8: FLOW_TARGET

grid2_excluded.txt Item 9: EXCLUDED_TARGET

grid1_budget.txt Item 10: ZONBUD_SOURCE

FEET Item 11: LUPOLY

2007/07/01 Item 12: STARTDATE_SOURCE

2007/07/01 Item 13: STARTDATE_TARGET
Appendix 1: GRID2GRIDFLOW Example 21

Source-model Discretization file “demo1.dis”:

2 12 26 5 4 1

1 

0 

CONSTANT 1000.0

CONSTANT 1000.0

CONSTANT 200.0

CONSTANT 100.0

CONSTANT 90.0

CONSTANT 0.0

1.0 1 1.0 SS

30.0 5 1.1 TR

30.0 5 1.1 TR

30.0 5 1.1 TR

30.0 5 1.1 TR

Source-model Zone file “demo1.zon”:

2 12 26 Items: NLAY NROW NCOL

CONSTANT 1

CONSTANT 2

Target-model Discretization file “demo2.dis”:

1 38 47 5 4 1

0 

CONSTANT 500.0

CONSTANT 500.0

CONSTANT 200.0

CONSTANT 100.0

1.0 1 1.0 SS

30.0 5 1.1 TR

30.0 5 1.1 TR

30.0 5 1.1 TR

30.0 5 1.1 TR
22 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

Grid coefficient file “gridcoef.csv” (excerpts shown):

“TgtRow”,”TgtCol”,”TgtActive”,”SrcRow”,”SrcCol”,”POLYAREA”

38,29,0,12,20,1935.838021

38,30,0,12,20,71331.159855

38,30,0,12,21,24477.183583

38,31,0,12,21,226694.396504

38,32,0,12,21,234417.629398

38,32,0,12,22,15582.370601

38,33,0,12,21,20682.221378

38,33,0,12,22,227381.940600

38,33,0,11,22,1935.838021

...

37,32,0,12,21,192083.655879

37,32,0,11,21,57916.344120

37,33,1,12,21,35424.222421

37,33,1,12,22,15040.840253

37,33,1,11,21,114013.200263

37,33,1,11,22,85521.737063

37,34,1,11,22,250000.000000

37,35,1,11,22,218485.149825

37,35,1,11,23,31514.850174

Output files for the example include:

FLOW_TARGET file “grid2_flow.txt” (excerpt shown):

Flow data for stress period 1

 Row Column Flow rate

 37 33 99.239475

 37 34 109.77902

 37 35 95.940344

...

EXCLUDED_TARGET file “grid2_excluded” (excerpt shown):

 Flow data excluded from main output data file

 Excluded flow data for stress period 1

 Row Column Flow rate

 38 33 0.85005762 

 38 34 42.070988 

 38 35 32.575980 

...

The complete set of input and output files for the GRID2GRIDFLOW example are included in the electronic distribution file 

identified in the section entitled “Obtaining and Installing the Software,” in the main part of the report.
Appendix 2: Conversion from MODFLOW Array to Raster 23

Appendix 2: Conversion from MODFLOW 

Array to Raster

Each of the utility programs CBC2RASTER, DIS2RASTER, MFBIN2RASTER, and MULT2RASTER creates one 

or more files structured in the ASCII file format expected by the 

ArcGIS “ASCII to Raster” tool; these utilities are referred to as 

“raster-conversion” utilities, and the text output files are referred 

to as “raster text” files in this appendix. “ASCII to Raster” 

can be accessed from the ArcToolbox of ArcGIS; it is located 

under Conversion Tools...To Raster. The same functionality 

can be accessed from the ArcGIS command line by invoking 

the ASCIIToRaster command or in a script by invoking ASCIIToRaster_conversion. The ArcGIS help facility documents these 

options (ESRI, Inc., 2005a). In each case, the option to generate 

a floating-point raster data set should be selected.

Any ArcGIS raster is a rectangular grid of cell-based data, 

where all the cells are square and have uniform dimensions. The 

edges of the cells align with the X and Y directions of a particular projected coordinate system. The raster-conversion utilities 

implement a one-to-one correspondence between the cells of the 

finite-difference grid of a MODFLOW model (as represented in 

map view) and the cells of an ArcGIS raster. This implementation restricts the applicability of the raster-conversion utilities to 

MODFLOW models that use grids that (1) have uniform row and 

column spacing and (2) are aligned with the projected coordinate 

system into which the raster data sets are to be converted. Row 1 

of the model is assumed to be at the northern limit of the model 

domain and aligned east-west. Column 1 is assumed to be at the 

western limit of the model domain and aligned north-south.

Model-Data File

Each raster-conversion utility expects to read data from a file named “modeldata.txt,” which must be present in the directory in which the utility is invoked. All raster-conversion utilities read the first line of this file; only MFBIN2RASTER reads the 

second and third lines. 

The file named “modeldata.txt” needs to contain three lines of data, in free format:

1. XORIG YORIG

2. HNOFLO

3. HDRY

Where:

XORIG—is the X coordinate (easting) of the northwest corner of the cell in row 1, column 1 of the model grid, in the projected 

coordinate system in which the model grid is defined.

YORIG—is the Y coordinate (northing) of the northwest corner of the cell in row 1, column 1 of the model grid, in the projected 

coordinate system in which the model grid is defined.

HNOFLO—is the HNOFLO value as specified in the MODFLOW Basic Package input file.

HDRY—is the HDRY value as specified in the Layer-Property Flow (LPF), Block-Centered Flow (BCF), or Hydrogeologic-Unit 

Flow (HUF) Package (Anderman and Hill, 2000) input file.

The XORIG and YORIG values are used in combination with row and column dimensions read from a MODFLOW Discretization file to define projected X and Y coordinates for the raster to be generated.
24 User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs

Raster Text File

Each of the raster-conversion utilities generates one or 

more raster text files. The first six lines of the files produced 

by the raster-conversion utilities contain header information 

used in the conversion procedure. The first two lines specify 

the numbers of rows and columns in the MODFLOW grid 

(NROW and NCOL, respectively, of MODFLOW input) and 

in the raster. The third and fourth lines specify the X (easting) and Y (northing) coordinates of the lower left (southwest) 

corner of the cell in the southwest corner of the model domain. 

The fifth line specifies the size of one model or raster cell. 

The sixth line specifies a value that will be recognized by 

ArcGIS as a “no data” value.

Numeric values that are to be used to populate the raster 

follow the six-line header in row-major order. That is, line 

seven of the file contains values for model row 1, line eight 

contains values for model row 2, and so on. Thus, the data 

appear in the same order as in MODFLOW array input.
Publishing support provided by: 

Denver Publishing Service Center

For more information concerning this publication, contact:

Director, USGS Colorado Water Science Center

Box 25046, Mail Stop 415

Denver, CO 80225

(303)236-4882

Or visit the Colorado Water Science Center Web site at:

http://co.water.usgs.gov/
Banta and others—User Guide and Documentation for Five MODFLOW Ground-Water Modeling Utility Programs—Techniques and Methods 6–A28