U.S. Department of the Interior

U.S. Geological Survey

Open-File Report 2007–1204

MF2KtoMF05UC, a Program To Convert MODFLOW-2000 Files 

to MODFLOW-2005 and UCODE_2005 Files

MF2KtoMF05UC, a Program To Convert 

MODFLOW-2000 Files to MODFLOW-2005 

and UCODE_2005 Files

By Arlen W. Harbaugh

Open-File Report 2007–1204

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: 2007

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:

Harbaugh, A.W., 2007, MF2KtoMF05UC, a program to convert MODFLOW-2000 files to MODFLOW-2005 and 

UCODE_2005 files: U.S. Geological Survey Open-File Report 2007–1204, 4 p. (available only online at 

http://pubs.water.usgs.gov/ofr2007-1204)
iii

Preface

This report describes the computer code MF2KtoMF05UC. The code is in the public domain and 

can be downloaded from the Internet at address http://water.usgs.gov/software/ground_

water.html. The code has been tested in a variety of applications, but future applications could 

reveal previously undetected errors. Users are requested to notify the originating office of any 

errors found in the report or computer code:

U.S. Geological Survey

Office of Ground Water

411 National Center

Reston, VA 20192

(703) 648-5001

Any updates to the code will be posted at the above Internet address.
iv
v

Contents

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

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

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

MODFLOW-2005 Files....................................................................................................................................1

UCODE_2005 Files..........................................................................................................................................2

Running MF2KtoMF05UC..............................................................................................................................2

Summary and Example..................................................................................................................................3

References Cited............................................................................................................................................4
vi
Abstract 

The program MF2KtoMF05UC has been developed to 

convert MODFLOW-2000 input files for use by MODFLOW2005 and UCODE_2005. MF2KtoMF05UC was written in the 

Fortran 90 computer language. This report documents the use 

of MF2KtoMF05UC.

Introduction

MODFLOW-2005 (Harbaugh, 2005) is an updated 

version of MODFLOW-2000 (Harbaugh and others, 2000; Hill 

and others, 2000). Although many of the input files for 

MODFLOW-2005 are the same as those for MODFLOW2000, some changes are necessary. Further, the sensitivityanalysis and parameter-estimation capabilities of 

MODFLOW-2000 were removed from MODFLOW-2005. 

These capabilities can still be obtained with MODFLOW2005; however, using a separate program called UCODE_2005 

is necessary (Poeter and others, 2005). The program 

MF2KtoMF05UC has been developed to make conversion from MODFLOW-2000 to MODFLOW-2005 and 

UCODE_2005 more convenient. The conversion program 

makes the required changes to files used by MODFLOW2005 and creates files required for running UCODE_2005. 

MF2KtoMF05UC supports all of the functionality of 

parameter estimation in MODFLOW-2000 except for variance-covariance matrices for weighting flow observations and 

prior information. MF2KtoMF05UC will stop execution if the 

MODFLOW-2000 files specify variance-covariance matrices. 

MF2KtoMF05UC was written in the Fortran 90 computer 

language.

This report documents use of the MF2KtoMF05UC 

conversion program. It is recommended that users of the 

conversion program become familiar with the MODFLOW2005 and UCODE_2005 programs. In the information below, 

dsname is the prefix from a MODFLOW-2000 Name File. 

For example, if the MODFLOW-2000 Name File is called 

“SIMULATION1.NAM,” “SIMULATION1” is dsname.

MODFLOW-2005 Files

MF2KtoMF05UC creates several MODFLOW files 

that differ between MODFLOW-2000 and MODFLOW-2005. 

A Parameter Value file, named dsname.pvl, is created 

from the MODFLOW-2000 Sensitivity-Process input file. 

New Observation-Process input files also are created. 

These files have the names dsname.obh, dsname.obd, 

dsname.obr, dsname.obg, and dsname.obc for the head, drain, 

river, general-head boundary (GHB), and constant-head observation files, respectively. The MF2KtoMF05UC-created observation files cause dsname._os to be used to save the simulated 

equivalents of the observations (heads, drains, rivers, GHBs, 

or constant heads). All of these MODFLOW-2005 files have 

a slightly modified format compared to the MODFLOW-2000 

files. Further, the observation names are changed if they do not 

meet the naming requirements for UCODE_2005 observations 

(Poeter and others, 2005, p. 83).

One naming requirement is that the first character of an 

observation name must be a letter. Another requirement is that 

the characters in the name are restricted to letters, numbers, 

underscore, period, colon, ampersand, # symbol, and @ 

symbol. Characters not meeting these two requirements are 

replaced by use of a numerical algorithm. UCODE_2005 also 

requires unique names that are not case sensitive. MF2KtoMF05UC replaces non-unique names with unique names by 

adding two characters if the name is less than 10 characters or 

by modifying the eleventh and twelfth characters. The changed 

names are written into file dsname.log.

A new MODFLOW-2005 Name File, with the same 

name as the MODFLOW-2000 Name File, is created. To 

avoid losing the original file, the original file is renamed to 

dsname_mf2k.nam before the new Name File is written. In 

this new Name File, the lines that specify the sensitivity and 

observation files are replaced by lines that specify the Parameter Value and modified observation files. File dsname._os 

is inserted as the file for saving the simulated equivalents of 

observations. MODFLOW-2005 allows only a single Listing 

File, while MODFLOW-2000 allows two output files designated by the file types GLOBAL and LIST. If the GLOBAL 

file type is specified with or without an additional LIST file, 

MF2KtoMF05UC, a Program To Convert MODFLOW-2000 

Files to MODFLOW-2005 and UCODE_2005 Files

By Arlen W. Harbaugh
the MODFLOW-2005 Name File will have a single file with 

LIST as the type and dsname.lst as the name. If only a LIST 

file type is specified in the MODFLOW-2000 Name File, the 

entry is unchanged in the MODFLOW-2005 Name File.

Finally, a file named dsname.bat is created. This file 

facilitates running MODFLOW-2005 on a personal computer 

running the Microsoft Windows operating system. The 

MODFLOW-2005 simulation will be run by double-clicking 

dsname.bat within Windows Explorer. The MODFLOW-2005 

executable is named MF2005 in dsname.bat; this .bat file 

will need to be edited if the MODFLOW-2005 executable 

has a different name on the computer being used or if the 

directory containing this executable is not listed in the PATH 

environmental variable.

UCODE_2005 Files

 UCODE_2005 files are created if the Sensitivity or 

Parameter-Estimation Process is used in the MODFLOW-2000 

simulation. UCODE_2005 requires a main UCODE input 

file, and most data for this file come from the MODFLOW2000 Parameter-Estimation Process and Sensitivity Process 

input files. The main UCODE input file is named 

dsname_ucode.in. The required information needed by 

UCODE_2005 to describe parameters and observations may 

be included in the main UCODE input file or in separate files; 

MF2KtoMF05UC puts the parameter and observation data in 

separate files. 

The UCODE_2005 parameter file is named 

dsname_ucode.par. Some data from the MODFLOW-2000 

sensitivity file that are not required by MODFLOW-2005 are 

used to create the parameter file. The fields are StartValue, 

LowerValue, UpperValue, ScalePval, Transform, and Adjustable. Three additional values, which are not contained in the 

MODFLOW-2000 sensitivity file, are needed for the parameter file: Constrain, LowerConstraint, and UpperConstraint. 

Constrain is set to “no,” LowerConstraint is set to LowerValue, 

and UpperConstraint is set to UpperValue. All of these values 

are documented in the UCODE_2005 documentation.

The UCODE_2005 observation file is named 

dsname_ucode.obs. Data from the MODFLOW-2000 

observation files that are not required by MODFLOW-2005 

are used to create the UCODE_2005 observation file. The 

MODFLOW-2000 STAT, STAT-FLAG, and PLOT-SYMBOL 

values become the UCODE_2005 Statistic, StatFlag, and 

GroupName values. Further, the MODFLOW-2000 PLOTSYMBOL is made to be the UCODE_2005 PlotSymbol 

using the UCODE_2005 group capability. A UCODE_2005 

Observation_Groups Input Block is created in the main 

UCODE input file, and this block assigns the PlotSymbol to 

be the same as the GroupName.

UCODE_2005 requires the use of template files to 

describe how to generate input data for running a model. 

MF2KtoMF05UC creates a single template file, which is 

named dsname_ucode.tpl. This file allows UCODE_2005 

to generate a MODFLOW-2005 Parameter Value file when 

UCODE_2005 runs MODFLOW-2005.

UCODE_2005 further requires the use of instruction files 

to be able to determine the simulated equivalents for observations from the output of a model. MF2KtoMF05UC creates 

a single instruction file, which is named dsname_ucode.inst. 

This file allows UCODE_2005 to read the simulated equivalents produced by MODFLOW-2005 from file dsname._os. 

Prior-information equations specified in the 

MODFLOW-2000 parameter estimation file are moved 

into a Linear_Prior_Information Input Block (Poeter and 

others, 2005, p. 95) in the main UCODE input file. Manual 

editing will be required if the prior-information equations 

include log-transformed parameters. UCODE_2005 requires 

prior-information equations that include log-transformed 

parameters to transform the parameters using the Log10 

function, but MF2KtoMF05UC does not add the Log10 

function. As with observations, the MODFLOW-2000 

PLOT-SYMBOL for prior information is made to be the 

UCODE_2005 PlotSymbol using the UCODE_2005 group 

capability. A UCODE_2005 Prior_Information_Groups Input 

Block is created in the main UCODE_2005 input file to set the 

PlotSymbol to be the same as the GroupName.

MF2KtoMF05UC makes an additional MODFLOW-2005 

Name File, which UCODE_2005 uses to run MODFLOW2005. This file is named dsname.nam.ucode. This additional 

Name File is identical to dsname.nam except that the Parameter Value file is named ucode.pvl rather than dsname.pvl. 

The reason for the change is to avoid having UCODE_2005 

overwrite the dsname.pvl file when UCODE_2005 runs. 

UCODE_2005 recreates the ucode.pvl Parameter Value file 

many times as it computes sensitivities of parameters.

Finally, a file named dsname_ucode.bat is created. This 

file facilitates running UCODE_2005 on a personal computer 

running a version of the Microsoft Windows operating system. 

The UCODE simulation will be run by double-clicking 

dsname_ucode.bat within Windows Explorer. The UCODE_

2005 executable is named UCODE_2005 in dsname_ucode.

bat; this .bat file will need to be edited if the UCODE_2005 

executable has a different name on the computer being used or 

if the directory containing this executable is not listed in the 

PATH environmental variable. The required filename prefix 

for UCODE_2005 (Poeter and others, 2005, p. 29) is specified 

as dsname_ucode.

Running MF2KtoMF05UC

MF2KtoMF05UC should be run in a command-prompt 

window with the current directory being the directory that 

contains the MODFLOW-2000 Name File. The MODFLOW2000 Name File can be specified as a command argument. If 

the argument is not specified, the user is prompted to enter the 

Name File.

   MF2KtoMF05UC, a Program To Convert MODFLOW-2000 Files to MODFLOW-2005 and UCODE_2005 Files
After MF2KtoMF05UC is run, MODFLOW-2005 can be 

run without parameter estimation by double-clicking the file 

dsname.bat within Windows Explorer. If a command-prompt 

window is being used, run MODFLOW-2005 with the 

command:

 mf2005 dsname

If the original MODFLOW-2000 simulation included 

sensitivity analysis or parameter estimation, UCODE_2005 

can be run by double-clicking the file dsname_ucode.bat 

within Windows Explorer. If a command-prompt window is 

being used, run UCODE_2005 with the command:

ucode_2005 dsname_ucode.in fn

where “fn” is the filename prefix used by UCODE to generate 

output files.

MF2KtoMF05UC creates a file named dsname.log, 

which contains information about the data read from the 

MODFLOW-2000 files. This file will contain information 

about any problems with the file conversions. Modifications of 

observation names to meet UCODE_2005 naming conventions 

will be shown in dsname.log.

Summary and Example

In summary, MF2KtoMF05UC will create up to eight 

new files for running MODFLOW-2005 and seven new files 

for running UCODE_2005. If the MODFLOW-2000 Name 

File is dsname.nam, the new MODFLOW-2005 files are as 

follows:

dsname.nam – MODFLOW-2005 Name File

dsname.pvl – MODFLOW-2005 Parameter Value file

dsname.obh – MODFLOW-2005 head observation file

dsname.obd – MODFLOW-2005 drain observation file

dsname.obr – MODFLOW-2005 river observation file

dsname.obg – MODFLOW-2005 general-head boundary 

observation file

dsname.obc – MODFLOW-2005 constant-head observation file

dsname.bat – File for running MODFLOW-2005 from 

within Windows Explorer

Each observation file is created only if the respective observation type exists in the MODFLOW-2000 simulation. The 

UCODE_2005 files are as follows:

dsname_ucode.in – Main UCODE_2005 input file

dsname_ucode.par – UCODE_2005 parameter file

dsname_ucode.tpl – UCODE_2005 template file

dsname_ucode.obs – UCODE_2005 observation file

dsname_ucode.inst – UCODE_2005 instruction file

dsname.nam.ucode – Modified MODFLOW Name File 

used when UCODE_2005 runs MODFLOW-2005

dsname_ucode.bat – File for running UCODE_2005 from 

within Windows Explorer

An additional file named dsname_mf2k.nam, which is 

a copy of the original MODFLOW-2000 Name File, is also 

made.

An example simulation, which is called tc1, is included 

with Hill and others (2000). The original tc1 files and the new 

files created by MF2KtoMF05UC are distributed along with 

the MF2KtoMF05UC code so that users can check to see 

that MF2KtoMF05UC is running properly. The original tc1 

simulation input files are as follows:

tc1.nam – MODFLOW Name File

tc1.dis – Discretization file

tc1.zon – Zone array file

tc1.mlt – Multiplier array file

tc1.bas – Basic Package input file

tc1.oc – Output Control Option input file

tc1.lpf – Layer-Property Flow Package input file

tc1.wel – Well Package input file

tc1.ghb – General-Head Boundary Package input file

tc1.riv – River Package input file

tc1.rch – Recharge Package input file

tc1.pcg – Preconditioned Conjugate-Gradient Package 

input file

tc1.obs – Observation input file

tc1.ohd – Head observation input file

tc1.orv – River observation input file

tc1.sen – Sensitivity-Process input file

tc1.pes – Parameter-Estimation Process input file

When MF2KtoMF05UC is run with the tc1 data set, 

the following changes occur. The file tc1.nam is modified as 

described above, but a copy of the original file is made using 

the name tc1_mf2k.nam. Many new files are made using data 

from the original MODFLOW-2000 files, but the original files 

are not changed:

tc1.obh is created from tc1.ohd

tc1.obr is created from tc1.orv

tc1.pvl is created from tc1.sen

tc1_ucode.in is created primarily from tc1.pes

tc1_ucode.par is created from tc1.sen

tc1_ucode.tpl is created from tc1.sen

tc1_ucode.obs is created from the observation files

tc1_ucode.inst is created from the observation files

In the original simulation, the head observations have names 

that start with numbers, and this convention is not allowed by 

UCODE_2005. MF2KtoMF05UC changes these names to 

start with a letter.

Summary and Example 
MODFLOW-2005 can be run using the tc1.nam Name 

File. Output will go into tc1.lst. If using Windows Explorer, 

MODFLOW-2005 can be run by double-clicking on tc1.

bat. UCODE_2005 can be run using the tc1_ucode.in main 

UCODE input file. Output will go into tc1_ucode.#uout. 

If using Windows Explorer, UCODE_2005 can be run by 

double-clicking on tc1_ucode.bat.

The original simulation can still be run with MODFLOW2000 using the tc1_mf2k.nam Name File. Output will go to 

tc1.glo and tc1.lst.

References Cited

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 6-A16, variously paginated. 

Harbaugh, A.W., Banta, E.R., Hill, M.C., and McDonald, 

M.G., 2000, MODFLOW-2000, the U.S. Geological Survey 

modular ground-water model—User guide to modularization concepts and the ground-water flow process: U.S. 

Geological Survey Open-File Report 00-92, 121 p.

Hill, M.C., Banta, E.R., Harbaugh, A.W., and Anderman, E.R., 

2000, MODFLOW-2000, the U.S. Geological Survey modular ground-water model—User guide to the observation, 

sensitivity, and parameter-estimation processes and three 

post-processing programs: U.S. Geological Survey OpenFile Report 00-184, 210 p.

Poeter, E.P., Hill, M.C., Banta, E.R., Mehl, Steffen, and Christensen, Steen, 2005, UCODE_2005 and six other computer 

codes for universal sensitivity analysis, calibration, and 

uncertainty evaluation: U.S. Geological Survey Techniques 

and Methods 6-A11, 283 p.

 MF2KtoMF05UC, a Program To Convert MODFLOW-2000 Files to MODFLOW-2005 and UCODE_2005 Files
iv
Harbaugh—MF2KtoMF05UC, a Program To Convert MODFLOW-2000 Files to MODFLOW-2005 and UCODE_2005 Files—Open-File Report 2007–1204

Printed on recycled paper