vvEPA
         United States
         Environmental Protection
         Agency
           Office of Research and
           Development
           Washington DC 20460
EPA/600/R-97/099
September 1997
Michigan Soil Vapor
Extraction Remediation
(MISER) Model

A Computer Program to
Model Soil Vapor
Extraction and Bioventing of
Organic Chemicals in
Unsaturated Geological
Material

-------

-------
                                                          EPA/600/R-97/099
                                                            September 1997
            MICHIGAN SOIL VAPOR EXTRACTION
               REMEDIATION (MISER) MODEL:
A COMPUTER PROGRAM TO MODEL SOIL VAPOR EXTRACTION AND
            BIO VENTING OF ORGANIC CHEMICALS IN
             UNSATURATED GEOLOGICAL MATERIAL
                               by
              Linda M. Abriola, John Lang, and Klaus Rathfelder
              Department of Civil and Environmental Engineering
                       The University of Michigan
                      Ann Arbor, Michigan 48109
                    Cooperative Agreement CR-822017
                           Project Officer

                           Jong Soo Cho
               Subsurface Protection and Remediation Division
               National Risk Management Research Laboratory
                        Ada, Oklahoma 74820
        NATIONAL RISK MANAGEMENT RESEARCH LABORATORY
              OFFICE OF RESEARCH AND DEVELOPMENT
             U.S. ENVIRONMENTAL PROTECTION AGENCY
                       CINCINNATI, OH 45268
                                                         Printed on Recycled Paper

-------
                                       DISCLAIMER

       The U.S. Environmental Protection Agency through its Office of Research and Development partially
funded and collaborated in the research described here under assistance agreement number CR-822017 to the
University of Michigan. It has been subjected to the Agency's peer and administrative review and has been
approved for publication as an EPA document. Mention of trade names or commercial products does not
endorsement or recommendation for use.

       When available, the soft ware in this document is supplied on an "as-is" basis without guarantee or
warranty of any kind, express or implied. Neither the United States Government (United States Environmental
Protection Agency, Robert S. Kerr Environmental Research Center), the University of Michigan, nor any of
the authors accept any liability resulting from use of this software.
                                               11

-------
                                        FOREWORD

       The U.S. Environmental Protection Agency is charged by Congress with protecting the Nation's land,
air, and water resources. Under a mandate of national environmental laws, the Agency strives to formulate
and implement actions leading to a compatible balance between activities and the ability of natural systems
to support and nurture life. To meet these mandates, EPA's research program is providing data and technical
support for solving environmental problems today and building a science knowledge base necessary to manage
our ecological  resources wisely, understand how pollutants affect our health, and prevent or reduce
environmental risks in the future.

       The National Risk Management Research Laboratory is the Agency's  center for investigation of
technological and management approaches for reducing risks from threats  to human health and the
environment. The focus of the Laboratory's research program is on methods for the prevention and control
of pollution to air, land, water, and subsurface resources; protection of water quality in public water systems;
remediation of contaminated sites and ground water; and prevention and control of indoor air pollution. The
goal of this research effort is  to catalyze development and implementation of innovative,  cost-effective
environmental technologies; develop  scientific and engineering information needed by EPA to support
regulatory and policy decisions; and provide technical support and information  transfer to ensure effective
implementation of environmental regulations and strategies.

       Soil vapor extraction (SVE) and bio venting (BV) are effective and widely used in-situ remediation
techniques for unsaturated soils contaminated with organic compounds, primarily petroleum hydrocarbons.
Despite the effectiveness and flexibility of SVE and BV technologies, the efficiency and degree of success of
those systems is controlled by a combination of physical, chemical, and biological factors. The dynamics of
those interrelated processes is  often incompletely understood, and consequently the performance and efficiency
of specific SEE/BV systems is generally difficult to predict.  This report describes the  development of a
numerical model for the simulation  of physical, chemical, and biological interactions occurring in SVE and
BV systems. The model can be used as a research tool for studying and elucidating dynamics in SVE and BV
systems.
                                            L
                                                   :u
                                            Clinton W. Hall, Director
                                            Subsurface Protection and Remediation Division
                                            National Risk Management Research Laboratory
                                               in

-------
                                        ABSTRACT

       This  report  describes the  formulation,  numerical development,  and use  of a  multiphase,
multicomponent, biodegradation model designed to simulate physical, chemical, and biological interactions
occurring primarily in field scale soil vapor extraction (SVE) and bioventing (BV) systems. The model is
entitled the Michigan Soil Vapor Extraction Remediation Model, or MISER.  MISER solves the governing
flow and transport equations  in two space dimensions  -  either a cross sectional x-z  domain, or an
axisymmetrical r-z domain for simulating radial flow to a single well.  A standard Galerkin finite element
approach with linear triangular elements is employed. The coupled nonlinear equations are solved using a
modular, set-iterative solution algorithm. In this approach the sets of flow, transport, and biodegradation
equations are decoupled within the simulator and solved separately. The set-iterative approach substantially
reduces the size of solution matrices and provides increased flexibility. Features of the model include: the
ability to simulate multiphase flow, including water table coning; the simulation of multicomponent transport
processes, incorporating fate-limited interphase exchange in processes of volatilization and dissolution of an
entrapped organic liquid, interphase exchange between the mobile gas and aqueous phases, sorption, and
biophase update; and the simulation of multicomponent biodegradation kinetics  and microbial population
dynamics.

        This report is divided into 6 sections.  Section 1 provides an overview of SVE and BV systems and
a review of existing models. Section 2 presents the conceptual formulation of MISER and the associated
mathematical representation  for flow, transport and biotransformation processes. Section 3 describes the
numerical solution approach and Section 4 presents the results of model verification analyses.  Description and
usage of the model is provided in Section 5, and example SVE and BV simulations are described in Section
6.

        This report was submitted in fulfillment of CR-822017 by the University of Michigan under the partial
sponsorship of the U.S. Environmental Protection Agency. This report covers a period from September 1993
to March 1996 and work was completed as of March 1996.
                                                IV

-------
                          CONTENTS






DISCLAIMER                                                    ii




FOREWORD                                                    iii




ABSTRACT                                                     iv




LIST OF FIGURES                                                x




LIST OF TABLES                                                 xiii




LIST OF ABBREVIATIONS AND SYMBOLS                            xv




1 INTRODUCTION                                               1




  1.1  OVERVIEW AND PURPOSE	  1




  1.2  BACKGROUND AND LITERATURE REVIEW	  2




      1.2.1  Limits of Applicability	  2




      1.2.2  Rate Limited Mass Transfer	 3




      1.2.3  Biodegradation Rates	 3




      1.2.4  Temperature	 4




      1.2.5  Previous Models	 5




  1.3  MODEL FEATURES	 6




2 MODEL FORMULATION AND THEORETICAL DEVELOPMENT        8




  2.1  CONCEPTUAL MODEL	 8




  2.2  PHASE MASS BALANCE EQUATIONS	 11




  2.3  COMPONENT MASS BALANCE EQUATIONS	 13




  2.4  INTERPHASE MASS TRANSFER	 15




      2.4.1  Equilibrium Partitioning	 15

-------
       2.4.2   Rate Limited Interphase Mass Transfer	  17
       2.4.3   Biotransformations	  19
   2.5  CONSTITUTIVE RELATIONS	  21
       2.5.1   Capillary Pressure	  21
       2.5.2   Relative Permeability	  23
       2.5.3   Gas phase density	  23
       2.5.4   Liquid Phase Density	  23
       2.5.5   Gas phase viscosity	  24
       2.5.6   Aqueous Phase Viscosity  	  24
       2.5.7   Hydrodynamic Dispersion	  24
       2.5.8   Matrix Compressibility  	  25

3  NUMERICAL DEVELOPMENT                                                   26
   3.1  FINITE ELEMENT APPROACH	  26
   3.2  SOLUTION OF THE  PHASE MASS BALANCE EQUATIONS	  28
       3.2.1   Pressure Based Formulation	  28
       3.2.2   Trial Functions and Weighted Residual Equations	  29
       3.2.3   Capacity Coefficients  	  31
   3.3  MATERIAL PROPERTIES	  31
   3.4  VELOCITY EQUATIONS	  32
   3.5  COMPONENT MASS BALANCE EQUATIONS	  34
       3.5.1   Weighted Residual Equations in Cartesian Coordinates	  35
       3.5.2   Mass Exchange Terms	  38
   3.6  BIOLOGICAL REACTIONS	  39
   3.7  NAPL SATURATION	  40
   3.8  AXISYMMETRIC COORDINATES  	  40
   3.9  TIME DISCRETIZATION	  41
   3.10 TIME STEP CONTROL	  41
   3.11 BOUNDARY CONDITIONS	  42
        3.11.1 Phase Mass Balance Boundary Conditions	  42

-------
        3.11.2 Component Mass Balance Boundary Conditions	  43
        3.11.3 Extraction Wells	  44
        3.11.4 Treatment of Injection Wells	  45
   3.12 ITERATION SCHEME	  46
   3.13 SOLVER	  46

4  MODEL VERIFICATION                                                         49
                                                         t
   4.1   MATERIAL BALANCE CALCULATION	i	  49
        4.1.1   Phase Material Balance	  49
                                       «
        4.1.2   Component Material Balance	  50
        4.1.3   Calculation of Mass Balance Error .	  50
   4.2   VERIFICATION OF THE PHASE MASS BALANCE SOLUTIONS	  52
        4.2.1   Comparison with One Dimensional Richards Equation	  52
        4.2.2   Comparison with Two Dimensional Richards Equation	  54
        4.2.3   Comparison with Quasi Analytical Solutions for Unsteady Radial Flow of Gas ...  57
   4.3   VERIFICATION OF THE COMPONENT MASS BALANCE SOLUTIONS	  60
        4.3.1   Comparison with One Dimensional Analytical Solutions	  60
        4.3.2   Comparison with Two Dimensional Analytical Solutions	  61
        4.3.3   Verification of Biokinetics	  62
        4.3.4   Verification of Interphase Exchange	  64
   4.4   VERIFICATION OF THE COUPLED PHASE AND COMPONENT MASS BALANCE
        SOLUTIONS	  65

5  PROGRAM DESCRIPTION AND SIMULATION SETUP                               68
   5.1   CODE DESCRIPTION	  68
   5.2   PROGRAM MODULES	  68
   5.3   ARRAY DIMENSIONS AND PROGRAM VARIABLES	  68
   5.4   DESCRIPTION OF INPUT FILES AND INPUT DATA	  69
        5.4.1   Data Block A - Input/Output Files and Control Options	  69
        5.4.2   Data Block B - General Model Control Options	  69
        5.4.3   Data Block C - Time  Step and Iteration Control Parameters	  69
                                         VII

-------
        5.4.4  Data Block D - Grid Information and Control Options	  69


        5.4.5  Data Block E - Component Chemical Properties  	  70


        5.4.6  Data Block F - Mass Transfer Coefficients  	  70


        5.4.7  Data Block G - Material Property Block Information	  70


        5.4.8  Data Block H - Sorption Parameter Data	  70


        5.4.9  Data Block I - Biological Parameter Data	  71


        5.4.10 Data Block J - Phase Parameter Data	  71


        5.4.11 Data Block K-Temperature Parameter Data	  71
                                                 •»

        5.4.12 Data Block L - Output Control Parameters	  72


        5.4.13 Data Block M - Restart Identifier	  72


        5.4.14 Data Block N - Initial Pressure Conditions	  72


        5.4.15 Data Block O - Velocity Computation	  73


        5.4.16 Data Block P - Organic Liquid Saturation and Composition	  73


        5.4.17 Data Block Q - Oxygen and Nutrient Initial Conditions	  73


        5.4.18 Data Block R - Boundary Conditions	  73


        5.4.19 Data Block S - Extraction/Injection Well Conditions	  74


        5.4.20 Data Block T-Velocity Boundary Conditions	  74


   5.5  DESCRIPTION OF OUTPUT FILES	  74


        5.5.1  Main Output File - 'Outpre.out'	  74


        5.5.2  Convergence History and Runtime Information Output File - 'Outpre.cnv'	  75


        5.5.3  Error Message Output File -'Outpre.err'  	  75


        5.5.4   Mass Balance Output File - 'Outpre.mb'	  75


        5.5.5   Contour Plot Output File - 'Outpre.con'	  76


        5.5.6  Time Series Plot Output File - 'Outpre.plt'   	  76


        5.5.7   Restart Output File - 'Outpre.rst'  	  76



6  DEMONSTRATION OF MISER                                                       105


   6.1  SOIL VAPOR EXTRACTION	106


   6.2  BIOVENTING	107


   6.3  FIELD SCALE BIOVENTING	109
                                             vm

-------
A ELEMENT MATRICES FOR THE SIMULTANEOUS SOLUTION OF THE PHASE MASS
  BALANCE EQUATIONS                                                ii


B ELEMENT MATRICES FOR THE SOLUTION OF DARCY'S LAW EQUATION


C ELEMENT MATRICES FOR THE SEQUENTIAL SOLUTION OF THE COMPONENT
  MOLE BALANCE EQUATIONS


D ELEMENT MATRICES FOR THE SOLUTION OF THE ORGANIC PHASE MASS BAL-
  ANCE EQUATION                                                    129
E Description of Major Variables
F EXAMPLE MAKE FILE
13J


139
G EXAMPLE DATA FILES
H SOURCE CODE LISTING
REFERENCES
140


151


230
                                   IX

-------
                            LIST OF FIGURES
1.1   Basic SVE/BV system configuration	   2
2.1   Conceptual model of the soil system composition	   9
2.2   Conceptual model of interphase mass transfer pathways	   10
3.1   Triangular element in global and transformed coordinates (after Lapidus and Finder, ,1982).    27
3.2   Variable representation in MISER	   32
3.3   Representation of an extraction well in the discretized domain	   44
4.1   Computational grid used for the numerical solution of the one dimensional Richards equation.  53
4.2   Comparison of numerical and analytical solutions for the one dimensional Richards equation.
     Simulation time = 6 hours; convergence tolerance = 1 x 10~4	   54
4.3   Domain configuration used in two dimensional (2D) flow simulations for comparison to
     SWMS_2D	   55
4.4   Numerical grid used in two dimensional flow simulations for comparison to SWMSJ2D. .  .   56
4.5   Simulated volumetric moisture content in the homogeneous domain at time 12 hrs (MISER
     = solid line; SWMS-2D = dashed line)	   56
4.6   Simulated volumetric moisture content in the layered domain at time 6 hrs (MISER = solid
     line; SWMS_2D = dashed line)	   57
4.7   Simulated volumetric moisture content in the layered domain at time 12 hrs (MISER = solid
     line; SWMS.2D = dashed line)	   57
4.8   Domain configuration used in two dimensional flow simulations for comparison to quasi
     analytical solutions for radial gas flow.	   58
4.9   Comparison of quasi analytical and numerical solutions for two dimensional radial gas flow
     in a uniform soil with fc = 1 x 10~u  m2	   59
4.10 Comparison of quasi analytical and numerical solutions for one dimensional radial gas flow
     in a uniform soil with k = 1 x 10~~I4m2	   59
4.11 Computational grid used for the numerical solution of the one dimensional transport equation
     with and without advection	   60
4.12 Comparison of MISER  with the one dimensional analytical solution for diffusion driven
     transport	   61

-------
4.13  Comparison of MISER with the one dimensional Ogata and Banks analytical solution for
      transport with dispersion and constant advection	   61

4.14  Comparison of MISER (solid lines) with a two dimensional analytical transport solution
      (dashed lines) at 4000 sec. Contours of normalized concentration are from left to right: 0.8,
      0.6,0.4,  0.2,0.1, and 0.01	   62

4.15  Comparison of MISER (solid lines) with a 2D analytical transport solution including first
      order decay (dashed lines) at 4000 sec. Contours of normalized concentration are from left
      to right:  0.8, 0.6, 0.4,0.2,0.1, and 0.01.	  .  ;	   63

4.16  Comparison of substrate profiles along a one dimensional column by MISER (lines) and a
      one dimensional numerical solution (discrete points) for biodegradation by Moltz et al, [1986].  64

4.17  Comparison of MISER (solid lines) with a two dimensional analytical solution including
      linear equilibrium sorption (dashed lines) at 4000 sec. Contours of normalized concentration
      are from left to right: 0.8, 0.6, 0.4,0.2, 0.1, and 0.01	   65

4.18  Comparison of MISER (lines) with a one dimensional column experiment (discrete points)
      for multicomponent organic liquid (benzene, TCE, toluene) volatilization under equilibrium
      conditions	   65

4.19  Comparison of predicted solute concentrations at time 6 hrs (MISER = solid line; SWMS_2D
      = dashed line)	   66

4.20  Comparison of predicted solute concentrations at time 12 hrs (MISER=solid line; S WMS _2D
      = dashed line)	   67

6,1   Problem  depiction used in example simulations. Contours show the initial organic liquid
      distribution. The contour interval is 0.005 with levels increasing inward	105

6.2   Predicted organic liquid saturation distribution in SVE simulations with intermediate mass
      transfer rates. The contour interval is 0.005 with levels increasing inward	107

6.3   Toluene sorbed (ppm) at 20 and 100 days	107

6.4   Toluene removal versus time	108

6.5   Predicted organic liquid saturation (%) at selected times in the example BV simulation. . . . 109

6.6   Predicted biomass distribution (g/1 x 10~3) at selected times in the example BV simulation.  109

6.7   Simulation domain used in the field scale bioventing demonstration simulation	110

6.8   Initial conditions used for the field scale bioventing demonstration simulation	113

6.9   Predicted organic liquid distributions at specified times for the field scale bioventing demon-
      stration simulation	114

6.10  Predicted benzene substrate distributions at specified times for  the field scale bioventing
      demonstration simulation	115

6.11  Predicted biomass distributions at specified times for the field scale bioventing demonstration
      simulation	116
                                            XI

-------
6.12 Predicted oxygen distributions at specified times for the field scale bioventing demonstration
     simulation	H7
                                            XII

-------
                             LIST OF TABLES

3.1  Summary of mass transfer expressions	   35
3.2  Summary of lumped mass exchange and bioreaction coefficients	   37
3.3  Summary of numerical scheme in MISER	;.	   47
4.1  Comparison of global mass balance errors from numerical solutions of the one dimensional
     Richards equation at time 6 hrs	   54
4.2  Soil properties used in two dimensional flow simulations for comparison to SWMS_2D.  .  .   55
4.3  Soil properties used in two dimensional flow simulations for comparison to quasi-analytical
     solutions for radial gas flow	   58
5.1  MISER program modules	  .	   77
5.2  Selected parameter variables defined in the include file'dimen.inc.'	   79
5.3  Description of input and output files	   80
5.4  Input Data in Block A - Input/Output Files and Control Options	   81
5.5  Input Data in Block B - General Model Control Options	   83
5.6  Input Data Block C - Time Step and Iteration Control Information	   84
5.7  Input Data Block D - Grid Information and Control Options Information	   85
5.8  Input Data Block E - Component Chemical Properties	   86
5.9  Input Data Block F - Mass Transfer Coefficients	   87
5.10 Input Data Block G - Material Property Block Information	   88
5.11 Input Data Block H - Sorption Parameter Data	   89
5.12 Input Data Block I - Biological Parameter Data	   90
5.13 Input Data Block J - Phase Parameter Data	   91
5.14 Input Data Block K - Temperature Parameter Data	   92
5.15 Input Data Block L - Output Control parameters	   93
5.16 Input Data Block M - Restart Identifier.	   96
5.17 Input Data Block N - Initial Pressure Conditions	   97
5.18 Input Data Block O - Velocity Computation	   98
                                         xm

-------
5.19 Input Data Block P - Organic Liquid Saturation and Composition	   99
5.20 Input Data Block Q - Oxygen and Nutrient Initial Conditions	100
5.21 Input Data Block R - Boundary Conditions	101
5.22 Input Data Block S - Extraction/Injection Well Conditions	103
5.23 Input Data Block T - Velocity Boundary Conditions	104
6.1  Soil properties used in example SVE and BV simulations	106
6.2  Mass transfer coefficients used to simulate an SVE system	106
6.3  Biotransformation parameters used in an example BV simulation	109
6.4  Soil parameters used in the field scale bioventing demonstration simulation	Ill
6.5  Fluid properties used in the field scale bioventing demonstration simulation. All values are
     for20°C	Ill
6.6  Mass exchange and biokinetic parameters used in the field scale bioventing demonstration
     simulation	112
                                           xiv

-------
      LIST OF ABBREVIATIONS AND SYMBOLS
  aap   specific contact area between the a and ft phases

   A   general mass matrix
  Ae   area of a triangular element [L2]
  AXl   cross-sectional area associated with node i [L2]
  A;   subarea of a triangular element [L2]
   b   Klinkenberg parameter [ML"1 T~2]
   B   general stiffness matrix
#1,2,3   material balance error measures [%]
  Ba   net mole biological transformation rate in phase a
       per medium volume [mole L~3Z"~1].
  Bac   mole biological transformation rate of component'
       c in phase a. per medium volume [mole L"3 T"1 ].
  B*   net mass biological transformation rate in phase a
       per volume of phase a [ML~3T~1].
  B*c   mass biological transformation rate of component
       c in phase a per volume of phase a [ML~3T~1].
  Cai.   mass concentration of component c in phase a
       [ML"3]
  Cp   capacity coefficient dS^/dPc [M~1LT2]
 D^c   hydrodynamic dispersion  tensor of component c
       in phase a [L27"~:]
  L>™   binary molecular diffusion coefficient of compo-
       nent c in phase a [L2T-1]
   E   general RHS vector
  Ea   net interphase mole transfer rate to phase a from
       all contiguous phases per pore volume [mole

  Eac   netinterphase mole transfer rate to phase a of com-
       ponent c from all contiguous phases per pore vol-
       ume [mole L"3?1"1]
 Eapc   interphase mole transfer rate of component c to
       phase a,  from phase ft per pore volume [mole

  E*   net interphase mass transfer rate to phase a.
       from all  contiguous phases  per pore  volume
net interphase mass transfer rate of component c
to phase a from all contiguous phases per pore
volume [ML~3T~l]
                                                   interphase mass transfer rate of component c
                                                   to phase a  from  phase  ft per pore  volume
                                             /, F  general RHS vectors
                                               Fci  use coefficient of component c with substrate /
                                                   degradation [-]
                                              foe  soil organic carbon fraction [-]
                                               Fb  boundary flux in material mass balance calculation
Fr
                                               g
                                               gx
                                               gz
                                              Ga
                                              hgj
                                               7C
                                              7™
                                              J«c
                                                   exchange flux in material mass balance calculation
                                                   [ML~3T~l]
                                                   source/sink in material mass balance calculation
    rate of change in material mass storage for balance
    calculation [ML~3T~l]
    biological reaction rate in material mass balance
    calculation [ML"3?7-']
    lumped RHS mass transfer coefficient for compo-
    nent c in phase a [mole L"3?""1]
    gravitational acceleration vector [LT~2]
    horizontal component of g [LT~2]
    vertical component of g [LT"2]
    a phase compressibility factor [-]
    equivalent gas phase head [L]
    component c inhibition function [-]
   „  biomass inhibition functions [-]
    saturation inhibition function [—]
    mass flux of component c in phase a by kinematic
    dispersion [ML"2?1"1]
    mass flux of component c in phase a by molecular
    diffusion  [ML"2?7"1].
    intrinsic permeability tensor [L2]
    biomass decay rate [T~l]
    effective gas phase permeability [L2]
    maximum substrate / use rate [mole M~lT~l]
    relative permeability of phase a [—]
    half saturation constant for substrate / [-]
    overall mass transfer coefficient for component c
    controlled by phase a [LT~l]
                                          xv

-------
       gas phase permeability at a high pressure; equiva-
       lent to the liquid permeability [L2]
       Henry's  Law  constant   for  component  c
 K,
  oc,
Ka
L(H)
  Lj
 Lar

   m
 Ma
 Mc
   71
  N*
  M-

  PC
  Pgf
  "nw
  P*
  Pw
  Pa
  9
-------
p*o
 PC,
 p*a
  e
0>Se
        mass density of the  uncontaminated gas phase
        [ML-3]
        bulk solid phase mass density [ML~3]
        molar density of phase a [mole L~3]
        mass density of phase a [ML~3]
        element average phase mass density [ML~3]
        tortuosity of phase a [-]
        porosity [-]
        gas phase viscosity parameter [-]
        variable time weighting factor [-]
        adsorbed mass of component c per mass of soil [-]
        computational domain
subscripts

    a  aqueous phase
   A  nutrient
    b  biophase
    c  component
   g  gas phase
  i, j  nodes
   k  direction
    /  degradable substrate; direction
   L  longitudinal direction
  N2  nitrogen
   o  organic phase
  Oi  oxygen
   r  radial direction
   s  solid phase
   t  total
                                                       T   transverse direction
                                                       x   horizontal direction
                                                       to   water
                                                       z   vertical direction
                                                    a, ft   phase (aqueous, gas, organic, solid)
                                                       y   components of the organic liquid

                                                   superscripts

                                                       d   kinematic dispersion
                                                       e   element
                                                       h   hydrodynamic dispersion
                                                       k   iteration counter
                                                      L   mass lumped
                                                      m   molecular diffusion
                                                       o   initial time, conditions in contacting fluid, uncon-
                                                           taminated gas phase
                                                       t  time
                                                       *  mass based variable

                                                   abbreviations

                                                    BV  bioventing
                                                   LEA  local equilibrium assumption
                                                   LHS   left hand side
                                                   RHS   right hand side
                                                     SS   simultaneous solution method
                                                   SVE   soil vapor extraction
                                                 xvu

-------

-------
                                          Section 1
                                 INTRODUCTION
1.1   OVERVIEW AND PURPOSE
The migration and fate of nonaqueous phase liquid (NAPL) organic contaminants in the subsurface has
been the subject of intensive investigation in the past few years. It is now generally recognized that the
prevalence of NAPLs at contaminated sites is a significant impediment to aquifer restoration [Mackay and
Cherry, 1989]. As a NAPL migrates through a porous formation a portion of the organic liquid is retained
within the pores due to the action of capillary forces. Residual NAPL can vary from 5-40% of the pore
volume, or on a volume basis, from 3-5 1/m3 in permeable soils up to 30-50 1/m3 in low permeable soils
[Schwille, 1984; Hoag and Marley, 1986; Wilson et al., 1990]. These entrapped residuals cannot be
mobilized by simple hydraulic flushing, and thus due to the low aqueous solubility of the NAPLs, the
residuals  may serve as long term sources of groundwater contamination. Conventional pump and treat
remediation technologies have proven to be an ineffective and costly approach to aquifer restoration when
NAPLs are present [Mackay and Cherry,  1989; Haley et al., 1991; National Research  Council, 1994].

   Based upon the limitations of conventional pump and treat methods, considerable  effort is currently
focused on the development  of alternative remediation technologies. Soil vapor extraction (SVE) is an
alternative remediation approach which targets the removal of volatile organic contaminants (VOCs) from
the unsaturated zone.  SVE involves the generation of advective vapor fluxes through the pores of the
contaminated soil to induce transfer of VOCs to the air stream. Air flow is established by pumping from a
system of vadose zone wells through which contaminant vapors are collected and transported above ground
where they are treated if required, and discharged to the atmosphere (Figure 1.1). Since its development in
the late 70's and early 80's [Texas Research Institute, 1980, 1984; Thornton and Wootan, 1982; Marley and
Hoag, 1984; Crow et al., 1985, 1987] SVE applications have become widespread, with SVE now
comprising up to 18% of selected remedies at Superfund sites [Travis andMacinnis, 1992]. The popularity
of SVE technologies stems from their proven effectiveness for removing large quantities of VOCs from the
soil, their cost competitiveness, and their relatively simple nonintrusive implementation. Numerous articles
and reports document and describe SVE applications [e.g. Hutzler et al., 1989; Downey,and Elliott, 1990;
Gerbasi andMenoli, 1994; McCann et al., 1994].

   The ability of SVE systems to enrich the unsaturated zone with oxygen and stimulate indigenous
microorganisms to biodegrade organic contaminants was recognized in early feasibility studies [Thornton
and Wootan, 1982; Texas Research Institute, 1984]. Enhanced biodegradation in the unsaturated zone was
subsequently evaluated in laboratory treatability studies [Hinchee and Arthur, 1991; Kampbell and Wilson,
1991] and in monitored field applications [Miller, 1990; Hinchee et al., 1991; Dupont  et al., 1991]. These
studies helped spawn  the development of engineered systems referred to as bioventing (BV) (Figure 1.1).
BV is similar to SVE  in that remediation is facilitated by advective vapor fluxes established through vadose
zone wells. BV, however, differs fundamentally from SVE in that it designed to maximize soil remediation
by in situ biodegradation and to minimize contaminant volatilization and above ground recovery [Dupont,

-------
                            SVE System
BV System
                          Figure 1.1: Basic SVE/BV system configuration.

1993; Hinchee, 1994]. BV is now recognized to be a highly effective and cost-competitive remediation
alternative [Miller et al, 1994] especially when treatment of off-gas is required [Reisinger et al., 1994]    ;

    Because of the complexity of the processes influencing the performance of SVE/BV technologies,
design and operation guidelines are frequently qualitative in nature based on experience or simple design
rules [Hutzler et al, 1989; Dupont, 1993; Johnson etal,  1990,1995]. Mathematical models are recognized
as powerful tools that can be used to integrate and quantify the interaction of physical, chemical, and
biological processes occurring in field scale SVE/BV systems. In addition to predicting potential mass
removal, mathematical models can be used to explore alternative system designs and to investigate factors
limiting successful remediation. This report describes the development of a comprehensive SVE/BV
simulator, entitled the Michigan Soil Vapor Extraction Remediation Model, or MISER.
1.2   BACKGROUND AND LITERATURE REVIEW
1.2.1  Limits of Applicability

Reviews of SVE technologies indicate success of SVE is strongly correlated with contaminant volatility
and the ability to generate advective gas fluxes through the contaminated soil [Hutzler et al., 1989; U.S.
EPA, 1991; Pedersen and Curtis, 1991; Johnson etal., 1995; Rath/elder et al., 1995]. SVE has been
effectively applied for the removal or mass reduction of a wide variety of halogenated and nonhalogenated
volatile and semivolatile organic compounds. It is not considered effective for organic compounds of low
volatility, inorganic compounds, polychlorinated biphenyls (PCB), dioxins, organic pesticides, cyanides,
and corrosives [U.S. EPA, 1991]. SVE is generally most effective in uniform soils with good conductivity,
low moisture content, and low organic carbon content [Fine and Yawn, 1993]. Soils with low air
permeability are more difficult to remediate [U.S. EPA, 1991], although applications in low permeability,
fractured media have been reported [Agrelot et al., 1985; Gibson etal., 1993].

    Reviews of BV design and applications [Thomas and Ward, 1992; Dupont, 1993; Miller et al., 1994;
Litchfield, 1993; Hinchee, 1994] indicate BV is most applicable for the removal of petroleum
hydrocarbons. Chlorinated organic compounds have not been considered appropriate for BV due to their
resistance to direct biodegradation, however, potential  exists that these compounds can be cooxidized

-------
during microbial growth on other hydrocarbons [English andLoehr, 1991; Speitel and Alley, 1991; Barbee,
1994; Wilson, 1994; Fuller et al, 1995]. In contrast to SVE, BV is not constrained by contaminant
volatility and is therefore applicable to contaminants with moderate to low volatility [Hinchee, 1994].
Moreover, biodegradation rates are slower than volatilization processes for many hydrocarbons, and
therefore BV may be well suited for application during the periods of long term, low level removal
efficiency observed in traditional SVE systems. Consequently, integrated systems have been designed
which employ SVE for rapid VOC recovery during early stages, followed by low cost, long term BV
operations [Dupont et al., 1991; Nelson et al., 1994].

                                                                I
1.2.2  Rate Limited Mass Transfer

SVE systems characteristically exhibit large initial VOC recovery rates followed by a rapid drop in exhaust
VOC concentrations and long term, low level removal efficiency [Crow etal, 1987; DiGiulio, 1992; Travis
and Macinnis,  1992; McClellan and Gilham, 1992]. Diminished removal efficiency is attributed to several
mechanisms which decrease the rate of VOC mass transfer to the mobile gas stream. Lighter, more volatile
contaminant fractions are preferentially removed, leaving the heavier, less volatile components and
decreasing remediation efficiency [Hoag etal., 1984; Fine and Yaron, 1993]. Secondly, removal efficiency
decreases due to preferential removal of contaminants that are most accessible to the advective gas stream,
leaving behind contaminants that have poor accessibility to the gas stream due to occlusion in
intraaggregate or intraparticle regions [Brusseau, 1991; Gierke et al, 1992], or due to flow by passing of
zones of low permeability [Kearl et al., 1991; Ho and Udell, 1992]. Diffusion controlled, rate limited
interphase mass transfer, including processes of volatilization, dissolution, sorption and biotransformation,
are also a potentially critical factor affecting removal efficiency [Brusseau, 1992; Armstrong et al, 1993,
1994; Wilkins et al,  1995].

    Several studies indicate the rate of NAPL volatilization can be adequately modeled with the assumption
of instantaneous local equilibrium [Hoag et al., 1984; Baehr et al., 1989; Berndtson  andBunge, 1991;
Bloes et al., 1992; Hoyden et al., 1994; Ho etal., 1994]. Other studies, however, have shown the rate of
NAPL volatilization to be limited, even in relatively homogeneous materials, at high pore velocities
[Rainwater et al, 1989; Kearl et al., 1991; Hoffman etal., 1993; Wilkins et al., 1995], or low constituent
mole fractions  [Haydenetal.,  1994]. Hoffman et al. [1993] and Wilkins et al. [1995] found that measured
effective  mass transfer coefficients in sandy media could be well correlated with dimensionless parameters
incorporating the vapor flux and mean grain size. Laboratory  and field studies have also documented rate
limited interphase mass transfer of VOCs between the soil water and mobile gas phases [Cho andJaffe,
1990; Berndtson and Bunge, 1991; Gierke et al.,  1992; McClellan and Gilham,  1992], and between the
water and organic liquid phases [Powers et al., 1991, 1992,1994]. Rate limited sorption/desorption on soil
particles  also plays an important role in the transport and retention of VOCs [Brusseau and Rao, 1989;
Weber et al., 1991], and may limit bioavailability of organic substrates [Pignatello and Xing, 1996]. Recent
experimental studies suggest that unsaturated zone sorption is more complex than that in the saturated zone,
due to the presence of gas-liquid interfaces [Pennell et al., 1992].
1.2.3   Biodegradation Rates

Biodegradation rates in field BV systems have been assessed by the measurement of: carbon dioxide
production [Hinchee and Arthur, 1991; Huesemann and Moore, 1994; van Eyk, 1994]; hydrocarbon

-------
consumption rates [Kampbell and Wilson, 1991]; and oxygen consumption [Baehr et al, 1991; Ong et al.,
1991; Hinchee, 1994; Huesemann and Moore, 1994]. Oxygen consumption is generally considered a more
reliable measure of biodegradation and is typically measured by in situ respirometry tests [Hinchee,  1994].

    Biodegradation rates in unsaturated soils have been observed in field and laboratory studies to be linked
to the soil moisture content. The reason for this linkage is poorly understood. Results from laboratory
studies generally show that higher rates of biotransformation occur at higher levels of soil moisture content
[Fan and Scow, 1993] and that this dependence may be compound specific [Holman and Tsang, 1995].
Moisture addition in field BV applications has similarly produced an increase in degradation rates [Hinchee
andArthur, 1991; Zwick etal., 1995]. At other sites, moisture addition has been found to reduce
degradation rates due to the constriction of air permeability and the resulting decrease in oxygen transport
[Miller et al., 1994] or was reported to have no affect on biodegradation rates [Miller, 1990].

    Enhanced biodegradation rates have also been observed in laboratory experiments following nutrient
additions (e.g. nitrogen or phosphorus) indicating that nutrient limitations can constrain biodegradation rates
[Hinchee andArthur,  1991; Dupont, 1993; Baker et al., 1994; Fuller et al.,  1995; Breedveld et al, 1995].
Nutrient addition in field  applications is typically  accomplished by water flooding [Nelson etal, 1994;
Norris et al., 1994]. However, it is not clear whether there is substantial enhancement of biodegradation
after nutrient addition in field studies [Miller, 1990; Miller etal., 1994; Leeson etal., 1995], partly because
it is difficult to separate the effects of nutrient addition from moisture addition [Dupont et al., 1991].

    Inhibition of biodegradation at high concentrations of inorganic nutrients [Baker et al., 1994] or high
concentrations of organic substrates [Speitel and Alley, 1991; Huesemann and Moore, 1994; Mu and Scow,
1994] has been observed  in laboratory studies.  The significance of inhibition in field operations, however,
has received limited attention. One study noted the possibility of observed substrate inhibition at low flow
rates [Moore etal., 1995]. Thus inhibitory effects, if important, could be strongly linked to system
operation and design.

    Degradation rates in field conditions depend not only on the metabolic properties of the microbes, but
also on the availability of substrates to the microorganisms.  A host of laboratory and theoretical studies
provide substantial evidence that diffusion controlled desorption of organic substrates can control the
overall rate of biodegradation [Molz etal., 1986; Scow and Alexander, 1992; Scow andHutson, 1992;
Novak et al., 1993; Scow, 1993]. Thus, relatively  slow rate limited desorption processes can in effect
control bioremediation of subsurface systems [Mueller etal., 1989; Rijnaarts etal., 1990]. Exposure time
and aging of the spill enhance the resistance to desorption and biodegradation [Novak et al., 1993;
Pignatdlo and Xing, 1996; Fuller etal., 1995]. Consequently, modeling of biodegradation processes
requires an accurate understanding and representation of sorption kinetics [Scow and Hutson, 1992;
Pignatello and Xing, 1996].
 1.2.4  Temperature

 Subsurface temperature is an important environmental variable in SVE remediation processes. The
 efficiency of SVE remediation is strongly linked to the vapor pressures of the target compounds with a
 suggested lower limit on vapor pressure of approximately 1000 Pa [Pedersen and Curtis, 1991; Johnson et
 al., 1990]. Vapor pressures of organic compounds increase by a factor of approximately 3 or 4 with every
 10"C rise in temperature. Experimental evidence also suggests that vapor sorption is inversely proportional
 to temperature [Goss, 1992]. Methods to increase SVE efficiency by increasing the subsurface temperature

-------
have been attempted by heating and injection of ambient air [Sittler et al., 1993] or by methods of steam
injection [Falta et al., 1992; Wilson and Clarke, 1992]. Several other novel approaches which integrate
SVE with methods for soil heating have been considered {Downey and Elliott, 1990].

    The effect of subsurface temperature on the design and operation of B V remediation efforts has
received little attention [Sayles et al., 1993,1995]. It is generally accepted that soil temperatures at most
sites are within the limits for microbial growth [Litchfield, 1993]. In Alaska, where soil temperatures are as
low as 1°C, respiration rates comparable to those in temperate and subtropical regions were observed
during summer months [Ong et al., 1994; Kellems et al., 1994]. The observed rates dropped slightly during
the winter months with less effect noted at sites with either active or passive soil wanning.
1.2.5  Previous Models
A number of mathematical models have been presented in the literature for the description of the SVE
process. These vary greatly in level of complexity and in the processes included. The simplest models are
analytical solutions for gas flow, intended to aid in the analysis of pneumatic pump tests and the design of
SVE applications [Massmann, 1989; Johnson etal, 1990; McWhorter, 1990; Baehr and Hult, 1991; Cho
andDiGiulia, 1992; Massmann and Madden, 1994; Beckett and Huntley, 1994; Baehr etal., 1995].
Numerical models of gas phase advection have also been developed for analysis of SVE systems [Welty et
al., 1991; CroiseandKaleris, 1992; Edwards and Jones, 1994] and BV systems [Mohr an d Merz, 1995].
Because only the gas phase flow field is considered in this group of models, they are not capable of
describing contaminant partitioning and migration, nor are they suitable when water movement is
important. These models are generally applicable for screening purposes and simple design analyses.

    A more complex group of models are those which combine constituent transport and steady state gas
phase flow. Although transport processes are considered in this group of models, their applicability is
restricted by assumptions on the flow field, partitioning mechanism, or domain configuration. They are, in
general, not adequate for comprehensive simulation of field scale SVE/BV system, but are suitable for
behavior assessment and screening purposes. The simplest models in this group couple steady state flow
fields with analytical transport models [Roy and Griffin, 1991; Zaidel andRusso, 1993]. Other models
incorporate steady state flow fields and the numerical solution of transport equations [Massmann and
Farrier, 1992; Johnson et al., 1990; Wilson etal., 1988]. The model by Wilson et al.  [1988] is extended in
a series of papers to explore: the effects of impermeable caps, permeability and evaporative cooling
[Gannon  and Wilson, 1989]; anisotropic permeability [Mutch and Wilson, 1990]; variable permeability and
soil moisture content [Gomez-Lahoz etal., 1991]; system geometry [Rodriguez-Maroto etal, 1991]; and
spatially variant permeability [Roberts and Wilson, 1993]. Other modifications to this model have enabled
the consideration of: rate limited mass transfer from fractured bedrock [Wilson, 1990] or areas of low
permeability [Rodriguez-Maroto and  Wilson, 1991; Osejo and Wilson, 1991]; Raoult's Law behavior of
organic contaminant mixtures [Kayano and Wilson,  1992]; and departures from Darcy's Law [Clarke et al.,
1993].  Other models coupling steady  state flow fields and numerical transport solutions have been extended
to include complexities introduced by soil heterogeneities [Baehr etal., 1989; Benson etal., 1993; Joss,
1993].

    Several numerical models incorporating transient single phase gas flow and constituent transport have
been developed. Two dimensional finite element models with transport of a single volatile organic species
have been developed [Metcalfand Farquhar, 1987; Stephanotos, 1988]. More complex one dimensional
models encompassing single phase gas flow have been developed for analysis of nonequilibrium interphase

-------
exchange [Brtisseau, 1991; Armstrong etal., 1994] and multicomponent, nonisothermal conditions
[Lingineni and Dhir, 1992]. A one dimensional model developed by Gierke et al. [1990] includes both
mobile gas and mobile aqueous phases. A two dimensional numerical model incorporating transient single
phase gas flow and multi component compositional transport was developed by Rath/elder et al. [1991].
Nonequilibrium mass transfer was also explored.

    Few models have appeared in the literature which can simulate multiphase flow, including gas and
aqueous phase advection, multicomponent transport, and interphase mass exchange [Abriola, 1984, 1988;
Abriola and Finder, 1985];. A two phase (air-water) two dimensional finite element simulator was
presented by Stephamatos [1988] for the transport of a single volatile organic species. Baehr et al. [1989]
presented a one dimensional multicomponent transport model which could predict vapor flux in a three
phase (air-NAPL-water) system. Both of these models assumed equilibrium mass transfer between phases.
Several more advanced models incorporate the effects of rate limited interphase mass exchange [Reeves
and Abriola,  1988, 1994; Sleep andSykes, 1989; Falta etal., 1989], however,  these models have not been
extensively applied to SVE. Additionally, none of these models incorporates biotransformations of
contaminants.
    Existing models capable of simulating bioremediation processes have focused primarily on
transformations and transport in the saturated zone [e.g. Chiang et al., 1989].  For saturated transport
models which incorporate microbial growth and transport and uptake of contaminants, nutrients, and
electron acceptors, two general approaches have been used to represent microbial activity. In the first
approach kinetic expressions describing the microbial consumption of a component are incorporated
directly into the transport equation as a macroscopic sink term [e.g. Sykes etal., 1982; Borden and Bedient,
1986; Frind et al., 1990; Sleep and Sykes, 1991].  Here the bulk phase concentration of a component
controls microbial consumption. In  the second approach, the potential for diffusion limited transport to the
biophase is accounted for by employing a macroscopic Pick's Law expression to represent the sink term
[Molzetal., 1986; Widdowsonetal., 1988; Baveye and Valocchi, 1989; Kinzelbach et al, 1991;  Chen etal,
1992]. Of the models presented above, only Chen etal, [1992] includes interphase mass transfer and
transport within the gas phase. However, in this model, equilibrium interphase partitioning is assumed,
residual NAPL is not considered, and transport in the gas phase is by diffusion only. The model of Sleep
andSykes [1991] includes  advective flow of three fluid phases, however, no mass transfer limitations are
considered, including mass transfer to the biophase.
 1.3   MODEL FEATURES
 A review of the relevant literature indicates that SVE/BV performance is influenced by a variety of
 interrelated and spatially dependent physical, chemical, and biological processes. It points to the need for a
 flexible simulator which can accommodate multiphase multicomponent transport and potential mass
 transfer limitations. Such a model must link microbial degradation with a microbial population and
 availability of substrates, electron acceptor, and nutrients.

    The overall objective of this project is the development of a comprehensive numerical model for the
 simulation of multiphase flow, compositional transport, and biodegradation processes, occurring primarily
 in SVE and BV systems. Features in MISER include:

 • the simulation of both cross sectional x-z and axisymmetric r-z domains;

-------
•  the ability to simulate the simultaneous flow of aqueous and gas phases resulting from natural and
   induced processes, such as:  applied stresses at vadose zone extraction/injection wells, natural and
   artificial moisture infiltration, and density driven gas phase advection;
•  the simulation of multicomponent transport processes including multicomponent organic substrates, an
   electron acceptor, and a limiting nutrient;
•  the incorporation of rate limited interphase exchange including processes of volatilization, dissolution,
   sorption, and biophase uptake; and
•  the simulation of multicomponent biodegradation kinetics and microbial population dynamics.

    While MISER has the capability to consider both the unsaturated and saturated zones, it is not designed
to simulate remediation processes primarily directed at the saturated zone such as pump and treat or air
sparging. MISER is also not capable of simulating organic liquid migration nor is hysteresis considered in
the movement of the gas and aqueous phases.  MISER is designed to simulate aerobic microbial processes
by a single population which can metabolize multiple substrates.

-------
                                        Section 2

         MODEL FORMULATION AND THEORETICAL
                                 DEVELOPMENT

2.1   CONCEPTUAL MODEL
The following conceptual model is formulated and used as the framework for development of MISER.

   Three fluid phases are modeled: (1) an entrapped organic liquid; (2) a mobile gas phase; and (3) a
mobile aqueous phase. Because the organic liquid is assumed to be immobile, only the chemical and
physical processes affecting the disappearance of the entrapped organic are modeled in this approach. The
initial spatial distribution and composition of residual organic liquid are user defined inputs. The gas and
aqueous phases are considered mobile and can flow simultaneously in response to applied stresses at
extraction/injection wells, and to density gradients arising from spatial variation in phase composition.

   A compositional modeling approach is employed. The transport and transformation of the following
chemical species are modeled: the components comprising the organic liquid contaminant; one electron
acceptor (oxygen); nitrogen (the major component of air); water (including water vapor); and one limiting
nutrient (e.g. ammonia). A schematic of the conceptualized composition of the soil system is shown in
Figure 2.1.

   The organic liquid contaminant is considered as a mixture of y components. Partitioning of gas and
aqueous phase constituents into the organic liquid is assumed negligible. The composition of the organic
liquid can vary in space and time due to mass exchange into adjacent phases. The components of the
organic liquid may dissolve into the aqueous phase, but are assumed to be sparingly soluble. This
assumption is valid for a wide variety of organic components at typical environmental conditions
[Scliwanenbach etal., 1993]. Oxygen and the limiting nutrient may also partition into the aqueous phase.
Based upon available laboratory information, it is assumed that the microbes can metabolize only from the
aqueous phase. To account for possible rate limited uptake by the microbes, the biophase is envisioned as a
subset of the aqueous phase as depicted in Figure 2.1. The gas phase is assumed to be comprised of
nitrogen and oxygen (i.e. the two major components of air), water vapor, the volatile components of the
entrapped organic liquid, and the limiting nutrient. Water vapor is included so that drying effects caused by
the application of S V, can be predicted. Although carbon dioxide has been  monitored as an indicator of
biological activity [Dupont et al,  1991], this component is not modeled due to the complex geochemical
considerations which impact the concentration of carbon dioxide in a soil systems. Sorption to the solid
phase is limited to components of the organic liquid.

    Mass transfer expressions are incorporated into the model to simulate rate limited mass exchange
between phases. These expressions are used to model volatilization and dissolution of the entrapped
organic liquid, mass exchange between the aqueous and gas phases, rate limited sorption, and rate  limited
transport to the biophase. This modeling approach is schematically illustrated in Figure 2.2.

-------
                  gas phase
                   nitrogen
                    oxygen
                  water vapor
               NAPL components
                limiting nutrient
organic phase (NAPL)
     NAPL components
       — ass&ssa-
  solid phase
NAPL components
                                  ^ attached
                                     micro-colonies
                                           water
                                     organic substrates
                                           oxygen
                                       limiting nutrient
           aqueous phase
                 water
           NAPL components
                oxygen
            limiting nutrient
                    Figure 2.1: Conceptual model of the soil system composition.
    The conceptual distribution of fluids in the soil system is shown in Figure 2.1 and is based on following
assumptions: water is the preferential wetting fluid; gas is always the non-wetting fluid; and the organic
liquid has intermediate wettability [Mercer and Cohen, 1990; Wilson, 1992]. Complete drying of the
aqueous phase is not considered. Thus, the soil grains remain in continuous contact with the aqueous
phase. Correspondingly, solid phase sorption occurs only through the aqueous phase. Adsorption from the
vapor phase, which can be significant in dry systems [Pennell et al, 1992], is neglected.

    Quantification of the biotransformation processes follows the conceptual approach of Chen et al.
[1992]. Biodegradation is assumed to occur only within the aqueous phase by an indigenous, spatially
homogeneous, mixed microbial population which is present as attached microcolonies.  Monod-type kinetic
expressions are used to model biophase utilization of substrates, electron acceptor, and limiting nutrient, as
well as growth of the microbial population. Under zero substrate conditions, the microbes are not permitted
to die off completely, but are maintained at a minimum concentration representative of the background

-------
              Phase  Interrelationships
           organic components,
             oxygen, limiting
             nutrient, biomass
organic components
                                              Solid  Phase
                             Aqueous Phase
        VOLATILIZATION / DISSOLUTION
                                                    SORPTION
  organic components,
   water, oxygen, limiting
   nutrient
                                                   DISSOLUTION
                Gas Phase
            organic components,
             oxygen, nitrogen,
             limiting nutrient
  organic components
                             VOLATILIZATION
              Figure 2.2: Conceptual model of interphase mass transfer pathways.


microorganism populations that are found in nearly all vadose zone environments. It is further assumed that
biomass growth does not affect soil permeability and that there is no biomass transport. These two
assumptions are consistent with the dominant influence of gas phase mobility during SVE and BV
remediation, as well as the generally low mobility of the aqueous phase in the vadose zone. Due to the large
number of required microbial transformation parameters, the number of biodegradable components is
limited to three. A detailed discussion of many of the concepts mentioned above can be found in Brock et
at. [1984].
                                     10

-------
    Interphase partitioning and biological degradation processes are strongly temperature dependent. The
prediction of transient temperature effects requires the solution of an energy balance equation, which
substantially increases model complexity and computational requirements. To limit model complexity and
computational requirements, temperature dependence is incorporated in the SVE simulator by the
specification of a known (steady state) spatial distribution of temperature. This nonuniform temperature
distribution is allowed to be a function of depth only.
2.2   PHASE MASS BALANCE EQUATIONS

Description of multiphase fluid movement is based on the numerical solution of phase mass balance
expressions (i.e., flow equations). A general mass balance equation for a fluid phase, a, which is composed
of multiple components, c, is expressed as [Abriola, 1989],
                  9
                                  VI i  *c T7- \    i v^ V^ F*   i  V^ D*
                                 • I (DO , Jni V nl — 0 7  7  Hi ,a  + /  tf
                                  \rrct  a  a;   v / ^ / ,  ap'c   / j  ac
                                                                                          (2.1)
where:

     a = g,a, o, s, b
                      denotes the phases comprising the porous medium (g=gas, a=aqueous, o=NAPL;
                      5=solid; &=biophase);
                  c   denotes components of the phase a;
                 (j)   is the matrix porosity [-];

                 p*   is the mass density of phase a. [ML~3];
                 8^   is the saturation of phase a [-];
                Va   is the pore velocity of the phase a[LT~1];
                      is the rate of interphase mass transfer of component c to the a -phase from the ft
                      phase, per unit pore volume; [ML~3T~1];.
                      is the net rate of biological transformation of component c in the phase a per unit
                      aquifer volume [ML~3r~!]; and
                 Ra   are the internal source/sinks of phase a - volume of a. phase produced per unit
                      aquifer volume per unit time IT""1].
               E*p
                B*
The fluid saturations in (2.1) are subject to the constraint,
                                       Sa + S0
                                                 Sg =
(2.2)
Note that Sb is neglected in 2.2. This is a consequence of the assumption that biomass growth does not
affect the flow field. For mass balance purposes Sb is included in Sa.

    The phase velocity is typically evaluated with an extended form of Darcy's Law which accounts for the
simultaneous flow of more than one fluid [Abriola, 1989],
                    qa = SaVa = -k- (VP« - p*ag) = -\a
                                                                                          (2.3)
where:
                                              11

-------
A* =
          qa   is the specific discharge of phase a [LT *];

           k   is the intrinsic permeability tensor of the medium [L2];
         kra   is the relative permeability of the a phase [-];

          Ha   is the a phase dynamic viscosity [ML"1 T~1];

          Pa   is the a phase pressure [ML"1 T~2];

           p   is the gravitational acceleration vector [LT~2]; and

         :^*   is the mobility tensor of phase a [M"1 L3T].
    Darcy's Law is applicable when average water and gas velocities are within an accepted laminar flow
range. For groundwater flow the upper range of validity is generally not violated except for possibly near
wells [Bear, 1972]. Similarly, gas fluxes generated in SVE systems are known to diminish fdpidly at short
distances from the extraction well and are generally within the upper range for laminar flow [Cho and
DiGiulio,  1992; Beckett and Huntley, 1994]. Gas phase velocities are therefore also assumed to be within
the upper range of validity, or that deviations are localized near the extraction well.

    The lower range of validity of Darcy's Law becomes significant for gas flow when the mean free path
approaches the diameter of the pores resulting in a gas slippage which  increases the effective gas
conductivity.  Klinkenberg [1941] observed that gas permeability decreases with increasing pressure until it
approaches the liquid permeability.  Slip flow, which is also known as the Klinkenberg effect in porous
media, is most significant at low air pressure in fine textured material [Corey, 1986]. Comprehensive error
analyses have been conducted by several researchers [Massmann, 1989; McWhorter, 1990; Baehr and Huh,
1991 ] and all have found that the Klinkenberg effect is significant only in fine sands and silts at low
pressures. However, a Klinkenberg correction factor which accounts for the pressure influence on gas
permeability is included in MISER for two reasons: first SVE systems are being increasingly applied in
fine textured materials; and  secondly implementation of the correction is relatively simple with minimal
effect on overall computational requirements. The correction factor has the form,
                                                                                            (2.4)
where:
                                                    2
               is the effective gas phase permeability [L2];

               is the gas phase permeability at a high pressure and is equivalent to the liquid permeability
               [L2]; and
           b   is a parameter of the porous medium referred to as the Klinkenberg parameter [M L  T  ].
    An empirical relation for b was developed by Held et al.  [1950],

                                     b = (3.98 x 10~5)fc-°-39
                                                                                         (2.5)
where b is in atmospheres and fcoo is in cm2. This correlation is based on experimental measurements of air
permeability in consolidated soils of 11 synthetic cores and 164 natural cores from various oil fields in the

                                                12

-------
United States. Abu-El-Sha'r [1993] measured air permeability in a variety of unconsolidated soils and
compared them with predicted values from (2.5). He found that measured values of b from unconsolidated
soils were generally within the envelope containing the measurements of Held et al.  [1950], with the
exception of an Ottawa sand which was slightly greater than the upper limits.  This finding is consistent
with an analysis by Baehr and Hult [1991 ]. These researchers conclude that the correlation of Held et al
[1950] may underestimate b for some unconsolidated soils, but in general can be used to approximate the
Klinkenberg effect over a range of soil types.

    Substituting Darcy's Law (2.3) into (2.1), the aqueous and gas phase mass balance equations are
expressed as,
 d_
~ai
                - (faZSa) - V • [p*\u (VPa -
a=a,g
(2.6)
where E* = ]TC ^ E*pf. Here it has also been assumed that biodegradation of the organic components
has no appreciable effect on the aqueous flow field. These constituents comprise a small fraction of the
aqueous phase mass and the rate of their biodegradation is comparatively slow.

    Changes in the NAPL saturation result solely from interphase mass transfer processes because the
NAPL is assumed to be immobile and there are no internal sources and sinks of organic liquid. The NAPL
mass balance equation is thus expressed as,
                                            ts,) =£,
                   (2.7)
    Changes in the solid phase bulk density due to sorption and desorption are considered negligible and
ignored. Also, the biophase volume is considered constant with the same properties as the aqueous phase.
Therefore, phase mass balances are not required for the solid and biophases.
2.3   COMPONENT MASS BALANCE EQUATIONS

A general mass balance equation of component c within phase a. (i.e. transport equation) is expressed as,




where:

         Cac   is the mass concentration of component c in phase a [ML~3];

         J%c   is the mass flux of component c in phase a by kinematic dispersion [ML~2T~1]; and

         J™   is the mass flux of component c in phase a by molecular diffusion [ML~2T~1].

    The dispersive and diffusive mass fluxes are typically combined and expressed in a Fickian form, e.g.

                                                                                         (2.9)
                                              13

-------
where JDJJC is the hydrodynamic dispersion tensor of component c in phase a [L2T  ']. The validity of the
Fickian approach for gas transport in the subsurface was rigorously studied by Fen [1993] through
comparisons with a dusty gas model. The latter model is considered to be more general because it
integrates a number of flux mechanisms for multicomponent gas transport which are not captured in the
Fickian approach. Fen [1993] found the Fickian approach is generally valid when advection is the
dominant mass flux mechanism. In systems where diffusive fluxes are significant the Fickian approach
coupled with the flow equations was found to inaccurately represent induced pressure gradients due to
nonequimolar effects. Errors were found to be reduced when the mass balance equations were expressed in
molar form, and when the organic contaminants were of low volatility or their molecular weights were
similar to the ambient gases.
    Dispersive and diffusive mass fluxes are evaluated in MISER with the Fickian approach expressed by
(2.9). This approach is used for several reasons. The Fickian approach is simpler and more expedient to use
because the dusty gas model is  conceptually complex and numerically difficult to implement. Secondly,
advective fluxes of equal magnitude to diffusive fluxes are obtained from very small pressure gradients
[Thorstenson and Pollock,  1989].  Thus, advection dominance can be reasonably expected throughout a
majority of the domain during SVE/BV operations in typical systems. Diffusive fluxes are expected to
become significant only at large distances from the extraction/injection wells, in tight formations, or during
shut down periods.
    To reduce possible errors in the modeling of nonequimolar fluxes in regions of diffusion dominance,
the component mass balance equations are converted to molar form [Fen, 1993]. Mass concentration may
be expanded as,
                                         Cac = paMcxac                                   (2.10)

where pa is the phase molar density [mole L~3]. Substituting (2.9) and (2.10) into (2.8), and defining
McEai = £0 E%p  and McBUc  = E/? B*pc, the general molar based transport equation is expressed as,
                  —
                     • (t>Sa (paxacVa -
                                                                  = (/>Eac + B
                                                                             ac
(2.11)
 where:
         B,
           Cte
is the mole fraction of component c in phase a [-];
is the net rate of moles of component c transferred to the a phase from all contiguous
phases per unit pore volume [mole L~^T~1]; and
is the net rate of biological transformation of moles of component c in phase a per unit
aquifer volume [mole L~3T-1].
 The component mole fractions in (2.11) are subject to the constraint,
                                                                                           (2.12)
 Five equations of the form (2.11) are developed for each component - one for each fluid phase, one for the
 solid phase, and one for the biophase.

     Constituents of the gas and aqueous phases are subject to transport by advective and dispersive
 processes. Constituents of the aqueous phase may also be subject to biotransformation when a separate
                                                14

-------
biophase is not considered. The constituent mass balance equations for these phases are expressed as,
—WSgpgXgJ
V •
                        (pgxgi.Vg -
8_
a7
                 O2, A
           c = y, 02, A
                                                                                          (2.1 3a)
                                                                                          (2.13b)
where the denoted components are: y = organic liquid constituents; w = water or water vapor; Oi =
oxygen; A = nutrient. Note that constituent mass balance equations are not needed for nitrogen (N2~) in the
gas phase and water in the aqueous phase due to use of the mole fraction constraint (2.12).

    Constituents in the organic phase, solid phase, and biophase are not subject to transport by advection. It
is further assumed that diffusion in these phases is negligible.  Diffusion in the organic liquid is restricted by
the assumed disconnected nature of entrapped residuals. In the solid phase, surface diffusion of sorbed
components is considered negligible. The transport equations for the organic and solid phases are then
given by:
                                  <\
                                              = 4>E0t      c = y                           (2.14)
                          a_
                          ~di
                           d_
                           a?
                                                         c = y
                               (2.15)
where a)sc is the sorbed mass of component c per mass of soil, and p* is the bulk solid phase mass density.
Diffusion is similarly neglected in the biophase because the constituent distribution is assumed to be
dominated by exchange with the aqueous phase and by biotransformation. Due to difficulties in calculating
the molar density of subsurface microorganisms, the biophase density is assumed to be equal to the aqueous
phase molar density. The transport equation for the biophase is,
   d_
   Tt
                                        = Ebc + Bbc
= Y, O2, A
                                                                                   (2.16)
where Sb is the biophase saturation. Since aqueous flow is assumed to be unaffected by biomass growth, Sb
is considered constant, representing the fraction of pore volume suitable to microbial growth. It is evaluated
by,
                                                 -^
                                                                                           (2.17)
                                                 P*a
where Xmax [M L 5} is the maximum biomass concentration.
2.4   INTERPHASE MASS TRANSFER


2.4.1   Equilibrium Partitioning

In the absence of phase partitioning rate data the local equilibrium assumption (LEA) has been employed in
SVE models to simplify the description of phase partitioning. The LEA enables the use of partition
coefficients to relate constituent phase concentrations. These partitioning coefficients are typically
developed under the assumption of ideal fluid behavior. Detailed developments of the partition coefficients
are found in:  Lyman et al. [1982]; Baehr [1984]; and Schwarzenbach et al. [1993].
                                               15

-------
    Equilibrium partitioning between the organic and gas phases is expressed with Raoult's Law, which
states,
                                         P,, = Yo,x0rP^                                   (2.18)
where:
               is the partial pressure of the component c
                                                         ~ '  ~2
                                                           T~2];
        y0f     is the activity coefficient of component c in the organic phase [-]; and

        PV(,     is the vapor pressure of component c as a pure substance [ML~1T~2].

The activity coefficient is a relative measure of nonideal behavior due to interactions of dissimilar
molecules. Ideal behavior of the organic phase (i.e. y0c = 1) can be readily assumed for pure NAPLs and
many common mixtures of hydrocarbons which are composed of chemically similar components (e.g.
gasoline and petroleum hydrocarbons) [Baehr, 1984; Schwarzenbach et al., 1993; Adenekan et 
-------
which can be expanded as,
                                        Pi,. =•
                                                                                          (2.24)
Equation (2.24) is a statement of Henry's Law where KH = PVc/x™} is the Henry's Law constant. There is
substantial evidence that KH is unaffected by solute-solute interactions for slightly, or even, moderately
soluble organic compounds [Schwarzenbachetal, 1993].
    Equilibrium sorption capacity is commonly related to the aqueous concentration by a Freundlich
isotherm [Weber et al, 1991],
where:
      Kfa
                                                                                          (2-25)
               is the aqueous/solid equilibrium partition coefficient [(mass adsorbed / mass soil) / (mass
               solute / volume solution)]" [(Z^M"1)")]; and
         n     is an empirically derived constant [-].
In the case where n = 1, a retardation factor may be defined as,
                                            /     n* W  \
                                            /1+p^\
                                                                                          (2.26)
where rc is then inserted directly into (2.1 1) for the aqueous phase,
— (rcSapaxac) + V • (j)Sa
at
                                                              ac  = Eac
                                                                                          (2.27)
Sorption is assumed to be both linear and at equilibrium when using retardation for a given component, c.
Retardation can be considered for all the components of the aqueous phase.

    In the absence of measured data, AT® 'can be estimated from commonly used correlations with the soil
organic content [Lyman, 1982],
                                      y&   	  sc 	  f  f                                  //-> oo\
                                      Ksac — 7T~ —  it-ocjoc                                 (2.2S)

where:

       Koc     is the organic carbon - normalized partition coefficient (mass sorbed / (mass organic
               carbon) / (mass) / volume solution); and
        foe     is the fraction of organic carbon in the soil [-].

Additionally, n = 1 is assumed when this correlation is used.


2.4.2   Rate Limited Interphase Mass Transfer

Nonequilibrium interphase mass transfer processes are often represented by the dual resistance model
[Weber and DiGiano, 1996]. This model assumes: (1) mass transfer is controlled by the rate of diffusion on
each side of the interface, and (2) no resistance is encountered at the interface.  The diffusional resistance on
                                               17

-------
one side of the interface is frequently considered dominant such that the mass transfer rate can be described
with an overall mass transfer coefficient [Weber and DiGiano, 1996}. Generally, use of overall mass
transfer coefficients are strictly applicable for the measured system only and should, be extended to other
systems with caution.
    The rate of organic phase volatilization is assumed, to be controlled by gas phase resistance, and is
evaluated with a linear driving force expression [Weber and DiGiano, 1996],
                            ES°c —
                                                 c \xgoc ~ X8c)
                              (2.29)
where:
       Kgo<.    is the lumped gas-organic mass transfer coefficient [T  !]; and

       xca     is the gas phase mole fraction of component c in equilibrium with the prganic phase mole
               fraction of component c [-].

The lumped mass transfer coefficient is a function of the fluid saturation, phase velocity, and properties of
the porous media. It can be expressed as,
                                          Ken  =ke,.aeo                                    (2-30)
where:
               is the overall mass transfer coefficient based on gas phase control (moles transferred /
               (time)(interfacial contact area)(Apgx)) [LT~1]; and
a
         go    is the gas phase specific contact area with the organic phase (gas-organic interfacial contact
               area / pore volume) [L~ l ] .
The linear driving force model is completed by relating the equilibrium gas phase mole fraction of
component c in (2.29) with the corresponding organic phase mole fraction concentration by (2.21),
                                                                                            (2.31)
    A similar linear driving force model is used for the rate of nonequilibrium organic phase dissolution. In
 this case, the mass transfer resistance is assumed to be contained within the aqueous phase. Equation (2.22)
 completes the expression by relating the equilibrium aqueous phase mole fraction of component c to the
 corresponding organic phase mole fraction,
                           Ean, —
                                                                                            (2.32)
    Mass transfer across the aqueous-gas interface is commonly assumed to be controlled by resistance in
 the aqueous phase. This assumption is generally valid for sparingly soluble organic compounds, however,
 gas phase resistance becomes more significant for moderately soluble compounds [Munz and Roberts,
 1984; Roberts et al, 1985]. The aqueous/gas transfer term is expressed as,
                                                            x"
0
                                                                                    (2.33)
                                                18

-------
Here the equilibrium aqueous phase mole fraction of component c is related to the corresponding gas phase
mole fraction with (2.23).

    The rate of mass transfer between the aqueous and solid phases is also assumed to be controlled by
resistance in the aqueous phase,
                                                                                            (2.34)
where x%s . is the aqueous phase mole fraction in equilibrium with the solid phase loading as computed by
(2.25).

    Rate limited mass transfer into the biophase is assumed to occur through an immobile liquid film
adjacent to the biomass. Diffusional mass transfer resistance into the biophase can be represented with,
                                     Eabc = PaKabc (xbc ~ -V)                               (2.35)

where Kabc is a lumped biophase/aqueous phase mass exchange coefficient for component c.
2.4.3   Biotransformations
The biodegradation module of MISER can model up to six spatially heterogeneous variables; three
biodegradable organic substrates (contaminants), oxygen as the electron acceptor, a limiting nutrient, and
the biomass. Monod-type kinetics are used to describe the microbial consumption and growth processes.
   s approach assumes that the conversion of contaminant into biomass is not instantaneous.  Additionally,
  icrobial activity may be limited by the diffusional mass transfer resistance described with (2.35) above. In
  is approach biotransformation is coupled to the aqueous phase component balance equations (2.13b), by
  e exchange term Eabc.
microbial activity may be limited by the diffusional mass
this approach biotransfo
the exchange term Eabc.

    No mass transfer resistance internal to the biophase is considered due to a lack of information and the
difficulty in determining the additional parameters needed to represent such processes.  The biophase mole
fraction profiles of the contaminants, oxygen and the limiting nutrient are therefore assumed to be uniform
within the biophase. This assumption is based on two concepts. First, that microbial populations in the
subsurface are generally low and hence that microcolonies can be modeled as fully penetrated biofilms.
Secondly, that microbial kinetics within the biofilm are fast relative to the time scales of the physical
processes in bioventing and thus biophase concentration profiles can be considered to be at "pseudo-steady
state" during a time step. By assuming a uniform concentration within the biophase (i.e. a fully penetrated
biofilm or a quasi steady state consumption of the substrate /) the mass transfer expression (2.35) can be
related to biophase utilization  by a Monod-type kinetics expression [Williamson andMcCarty, 1976] as,
       — (Sbpaxbc) =
       at
                          c - FdkiX
(2.36)
where:
        Fci     is the use coefficient of component c with substrate / degradation [(mole c)(mass /)~1],
               Fci = Mc~l when c — I. Note that Fci is input in units of gm c/gm / and is converted
               internally;

         ki     is the maximum specific substrate utilization rate of substrate / [(mass /)(biomass 71)"1];

         X     is the active biomass concentration [ML~3] expressed on a media volume basis;
                                               19

-------
        Kst     is the half-saturation coefficient of component / [(mole /)(mole biophase)  *]. Note that
               KSI is input in units of gm //liter and is converted internally;
         //     is a substrate inhibition function described below [-];
        /02     is an oxygen inhibition function described below [-];
        I A     is a nutrient inhibition function described below [-]; and
        Is     is a saturation inhibition function described below [-].

When c = Oz or A, the Monod expression on the right hand side of (2.36) must be summed over all the
substrates, /. Equations of the form (2.36) comprise a system of coupled nonlinear equations.

    A second approach used to model biodegradation is to assume that constituents in the aqueous and
biophases are in equilibrium. The biotransformation sinks are then directly inserted into the aqueous phase
component balance equations (2.l3b) using,
                 Bac = -
                                        (2.37)
    Because the organic substrates may potentially have inhibitory effects on biodegradation at high
concentrations [Speitel and Alley, 1991; Huesemann and Moore, 1994; Mu and Scow, 1994], equations
(2.36) and (2.37) are modified to include inhibition kinetics. The following expressions for inhibition are
currently used,
                                   /i =  1 -
1 -
 XI
..max
Xl    .
(2.38)
where x"tin represents the minimum detectable mole fraction of / (currently 1 ppb on a mass basis) and
xfax is the inhibitory mole fraction of substrate /. In the presence of several substrates, inhibition may be a
function of the total substrate mole fraction. In this case, xi in (2.38) is the sum of all the substrate mole
fractions.  Jtf"'" remains the same and x™ax can have different values for each substrate. Equation (2.38) is
also used to represent nutrient inhibition by replacing / with A and setting xfn = 0.

    Microbial activity is assumed to be restricted by a threshold oxygen concentration below which aerobic
metabolism ceases. This effect is  modeled with an inhibition function of the form,
                                         I
-------
    Both the equilibrium and nonequilibrium descriptions of biotransformation discussed above require
additional expressions describing the growth and decay of the attached biomass. Here, an ordinary
differential equation based on Monod kinetics is used,
     dX
     ~dt
where:
                                 &02
                            Kso2 + xb
                                          02
KSA + xbA
                                                                             X
                                         (2.41)
               is the biomass yield coefficient for the metabolism of substrate / [(biomass)(mole /)"'].
               Note that F/ is input in units of (biomass)(gm /)"' and is converted internally;
               is the microorganism decay coefficient [T   ];
               is a function which prevents the biomass from exceeding a maximum concentration given
               by,
                                                                                         (2.42)
Xmax     is the maximum allowable biomass concentration
 Imin     is a function which maintains a minimum concentration reflecting the indigenous
         population present in uncontaminated subsurface environments,


                               Imin = (1	^- } ; and
                                     V     A  /

X/n;n     is the background or indigenous concentration of biomass.
                                                                                         (2.43)
The detachment or sloughing of the attached biofilm is not considered in this equation due to a lack of
information regarding the necessary parameters to model this process.
2.5   CONSTITUTIVE RELATIONS
2.5.1   Capillary Pressure
Capillary pressure is defined as,
                                         P — P   — P
                                         * c. — I nw   in.
                                                                                    (2.44)
where Pnw and Pw are the phase pressure in the non-wetting and wetting fluids, respectively. In soil
systems containing only two fluid phases (e.g. gas and aqueous), capillary pressure data is routinely
measured and related to fluid saturation. A common fitting function for such two phase gas-aqueous
capillary retention data was developed by van Genuchten [1980],
                                                                                         (2.45)
where:
                                               21

-------
                 Sa = sf fr   is the normalized aqueous saturation [-];
                       1—-Vo
                         Sra   is the residual aqueous saturation [-];

                         asa   fitting variable [LT2M~' ]; and

             n, ;n = 1 — 1/n   are additional fitting variables [-].

Here, the wetting fluid is the aqueous phase and gas phase is the nonwetting fluid.

    In contrast to two phase systems, capillary pressure behavior in a porous medium containing three fluid
phases (gas, aqueous, and organic) is difficult to measure.  Consequently, three phase behavior is typically
estimated from two phase capillary pressure data. A parametric model developed by Parker et al.  [1987] is
frequently used to estimate three phase capillary pressure. This model assumes the aqueous phase is the
preferential wetting fluid, gas is the nonwetting fluid, and the organic phase retains intermediate wettability
and completely separates the gas and aqueous phases. Thus, gas-aqueous interfaces do not occur in the
three phase system. Under such conditions the two phase organic-aqueous relation is assumed to control
the aqueous phase saturation, and  the two phase gas-organic relation is assumed to control the total liquid
saturation regardless of the proportion of aqueous and organic liquids.  Extensions of the three phase
estimation model have been developed for hysteretic behavior and capillary entrapment of organic liquid
and gas \Kaluarachchi and Parker, 1992].

    The parametric model described above is mathematically expedient, but requires the explicit evaluation
of an organic liquid pressure. Tracking the pressure of an organic liquid which is assumed to be at
immobile residual saturation is a difficult prospect that is complicated  by limitations of the three phase
parameteric model. The parametric model predicts organic liquid entrapment by the water phase, but not by
the gas phase. Thus, evaluation of the residual organic liquid pressure  is uncertain in a system containing
residual water, and can only be exacerbated by the effects of volatilization from the organic phase . The
parametric model also predicts a discontinuity in capillary pressure due to the appearance and
disappearance of the organic phase which can potentially lead to numerical difficulties. Lastly, the
assumption that the organic phase completely partitions the gas and aqueous phases may be invalid for
nonspreading organic liquids [McBride etai, 1992; Wilson, 1992], leading to further difficulties in the
tracking of organic liquid pressures.

    Due to the conceptual difficulty of tracking the pressure of an organic liquid which is assumed to be at
immobile residual saturation, MISER assumes that all capillary behavior is independent of the organic
liquid pressure.  The aqueous phase saturation is related to the two phase gas-aqueous capillary pressure
data (2.45), regardless of the proportion of aqueous and organic phase, or the spreading characteristic of the
organic phase. Hysteretic behavior in this relation is also neglected. Under this assumption of effects of air
entrapment on fluid distribution is neglected. While these effects may  be significant under some conditions,
neglecting hysteretic behavior due to air entrapment should not pose a significant limitation in modeling
field scale SVE/BV systems due the typically large uncertainty in quantifying distributed capillary and
relative permeability parameters.

    With the assumptions described above, eq. (2.45) is used to determine aqueous saturation from
predicted gas and aqueous pressures. Subsequently, gas phase saturation is calculated from (2.2). In the
case when the total liquid saturation is greater than one, then Sg is set  to zero and Sa = 1 — $„.
                                                 22

-------
2.5.2   Relative Permeability

Relative permeability expressions for the three phase system are obtained from the model of Parker et al.
[1987].  This model employs correlations developed by Mualem [1976] to relate effective permeability with
Pc (5) data. The functional forms for the aqueous and gas phases are,
                                   L.   — ~c1/2n  _ n   ~?l/
                                   -ra — oa  U    U — Ja
                                                                                         (2.46a)

                                                                                         (2.46b)

where St = Sa + S0. Because the organic phase is assumed immobile throughout SVE operations,

                                             kro = 0                                       (2.47)

As discussed above, hysteretic behavior in the relative permeability relations due to gas entrapment is
neglected.


2.5.3   Gas phase density

At common environmental conditions (0-50 °C, & I atm.), the gas phase molar density can be accurately
estimated with the ideal gas law [Lyman, 1982],
                                              _Pg_
                                              - RT
                                                                                          (2.48)
The gas phase mass density is then given by,
                                                                                          (2.49)
2.5.4  Liquid Phase Density

Compressibility of the aqueous and organic phases is considered negligible for environmental pressures
expected during typical venting operations. Liquid density is computed as a function of composition and
temperature.

    The molar density of liquid mixtures at constant temperature and pressure is estimated with Amagat's
Law [Reid et al., 1977],
                                       P« =
                                                                                          (2.50)
where p* is the mass density of pure component c at the mixture temperature [ML~3]. Amagat's Law
assumes the volumes of the mixture components are additive. This assumption is valid for mixtures of
similar components which are at low to moderate pressures and temperatures not close to the critical point
of the mixture. These conditions are readily met for common organic contaminants in typical
environmental settings.
                                               23

-------
2.5.5  Gas phase viscosity

Gas viscosity is independent of pressures at the relatively low pressure encountered in environmental
settings (below 10 atmospheres) [Welty et al., 1984]. Under these conditions the gas phase mixture viscosity
can be estimated as a function of composition using the semi-empirical formula [Reid et al., 1977],

                                       V-R = V, T-/fe^l                                  (2.51 a)
                                                                                          (2.5 Ib)
where fjLc and IJL ; are the viscosity of components c and j in the pure state at the system temperature.
2.5.6  Aqueous Phase Viscosity

The aqueous phase viscosity is assumed to be independent of composition and pressure. For steady state
temperature conditions the aqueous phase viscosity is constant in time.
2.5.7  Hydrodynamic Dispersion

Dispersive fluxes are assumed to be significant in the mobile aqueous and gas phases only; diffusion within
the immobile NAPL and biophase is neglected, as is surface diffusion within the solid phase. A traditional
groundwater modeling approach is used in applying Pick's Law to evaluate combined processes of
mechanical dispersion and molecular diffusion. For an isotropic medium the dispersion tensor is evaluated
by [Bear, 1972],
                               = cti\qa\Ski + (SaTaD™f&L.T                (2.52)
                            LT
                                                       via \
where:
 
-------
2.5.8  Matrix Compressibility

Changes in the soil porosity are assumed to be negligible under pressure changes induced in typical
SVE/BV systems. Thus,

                                           JP =°
(2.54)
                                             25

-------
                                         Section 3

                      NUMERICAL DEVELOPMENT
    The mathematical model of SVE/BV processes developed in the preceding section consists of a number
of coupled nonlinear partial differential equations. A numerical solution of these equations is developed
using the Galerkin finite element method. This approach is well suited for the simulation of SVE/BV
scenarios and has advantages over other methods in the ability to accurately represent boundary conditions
and source/sinks, as well as flexible discretization of irregular and heterogeneous domains. The governing
equations are solved in two space dimensions; either a cross sectional x-z domain, or an axisymmetrical r-z
domain. This section describes details of the numerical algorithm implemented in MISER.
3.1   FINITE ELEMENT APPROACH

The Galerkin finite element method has been widely used to solve groundwater flow and transport
equations. Detailed descriptions of this method are found in several reference texts (Strang and Fix, 1973;
Lapidus and Finder, 1982; Huyakorn and Finder, 1983; Zienkiewicz and Taylor, 1991].

    The finite element method is based on a weighted residual technique to approximate the solution, u, of
the general differential equation represented by,

                                        L(«) - / = 0                                    (3.1)

The solution domain, £2, is first discretized into a network of elements which are connected at discrete
nodal points. Within each element the dependent variable u is approximated by a trial function u,
                                                                                         (3.2)
                                           J=l
where Nj are the basis functions; iij are values of the dependent variables at nodes of the element, and ne is
the number of nodes in the element. Substituting u into (3.1) results in an error or residual. This residual is
weighted and integrated over the domain, £2, developing the weighted residual equations as,
 f (L(u) - /)
Jo.
                                                       = 0
(3.3)
where VV/ is an arbitrary weighting function. In the Galerkin finite element method the weighting functions
are chosen to be the basis functions. Combining (3.2) and (3.3) leads to a system of n simultaneous
equations which are solved for the all the unknowns, M,-, at the n nodes in £2.

    Application of the Galerkin finite element method in MISER employs triangular elements for spatial
discretization and linear basis functions. Triangular elements are advantageous for the discretization of
irregular and heterogeneous domains. They also simplify the evaluation of integrals in the weighted
                                              26

-------
                   Xi.Z,
                                                                        x3.z3
                                         X2,Z2
                                                  x,,z,
                                                                                     X2.Z2
                                                                                 L2=1
  Figure 3.1 :  Triangular element in global and transformed coordinates (after Lapidus and Finder, 1982).

residual equation by the use of local area coordinates. Figure 3.1 shows an arbitrary triangular element in a
two-dimensional Cartesian domain and the transformed element in local area coordinates.

    Linear basis functions for triangular elements may be developed in global coordinates as [Lapidus and
Finder, 1982; Huyakorn and Finder, 1983],
                                                                                            (3.4)
where,
                                               = 3*2 — w,    y\ = *3 —
                                                                                            (3.5)
and,
j.
2'
                                              z\
                                              Z2
= area of the triangle
(3.6)
    Transformation from the global coordinates (xy,zy) to the local area coordinates (Ly) is obtained by,

                                                  A,-
                                            LJ = -fe                                       (3-7)

where the subarea Ay is defined by the point of interest within a given element and the element vertices
(Figure 3.1). Since A\ + A2 + A3 = A then LI + L2 + L3 = 1.0, and it can be shown that the local
coordinate variables Ly are equivalent to the basis function Nj [Lapidus and Finder, 1982; Huyakorn and
Finder, 1983]. The advantage of using the local area coordinates is that simple integration formulas have
been developed for linear basis functions [Lapidus and Finder, 1982],
                                                (mi + m2+m3+'2)!
                                                                    2A
                                         (3.8)
                                               27

-------
where £2C is the domain occupied by element e. Differentiation of the basis function yields,
                                      dx
        dx    2Ae
dN,    9L,-
                                                    Yj
(3.9a)

(3.9b)
                                      3z     9z    2Ae
    After transformation to local area coordinates the weighted residual equation (3.3) can be expressed as,

                                                        = 0                           (3.10)
                                 e=l
where Ne is the number of elements in £2.
3.2  SOLUTION OF THE PHASE MASS BALANCE EQUATIONS

The aqueous and gas phase flow equations (2.6) are solved by the simultaneous solution (SS) method [Aziz
andSettari, 1979]. In this approach fluid pressures are selected as the primary dependent variable, and the
flow equations are solved simultaneously for Pa and Pg. Saturations are subsequently updated from
capillary pressure-saturation relations (2.45).
3.2.1  Pressure Based Formulation

The simultaneous solution scheme is developed by first recasting the flow equations in terms of the primary
pressure variables. The time derivatives in (2.6) are expanded as,
    The first term on the right hand side (RHS) is the change in mass storage due to matrix compressibility,
which is assumed to be negligible.

    The middle term represents the temporal change in phase density. Density of the aqueous phase is
assumed to depend on composition only. Moreover, the temporal change of this term is assumed to have a
minor influence on the aqueous flow field such that it can be lagged by a single time step and moved to the
RHS. The density of the gas phase, however, depends on composition and pressure. The temporal change
of gas density may be expanded as,
                                  a r ji/f D n       fl/f a D        D  a KA
                                                                                       (3.12)
                                                               8 RT  dt
Similar to the aqueous phase, changes in the gas phase density due to temporal changes in composition (i.e.
the last term in (3.12)) are assumed to be small such that they can be lagged by a time step.

    The last term on the RHS of (3.11) accounts for change in phase mass storage due to change in fluid
saturation. This term is expanded in terms of capillary pressure, obtaining,
                                                                 P \
                                                                                       (3.13)
                                             28

-------
where C,,a = dSa/dPc is the capacity coefficient. Note Cp = Cpa = dSa/dPc = -dSg/dPc.

    The pressure based aqueous and gas flow equations are developed in two dimensional coordinates by
substituting (3.12) and (3.13) into (2.6), dividing through by p*, and expanding the spatial derivatives,
                                               - Pa8x    -
-^,  ~
                              dx
-g»
dp*
                                        dp*
-A*
                                              dz
                                                                                        (3.14a)
                                                                 dz
                                                                                        (3.14b)
where gx and gz are components of the gravitational acceleration vector. Division by the phase density is
performed to simplify the specification of boundary conditions.
3.2.2  Trial Functions and Weighted Residual Equations

Standard trial functions are employed for the primary variable, Pa, and for secondary variables p*, Ea, and
^•a»                                         :
                                              3
             Pa(x, y, 0 -
                                                                                        (3.15a)
                                                                                        (3.15b)


                                                                                        (3.15c)
                                                                                        (3.15d)
                                             7 = 1
    Based on the work ofAbriola and Rath/elder [1993] and Rath/elder andAbriola [1994], nontraditional
finite element approaches are used in defining trial functions involving products of dependent variables and
coefficients. In this work it was found that computational efficiency and material balance properties are
                                              29

-------
enhanced when products are expanded collectively with a single basis fimction. The following trial
functions for the terms in (3.14) are defined,


                                 (i)Sg 3P8 ~, ^ V^  SSj  dPgj ,r
                   RTpg  dt
                                                           dt
                        dt
                         3
                        E
                       w=i
                                                  i
                                                J — 1
                                              y=l

(3.16a)



(3.16b)



(3,16c)



(3.16d)


(3.16e)


(3.16f)
where (j>e is the porosity in element e.
    Substituting the trial functions (3.15) and (3.16) into (3.14) and applying Galerkin's method and
Green's theorem leads to the weak form of the weighted residual equations. For the aqueous and gas
phases, respectively, the weak form is expressed as,
                                                    dN;
                                                                                           (3.17a)
= E /ff
                                                                 aj
                  _RTJPgj
        j?j	Sj_XT 	/-*   /   ffy 	    ^j \
        /p-f,  a?    y~  Pj\ dt      dt  )
                                                                                dNi
                                                30

-------
                                                  9Ni
                                                                                         (3.17b)
                           Sj
         "Sj
where the summation convention is used for the repeated subscript j, Ye is the domain boundary of domain
associated with element e, and n is an outward unit normal vector.

    Performing the integration over each element and assembling the resulting equations yields a global
system of time dependent ordinary differential equations with nonlinear coefficients,
[A]
                                       + [B] {P} = {F} + {E} + {Q}
(3.18)
where {P} is the vector of pressures at all nodes and is ordered with alternating aqueous and gas pressures,
[A] is the mass matrix, [B] is the stiffness matrix, and {F}, {E}, and {Q} are the RHS matrices. MISER
also includes an option to lump the mass matrix. Detailed development of the element matrices is given in
Appendix A.
3.2.3  Capacity Coefficients
Treatment of the capacity coefficient is based on the work ofAbriola and Rath/elder [1993] who
investigated mass balance accuracy in two-phase flow problems. They showed that finite element solution
with the SS scheme is mass conservative when the accumulation term is approximated with the
nontraditional trial function in (3.16b) and the capacity coefficient is evaluated with the standard chord
slope approximation,
                                              0*,f+I  I  Of
                                       -      "'   +S"                                  (3-19)
                                                      P'c;
where k is an iteration counter. Cpi is set to a dummy minimum value (1 x 10~7) at the first iteration
(k = 1), and additionally if the calculated value of CP! is less than the minimum value.
3.3   MATERIAL PROPERTIES

The representation of heterogeneous soil properties is essential for accurate representation of field
processes. Discontinuities in soil properties produce discontinuities in dependent variables such as
saturation, mobility, and mass exchange. Since these parameters influence transport and degradation
processes, the method used to represent discontinuous material properties can influence simulation results
and interpretation. Discontinuities are typically handled by averaging adjacent, but different material
properties [Voss, 1984; Simunek et al., 1994]. This can introduce a smearing or dispersion effect that
                                               31

-------
                     Element Properties
                          porosity
                         permeability
                         soil density
                        organic carbon
                         dispersiyity
                          tortuosity
                     Freundlich parameters
                   van Genuchten> parameters
                    element average velocity
                         media 1
                        S«W«IS
                         media 2.
                    Stacked Modal Properties
                           saturation
                  Interphase exchange (computed)
                           mobility
     Domain Properties
mass transfer coefficients (input)
    biological parameters
         retardation-
    Klinkenberg parameter
      aqueous viscosity
        media 3
       «ffiS«»CS
        media 4
     Nodal Properties
        pressure
      mole fractions
        biomass
         density
       gas viscosity
    nodal Darcy velocity
                            Figure 3.2: Variable representation in MISER.


necessitates grid refinement for the accurate representation of interfaces.  Such refinement, however, may
not always be possible for the simulation of large and/or strongly heterogeneous domains. MISER
incorporates a unique data structure for the representation of discontinuous properties at soil interfaces.
MISER maintains and numerically tracks discontinuous variables at material property interfaces, including:
saturation, mobility, and interphase exchange. These variables are termed 'stacked nodal variables' (Figure
3.2) because multiple values can exist at a single node. A maximum of four material property blocks may

be contiguous at a given node.

    Other variables are treated as either continuous nodal properties (material independent), element
constant variables (material dependent), or domain properties (spatially invariant). Figure 3.2 identifies
variables in each group.
3.4   VELOCITY EQUATIONS


MISER includes two optional approaches for evaluating aqueous and gas phase specific discharges from
Darcy's Law (2.3). The first approach generates element wise constant fluxes by solving (2.3) directly,
                                                                                             (3-.20a)
                                                                                            (3.20b)
where:
                                                 32

-------
         q^x   is the element constant specific discharge of phase a in the x direction [LT~1];

         q#z   is the element constant specific discharge of phase a in the z direction [LT~l}\

        Xeaxx   is the element averaged mobility of phase a in the x direction [M~1L3T];

        Xea^   is the element averaged mobility of phase a in the z direction [M~ l L3 T] ; and

          pea   is the element averaged phase mass density [ML~3].

The element averaged mobilities are computed from,
                                               2-,
                                                                                          (3.21)
Averaging of the phase density is done in a manner that is consistent with the spatial variability of the
pressure term [Voss, 1984],
                                               '3   l  EL
                                               •7=1 I  3z
                                                                                          (3.22)
    The second option is the calculation of nodal specific fluxes by solving Darcy's Law (2.3) with the finite
element method. This approach eliminates discontinuities in the velocity field that are present when using
element average velocities. The use of a continuous nodal velocity field has been shown to yield significant
improvements in mass balance for the transport equation [Yeh, 1981]. After substituting the trial functions
and applying Galerkin's method to (2.3), the weighted residual equations for the aqueous phase are,
N
E
e
                   f  q^NjNtdOT = -E
                =l  "                  e=l
                                                   Nj
?^-Pl1**Nj)WV


                JV   f
                EI 9«w
                7=1 J «e   '
where the summation convention is used for the repeated subscript j.
(3.23a)


(3.23b)
    For the gas phase, a modified version of (2.3) is used which is expressed in terms of the equivalent head
[Mendoza and Frind, 1990]. The weighted residual equations for the gas phase are,
        N'  f
       5/,
        Ne



                                                                                         (3.24a)


                                                                                         (3.24b)
where the summation convention is used for the repeated subscript j, p*0 is the mass density of the
uncontaminated gas phase, and the equivalent head hgj is defined by,

                                               Pg.
                                        h   —   8j 4- 7 •
                                          ' — o*  p

Additionally, nodal gas phase velocity is set to zero when the gas phase saturation is less than a user
specified value, currently set at 5%.
                                                                                          (3.25)
                                               33

-------
3.5   COMPONENT MASS BALANCE EQUATIONS
The transport equations are solved in sequence [Reeves, 1993; Reeves andAbriola, 1994]. They are first
modified to eliminate the divergence of velocity which is not defined when using a linear interpolation
space to approximate the pressure field.
c) + V • Sa (paxac Va -
      ac  = Eac + Bac
    The general form of the component balance equation from Section 2, eq. (2. 1 1) in molar form is,
                  r\
                 —

The first two terms in (3.26) are expanded using the chain rule,
                f\                  O
            Xa—tySapd) + (j>Sapa —
               at                at
                    V - (SapaDhac V xac) = Eac + Bac

Equation (3.26) is next summed over all the components c in phase a and multiplied by xac,
                                                                                        (3.26)
                                            ttc V (SapaVa) + 4>SapaVa- V (xac) -
                                                                                        (3.27)
= xa
                                                                    Btt)
                        a              ac   •    aaa     ac
                          at

Substituting (3.28) into (3.27), the divergence in velocity term is eliminated, obtaining,
                            #\
                           — (XaJ + 4>SapaVa- V (*«,) - V •

                                          - xac (Ea + Ba)
                                                                                        (3.28)
                                                                                        (3.29)
    The nonequilibrium mass exchange terms are evaluated with the linear driving force expressions
described in the preceding chapter. These expressions have the general form,
                                                                                        (3.30)

where Eapc is the rate of moles of component c transferred to the a-phase from the ft phase per pore volume,
and K%p  is the equilibrium phase partitioning coefficient for the a phase in contact with the /3 phase.

    The nonlinear biotransformation reaction terms, Bac, are developed in detail in Section 3.6. Presently
these terms are represented by,
                                         Bac = (Jiacxac                                   (3.31)
where tiUe represents aMonod-type nonlinear reaction coefficient [mole L~3r~1].

    The foregoing expressions are used to develop a general form of the transport equation. Substituting
(3.30) and (3.31) into (3.29) and rearranging, the general form of the transport equation is,
                  SaPa—(xac)
                                                 - V •
                            Uc I Pa ^2 Kctflc
                                                                                         (3.32)
                                              34

-------
Note that the last term on the right hand side of (3.32) reflects those mass transfer terms for which the mass
transfer resistance is assumed to be present in the ft phase. In (3.32) the coefficients included in the mass
exchange terms reflect which phase controls the equilibrium partitioning and nonequilibrium mass
exchange. To simplify notation and to facilitate the development of general finite element equations, the
following lumped coefficients are defined,
                                  — P<*
                                                        (3.33a)
                                                                                          (3.33b)

These terms contain the mass exchange and bioreaction information and may be different for each phase
and component. Tables 3.1 and 3.2 summarize the phase and component dependencies of these lumped
coefficients. Substituting (3.33) into (3.32), the final form of the general transport equation in molar form is,
           O
          —
                                       V •
                                                                                           (3.34)
    Equation (3.34) is used to model transport of component c in the two mobile phases. The transport
equation for the immobile phases (organic, solid, biophase) is derived directly from (3.34) by neglecting the
advective and dispersive terms, obtaining,
— (Xac) +
                                                           a — O, S, b
(3.35)
Note that for the solid phase, the principal variable is the mass loading, a>Sc, the bulk solid phase mass
density, p*, is used on the LHS in place of
-------
Component
organic

water
oxygen
nutrient
Phase pair
gas-organic
aqueous-gas
aqueous-organic
aqueous-solid
aqueous-biophase
all others
aqueous-gas
all others
aqueous-gas
aqueous-biophase
all others
aqueous-gas
aqueous-biophase
all others
Mass exchange expression ;
£:;=P!W'">
17 _ #•• / z^e v \- \
'J-'aSy — Pa^asy vjv«^ YASy ^ay)
^--M^J
Jj1 	 f\
\:^Kf
                         Table 3.1: Summary of mass transfer expressions.
After applying Green's Theorem the weak form of the weighted residual equation (3.36) is,
±dQ.e
              = E /Q, 7'., NiN'dff + E /r, {*'«., A.,
                                      "'
                                                                                         (3.37)
    When retardation is considered in the aqueous phase, the time derivative term in (3.37) becomes,
                                                                                         (3.38)
Retardation may be considered for any component of the aqueous phase. When retardation is included,
nonequilibrium mass exchange to the solid phase is not allowed for any aqueous phase component.
                                              36

-------
Phase
organic
Aqueous





Gas

Solid
Biophase

Component
organic
organic

02

water
nutrient
organic
water
nutrient
organic
organic
oxygen
nutrient
Lumped Mass Exchange and Bioreaction Terms
F°Jy =
Kay =
^ -
K002 =
~Fa02 =
J_am =
I1 I
FJY =
f£ =
FgA =
"F*
r; :
SY
Kby ' =
F_by =
£bA =
E0
-Ea0y - 4>Eg0y
Ea+ Ba+4>Pa (KaoY + Kagy + Kaby + KaSy)
*r^^ + V^, + ^r
Ea + Ba+ (t>pa \Kag02 + Kabo2) ~ f^ao2
pa (Kag02Keagofg02 + KabQ2xbo^
Ea
fiEa + Ba + 4>pa \KagA "h Kabfj — fJ,aA
Eg + (j)pgKg0
Eg
4>Eg
0
— (j)E
f^by
—Eaby
=*c
              Table 3.2: Summary of lumped mass exchange and bioreaction coefficients.

    Equation (3.37) applies to the mobile aqueous and gas phases. The weighted residual equations for the
immobile phases are developed from (3.37) by dropping the advective and dispersive terms. For the organic
phase the weak form of the weighted residual equation is,
(3.39)
                /•  f            dx»c-     ;—       -    }          ^  r -
                /    ^S0jp0jNj—-^Nj + K0  NjXoc NJ  Nidtf = E /  FOCJ NjNidQ
            =\ jQ'e I             at                    }          e=\ Ja'
A similar equation can be developed for the solid phase. Note that since mass exchange is assumed to be
                                               37

-------
negligible compared to the mass of the solid phase, E* = 0,

                N'  r  {   9
-------
      restriction applies to a single element. Over several elements a much closer approach to equilibrium
      is possible with MISER (see Section 4,3.4).

   2.  When the organic phase is present in a given element, organic mass exchange is not considered
      between the aqueous and gas phases, the aqueous and solid phases, or between the aqueous and
      biophase.                      ,

   3.  Exchange into the gas phase from the organic phase is not allowed when the gas phase saturation
      falls below a specified value, (currently 0.05)..

   4.  The exchange terms for organic phase volatilization are;adjusted downward when the predicted
      exchanged component mass for an element is greater than the organic phase component mass present
      in the element. The exchange terms are reduced by the ratio of the total component mass present in
      the element to the original predicted component exchange mass.

   5.  Mass is not allowed to partition from the aqueous or gas phases into the organic phase when only one
      organic component is present.

   6.  Oxygen mass transfer from the aqueous  phase to the biophase is allowed only when the aqueous
      phase oxygen mole fraction is positive.

   7.  Nutrient mass transfer from the aqueous phase to the biophase is only allowed when the aqueous
      phase nutrient mole fraction is positive.
3.6   BIOLOGICAL REACTIONS
Biological activity is described with Monod-type kinetic expressions. As shown in Table 3.2 these
expressions can be inserted directly into the aqueous phase component transport equations or into a
separate biophase component transport equations when mass transfer rate limitations to the biomass are to
be considered. The nonlinear rate coefficient /j,ai takes three forms as follows, one form for the degradation
of organic substrates, one for the utilization of oxygen, and the last for the utilization of nutrient,
                                  1
                                     •or;
                                                               *-cto2
                                               >'O
                                                                   *-ctA
    Biomass growth, maintenance, and decay is governed by an ordinary differential equation,
                              ,]V    /                          \
                              —77 — I 2_/ (^l^a,Xa,Imax} — ^-dlmin I X
                              at    \ I                        /
(3.43b)


(3.43c)
 (3.44)
    In order to reduce negative mole fractions in either the biophase transport equations when considering a
separate biophase, or in the aqueous phase transport equations when they have the bioreaction term inserted
                                               39

-------
directly, the size of the bioreaction term is limited in some cases. If the calculated bioreaction term over the
course of the current time step will consume more of the component to which it applies than is available,
the bioreaction term is reduced by the ratio of available component rnass to projected required component
mass. The available component mass is defined as the mass of component present in the appropriate phase
plus the projected amount of component to be delivered to the appropriate phase through interphase mass
exchange. Other affected bioreaction terms are also reduced. For instance, if a organic component reaction
rate is reduced, that component's contribution to oxygen and nutrient usage, as well as to biomass
production, must be accounted for. A reduction in oxygen or nutrient reaction rate affects all the organic
components and biomass production. In addition, Monod terms are zero when the corresponding
component is below a preselected minimum detectable value, currently set to 1 ppb by mass.
3.7   NAPL SATURATION

The numerical formulation is completed with an expression describing the change in organic phase
saturation. Since the organic phase is assumed to be immobile, changes in organic saturation result solely
from interphase mass transfer as indicated in (2.7). Expanding the time derivative term of this equation and
substituting the summation over the phase exchange terms as previously defined gives,
                                        dt
         dt
                                                                                         (3.45)
Because the organic phase is assumed to be incompressible, -jf- is strictly a function of composition.
Furthermore, since the organic phase saturation is updated after convergence of the phase compositions, the
density derivative term is known and can be moved to the right hand side along with the exchange terms,
                                                                                         (3.46)
                                                                                         (3.47)
The weighted residual equation for (3.46) is then developed as,
2* = E £ * \f0iN, - SojNj^Nj} N,
The solution of (3.47) is obtained by mass lumping the left hand side. When the organic phase consists of
only one component, the resulting finite element equation is explicit in organic phase saturation since the
density derivative term is zero. When more than one organic phase component is present, (3.47) is solved
iteratively because the organic phase saturation appears on both sides of the equation. Additionally, the
organic phase saturation is never allowed to fall below zero.
3.8   AXISYMMETRIC COORDINATES
An axisymmetric coordinate system (r-z) is simulated by multiplying the element matrices by [Huyakorn
and Finder, 1983],
                                27T
                            re = — (n + /-2 + rs)            for (r-z)                      (3.48)
                                              40

-------
where r/ is the radial coordinate of node /.The horizontal coordinate x is then taken to represent the radial
distance r. When simulating a cross sectional (x-z) domain, 7e is set to unity,
                                                     for (x-z)
                                                                                          (3.49)
3.9   TIME DISCRETIZATION
Consider the following generic finite element equation,
                                    I- J  f\ ,   '  t-  J 1 J

A standard finite difference approach is used to discretize the time derivative in all the finite element
equations developed above [Huyakorn and Finder, 1983],

                                      9/1,1    f,.lk+l,t+l
                                      \ul    W
                                                                                          (3.50)
                                                                                          (3.51)
where k is an iteration counter; A? is the time step; and the superscript t + I represents the t + A? time
level. A variable time weighting factor, 9, is included in MISER and is defined as,
                              [u}k+l't+l = 0 {u}k+l't+l + (1-6) {«}'

where 0 — 1 is used for fully implicit time stepping and 6 = 1/2 is used for Crank-Nicholson time
stepping. Substituting (3,51) and (3.52) into (3.50) yields,
                                                                                          (3.52)
                               ] {u]
                     [A] + e[B]
    To reduce potential errors due to limited computer precision, the dependent variable is expressed as a
difference over the time step, Aut+l,
                                           = {uy
and substituting (3.54) into (3.53) yields,

                         -±-[A]+9[B]}
                          it           j
                                                   = -[B] {u}1 + {F}k't+l
                                                                                          (3.54)
                                                                                          (3.55)
Equation (3.55) is not used for the calculation of the velocities when (3.23) and (3.24) are solved. In this
case difference equation (3.53) is employed.
3.10   TIME STEP CONTROL

The time discretization starts with a prescribed time step size. This time step is adjusted automatically in
accordance with the following set of rules:

   1.  The time step size cannot be smaller than a prescribed minimum value.
                                              41

-------
  2. The time step size cannot be larger than a prescribed maximum value.

  3. During a given time step, if the number of iterations required for convergence of the flow equations
     and for convergence of the transport equations is less than prescribed numbers, the time step is
     increased by multiplying the current time step by a prescribed constant (> 1). Different values of the
     prescribed number of iterations may be specified for the flow and transport equations.

  4. During a given time step, if convergence of the flow equations or of the transport equations is not
     attained within a specified maximum number of iterations, the time step is decreased by multiplying
     the current time step by a constant (< 1). Different values of the maximum number of iterations may
     be specified for the flow and transport equations. If convergence is repeatedly not attained, the
     simulation will terminate when a minimum time step size is reached.

  5. Solution of the flow equations may be skipped for a specified number of time steps. The transport
     equations are always solved on every time step. Adjustment of the time step size proceeds as
     described above, however, the use of small multipliers for increasing the time step size is advised
     (< 1.1).
3.11   BOUNDARY CONDITIONS

3.11.1  Phase Mass Balance Boundary Conditions

Boundary conditions must be specified for the aqueous and gas phase mass balance equations as either
constant specified pressure (type I) or constant specified flux (type II).
    Constant pressure conditions may be specified at any node in the computation domain. This condition
is implemented by modifying the appropriate row in the global matrix equation (3.18) to,

                                               •] = 0                                    (3.56)
where / is the node at which constant pressure conditions are specified.
    Specified boundary fluxes are introduced through the source/sink terms. The flow across a boundary
segment of element e is represented by the surface integrals on the RHS of (3.17) and is expressed as,
                                     N*  r               N*    A
                                 = -E   a* AWr'= -!>««,-f-
                                     e=l •T'              e=i    *
(3.57)
where qa, is the boundary flux [LT~l] of phase a at the boundary node i and Qai is the total discharge at
node / [L3T~']. No flow boundaries (qa = 0) are the natural finite element boundary condition. The
boundary flux is assumed to be uniform over the cross sectional area, Ax., associated with the boundary
node i. This cross sectional area depends on the coordinate system and thus the specified flow must
properly reflect the cross sectional area.

    Due to compressibility effects the specified volumetric flux of the gas phase is referenced to free
surface conditions (fs) conditions which are assumed to 1 atmosphere of pressure at 20 °C. The free surface
                                               42

-------
conditions are related to the reservoir conditions (re) by a compressibility factor, G8 [-], which is evaluated
from the ideal gas law (2.49),
                                                      /P*rTK\
                                  Qg« = QgfsGg = Qg(s  —V                              (3.58)
3.11.2   Component Mass Balance Boundary Conditions

Boundary conditions are required for the gas and aqueous phase component balance equations. These may
be specified as either: constant specified mole fraction (type I); specified diffusional flux (type II),
                                             . _
                                              ~
                                                                                          (3.59)
where Lar is the thickness of the stagnant boundary layer in the contacting a phase fluid and x° is the
specified value of the component mole fraction in the contacting fluid; or mixed (type III) where'the
composition of an incoming fluid is specified along a boundary section,
                                                                                          (3.60)
                                    •~ ~ \j j\t i

When the boundary is impermeable or water flow is directed out of the domain, (3.60) reduces to (3.59).
Eqs. (3.59) and (3.60) are expressed at all nodes to which a given boundary condition applies.

    Constant mole fraction boundary conditions may be specified at any node in the computational domain.
This condition is implemented by modifying the appropriate row in the global matrix equation (3.55) to,

                                                                                          (3.61)

where i is the node at which constant mole fraction conditions are specified.

    Zero diffusive flux type n boundaries are the natural finite element boundary condition for the transport
equation, i.e.,

                                               *"<-•-"                       •           (3.62)
                                              dx.
                                                     =0
This boundary condition corresponds to setting the surface integral term on the RHS of (3.37) to 0. This
condition is used to represent those boundaries where advective transport is directed outward and there is
no mole fraction gradient at the boundary. Since the NAPL, solid, and biophase component transport
equations do not consider advective or diffusive flux no additional specification of boundary conditions is
required beyond the natural condition. This is also true for the NAPL saturation equation.

    Nonzero type II and type III boundary fluxes are introduced through the surface integral on the RHS of
(3.37). For type III boundaries, (3.60) becomes,
                                                          = QajnjXae -
                                                                                          (3.63)
The first term on the RHS of (3.63) represents the advective flux and is inserted into the matrix [B] in
(3.55). The second term is the total material flux and is added to the vector {F} in (3.55). The boundary
flux is evaluated in two ways. When the flow equations are solved, the boundary flux calculated for the
                                               43

-------
    well screen
    interval
                           k+1
               Figure 3.3: Representation of an extraction well in the discretized domain.

phase material balance calculation, or imposed as a boundary condition for the flow equations is used to
evaluate Qa. Otherwise the boundary flux is evaluated using the Darcy flux in the following fashion. The
boundary flux is assumed to be uniform over the cross sectional area, AXi, associated with the boundary
node i. The cross sectional area depends on the coordinate system and is evaluated by,
                             AX! = k
                             AX  =
for (x-z)

for (r-z)
(3.64a)

(3.64b)
Here // = |(/ei + lez) is the length of the boundary segment associated with node i and le\ and Ie2 are the
lengths of the boundary segments of elements el and el which are connected at node /. The average radius
of the boundary segment associated with node i is r/ = |(r/_i + In + r/+i). Here r/_i, n, and ri+\ are the
radii of the three nodes spanning e 1 and el. Nonzero type II boundaries are treated in the same manner as
nonzero type HI boundaries with the RHS of (3.63) being replaced by the RHS of (3.59) after evaluation of
the surface integral.


3.11.3   Extraction Wells

MISER incorporates the option to simulate radial flow to an extraction well positioned in the center of
axisymmetric (r-z) domains. Consider the problem of simulating an extraction well along the left boundary
of the domain shown in Figure 3.3. The well screen spans k elements and k + 1 nodes, and is assumed to be
parallel to the z-coordinate.

    Vadose zone extraction wells operate in regions of variable saturation and therefore typically remove
both aqueous and gas phases during operation. MISER requires the specification of the total combined
(aqueous and gas) extraction rate and then apportions the flow of each phase at each node along the well
                                               44

-------
screen. The flow of each phase is apportioned along the well screen by [Aziz and Settari, 1979],
               E
                     k  2
                    yyj
                    2-/Z^;
                                                                                  £»fs
                             (3.65)
where Qt(fs is the specified combined discharge at free surface conditions, and j denotes the nodes along
the well screen in element e. The cross sectional area associated with each node along the well screen is
computed by,
                                          Ax. = 2jrrweii//                                     (3.66)
where rwell is the radius of the well, // = i(lei + Ie2) is the vertical length of well segment associated with
node i, and le\ and Ie2 are the lengths of the element el and el which are connected at node i. Here it is
assumed that well is parallel with the z-coordinate.

    Further simplification is made by assuming that the potential gradient for each phase is the same in all
layers. The flows may then be apportioned solely by mobility,
                                 E
                                 e=l
     Q
      ttfs
(3.67)
where the aqueous compressibility is set to 1, and the gas phase compressibility is computed from (3.58).
This 'transmissibility allocation' method is generally valid when variation in permeability along the well is
small. However, the method "may give erroneous results in the case of large vertical heterogeneity and
especially when non-communicating layers exist" [Aziz and Settari, 1979].

    The appropriate boundary condition for the transport equations at an extraction well is type II with zero
diffusive flux.
3.11.4   Treatment of Injection Wells

Presently MISER is configured to consider the injection of gas phase only. Thus, under injection conditions
the specified total discharge, Qtt(s, is comprised solely of gas phase which is similarly apportioned along
the well screen by the transmissibility allocation methods, using,
                                   = E
                                           2_,e=l 2^;=1
Q
  gtfs
(3.68)
In the case when the denominator in (3.68) is zero (i.e. injection below the water table), then Qtt!s is
distributed uniformly over the well screen.

    The appropriate boundary condition for the transport equations at an injection well is type in which
specifies the composition of the incoming fluid.
                                               45

-------
3.12   ITERATION SCHEME

An iteration scheme is necessary to update secondary variables that are functions of the primary solution
variables. A Picard iteration approach is employed in MISER [Huyakorn and Pinder, 1983]. This approach
is implemented by simply lagging the secondary variables and iterating within a time step until a
convergence criterion is satisfied.

    A relative maximum differential is used to test convergence. For the flow equations convergence is
established by the change in pressure, evaluated by,
                                    max/\P5
                                            •k+l
                                                                                         (3.69)
                                       maxy|P*+M    -  7

where e/ is the convergence tolerance for solution of the flow equations.

    Mole fractions, *<*,., are used to control convergence of the transport equations. The transport equations
for the gas, aqueous, organic, solid and biophases are solved sequentially until convergence is achieved for
each equation. Two values of the convergence criteria are used, one for the gas and aqueous phase transport
equations, em, and one for the immobile phase transport equations, e,-. Convergence is measured by,
                                  max,-
                                     max,- be:
                                            •fc+ii
                                                    < Cm Or €/
                                                    (3.70)
                                            't*c,
For the solid phase, convergence is measured using solid phase mass loadings, coSc, otherwise the
expression is the same as (3.70).

    After convergence has been obtained for all the transport equations (3.47) is solved for the organic
phase saturations.  An iterative solution is not required if the organic phase is composed of only a single
component. When more than one organic phase component is present, convergence is measured using the
organic phase saturations,
max
                                               -.S*|
                                                                                         (3.71)
                                        max;
were e0 is the convergence criterion for the organic phase saturation. When a nodal organic phase mole
fraction falls below a user specified value (currently 10~3), convergence is not measured for that nodal mole
fraction.

    Table 3.3 summarizes the numerical iteration scheme employed in MISER.
3.13   SOLVER

The nonlinear discretized flow and gas and aqueous phase transport equations are solved using the Harwell
Sparse Matrix Package [Duff, 1979]. The specific flux equations are solved directly when calculating
element fluxes.  When calculating nodal velocities the Harwell package is used, unless the mass matrix is
lumped. In that case, the specific fluxes are solved for directly. The NAPL and solid phase transport
equations can also be solved using the Harwell Sparse Matrix Package. The NAPL and solid phase
                                              46

-------
                             Numerical Solution Scheme
Sequence
Description
Section Reference
1.
2.
3.
Problem Setup
Read input files and initialize variables as needed.
Calculate element areas.
Calculate initial mass in domain.
5.4
3.1
4.1
4.
Begin Iteration Over Time
Update phase molecular and mass densities.
2.5.3 and 2.5.4
           Solve Flow Equations
5.         Update gas phase viscosity.
6.         Begin iterative solution of flow equations.
  6a.        Update capacity coefficients and mobilities.
  6b.        Update well terms.
  6c.        Solve flow equations after imposing boundary conditions.
  6d.        Update gas and aqueous phase saturations.
  6e.        Update gas phase mole and mass density.
  6f.        Check convergence. Iterate to 6. if not converged.
7.         Update boundary fluxes for material balance and
           transport equation boundary conditions
           Update phase material balance.
                                                        2.5.5
                                                        3.2
                                                        3.2.3, 2.5.2
                                                        3.11.3,3.11.4
                                                        3.11.1
                                                        2.5.1
                                                        2.5.3
                                                        3.12
                                                        4.1.1

                                                        4.1
           Solve Transport Equations
9.         Update velocity field.
10.        Update bioreaction terms and biomass.
              Only when a separate biophase is not present.
11.        Begin iterative solution of transport equations.
   11 a.        Update biophase mole fractions and biomass.
               Only when a separate biophase is present.
   lib.        Update phase molecular and mass densities.
   lie.        Update mass exchange terms.   >•
   1 Id.        Update dispersion coefficients.
   lie.        Solve gas and aqueous phase transport
              equations after imposing boundary conditions.
   1 If.        Solve organic phase transport equations.
   1 Ig.        Solve solid phase transport equations.
   1 Ih.        Solve organic phase saturation equation.
   Hi.        Update gas and aqueous saturations
              if the flow equations are not included.
   1 Ij.        Check convergence. Iterate to 11. if not converged.
                                                        3.4
                                                        3.6

                                                        3.5
                                                        3.6

                                                        2.5.3 and 2.5.4
                                                        3.5
                                                        2.5.7
                                                        3.5.1 and 3.11.2

                                                        3.5.1
                                                        3.5.1
                                                        3.7
                                                        3.12
            Increment to Next Time Level
 12.         Update component material balance.
 13.         Print output if desired.
 14.         Adjust time step if indicated and proceed to next time level.
                                                        4.1.2

                                                        3.10
                Table 3.3: Summary of numerical scheme in MISER.
                                         47

-------
transport equations only have the thrie derivative term on the left hand side arid are solved directly when
mass lumped. In contrast, when considering a separate biophase, the biophase transport equations have
exchange and bioreaction terms oh the left hand side arid hence ate not diagonal after mass lumping. Thus,
the biophase transport equations ate always solved using the Harwell package. The &APL saturation
equatibn is always mass lumped and solved directly.
                                               48

-------
                                      Section 4

                         MODEL VERIFICATION
4.1   MATERIAL BALANCE CALCULATION


A material balance calculation is included as an option in MISER. This option calculates a mass balance
error as a measure of the material balance in the numerical solution of the flow and transport equations. The
mass balance error is calculated over the entire computational region £2.


4.1.1   Phase Material Balance

Mass balance error in solutions to the flow equations is obtained by integrating (2.6) over £2 and applying
the divergence theorem,

         f — (p*Sa) dQ, + f [p*Aa (VPa - p*gVz)} • ndF - f E*d& - f RadQ, = 0    (4.1)
        J& at             Jr                             JQ          Jo.
where F is the boundary of £2.

   If the numerical solution is substituted into (4.1) then the mass balance residual of phase a. may be
calculated by,
                                e« = FSa + Fba + Fea + Fra                      "       (4.2)
where,
                         3
                                        "	"       ""                  (4.3a)
                   = Li
                            ba = f [p*Aa (VPa - p*
                                Jr
                         Fe  = -

                              ra = - f Ra
                                     J Q
                                                                                  (4.3b)


                                                                                  (4.3c)


                                                                                  (4.3d)
Here mass lumping is employed to evaluate the volume integrals. The boundary integrals are evaluated by
back substitution of the predicted pressures into the finite element equations [Huyakorn and Finder, 1983].
                                          49

-------
4.1.2  Component Material Balance
Mass balance error in solutions to the transport equations is obtained by integrating (2,1 1) over Q, applying
the divergence theorem, and substituting iJiacxac for Bac. The resulting equation is summed over the phases
giving,
                    f ^ (PaSarcxac
                    JQ Of
-Mc^L
      H J ifi
                                                       = 0
                                                                     (4.4)
where Mc is the component molecular weight. Retardation (rc =^ 1) is included only when a = a and
nonequilibrium sorption is not considered.

    If the numerical solution is substituted into (4.4) then the component residual for the entire domain may
be calculated by,

where,
            r  ft
sc = McJ2    -^ (       for r«- = Typ6 n
                                III  f
                            E E / A*, J2S'^, Ni        for T,- = Type HI
                             a f=i Jy
                                                                    (4.6b)
                                                                    (4.6c)
The type I boundary integrals are evaluated by back substitution of the predicted mole fractions into the
finite element equations [Huyakorn and Finder, 1983]. When rc ^ 1, the change in component mass
determined with (4.6a) includes the change in sorbed mass.


4.1.3   Calculation of Mass Balance Error

The accuracy of the numerical scheme is evaluated by three measures of mass balance error. The first two
are relative errors, and the third represents an absolute error.  The expressions used to calculate these errors
                                              50

-------
are respectively,
At

100

Ne ^ ,
\e=l ^!
#At inn i
Da'i 1UU 1 max|Y| p
oAt
Da3

J?Af -inn

100
A
I
+
eaA?|
*
\ea
Fea
=^

+
N^

Fra|)
P i p i p
^ £>a T fga T /^ra
.^.
/

N<

€CA
/„'

t\
>J 5


°Af
  ^C2  = 100
                                                    \Sc\
                                       = 100 11 -
                                                                                            (4.7e)
                                                                 (4.7f)
where the denominators in (4.7a) and (4.7d) are the mass storages of phase a and component c respectively
at the start of the simulation. Ba\, Ba2, #0-3, Bc\, 5C2,and B& are set to zero if the denominator is zero.

    The error measures above represent the percentage mass balance error over a single time step.
Cumulative mass balance errors are also computed using,
     5f,, = 100
                                                  At
                                            ^'    /"
                                          \e=l   •*&
                                                                                            (4.8a)
                 = 100
                                                                 (4.8b)
                                                                                            (4.8c)
B'd = 100
                                                f f piailxlK
                                              =i   JV
                                                                                           (4.8d)
                                               51

-------
                  B'c2 = 100
                            B'c3 = 100 | 1 -
                                      (4.8e)
                                      (4.8f)
4.2   VERIFICATION OF THE PHASE MASS BALANCE SOLUTIONS
4.2.1  Comparison with One Dimensional Richards Equation

Numerical solutions of the flow equations were compared with analytical solutions of the Richards
equation. This equation describes the movement of a constant density aqueous phase in variably saturated
media under the assumption that the gas phase does not impede the liquid migration; i.e. the gas pressure is
static. Thus, comparisons with solutions of Richards equation provides verification for the solution of the
aqueous flow equation only, even though both aqueous and gas flow equations are solved.
    The one dimensional vertical form of Richards equation is expressed as,

                              . 8Sa    9 rkkr.
                                                                                      (4.9)
Semi-analytical solutions of (4.9) developed by Philip [1969] were compared to MISER. The test problem
considered is for vertical moisture infiltration under constant surface ponding into a soil with an initial
moisture content close to residual. Conditions of the test problem were obtained from Celia et al., [1990].
The asymptotic characteristic of the capacity coefficient in the region of residual water saturation creates
computational difficulties for numerical simulators. Therefore, this test problem provides a rigorous test of
MISER for typical moisture infiltration conditions in the unsaturated zone. The hydraulic properties of the
test problem are,
                                          1  ~ ^ !	+ Sra                            (4.10)
                                                        —-——                      (4.11)

where 0 = 0.368; Sra = 0.2772; n = 2; m = 0.5; a = 3.415 x 10~4 Pa"1; and k = 9.43435 x 1Q-'2 m2.
The initial and boundary conditions are:

       Pa(jc,z,f = 0) = -1000 cm = -98071 Pa   Pg(x,z, t = 0) = OPa       (Sa = 0.299)
       Pa(x,z = 0,0 = -75 cm = -7355.325 Pa   Pg(x, z = 0, t) = OPa       (Sa = 0.544)
       Pa(jc,z = Z,,0 =-1000 cm =-98071 Pa   Pg(x, z = L, t) = OPa       (Sa = 0.299)
       3 pa (x = 4 cm, z, t)/dx = 0
dPg(x = 4cm,z,t)/dx = 0
                                             52

-------
                                                        40cm
                              2cm
                                     101   102    103
                                       2cm

 Figure 4.1: Computational grid used for the numerical solution of the one dimensional Richards equation.

    Numerical simulation of the moisture infiltration problem was obtained on a symmetric "union jack"
grid consisting of 160 elements and 103 nodes (Figure 4.1). Nodes were uniformly spaced in the x and z
directions at 2 cm. The gas phase was simulated with three components: nitrogen, oxygen, and water.
Since transport equations were not solved, the gas phase composition was fixed, with a mass density of 1.24
g/1. To reduce the effect of gas pressure transients on aqueous migration, the vapor viscosity of the three
components were reduced to an artificially small value of 1 x 10~7 Pa-s. The aqueous phase was simulated
as pure water.

    Figure 4.2 compares the predicted and analytical solutions at time 6 hrs. Close agreement was
generally obtained for pressure and saturation distributions.  Pronounced oscillations at the toe of the sharp
front are evident in the pressure distribution when the consistent form of the mass matrix is used. The
oscillations are eliminated when the mass matrix is lumped. This behavior is consistent with that
commonly observed in the numerical solution of Richards equation [Milly, 1985; Celia etal, 1990;
Rath/elder and Abriola, 1994]. The magnitude of oscillations increases as Ca  = dSa/dPc approaches zero
(i.e. as Sa approaches Sra), and the effect of the oscillations can be to severely limit computational
efficiency and numerical accuracy. Therefore, mass lumping is frequently recommended to eliminate
oscillatory behavior [Milly, 1985; Celia et al., 1990;], at the expense of some loss in numerical accuracy
[Huyakorn and Finder, 1983; Zienkiewicz and Taylor, 1991].

    Global mass balance errors at varying convergence tolerances are listed in Table 4.1. Small mass
balance errors further confirm the accuracy of the numerical solutions. Mass balance errors increase
slightly with increasing convergence tolerance.

    No grid effects were observed in that all solutions were identical  along nodes in the horizontal plane.
Furthermore, identical solutions were obtained when the vertical direction was numerically reversed (i.e.
the grid was rotated by 90 degrees and gravity components were set to gz=Q and gx=9.81 m/s2).
Collectively these results indicate MISER is  correctly solving the  aqueous phase mass balance equation in
cartesian coordinates.
                                               53

-------
                        pressure distribution
             0
             5
            10
            15
            20
            25
            30
            35
            40
            -1200 -1000  -800  -600  -400 -200
                       aqueous pressure (cm)
                                                           saturation distribution
	 1 1
- o- -lumped r
—•a— conslste
'" 	 '•&
[
i
I
i
i
i
— i 	 r •— 	 i
1 solution
nass matrix
it mass matrix '

i
i i i
         analytical solution
         - lumped mass matrix
         consistent mass matrix
0 0.25   0.3
0.35   0.4   0.45
aqueous saturation
                              0.5
Figure 4.2: Comparison of numerical and analytical solutions for the one dimensional Richards equation.
Simulation time = 6 hours; convergence tolerance = 1  x 10~4.
convergence
tolerance
l.Ox 10-2
1.0 x 1CT2
1.0 x 1Q-3
1.0 x 10-3
l.Ox 10~4
1.0 x 10~4
mass
matrix
consistent
lumped
consistent
lumped
consistent
lumped
residual
ea (kg)
2.66 x 10~4
1.76xlO-4
-4.64 x 10~5
-4.58 x 10~6
5.35 x 10-7
-5.70 x 10~6
B\a W
3.00 x 10-3
1.98 x 10-3
5.21 x 10-4
5.14x 10~5
6.02 x 10~6
6.41 x 10~5
*L (%)
5.77 x 10~2
3.81 x 10~2
1.00 x 10~2
9.93 x 10-4
1.16 x 10~4
1.23 x 10-3
Table 4.1:  Comparison of global mass balance errors from numerical solutions of the one dimensional
Richards equation at time 6 hrs.

4.2.2   Comparison with Two Dimensional Richards Equation

The capability of MISER to simulate a two dimensional variably saturated axisymmetric flow was tested by
comparison to numerical solutions of the two dimensional Richards equation obtained from the SWMS-2D
model [Simimek et al., 1994]. The scenario under consideration is described as example problem 4 [Section
7.4, Sinntnek et al., 1994] and involves moisture infiltration from a single-ring infiltrometer. The
axisymmetric domain is shown in Figure 4.3 and the associated soil properties are listed in Table 4.2. The
radius of the ring infiltrometer is 20 cm.

    SWMS_2D numerically solves the two dimensional Richards equation using the Galerkin-type linear
finite element scheme. For comparisons presented herein, SWMS_2D was run using quadrilateral elements.
The grid, shown in Figure 4.4, consists of 342 elements and 380 nodes; it is identical to that described in
the users manual [Section 7.4, Simunek et al., 1994]. No flow conditions were prescribed along all
boundaries, except at the five nodes along the top left boundary where constant pressure conditions were
                                               54

-------
                40
              §
              §-80
              T3
               120
               130
                               layer 1.
                               layer 2
      	0.84-

      	0.91-
                                                              	-—0.98	•	—
                             radius (cm)
                                             125
radius (cm)
                125
Figure 4.3:  Domain configuration used in two dimensional (2D) flow simulations for comparison to
SWMS_2D.
Parameter

kx — kz (m2)
^>rw
n
a (I/Pa)
Layer 1
0.399
3.9598xlO~13
2.51xKT4
1.376
1.77xlO~4
Layer 2
0.339
6.0327xlQ-13
2.95 xlO~4
1.603
1.42xlO~4
    Table 4.2: Soil properties used in two dimensional flow simulations for comparison to SWMSJ2D.

specified (Pa  — 1 atm; Sw = I).

    The two dimensional moisture infiltration problem was simulated with MISER using the same nodal
structure as in'Figure 4.4. Each quadrilateral element was subdivided into two triangular elements resulting
in 684 elements and 380 nodes. Boundary conditions for the gas phase were specified as first type, constant
atmospheric gas pressure along the entire top boundary and no flow conditions on remaining boundaries.
Other specifications required to conform to assumptions inherent in Richards equation were identical to
those used in the one-dimensional comparisons: the transport equations were not solved; the gas phase
composition was fixed; and the vapor viscosity was set to an artificially small value to eliminate effects of
gas pressure transients on aqueous migration.

    Intermodel comparisons were initially made for a homogeneous problem, employing the soil properties
for layer 1 over the entire domain. Very close agreement was obtained in numerical predictions of moisture
content, as demonstrated by near indistinguishable contour lines shown in Figure 4.5. Mass balance
computations from MISER were on the order of 10~6 and 10"3% for the relative and absolute error
measures, respectively, at a convergence tolerance of 10~3. Collectively, these results indicate MISER is
correctly solving the aqueous phase flow equation in a two dimensional axisymmetric domain.

    The second comparison was for the layered domain shown in Figure 4.3. Results shown in Figures 4.6
and 4.7 show very close agreement in the upper layer and moderate discrepancies near the region of the soil
interface (depth = 40 cm). These discrepancies are attributed to differences in the way that discontinuities
                                              55

-------
                            constant head nodes
                                    i *  * >
                                 Or
                                40

                             _o_

                             I 80
                             T3
                               120-
                               130L
                                            radius (cm)
                                                            125
   Figure 4.4: Numerical grid used in two dimensional flow simulations for comparison to SWMS_2D.
                                            0.5     0.8
                                              radius (m)

Figure 4.5: Simulated volumetric moisture content in the homogeneous domain at time 12 hrs (MISER =
solid line; SWMS_2D = dashed line).

at the material property interface are treated in the two numerical models. In MISER, discontinuities are
preserved numerically by tracking separate nodal material property parameters and saturation values within
contiguous elements spanning the interface. Moisture profiles from MISER exhibit a sharp contrast at the
interface (depth = 40 cm). In SWMS.2D, the nodal material property parameters are averaged. Moisture
profiles from SWMS.2D exhibit a sharp contrast at depth of approximately 45 cm, or approximately the
distance of one-half element below interface. Despite discrepancies near the interface, moisture profiles in
Figure 4.7 show good agreement at depth below the interface.
                                               56

-------
u.u-
0.1 -
0.3-
0.4-
0.5-
1 0.6-
t °-7:
0.8-
0.9-
1.0-
1.1 -
1.2-
1.3-
^JJJ L
~^Ml L ^





                              0.00
                                     0.25
                                                   0.75
                                              radius (m)
                                                           1.00
                                                                  1.25
Figure 4.6: Simulated volumetric moisture content in the layered domain at time 6 hrs (MISER = solid line;
SWMS_2D = dashed line).
                            1.3
                              0.00
                                            0.50    0.75
                                              radius (m)
                                                          1.00
                                                                  1.25
Figure 4.7: Simulated volumetric moisture content in the layered domain at time 12 hrs (MISER = solid line;
SWMSJ2D = dashed line).

4.2.3   Comparison with Quasi Analytical Solutions for Unsteady Radial Flow of Gas

The capability of MISER to simulate axisymmetric flow of gas to vadose zone extraction or injection wells
was tested by comparison to quasi analytical solutions developed by McWhorter [1994]. The quasi
analytical solutions represent unsteady one dimensional radial gas flow and account for nonlinearities
stemming from pressure dependent density (compressibility) and permeability (Klinkenberg effect). To
conform with conditions of the analytical solution, MISER was used to simulate confined radial gas flow to
                                               57

-------
               Q
         -no flow boundary
            1m
.'uniform soil conditions -;;'•:"•;-••
                          = 0.25m
constant atm
pressure
                                                                     -*-r,
                                                                        max
Figure 4.8: Domain configuration used in two dimensional flow simulations for comparison to quasi analytical
solutions for radial gas flow.
Parameter

kx = kz (m2)
"Viu
n
a (I/Pa)
b (atm)
Casel
0.33
IxlQ-11
0.12
7.0
0.002
0.0
Case 2
0.33
IxlO"14
0.12
7.0
0.002
0.316
Table 4.3:  Soil properties used in two dimensional flow simulations for comparison to quasi-analytical
solutions for radial gas flow.

a fully penetrating extraction/injection well (Figure 4.8). All soil properties were homogeneous (Table 4.3),
with water present at the immobile residual level. Properties of nitrogen gas were used to represent the gas
phase in both the numerical and analytical solutions.
    Comparisons  were made for varying conditions of gas injection and extraction using two values of
intrinsic permeability. The first case involves a relatively conductive soil under conditions in which slip
flow phenomena are negligible. For this problem the domain was discretized into 505 nodes (5 vertical by
101 horizontal) and 800 elements. Nodal spacing was uniform in the vertical direction and nonuniform in
the radial direction, evaluating nodal coordinates from [Aziz and Settari, 1979],
                                                                                           (4 12)
                                       n     Well/
where n = 101 is the number of nodes in the radial direction, and rmax = 1000 m is the radial coordinate of
the right boundary. Comparisons of predicted pressure distributions are shown in Figure 4.9 for a extraction
rate of 10 scfm and an injection rate of 1 scfm. Close agreement between MISER and the quasi analytical
solutions is observed, indicating MISER is correctly solving the axisymmetric gas phase flow equation with
specified well conditions. Figure 4.9 also shows an extensive radius of influence, indicating that accurate
representation of the flow field requires a large grid structure under conditions of confined gas flow in a
conductive soil.

    The ability to simulate slip flow phenomena based on the Klinkenberg correction factor (2.4) was
examined in a second problem involving extraction from a less conductive soil. For this problem the
domain was discretized into 1005 nodes (5 vertical by 201 horizontal) and 1600 elements, using a uniform
                                                58

-------
                          Q = -.10scfm
                                                 1.01-
                                                                 Q = 1 scfm
                                                                  Analytical Solution
                                                             --a--MISER, t=1 hr
                                                             --e--MISER, t=1 day
                                                                  MISER, t= 10 days
    Analytical Solution
                     --EJ--MISER, t=1 hr
                     --e--MISER, t=1 day
                     --A--MISER, t=10 days
200   400    600
       radius (m)
                                       800   1000
                                     100
200   300
radius (m)
                                                                             400    500
Figure 4.9: Comparison of quasi analytical and numerical solutions for two dimensional radial gas flow in a
uniform soil with k = 1 x 10~n m2.
                         time = 10 days
                                         time = 30 days
           0.2

            0
     Analytical Solution
.-a-.MISER, with slip flow
--Q-. MISER, no slip flow
                         5          10
                          radius (m)
                                       . -a.. MISER, with slip flow

                                       .-0-.MISER, no slip flow
                                        5          10
                                          radius (m)
Figure 4.10: Comparison of quasi analytical and numerical solutions for one dimensional radial gas flow in
a uniform soil with k = 1 x 10~14 m2.

nodal spacing in the vertical direction and (4.12) to compute radial coordinates with rmax = 200 m. The
Klinkenberg parameter (b) was evaluated from (2.5). Comparisons of predicted pressure distributions are
shown in Figure 4.10 for a constant extraction rate of 0.08 scfm. Close agreement between MISER and the
quasi-analytical solutions is observed, indicating MISER is correctly accounting for slip flow phenomena
using the Klinkenberg correction factor.
                                                59

-------
                            0.5cm
                                                      10 cm
                                    61    62   63
                                      0.5cm
Figure 4.11: Computational grid used for the numerical solution of the one dimensional transport equation
with and without advection.

4.3  VERIFICATION OF THE COMPONENT MASS BALANCE
      SOLUTIONS

4.3.1   Comparison with One Dimensional Analytical Solutions

The first set of model verifications for the transport section of MISER are comparisons with analytical
solutions of the one dimensional transport equation with and without advection. In all the simulations
discussed in this section, the flow portion of MISER was not operating. Additionally, the component
parameters were normalized for the comparisons with analytical solutions and Sa —  1. These comparisons
were used to verify the ability of MISER to simultaneously simulate transport of multiple components in
two mobile phases. The first analytical solution was of nonadvective transport with constant dispersion
coefficients. The second analytical solution included constant advection [Ogata and Banks, 1961]. Figure
4.11 shows the "herringbone" grid with 63 nodes and 80 elements used for both of these comparisons.
Minor grid effects were observed in that the nodal concentrations were not identical  across the axis
perpendicular to the direction of flow. Similar simulations performed using the "union jack" grid did not
show  these effects. Both vertical and horizontal orientations were tested for both mobile phases and for two
components in each phase. In all cases, A* = 0.5 cm, Az = 0.5 cm, Ar = 5 sec,  D - 0.0003 cm2 sec"1,
and the convergence criteria was 10~8. The component boundary conditions for the  analytic solutions were
first type with a value of C = 1.0 at x = 0 cm and second type with a zero solute gradient at x = oo.
Initially the solute concentration was 0.0 throughout the domain. For the numerical solutions, the domain
was large enough so that the second type boundary condition was not violated. For the comparison with the
Ogata and Banks solution, v = 0.0002 cm sec"1. As Figures 4.12 and 4.13 show,  MISER and the analytic
solutions closely match at t = 4000 sec. The numerical simulations shown are for oxygen in the aqueous
phase, however good matches were obtained when an additional component was added or when similar
Simulations were performed in the aqueous phase.
                                             60

-------
                           I
                              0.8
                              0.6
                           1  0.4
                              0.2
                                       One dimension diffusive transport
                                          analytical solution
                                          numerical solution
  D = 0.0003 cm2/sec
  t = 4000 sec
                                        246
                                               distance (cm)
                    10
Figure 4.12: Comparison of MISER with the one dimensional analytical solution for diffusion driven trans-
port.

                                        Advective-dispersive transport
                           I  °'8
                           c3

                           1  0.6
                           .a  0.4
                              0.2
 - Ogata-Banks solution
 - numerical solution
D=0.0003 cm2/sec
v=0.0002 cm/sec
t=4000 sec
                                                4      6
                                               distance (cm)
                                                                      10
Figure 4.13: Comparison of MISER with the one dimensional Ogata and Banks analytical solution for
transport with dispersion and constant advection.

4.3.2   Comparison with Two Dimensional Analytical Solutions

Numerical solutions obtained from MISER were next compared with solutions from a two dimensional
analytical groundwater mass transport model [Cleary and Ungs, 1978]. The analytical solution used
allowed for dispersion and advection in both the x and z directions, as well as first order decay of the solute.
These comparisons demonstrate the ability of MISER to correctly solve the transport equation in two
dimensions. A "herringbone" grid was used for these simulations with 441 nodes and 800 elements. The
                                                61

-------
                       Q.
                       0)
                      TJ
                          0.000
                          0.025
                          0.050-
                          0.075 -
                          0.100
                               0.000    0.025    0.050    0.075
                                         horizontal distance (m)
0.10
Figure 4.14: Comparison of MISER (solid lines) with a two dimensional analytical transport solution (dashed
lines) at 4000 sec.  Contours of normalized concentration are from left to right: 0.8, 0.6, 0.4, 0.2, 0.1, and
0.01.
                                                                                     i
grid was square with 21 nodes on each side. In all cases, A* = Az = 5.0 cm, A? = 5 sec,
Dx = Dz = 0.0003 cm2 sec"1, vx = vz = 0.0002 cm sec"1 (where vz is positive upwards), and the
convergence criteria was 10~8. The solute boundary condition for both the analytic and numeric solutions
was first type with a Gaussian distribution along x = 0 cm, centered at z = 5 cm with x = 1.0 at z = 5 cm
and a standard deviation of 1.0. At the other three boundaries the solute concentration gradient was
assumed to be zero (second type boundary) at oo for the analytic solution. For the numerical solutions, the
domain was made large enough so that the second type boundary condition was not violated. The initial
solute concentration was 0.0 throughout the domain at t = 0.0 for both the analytical and numerical
solutions.  The close agreement of the analytical and numerical solutions at t = 4000 sec in Figure 4.14
verifies the ability of MISER to correctly solve the transport equation in two dimensions.


4.3.3  Verification of Biokinetics

The ability of MISER to simulate Monod-type biological growth and decay was verified in two ways. First
comparisons were made with the two dimensional analytical solution discussed in Section 4.3.2. The
domain, parameters, boundary conditions, and initial conditions for the analytical solution were the same
with the addition of first order solute decay of k = 0.001 sec"1. MISER was then used to simulate first
order decay by setting the half saturation constant of the degradable solute equal to 1032 and the maximum
solute use rate equal to 1029 resulting in a first order decay rate of 0.001  sec"1 as in the analytic solution.
Otherwise, the grid and parameters were the same as for the previous simulation. MISER required that
oxygen be present in the aqueous phase in order for the biodegradation routines to function properly, but by
setting the oxygen use coefficient equal to zero, any effects of oxygen limitation were eliminated from this
simulation.  MISER also allows the biomass concentration to remain constant for the course of a simulation
eliminating any effect of biomass growth. Both oxygen and biomass were set to an initial concentration of
                                                62

-------
                         0.000
                         0.025 -
                     •£  0.050 -
                      Q.
                      CD
                     T3
                         0.075 -
                         0.100-1
                              0.000   0.025    0.050    0.075
                                        horizontal distance (m)
0.100
Figure 4.15: Comparison of MISER (solid lines) with a 2D analytical transport solution including first order
decay (dashed lines) at 4000 sec. Contours of normalized concentration are from left to right: 0.8, 0.6, 0.4,
0.2,0.1, and 0.01.

1.0 throughout the domain with first type boundary conditions for oxygen at x = 0.0 cm of 1.0. By using
these values for oxygen and biomass, any dependency of the solution from MISER on these terms was
eliminated. For this simulation a separate biophase was not considered and the reaction terms were directly
inserted into the aqueous phase transport equations. The close agreement of the analytical and numerical
solutions at t = 4000 sec shown in Figure 4.15 indicates that the Monod terms are being calculated and
inserted into the appropriate transport equation correctly.

    A comparison was also made to the model developed by Moltz et al., [1986] for simulating microbial
growth-degradation processes in porous media where the microorganisms are primarily present in
microcolonies. Modifications were made to MISER to account for the significant differences  in the way
Moltz,  el al, [1986] handled oxygen usage. Their model also assumed that the transport of substrate and
electron acceptor from the pore fluid to the microcolonies may be dominated by an adjacent diffusion layer
resistance. This concept can be incorporated in MISER by the inclusion of a separate biophase with rate
limited mass transfer. However, for this comparison MISER was operated with the bioreaction terms
inserted directly into the aqueous phase transport equation (i.e., no mass transfer resistance) due to the
differences in the way mass transfer resistance is handled in the two models. The comparison presented in
Figure 4.16 is with Figure 8 from Moltz et al., [1986] and the interested reader is referred to their paper for
all pertinent biokinetic and media parameters. A "herringbone" grid similar to Figure 4.11 was used for
these simulations with 303 nodes and 400 elements.  The grid was quasi one dimensional with 3 nodes in
one dimension and 101 nodes in the other dimension. In all cases, Ax = Az = 1.0 cm, the maximum
At = 0.1 day,  and the convergence criteria was 10~8. Given the differences between the two  models  the
comparison at  4 days presented in Figure 4.16 is reasonable and indicates that MISER is incorporating
nonlinear Monod-type biokinetics into the bioreaction terms.
                                               63

-------
                     16 -

                     14 -

                   I 12-

                   | 10 -

                   8  8 -

                   I  .-
                   (a
                      4 -

                      2
                                       40      60
                                        Distance (cm)
Figure 4.16: Comparison of substrate profiles along a one dimensional column by MISER (lines) and a one
dimensional numerical solution (discrete points) for biodegradation by Moltz et al, [1986].

4.3.4  Verification of Interphase Exchange

Next the ability of MISER to simulate linear equilibrium sorption was tested. Comparisons were made with
the two dimensional analytical solution discussed in Section 4.3.2. The coefficients of the analytical
solution were modified to incorporate a solute retardation factor of 2.0. This was done by setting
Dx = Dz = 0.00015 cm2 sec"1 and vx — vz =  0.0001 cm sec"1. All the other parameters for the analytical
solution remained the same. For MISER, the parameters and domain configuration discussed in Section
4.3.2 were used with the addition of the sorption parameters Kf — 1.0 and m = 1.0. The mass exchange
coefficient was set to 0.01 sec"1 which was large enough to simulate equilibrium sorption processes using
the nonequilibrium formulation. The other parameters remained the same as in the previous simulations.
As can be seen in Figure 4.17, good comparisons were obtained between MISER and the analytical
solution. The slight differences between the two solutions at the 0.01 contour is consistent with a slight
deviation from equilibrium for MISER. This comparison demonstrates the capability of MISER to simulate
equilibrium exchange processes between mobile and immobile phases. When a retardation factor of 2.0
was  incorporated directly into MISER, the match with the analytical solution was nearly exact (not shown).

    Finally, MISER was compared with a one dimensional multicomponent organic liquid volatilization
column experiment by Bloes et al., [1989]. In this experiment benzene, TCE, and toluene were vented from
a column of glass beads by passing dry nitrogen gas through the column at a constant flow rate. No aqueous
phase was present and the NAPL was at an immobile residual saturation. A analysis of the experimental
results revealed that at the experimental flow rate, the mole fractions  of the organic compounds in the gas
phase were approximately at equilibrium with the organic liquid for the duration of the experiment. For this
comparison, MISER was operated with only the gas and organic liquid phases present. All the pertinent
parameters are available in Bloes et al., [1989]  and Rath/elder et al.,  [1991]. A "union jack" grid similar to
Figure 4.9 was used for these simulations with  271 nodes and 480 elements. The grid was quasi one
dimensional with 31 nodes in the x direction and 5 in the z direction. Ax = Az = 1.0 cm, Af  = 600 sec,
vx =0.108745 cm sec"', and the convergence  criteria was 10"8. The mass transfer coefficients were set to
the arbitrarily large value of 500 sec""1 and eq.  (3.42) was used to limit the mass transfer coefficients to a
value sufficient to approximate equilibrium conditions. Figure  4.18 indicates that MISER can simulate
equilibrium multicomponent organic liquid volatilization validating the representation of interphase
exchange between a mobile and an immobile phase, this time for three components.
                                               64

-------
                        0.000
                        0.025 H
                    £   0.050 -
                    Q.
                    •8
                        0.075 -
                        0.100-1
                            0.000    0.025    0.050    0.075
                                     horizontal distance (m)
0.100
Figure 4.17: Comparison of MISER (solid lines) with a two dimensional analytical solution including linear
equilibrium sorption (dashed lines) at 4000 sec. Contours of normalized concentration are from left to right
0.8, 0.6, 0.4, 0.2, 0.1, and 0.01.
                          200
                        •B>
                                             6    8
                                             Time (hr)
Figure 4.18: Comparison of MISER (lines) with a one dimensional column experiment (discrete points) for
multicomponent organic liquid (benzene, TCE, toluene) volatilization under equilibrium conditions.

4.4   VERIFICATION OF THE COUPLED PHASE AND COMPONENT
      MASS BALANCE SOLUTIONS

In order for the coupled flow and transport portions of MISER to represent transport processes, the phase
pressures must be correctly translated into specific fluxes. Verification of this procedure was done by using
the domain from Section 4.3.1 and running the coupled flow and transport sections of MISER with first
type pressure boundary conditions of 1.001 atm at x — 0.0 cm and 1.0 atm at x = 10.0 cm. Otherwise the
                                            65

-------
                           o.o H
                           0.3-
                           0.4-
                                     (S      O.fe   '  ' 0.3   '   04  '  "0 >
                                             radius (m)


Figure 4.19: Comparison of predicted solute concentrations at time 6 hrs (MISER = solid line; SWMSJ2D
= dashed line).


parameter set remained the same as in Section 4.3.1. The specific fluxes generated by MISER were nearly
identical to specific fluxes calculated using,
                                                    Ax
                                                                                          (4.13)
This was done in both directions.
    Tests on the coupled flow equations and transport were also conducted by intermodel comparison with
SWMS-2D model [Simunek et al, 1994]. The flow domain was identical to that described in Section 4.2.2.
Water introduced through the ring-infiltrometer contains a solute at the solubility limit. This condition was
simulated with type I (constant concentration) boundary conditions on the aqueous solute. No sorption was
considered in these comparisons. Additional transport parameters are given in Section 7.4 of Simunek et
a/., [1994].

    Figures 4.19 and 4.20 compare predicted solute distributions from MISER and SWMSJ2D. Similar
results were obtained with MISER using either element average or nodal velocity computations. Results
show that MISER predicts a slightly more disperse solute front away from the boundaries. There is,
however, relatively good agreement in the location of the center of mass of the solute front (C=0.5), and the
overall agreement is considered reasonably good, given the differences in the type of elements and material
property discretization used by the two models.
                                               66

-------
                             0.1 _
                             0.3-
                                —0.1
                               O.D     o'l      oi      O.B      o!4     o)
                                                radius (m)
Figure 4.20: Comparison of predicted solute concentrations at time 12 hrs (MISER = solid line; SWMSJ2D
= dashed line).
                                                 67

-------
                                      Section 5

   PROGRAM DESCRIPTION AND SIMULATION SETUP


5.1   CODE DESCRIPTION

MISER is structured in a top down modular format for clarity, to aid in logic tracing, and to simplify code
modification. The modular format also enables the code to be easily programmed to run in different modes
such as: (1) flow solutions only; (2) transport solutions only using a steady state flow field; (3) transport
and biodegradation solutions using a steady state flow field; and (4) full coupling of the transient flow,
transport, and biodegradation equations. The code is liberally annotated with comment lines.

   MISER is developed in the FORTRAN 77 programming language with a few standard enhancements
such as 'include' and 'Do-EndDo' statements. Due to the large number of equations being solved and the
complexity of the solution algorithm, the code is intended to be used on work station platforms or main
frame computers. The code has been tested with, and should normally be run using double-precision real
variables.


5.2   PROGRAM MODULES

MISER is comprised of 25 program modules: 1 main program, 23 subroutine files, and 1 include file. Table
5.1 provides a short description of the program modules.

    To implement MISER, all program modules must be compiled and linked into an executable code. A
sample make file to compile MISER on an IBM RS6000 workstation is given in Appendix F.


5.3  ARRAY DIMENSIONS AND PROGRAM  VARIABLES

Named common blocks are used to dimension all global arrays and to pass information between program
modules. The variable dimensions of all global arrays are defined with parameter statements in a single
'include1 file (dimen.inc). Most array dimensions are calculated from a combination of only a few
parameter variables, such as: the maximum number of nodes; maximum number of elements; maximum
number of components; and maximum number of material property blocks. In this way the dimensions of
most array variables can be easily adjusted by modifying only a few parameter variables in a single
program unit. These parameters should be set greater than or equal to the conditions of the problem to be
simulated. The major user defined parameter variables in 'dimen.inc' are listed in Table 5.2. Other
parameters in 'dimen.inc' include physical constants, constants related to numerical performance, and
control variables. The entire code must be compiled each time changes are made in 'dimen.inc'.
                                           68

-------
    A description of major program variables is given in Appendix E
 5.4   DESCRIPTION OF INPUT FILES AND INPUT DATA

 Table 5.3 describes all input and output files that can potentially be used in a single simulation run. A given
 simulation may not generate every listed output file depending upon user specifications. Only those files
 that are required on the basis of user specifications are opened.

    The user supplied input data is contained in the first two input files. The first input file is named
 'miser.dl'. 'Miser.dl' must be located in the same directory as the executable code. The name and path of
 the second input file (designated as D2 in this documentation) is defined in data block A of 'miser.dl'.
 Similarly, a prefix name and path for all output files is defined in data block A of 'miser.dl'.

    The input data in 'miser.dl' and D2 are organized into blocks identified by letters A-T. File 'miser.dl'
 contains data blocks A-L, and file D2 contains data blocks M-T. Depending on the problem conditions, all
 data blocks may not be required for each simulation. The data blocks are further subdivided into fields that
 are separated by comment lines designated by a '#' in column 1. An indefinite number of comment lines
 can be added between fields, however, there must be at least one. The input data are read using list directed
 formatting (free format).

    The following sections  provide a description of all input data and the organization of the data blocks.
 Examples of input data files are shown in Appendix G.


 5.4.1  Data Block A - Input/Output Files and Control Options

 Input data in block A defines the names and paths of all input and output files used in a particular
 simulation. Several optional output files may be generated (Table 5.3) with specified control switches
defined in block A. Table 5.4 describes all input data required in block A.


5.4.2  Data Block B - General Model Control Options

Data block B contains a number of control switches used to specify general model options, such as: the
type of computational domain; the inclusion or exclusion of flow, transport, and biotransformation
processes; and numerical solution control parameters. Table 5.5 describes all data contained in block B.


5.4.3  Data Block C  - Time Step and Iteration Control Parameters

Data block C contains parameters that affect time step control, including parameters used for empirical
time step adjustment described in Section 3.10. Table 5.6 describes all data contained in block C.
5.4.4  Data Block D - Grid Information and Control Options

Data block D contains the grid and element information. Input data in this block are described in Table 5.7.
                                              69

-------
    MISER employs triangular elements to discretize the solution domain. The nodal inpidence list for
each element begins at an arbitrary node and proceeds counterclockwise if the vertical coordinate is
positive downwards, or clockwise if the vertical coordinate is positive upwards. The minimum material
property block size is a quadrilateral containing two elements in the case of a herringbone grid or four
elements in the case of a union jack grid (i.e. a single triangular element cannot be designated with unique
material property information).

    User options are provided to either input all nodal coordinates and elements indices, or generate a
regular grid on a rectangular solution domain. Two types of grids can be generated: a symmetric union jack
grid (e.g. Figure 4.1), or a herring bone grid (e.g. Figure 4.11). Material properties in a generated grid are
restricted to horizontal alignments (soil layers).


5.4.5   Data Block E - Component Chemical Properties

Data block E defines the chemical property information for all organic constituents, water, oxygen,
nitrogen, and an optional single limiting nutrient. The ordering of components is important. The organic
components are input first. Subsequently the water, oxygen, nitrogen are defined followed by the nutrient if
present. Each component is identified with a component number starting with 1 for the first organic
component and proceeding in the order that they are input. The organic components, oxygen and nutrient
can be restricted from partitioning into the gas or aqueous phases by specifying negative values  for the
vapor pressure and solubility, respectively. Table 5.8 describes all data in block E. Input values required in
this data block are widely available [c.f. Dean (Ed.),  1985].


5.4.6   Data Block F - Mass Transfer Coefficients

Data block F defines the lumped mass transfer coefficients for all the components. The organic  liquid mass
transfer coefficients are input first on a line followed by the minimum allowed deviation (See equation
(3.42) from equilibrium for the organic liquid components on a second line. These two lines are repeated
for water, oxygen, nitrogen, and nutrient if present. Note that exchange coefficients for nitrogen are entered
even though nitrogen does not exchange between phases. Table 5.9 describes all data in block F. The user is
referred to several recent studies which have developed correlations for mass transfer coefficients as an
initial point for setting values appropriate for the desired scenarios [c.f. Wilkins et al., 1995; Powers et al,
1991, 1992, 1994; Cho andJaffe, 1990]


5.4.7   Data Block G - Material Property Block Information

Soil property information and dispersion parameters are defined in data block G, and described in Table
5.10. Input values required in this data block are widely available [c.f. Freeze and Cherry, 1979].
 5.4.8   Data Block H - Sorption Parameter Data

 Sorption parameter data are specified in block H and are described in Table 5.11.
                                               70

-------
    Sorption can be modeled as either a rate limited or equilibrium process. If rate limited sorption is
modeled, then the solid phase transport equations must be solved as designated by the control switch
lctrl(25) defined in block B, field 2. Under rate limited conditions, sorption can be modeled with either a
single compartment or two compartment model.  The two compartment model, however, is restricted to the
case of a homogeneous soil domain and a single component organic liquid. Additionally, the aqueous-solid
exchange coefficients must be nonzero for all organic liquid components. A positive value indicates
sorption is modeled for that organic component.  A negative value indicates no sorption is  considered for
that organic component and therefore the solid phase transport equation is not solved for the corresponding
component.

    Equilibrium sorption processes are modeled by the inclusion of retardation factors.  Equilibrium
sorption can only be considered in the absence of nonequilibrium sorptive processes. However, any
component of the aqueous phase can be modeled with retardation. To implement the use of retardation
factors the control switch lctrl(25) must be set to .false., indicating that the solid phase transport equations
are not solved. Sorption isotherm data is widely available in the literature [c.f. Weber et al, 1988, 1991,
1992].


5.4.9   Data Block I - Biological Parameter  Data

Biological parameter data are specified in block I and are described in Table 5.12. This data block is read
only if the biotransformation equations are solved,  as indicated  by the control switch lctrl(3) defined in
block B, field 2. Otherwise the entire block is omitted.

    Five options are available to model biokinetics. Option 1 is standard Monod kinetics.  Option 2 is
Monod kinetics with substrate inhibition. Inhibition is modeled with hyperbolic  functions  that impede
microbial metabolism when substrate or nutrient concentrations are greater than  specified threshold limits.
Inhibition can also be applied to the electron acceptor, in which case inhibition occurs when the oxygen
concentration is below the  specified threshold limit. Option 3 is Monod kinetics  with lumped substrate
inhibition. Under this option lumping only applies  to the degradable substrates; nutrient and oxygen are
handled as in option 2. Option 4 is Monod kinetics  with saturation dependency. Option 5 is Monod kinetics
with saturation dependency and substrate inhibition. Inhibition is handled as in option 2. The user is
referred to several recent studies as a aid to determining the appropriate parameters required by this data
block [c.f. Sleep andSykes, 1991; Chen etal., 1992; Fuller etal., 1995; Chen, 1996].


5.4.10   Data Block J - Phase Parameter Data

Phase parameter data are specified in block J and are described in Table 5.13. On output, the composition
of each phase is identified. Phase parameter data can be found in standard reference texts [c.f. Dean (Ed.),
1985].


5.4.11   Data Block K - Temperature Parameter Data

Temperature parameter data are specified in block K and are described in Table 5.14.

    Steady state temperature distributions can be specified as either uniform or nonuniform with depth. The
                                               71

-------
latter option can be used only for rectangular domains, and requires input not only for the depth dependent
temperature distribution, but additionally requires the temperature dependencies of the following 6
parameters: vapor pressure, vapor viscosity, Henry's Law constant, aqueous solubility, maximum substrate
utilization rate, and biomass decay rate. Values for the first 5 temperature dependencies are required for all
components present in a given simulation (Note: values may be required for components to which a given
parameter does not apply, i.e. maximum substrate utilization rate for nitrogen. These values are ignored
subsequent to the input section). Values for the temperature dependent parameters are input for each node
along the vertical boundary.  Intermediate values are linearly interpolated for the nodes at the center of
"union jack" grids. The user is referred to Dean (Ed.) [1985] for a description of the temperature
dependencies for the first 4 parameters input in this section. Biological parameter temperature
dependencies are typically estimated with the van't Hoff- Arrhenius equation [c.f. Atlas andBartha, 1987;
Chen et al., 1992].


5.4.12   Data Block L - Output Control Parameters

This data block contains control parameters for the three major output files: 'outpre.out', 'outpre.con', and
'outpre.plt', where 'outpre' is the user specified path and file name from data block A, field 2. The user can
specify output variables for printing in the main output file, for printing in a contour plot format, or for
printing as a time series output. A complete description of the input required in this data block is described
in Table 5.15.


5.4.13   Data Block M - Restart Identifier

This data block contains two logical variables; (lctrl(26))  which is set to .true, if initial conditions (pressure,
saturation, and phase composition) are to be read from the restart file and (lctrl(32)) which is set to .true, if
the run is a continuation of a previous run and .false, if the run is a new run using the previous run as initial
conditions. If (lctrl(26)) is .true, data block M also contains the path and name of the file containing the
restart information.
    File D2 is read regardless of whether the restart option is used. However, when the restart option is
specified, initial conditions read from D2 are ignored and superseded by those read from the restart file.
Boundary conditions for either case are read from D2.


5.4.14  Data Block N - Initial Pressure Conditions

Initial pressure conditions are specified in block N as described in Table 5.17. Initial pressure conditions at
all nodes can either be input or computed. Computed pressures are assumed to be in hydrostatic
equilibrium, referenced to atmospheric pressure at ground surface for the gas phase, and referenced to the
gas phase pressure at the water table for the aqueous phase. The presence of organic components in the gas
and aqueous phases is ignored in computing the hydrostatic pressure distributions.
                                                 72

-------
5.4.15   Data Block O - Velocity Computation

This data block provides information indicating the method used to compute aqueous and gas phase
velocity. Table 5.18 describes all data inputs in block O.

    User options are provided to compute nodal velocities from the pressure distribution using a finite
element solution of Darcy's Law. Alternatively element velocities may be computed directly from Darcy's
Law using element averages of the nodal mobilities and densities.

    Velocity distributions can be unsteady (flow equations are solved) or assumed to be at steady state. This
is controlled by variable lctrl(l) in block B, field 1 (Table 5.5), which indicates if the flow equations are
solved. The velocity field is assumed to be at steady state if flow equations are not solved. A steady state
velocity field can either be input directly, or computed from an input pressure field.


5.4.16  Data Block P - Organic Liquid Saturation and Composition

Data block P contains the initial quantities for the immobile organic liquid saturation distribution and
composition (component mole fractions). All organic liquid saturations and component mole fractions are
input on a element basis and converted to nodal quantities by averaging adjacent elemental values.
Averaging is not performed across boundaries between different material property blocks. This results in
multiple values of NAPL saturation at boundary nodes between different material property blocks.
Components of the organic liquid are partitioned at equilibrium into the gas, aqueous, solid, and biophases
when present.  The mass of the organic liquid is not conserved during this process (i.e. organic mass is
generated). This is only done at nodes where organic liquid is present and can lead to sharp discontinuities
in the composition of the contacting phases. The use of smooth initial conditions such as those resulting
from a restart file generated by a diffusion driven problem is recommended. Table 5.19 describes all data
inputs in block P.


5.4.17  Data Block Q - Oxygen and Nutrient Initial Conditions

Initial conditions for oxygen and nutrient are defined in data block Q and described in Table 5.20. Fields
1-3 are for the gas phase, and fields 4-6 are  for the aqueous phase. The initial conditions of the biophase
components are identical to those of the aqueous phase. Initial conditions are required only when oxygen is
present in the phase; i.e. if oxygen is omitted from the gas phase and/or the aqueous phase, then no data is
read for the corresponding phase (oxygen can be omitted from the gas and aqueous phases by assigning
negative inputs to the oxygen vapor pressure and solubility, respectively, in block E). No data is read for
nutrient if it is absent (lctrl(9) = .false.). The biodegradation equations must be solved (lctrl(3) = .true,) in
order for nutrient to be present. When water is present in the gas phase the initial conditions are specified
with a relative humidity of 100%.


5.4.18   Data Block R - Boundary Conditions

Boundary conditions for the flow and transport equations are defined in data block R and described in Table
5.21.
                                               73

-------
    Boundary conditions on the flow field can be either constant pressure or constant flux (Section 3.11.1).
Boundary conditions at nodes not explicitly specified in data block R are treated as second type with no
flow across the boundary. Boundary conditions arising at an injection/extraction well discussed below are
also implemented through flux source/sink terms (Section 3.11.3).

    Boundary conditions for the gas and aqueous phase component transport equations include specified
concentration, specified diffusive flux, or mixed third type conditions. Boundary conditions at nodes not
explicitly specified in data block R are treated as second type with no concentration gradient across  the
boundary. No boundary information is required for the  immobile phases. Sections 3.11.2 and 3.11.3
discuss the transport equation boundary and associated  specifications with extraction/injection wells.


5.4.19   Data Block S - Extraction/Injection Well Conditions

An extraction/injection can be defined in an r-z rectangular domain. Data block S contains input data
defining the well conditions (see Table 5.22). The well  is positioned along the left vertical boundary; the
nodal coordinates along the left boundary must be equivalent to the specified well radius. A constant
injection/extraction rate is defined for the duration of the simulation (variable pumping rates require the use
of the restart option). The well screen is defined by specifying the minimum and maximum node numbers
along the well screen.


5.4.20   Data Block T - Velocity Boundary Conditions

Data block T contains input data defining the velocity boundary conditions (see Table 5.23). Boundary
conditions for the gas and aqueous velocities must be specified when the velocities are calculated using the
finite element method (lctrl(18) = .true.). When a boundary is specified as impervious, the velocities
normal to that boundary are zero. The boundary specification is the same for both the gas and aqueous
phases. The domain boundary is divided into 4 sections; top, bottom, left side, and right side. Each section
may be entirely impervious. The top boundary may also be partially impervious (i.e. a partial cap may
exist). The left boundary is adjusted for the presence of a well.
 5.5   DESCRIPTION OF OUTPUT FILES

 Table 5.3 describes all the output files that can potentially be used in a single simulation run. A given
 simulation may not generate every listed output file depending upon user specifications. Only those files
 that are required on the basis of user specifications are opened. The following sections provide a
 description of the output files.


 5.5.1  Main Output File - 'Outpre.out'

 The main output file, 'Outpre.out', is always generated and is written to device 21. 'Outpre' contains both
 the file name and path, and is specified in data block A, Field 1. 'Outpre.out' contains the input parameters
 and selected output variables. The user may elect not to print out the entire set of grid information (see Data
                                               74

-------
Block D, Field 1) and the initial conditions (see Data Block L, Field 1) in order to reduce output file size.
The selected output parameters are printed at user specified intervals (see Data Block A, Field 8). The
selected output variables are specified in Data Block L, Field 2. Selection of the individual components in a
phase is done with the global component numbers used to specify the component properties in Data Block
E.
5.5.2   Convergence History and Runtime Information Output File - 'Outpre.cnv'

The convergence history and runtime information output file is optional. This output can be directed to the
screen by setting the ipt(28) = 6 (Data Block A, Field 3), to 'outpre.out' by setting ipt(28) = 21, to
'outpre.cnv' by setting ipt(28) = 23, or not generated by setting ipt(28) = 0. Convergence history and
runtime information output consists of iteration information from the various routines, maximum element
Peclet and Courant numbers for both the gas and aqueous phases (set lctcl(4) = .true.; Data Block B, Field
7), time step information, and error messages from the solver.


5.5.3   Error Message Output File - 'Outpre.err'

Error message output consists of messages from the input error message file, (specified in Data block A,
Field 2) and relates primarily to error checking of input values. The error message output file is optional.
This output can be directed to the screen by setting ipt(29) = 6 (Data Block A, Field 3), to 'outpre.out' by
setting ipt(29) = 21, to 'outpre.err' by setting ipt(29) = 22, or not generated by setting ipt(29) = 0.


5.5.4   Mass Balance Output File - 'Outpre.mb'

The mass balance output file is optional and is generated when lprnt(6) = .true. (Data Block A, Field 5).
When generated, mass balance output is always written to the file, 'outpre.mb' (device 25). The mass
balance output is printed at user specified intervals (see Data Block A, Field 5).  Mass balance output is
available in two forms, referred to as report form (lprnt(27) = .true.; Data Block A, Field 5), and in multiple
files as time series form (lprnt(27) = .false.; Data Block A, Field 5).

    The report form mass balance contains self explanatory headings and contains both phase and
component mass balances. The boundary, reaction, and source fluxes are also reported, along with separate
values for the boundary fluxes at the surface and at the extraction well. Three types of mass balance errors
are also reported (see Section 4.1). A maximum of nine components are allowed when generating report
form mass balance output.

    The time series form mass balance also contains self explanatory headings at the beginning of the
generated output file(s).  'Outpre.mb' only contains the phase mass balance information.  Only the first type
mass balance error is reported (see Section 4.1) and surface flux is not reported in 'outpre.mb'. An
additional output file is generated for each of the components present. These additional files are named
'outpre.mb#' (device 28+#) where # is the global component number as defined in data block E. A
maximum of ten components are allowed when generating time series form mass balance output.  In the
files, 'outpre.mb#', the surface flux is reported  in place of the first type mass balance error. All time series
mass balance output files are formatted: ell.5,llell.4.
                                               75

-------
5.5.5  Contour Plot Output File - 'Outpre.con*

The contour plot output file is optional and is generated when lprnt(23) = .true. (Data Block A, Field 4).
When generated, contour plot output is written to the file 'outpre.con' (device 26). The contour plot output
is printed at the same intervals specified for the main output file (see Data Block A, Field 8). The selected
contour variables are specified in Data Block L, Field 2 and may be different than the output variables
selected for the main output file, 'outpre.out'. Selection of the individual components in a phase is done
with the global component numbers used to specify the component properties in Data Block E. The contour
plot file contains self explanatory headings at the beginning of each group of contour variables. Each group
of nodal contour variables has the nodal x (or r) location in the first column and the nodal z location in the
second column. For element contour variables the corresponding locations are for the element centroids.
All contour plot output files are formatted: 8el5.8.


5.5.6  Time Series Plot Output File - 'Outpre.plt'

The time series plot output file is optional and is generated when lprnt(l 5) = .true. (Data Block A, Field 6).
When generated, time series plot output is always written to the file, 'outpre.plt' (device 27). The time
series plot output is printed at user specified intervals (see Data Block A, Field 6). The selected time series
plot variables are specified in Data Block L, Field 3 (gas phase) and 4 (aqueous phase). Time series
plotting is only available for components of the gas and aqueous phases. Specification of time series plot
output requires both the global component numbers used to specify the component properties in Data Block
E and a node number. A given component may be specified at several locations in a phase. A maximum of
six components can be specified for the combined gas and aqueous phases. The time series plot file does
not contain headings.  All time series plot output files are formatted: 7el 1.8. The first column contains the
current simulation time in seconds, subsequent columns contain the component mole fractions at the
specified locations in order of their appearance in Data Block L, Field 3 and 4.


5.5.7   Restart Output File - 'Outpre.rst'

The restart output file is optional and is generated when lprnt(5) = .true. (Data Block A, Field 7). When
generated, the restart file is always written to the file, 'outpre.rst' (device 28). The restart file is printed at
the same intervals specified for the main output  file (see Data Block A, Field 8). At each print time the
restart file is rewound and restart information is  printed over restart output from the previous print time.
Thus 'outpre.rst' contains only restart information corresponding to the latest output time. To use a restart
file, rename 'outpre.rst' to the name specified in Data Block M, Field 2.
                                                76

-------
                            Table 5.1: MISER program modules.
Routine     Type
Description
atri.f       subroutine     Evaluates the area and radial centroid of all elements. Performs minor
                           error checking on grid geometry.
bcflux.f     subroutine     Computes gas and aqueous phase fluxes at prescribed pressure and source
                           nodes.
bio.f       subroutine     Computes the biological reaction terms using Monod kinetics. Solves the
                           biophase transport equations when a separate biophase is considered.
cbal.f       subroutine     Computes global and time step mass balance errors for the aqueous and
                           gas phases, and for all components in all phases.
commntf   subroutine     Determines comment lines in the input data files and positions the file
                           pointer to the next input data field.
dimen.inc   include file     Included in most MISER routines, this  program unit is used to define
                           parameter variables for array dimensions.
disper.f     subroutine     Computes the phase  dependent portion of the tortuosity coefficient and
                           the dispersion tensor.
error.f      subroutine     Reads and writes error message from the error message file.  Terminates
                           execution if the error is designated as fatal.
flow.f       subroutine     Solves the mobile aqueous and gas phase mass balance equations using
                           the simultaneously solution method for a single time step.
grid.f       subroutine     Generates a union jack  or herring bone grid for a rectangular solution
                           domain.
har.f       subroutine     Contains the  subroutines comprising the Harwell sparse matrix package
                           for linear system solutions.
inputl.f     subroutine     Reads the input and  output file names and opens appropriate file units.
                           Reads input data for:  model control options; time step and  iteration  con-
                           trol information; grid information; component chemical properties; mass
                           exchange information; material property block data; sorption parameters;
                           biological parameters; temperature data; and output control parameters.
                           Creates pointers and  performs basic error checking on input data.
input2.f     subroutine     Reads the initial and boundary conditions and performs basic error check-
                           ing of input data. Reads restart information.
miser.f      main program   Performs primary controls of simulation: initiates the read of all input
                           data; loops over all time steps; controls cycling between calls to appro-
                           priate routines for solution of the flow and  transport equations; controls
                           time step size; and controls calls to output routines.
mobil.f     subroutine     Evaluates capacity coefficients, and aqueous and gas phase mobility terms
                           in stacked storage.
molewtf    subroutine     Updates the gas, aqueous, and organic liquid phase molecular  weight,
                           phase molar density, and phase mass density, based on composition, tem-
                           perature and pressure.
mpex.f      subroutine     Computes the mole and  mass exchange terms for the flow  and transport
                           routines.
napls.f      subroutine     Updates the immobile organic liquid saturation using the finite element
                           solution of the organic liquid phase mass balance equation.
                                             77

-------
                                 Table 5.1 (continued).
Routine
            Description
naplx.f   subroutine


prnt.f     subroutine

satw.f     subroutine

solid.f    subroutine

tlhs.f     subroutine

trans.f    subroutine
vel.f
subroutine
Updates the immobile organic liquid component mole fractions using the
finite element solution of the component molar balance equation for the
organic liquid phase.
Writes current values of selected variables to the main output, contour
plot, or time series plot files.
Computes water and gas saturation at all nodes based on current values
of nodal capillary pressure.
Updates the solid phase mass loadings using the finite element solution
of the component mass balance equation for the solid phase.
Assembles the finite element matrices for the two dimensional component
mole balance equations.
Controls the sequential solution of the component molar balance equa-
tions for all components in all phases. The solution order is: the organic
components, water,  oxygen and nutrient. For each component the solu-
tion order is: biophase; gas phase, aqueous phase, organic liquid phase;
and solid phase.
Computes the mobile phase specific discharge. This routine is not called
when constant velocity simulations are being run.
                                           78

-------
        Table 5.2: Selected parameter variables defined in the include file 'dimen.inc.'

Type     Variable   Description

integer   nnmx      Maximum number of nodes.
integer   nelmx     Maximum number of elements.
integer   nmblk     Maximum number of material property blocks.
integer   nxmax     Maximum number of horizontal blocks in a generated grid.
integer   nzmax     Maximum number of vertical blocks in a generated grid.
integer   ncmpb     Maximum number of biomass populations. Currently restricted to one.
integer   ncmpo     Maximum number of organic components.
integer   ncmp      Maximum number of components; 3(always) + ncmpb + ncmpo + l(if nutrient is
                   present).
                   Maximum number of nodal variables in stacked storage.  Currently computed as
                   1.05*nnmx.
                   Maximum number of unknowns in the linear system. Currently set to 2*nnmx.
                   Maximum number of nonzero entries in the coefficient matrix.
                   Maximum number of nonzero entries in the coefficient matrix.
                   Minimum difference between the specified residual aqueous phase saturation and
                   the computed aqueous phase saturation. Currently set to 10~16.
real      sgtest      Minimum value of gas phase saturation for which a transport equation is written.
                   Currently set to 0.05.
                   Solver parameter. Currently set to 0.1.
                   Solver parameter. Currently set to 1.
                   Minimum mole fraction for convergence testing in the routine naplx.f. Currently
                   set to 10~3.
real      xround     Minimum mole fraction for convergence testing. Currently set to 10~16.
real      smino     Minimum sustainable organic liquid saturation. Currently set to 10~16.
integer   nnstk

integer   nsolve
integer   icnl
integer   irnl
real      srwmin
real      u
integer   mtype
real      xmino
                                           79

-------
                      Table 5.3: Description of input and output files.
File name    input/output   Unit  Description
miser.dl
D2*
input
input
                           11     Contains user supplied input data for the model control options,
                                  grid information, and the physical, chemical,.and biological
                                  parameters.
                           13     Contains user supplied input data defining the initial and bound-
                                  ary conditions.
                           14     Data file containing error and warning messages.
                           28     A restart input file.  Contains restart information necessary to
                                  either continue a terminated run or to use results from a previous
                                  simulation as the initial conditions for a new run. This file is a
                                  renamed copy of 'outpre.rst' generated as output
                           21     Main output file containing: a listing of most input variables; a
                                  description of boundary and initial conditions; simulation results
                                  for specified variables at selected times.
                           23     Listing of convergence history and runtime performance.
                           22     Listing of runtime generated error and warning messages.
                           25     Listing of runtime generated global mass balance calculations.
                           24     A contour plot data file.  Lists  values of selected variables at,
                                  specified times together with their nodal coordinates in a column
                                  format.
                           26     A time series plot data file. Lists values of selected variables for
                                  each time step.
                           27     A restart output file generated at the end of the simulation. Con-
                                  tains restart information necessary to either continue a  termi-
                                  nated  run  or to use results from a previous simulation  as the
                                  initial conditions for a new run.
* input file name is a user defined input variable and can contain path information
t 'restart.file' for the input restart file is a user defined input variable and can contain path information
t prefix 'outpre' for all output file names is a user defined input variable and can contain path information
miser.error   input
restart.file^   input
outpre*.out  output
outpre.cnv    output
outpre.err     output
outpre.mb    output
outpre.con    output
outpre.plt     output

outpre.rst     output
                                              80

-------
            Table 5.4: Input Data in Block A - Input/Output Files and Control Options.
Record   Type
              Variable    Description
Field 1 - Input files:
1         char*20    infile(2)

2         char*20    infile(3)
                         Path and name of file D2 containing the initial and boundary conditions
                         (must be in single quotes).
                         Path and name of error message file (must be in single quotes). Normally the
                         file is named 'miser.error' and is located in the directory with the executable
                         code.
Field 2
1

Field3
1
 Prefix name of all output files:
  char* 16   outpre     Path and prefix name for all output files (must be in single quotes); e.g. if
                        outpre is defined as 'vent', then the main output file is named 'vent.out'.
- Output unit numbers for error and performance information:
Field 4-
1
  integer    ipt(29)
         integer     ipt(28)
 Contour plot file:
  logical     lctrl(23)
Field 5 - Mass Balance Output:
1        logical    lprnt(6)
         logical     lprnt(25)
         logical    lprnt(27)
         integer
         real
             ipt(83)
             t(27)
Field 6-
1
 Time series output file:
  logical     lctrl(15)
The unit number of the output file to which error messages should be directed:
0 = do not print error messages; 6 = screen; 21 = main output file; or 22 =
error message file. The file 'outpre.err' is opened when unit number 22 is
specified.
The unit number of the output file to which runtime performance information
should be directed:  0 = do not print performance information; 6 = screen;
21 = main output file; or 23 = convergence history file. The file 'outpre.cnv'
is opened when unit number 23  is specified.

Set the switch to .true, to open the contour plot output data file 'outpre.con'.

Set the switch to .true, if material balance information should be computed
and printed in the output file 'outpre.mb'.
This record begins on a new line and is required only if lprnt(6) is .true.
Set this switch to .true, if the print interval for material balance output is set
by the number of iterations.  Otherwise set the switch to .false, if the print
interval is a constant time interval.
This record is required only if lprnt(6) is .true. Set this switch to .true, if
the material balance output is in  report form, otherwise the output will be in
multiple files in time series form.
This record begins 6n a new line and is required only if lprnt(6) is .true. Enter
the number of iterations if lprnt(25) = .true., or the time interval if lprnt(25)
= .false, (s).

Switch is set to .true, to open the  time series plot output data file 'outpre.plt'.
                                                 81

-------
                                         Table 5.4 (continued).
Record   "type
Variable   Description
          logical     lprnt(26)
          logical     lprnt(28)
          integer
          real
ipt(84)
t(28)
Field 7 - Restart file:
1         logical      lctrl(5)
This record begins on a new line and is required only if lctrl(15) is .true. Set
this switch to .true,  if the print interval for time  series output is set by the
number of iterations. Otherwise set the switch to .false, if the print interval is
a constant time interval.
This record is required only if lctrl(15) is .true. A logical switch indicating
the concentration units in the time series output:  set to .true, for mole fraction;
otherwise set to .false, for mass concentration.
This record begins on a new line and is required only if lctrl(15) is .true. Enter
the number of iterations if lprnt(26) = .true., or the time interval if lprnt(26) =
.false, (s).

Switch is set to .true, to open and print restart data to the file 'outpre.rst'.
Field 8 - Uniform print interval to the main output file:
\         logical     Iprnt(O)    Set this switch to .true,  if the print interval for MISER output to the main
                                 output file 'outpre.out' is set by the number of iterations. Otherwise set the
                                 switch to .false, indicating the print interval is a constant time interval.
2         integer     ipt(25)     This record begins on a new line. Enter the number of iterations if Iprnt(O) =
          real        t(12)       .true., or the time interval if lprnt(25) = .false, (s).
                                                     82

-------
                Table 5.5: Input Data in Block B - General Model Control Options.

Record   Type     Variable   Description

Field 1 - Coordinate system:
1         integer   ipt(27)    Variable designating the coordinate system:  0 = cross-sectional (x-z);  1 =
                             axisymmetric (r-z).
2         real      t(21)      Horizontal component of the gravity vector (m / s2).
3         real      t(22)      Vertical component of the gravity vector (m / s2).
Field 2 - Equation solution options:
1

2
3
logical   lctrl(l)
                             Switch is set to .true, if the aqueous and gas phase mass balance equations are
                             to be solved.
          logical   lctrl(2)    Switch is set to .true, if the component mass balance equations are to be solved.
          logical   lctrl(24)   Switch is set to .true, if the NAPL phase mass balance equations are to be
                             solved. Set to .false, if NAPL is absent.
4         logical   lctrl(25)   Switch is set to .true, if the solid phase mass balance equations are to be solved.
                             Set to .false, if equilibrium sorption or no sorption is considered .
5         logical   lctrl(3)    Switch is set to .true, if the biotransformation equations are to be solved. Set
                             to .false, if biotransformations are not considered.
Field 3 - Mass lumping options:
1         logical   lctrl(7)    Switch is set  to .true, for mass matrix lumping in the solution of the phase
                             mass balance equations.
2         logical   lctrl(8)    Switch is set to .true, for mass matrix lumping in the solution of the component
                             mass balance equations.
Field 4 - Flow solution skipping:
1         integer   ipt(85)    Number of time steps to be skipped between solutions of the phase phase mass
                             balance equations. For example if the flow equations  are to be solved every
                             other time step, then a skipping factor of 1 is specified.
Field 5 - Not currently used:


Field 6 - Coupling between flow and transport:
1         logical   lctrl(14)   Switch is set to .true, if mass exchange terms should be included in the solution
                             of the flow equations.

Field 7 - Element dimensionless numbers:
1         logical   lctrl(4)    Switch is set to .true, if element dimensionless numbers should be calculated
                             for the transport solution.
                                                83

-------
           Table 5.6: Input Data Block C - Time Step and Iteration Control Information.

Record   Type    Variable  Description

Field I - Simulation time frame:                                                      I
1        real     t(l)       Initial simulation time (s).                                \
2        real     t(2)       Final simulation time (s).

Field 2 - Time weighting:
1        real     t(10)      Time weighting parameter: 0 = explicit; 1 = implicit; 0.5 = Crank-Nicolson.

Field 3 - Number of time steps:
1        integer  ipt(30)    Maximum number of time steps.
Field 4 - Convergence tolerance:
1        real     t(13)      Convergence tolerance in the solution of the phase mass balance equations.
2        real     t(14)      Convergence tolerance in  the solution Of the component mass balance equa-
                            tions for the mobile phases (aqueous and gas).
3        real     t(15)      Convergence tolerance in  the solution  of the organic phase  saturation
                            equations.
4        real     t(16)      Convergence tolerance in  the solution of the component mass balance equa-
                            tions for the immobile phases.

Field 5 - Time step range:
1        real     t(3)
         real     t(4)
         real     t(5)
2
3
Field 6-
I
                            Initial time step (s).
                            Minimum time step (s).
                            Maximum time step (s).
        Iterations for convergence:
         integer   ipt(31)    Maximum number of iterations for convergence of the phase mass balance
                            equations.
2        integer   ipt(32)    Maximum number of iterations for convergence of the component balance
                            equations.
3        integer   ipt(33)    Maximum number of iterations for convergence of the organic phase saturation
                            equations.

Field 7 - Iterations for time step amplification:
1        integer   ipt(34)    Number of iterations in the solution of the phase mass balance equations below
                            which time step amplification is permissible. Must be less than the maximum
                            number of iterations - ipt(31).
2        integer   ipt(35)    Number of iterations in the solution of the component mass balance equations
                            below which time step amplification is permissible.  Must be less than the
                            maximum number of iterations - ipt(32).

Field 8 - Time step multiplications factors:
1        real     t(6)       Empirical time step amplification factor. Must be greater than or equal to one.
2        integer   t(7)       Empirical time step reduction factor. Must be less than or equal to one.
                                                84

-------
          Table 5.7: Input Data Block D - Grid Information and Control Options Information.
Record   Type     Variable
                          Description
Field 1
\
Field 2
1
Field3-
1
2
Field 4-
1
2
Output grid geometry:
 logical   Iprnt(l)
Grid specification options:
 integer   igrid
FieldS-
1
2
3

Field 6 -
1
2
                          Set switch to .true, to output all grid geometry to the main output file.

                          Integer variable indicating if a grid should be generated: 0 = input all element
                          numbers and nodal coordinates; 1 = generate a union jack grid; 2 = generate
                          herring bone grid.
Number of blocks in the generated grid (required only if igrid > 0):
 integer  nx             Number of blocks in the horizontal direction of the generated grid.
 integer  ny             Number of blocks in the vertical direction of the generated grid.
Horizontal Block spacing in the generated grid (required only if igrid > 0):
 logical  Idel            Set to .true, if the horizontal spacing is uniform.
 real      xzero           Horizontal coordinate of the left boundary.  This should be equal to the well
                          radius in an axial symmetric domain.
 real      delx            Starting on a new line, enter the horizontal spacings (m) from left to right.
                          Provide a single value if Idel = .true., otherwise provide nx values. If a single
                          negative value is provided then the nodal spacing is calculated from eq. (4.12).
Vertical Block spacing in generated grid (required only if igrid > 0):
 logical  Idel            Set to .true, if the vertical spacing is uniform.
 real      zzero           Vertical coordinate of the top boundary.
 real      delz            Starting on a new line, enter of the vertical spacings (m) from top to bottom.
                          Provide a single value if Idel = .true., otherwise provide nz values.
Material property blocks in the generated grid (required only if igrid > 0):
 integer  ipt(26)          Number of horizontally aligned material property blocks in the generated grid.
 integer  imblk           Required  if the ipt(26) > 1. Starting on a new line enter nz integer values
                          corresponding to the material block number of each vertical spacing from top
                          to bottom.
Field 7 - Grid dimensions (required only if igrid = 0):
1        integer   ipt(O)          Number of nodes in the grid.
2        integer   ipt(l)          Number of elements in the grid.
3        integer   ipt(26)         Number of material property blocks in the grid.
Field 8 - Nodal incidence list (required only if igrid = 0):
1        integer   iel             element number.
2        integer   nodal(3*iel-2)  Global node number of node 1.
3        integer   nodal(3*iel-l)  Global node number of node 2.
4        integer   nodal(3*iel)    Global node number of node 3.
5        integer   matel(iel)       Material block number of element iel. Only required if ipt(26) ^ 1.
                                  Field 8  is repeated for all  elements, with data for each element beginning on
                                  a new line. The elements do not need to be listed in sequential order.
Field 9 - Nodal coordinates (required only if igrid = 0):
1        integer   ind            Node number.
2        real      xnode(ind)     x-coordinate (horizontal) of node ind (m).
3        real      znode(ind)     z-coordinate (vertical) of node ind (m).
                                  Field 9  is repeated for all nodes, with data for each node beginning on a new
                                  line. The nodes do not need to be listed in sequential order.
                                                   85

-------
                   Table 5.8: Input Data Block E - Component Chemical Properties.
Record   Type      Variable
                                 Description
Field 1 - Number ofNAPL components:
1
         integer   ipt(15)
Enter the number of organic liquid, phase components.
Field 2 - NAPL component chemical properties (required only ifipt(15) > 0):
I        integer    ic              Component number - must range between 1 and ipt(15).
2        char* 10   cname(ic)      Component name - must be enter in single quotes.
3        real       cmw(ic)        Component molecular weight (g / mole).
4        real       cvp(ic)         Component vapor pressure (atm). A negative value indicates this component
                                  in involatile and is excluded from the gas phase composition.
5        real       cvvis(ic)       Component vapor viscosity (cPoise).
6        real       cden(ic)        Component liquid density (g /1).
7        real       cmdif(2*ic-l)   Component gas diffusivity (cm2 / s).
8        real       cmdif(2*ic)     Component aqueous diffusivity (cm2 / s).
9        real       chen(ic)        Component Henry's Law constant (atm 1 / g). Not currently used.
10       real       casol(ic)       Component aqueous solubility (g /1). A negative value indicates this compo-
                                  nent in insoluble and is excluded from the aqueous phase composition.
                                  Field 2 is repeated for all components in the organic liquid phase. Data for
                                  each component must begin on a new line.

Field 3 - Chemical property data for water, oxygen, and nitrogen:
1-10    -        -              Provide the same 10 data inputs described in field 2 above for water, oxygen,
                                  and nitrogen.  The input order and component numbers are fixed:  water =
                                  ipt(15)+l; oxygen = ipt(15)+2; and nitrogen = ipt(15)+3.
                                  Set to .true, if a nutrient is to be modeled.
Field 4 - Nutrient inclusion:
1        logical    lctrl(9)
Field 5 - Nutrient chemical properties (required only iflctrl(9) = .true.):
1-10     -         -             Provide the same 10 data inputs described in field 2 for the nutrient component.
                                 The component number for nutrient must equal ipt(15)+4.
                                                   86

-------
                     Table 5.9: Input Data Block F - Mass Transfer Coefficients.
Record   Type     Variable
                       Description
Field 1 - Interphase mass exchange
1
2
3
4
5
6
7
9
10
11
12
integer   ic
real      kex(5*ic-4)
real      kex(5*ic-3)
real      kex(5*ic-2)
real      kex(5*ic-l)
real      kex(5*ic)
integer   ic
real
real
real
real
real
kmax(5*ic-4)
kmax(5*ic-3)
kmax(5*ic-2)
kmax(5*ic-l)
kmax(5*ic)
coefficients and minimum deviations from equilibrium:
 Component number as defined in data block E.
 Aqueous/gas mass exchange coefficient (sec~l).
 Aqueous/NAPL mass exchange coefficient (sec~l).
 Gas/NAPL mass exchange coefficient (sec~l).
 Aqueous/biophase mass exchange coefficient (see"1).
 Aqueous/solid mass exchange coefficient (sec~l).
 Component number as defined in data block E. This record must start on a
 new line.
 Aqueous/gas minimum deviation from equilibrium.
 Aqueous/NAPL minimum deviation from equilibrium.
 Gas/NAPL minimum deviation from equilibrium.
 Aqueous/biophase minimum deviation from equilibrium.
 Aqueous/solid minimum deviation from equilibrium.
 Field 1  is repeated for all components. Data for each component must be
 separated by at least one comment line. When a component aqueous-solid
 mass transfer coefficient is defined to be zero, that component is not present
 in the solid phase. A negative value of the aqueous-solid mass exchange
 coefficient indicates that the Freundlich Kf = f0c * ^input where f0c is
 defined  in bfoc and K-     is defined in bok.
                                                87

-------
                Table 5.10: Input Data Block G - Material Property Block Information.
Record  Type    Variable
                          Description
Field
I
2
3
4
5
6
1 - Soil physical properties:
integer
real
real
real
real
real
iblk
bphi(iblk)
bpermh(iblk)
bpermv(iblk)
bsden(iblk)
bfoc(iblk)
Material property block number - must range between
Porosity (-).
Horizontal component of intrinsic permeability (m2).
Vertical component of intrinsic permeability (m2).
Bulk soil density (g / cm3).
Solid phase organic carbon fraction.
1 and ipt(26).





Field 1 is repeated for all material property blocks. Data for each'block must



start on a new line.

Field 2 - Water retention parameters:
1
2
3
4
  integer   iblk
  real      bsrw(iblk)
  real      bvgn(iblk)
           bvga(iblk)
real
Field3
1
2
3
• Dispersion parameters:
  integer   iblk
  real      bdisl(iblk)
  real      bdist(iblk)
Material property block number - must range between 1 and ipt(26).
Residual water saturation (-).
'n' parameter of the van Genuchten fitting function for air/water retention data.
'a' parameter of the van Genuchten fitting function for air/water retention data
(Pa-1).
Field 2 is repeated for all material property blocks. Data for each block must
start on a new line.

Material property block number - must range between 1 and ipt(26).
Longitudinal dispersivity (m).
Transverse dispersivity (m).
Field 3 is repeated for all material property blocks. Data for each block must
start on a new line.
Field 4 - Dispersion tensor computation:
1         logical   lctrl(21)        Set to .true, if the dispersion tensor should be calculated as a function of the
                                  dispersivities and velocity distribution.  Enter .false,  if a constant dispersion
                                  tensor is to be input.
Field 4- Dispersion tensor (required only iflctrl(21) = .false.):
1
2
3
4
5
6

7
8
9
10
integer
real
real
real
real
integer

real
real
real
real
ic
d(8*ic-7)
d(8*ic-6)
d(8*ic-5)
d(8*ic-4)
ic

d(8*ic-7)
d(8*ic-6)
d(8*ic-5)
d(8*ic-4)
Component number as defined in data block E.
Dxx - dispersion coefficient of component ic in the gas phase (m2/s).
Dxv - dispersion coefficient of component ic in the gas phase (m2/s).
D^x - dispersion coefficient of component ic in the gas phase (m2/s).
Dy - dispersion coefficient of component ic in the gas phase (m2/s).
Component number as defined in data block E. This record must start on a
new line.
Dxx - dispersion coefficient of component ic in the aqueous phase (m2/s).
£>5 - dispersion coefficient of component ic in the aqueous phase (m2/s).
D*x - dispersion coefficient of component ic in the aqueous phase (m2/s).
£>JL - dispersion coefficient of component ic in the aqueous phase (m2/s).
                                  Field 4 is repeated for all components. Data for each component must be
                                  separated by at least one comment line.

-------
                      Table 5.11: Input Data Block H - Sorption Parameter Data.
Record  Type    Variable
Description
Field 1 - Sorption Model (required iflctrl(25) = .true.):
1        logical  lctrl(19)       Set to .true, if a two compartment sorption model is used (can only be used
                                 under conditions of a homogeneous soil domain and a single component or-
                                 ganic liquid). Set to .false, if sorption is modeled with a single compartment
                                 model.
Field 2 - Two compartment sorption parameters (required iflctrl(25) = .true, and lctrl(J9) = .true.):
\        real     xbok          Multiplier to convert the slow compartment value of kf defined in bok to the
                                 fast compartment value.
2        real     xbom          Multiplier to convert the slow compartment value of n defined in bom to the
                                 fast compartment value.
3        real     xkex          Multiplier to convert the slow compartment value of of the exchange coefficient
                                 to the fast compartment value.
4        real     xden          Mass fraction of solid phase in the fast compartment.
Field3 - Sorption parameters (required if lctrl(25) = .true.):
1        integer  iblk           Material property block number - must range between 1 and ipt(26).
2        real     bok(see text)   Freundlich isotherm kf parameter for each organic component in order from
                                 1 to the number of components (enter ipt(15) values). Units are /j,g I g solid,
                                 with aqueous concentration in mg /1. Index number is (iblk-l)*ipt(15)+ic.
3        integer  iblk           Material property block number - must range between 1 and ipt(26). This
                                 record must start on a new line.
4        real     bom(see text)   Freundlich isotherm n parameter for each organic component in order from 1
                                 to the number of components (enter ipt(15) values). Index number is (iblk-
                                 l)*ipt(15)+ic.
                                 Field 3 is repeated for all material property blocks. Data for each block must
                                 start on a new line,
Field 4 - Include retardation factors (required iflctrl(25) - .false.):
1        logical  Iretrd          Set to .true, if retardation factors should be used.
Field 5 - Retardation factors (required iflctrl(25) = .false, and Iretrd = .true.):
1        integer  ic             Component number - must range between 1 and ipt(15)+3 if no nutrient is
                                 present, or between 1 and ipt(15)+4 if nutrient is present.
2        real     krtd(ic)        Retardation factor.'
                                 Field 5 is repeated for all components with data for each component beginning
                                 on a line.
                                                  89

-------
                    fatiie 3:12: Input Data Block I - Biological feamfetef b'ata.
Record  Type     Variable    Description
Field 1 - Number of biodegradable substrates:          .   .            i                 .
1         iHteger   ipt"(i?)     Specify the nuMber of 'bfdtiegr'aiiaBie substrates.  Miist be less than or equal
                              ttf ttie number of components in Irie drganic liquid (ipi'(i£)).

Field 2 - Biodegradation control switches:
1         logical   Ictrl(l7)    Set to .true, if a steady state biomass is to be modeled, otherwise set to .false.
                              if the biomass is time dependent.
2         logical   lctrl(16)    Set to .true, if biotransformations are modeled as a sink term in the aqueous
                              transport equations; otherwise set to .false, if a separate rate limited biophase
                              is modeled.
Field $ - Growth kimtic's options:
          integer
Field 4 - Monod parameters:
 1
 2
 3
 4
 5
 6
 7
integer
real
real
real
real
real
real
1C
fuse(ic,l)
fuse(ic,2)
umax(ic)
khalf(ic)
xyield(ic)
kinhib(ic)
Variable indicating ike type of growth" kiffetics: 1 p standard Moiildcl kinetics; 2
= Monod kinetics with substrate inhibition; 3 = Moii'od kinetics with lumped
substrate inhibition; 4 = Monod kinetics with saturation Dependency;  5 =
Monod kinetics with saturation dependency and substrate inhibition.

Component number as defined in block E.
Electron acceptor use coefficient (mole 62 / mole substrate).
Nutrient use coefficient (mole nutrient / mole substrate).
Maximum substrate use rate (g substrate / g biomass / sec).
Half saturation constant (g substrate /1).
Yield coefficient (g biomass / g substrate).
Inhibition constant (unitless) expressed as a fraction of the aqueous solubility.
Constant multiplies the sum of all substrate aqueous solubilities for type 3
growth kinetics.
Field 4 is repeated for all degradable substrates, for oxygen, and additionally
for nutrient, if present (i.e. field 4 is repeated ipt(17)+l times if no nutrient is
present, and ipt(17)+2 times if nutrient is present). Data for each component
must start on a new line.
 Field 5 - Decay and biomass range coefficients:
 1
 2
 3
 4
 5
real
real
real
real
real
kd
xbmin
xbmax
xinit
t(H)
Decay coefficient (sec !).
Minimum biomass (g biomass /1 media).
Maximum biomass (g biomass /1 media).
Initial uniform biomass (g biomass /1 media).
Delay period for initiation of bioreactions (sec).
                                                  90

-------
                      Table 5.13: Input Data Block J - Phase Parameter Data.
Record  Type    Variable  Description
Field 1 - Water phase viscosity:
1        real     wvis      Water phase viscosity (cPoise).
Field 2 - Gas phase slip flow parameters:
1        logical   lctrl(20)  Set to .true, if gas phase slip flow is simulated with the Klinkenberg model.
2        real     b         Klinkenberg parameter (atm). Set the value to zero if lctrl(20) = .false.
                                                91

-------
                  Table 5.14: Input Data Block K - Temperature Parameter Pata.
Record  Type    Variable   Description
Field I - Temperature distribution:
1        logical  lctrl(lO)   Set to -true, if the steady state temperature distrjbutipn is .uniform, or set to
                             .false, if the temperature distribution is depth .dependent.
Field2 - Uniform temperature (required only iflctrl(lO) •= .true.):
I        real     ctemp     Specify the uniform temperature (°C).
FieldS - Nommiform temperature distribution (required iflctrl(lO) = false.):
1        real     depthnd   Depth (m).                                            .
2        real     tnode     Temperature at the depth = depthnd (°C).
                             Field 3 is repeated for all vertical .nodes along the boundary starting at the
                             surface, downward (ny+1 values). Data for each node begins a new line.

Field 4 - Temperature dependent vapor pressure (required iflctrl(10) =  false.):
1        real     dtemp     Temperature dependent vapor pressure (atm).  Provide ny+1 values, one for
                             each node in the vertical direction.
Field 5 - Temperature dependent vapor viscosity (required iflctrl(lO) = false.):
1        real     dtemp     Temperature dependent vapor viscosity  (cPoise).  Provide ;ny+l values, one
                             for each node in the vertical direction.
Field 6 - Temperature dependent Henry's Law constant (required iflctrl(lO) = .false.):
1        real     dtemp     Temperature dependent Henry's Law constant (atm 1/g). Provide ny+1 values,
                             one for each node in the vertical direction.
Field 7 - Temperature dependent aqueous solubility (required iflctrl(lO) = false.):
1        real     dtemp     Temperature dependent aqueous solubility (g /I). Provide :ny+l values, one
                             for each node in the vertical direction.
Field 8 - Temperature dependent maximum substrate use rate (required iflctrl(lO) - .false.):
\        real     dtemp     Temperature dependent maximum substrate use rate (g substrate / g biomass
                             / sec). Provide ny+1 values, one for each node in the vertical direction.
                             Fields 4-8 are repeated for all components in the order established in block
                             E: organic liquid components, water, oxygen, nitrogen,  nutrient.  Data for
                             each component property begins on a new line, separated from the previous
                             information by at least one comment line.
Field 9 - Temperature dependent biomass decay rate (required iflctrl(10) = false.):
1        real     dtemp     Temperature dependent biomass decay rate (sec""1). Provide ny+1 values, one
                             for each node in the vertical direction.
                                                 92

-------
                   Table 5.15: Input Data Block L - Output Control parameters.
Record  Type     Variable    Description
Field 1 - Print initial conditions:
1        logical   lprnt(3)    Set to .true, if the initial conditions should be printed to the main output file.
Field 2 - Print switches for selected variables:
la
Ib

2a

2b
3a

3b
4a

4b
5a

5b
6a

6b
7a

7b
8b
8c
8d
9a

9b
9c
9d
logical

logical

logical

logical
logical

logical
logical

logical
logical

logical
logical

logical
logical

logical
logical

logical
integer
lprnt(8)

lcon(l)

lprnt(9)

lcon(2)
Iprnt(lO)

lcon(3)
Iprnt(ll)

lcon(4)
lprnt(12)

lcon(5)
lprnt(13)

lcon(6)
lprnt(14)

lcon(7)
lprnt(15)

lcon(8)
ipt(69)
integer   icp
logical   lprnt(16)

logical   lcon(9)
integer   ipt(70)
integer   icp
Phase concentrations in the main output file are reported in mole fractions
(.true.) or mass concentration (.false.).
Phase concentrations in the contour plot file are reported in mole fractions
(.true.) or mass concentration (.false.).
Print nodal gas phase pressure to the main output file. This record starts on a
new line.
Print nodal gas phase pressure to the contour plot file.
Print nodal aqueous phase pressure to the main output file. This record starts
on a new line.
Print nodal aqueous phase pressure to the contour plot file.
Print nodal gas/aqueous capillary pressure to the main output file. This record
starts on a new line.
Print nodal gas/aqueous capillary pressure to the contour plot file.
Print nodal gas phase density to the main output file. This record starts on a
new line.
Print nodal gas phase density to the contour plot file.
Print nodal aqueous phase density to the main output file. This record starts
on a new line.
Print nodal aqueous phase density to the contour plot file.
Print nodal NAPL phase density to the main output file.  This record starts on
a new line.
Print nodal NAPL phase density to the contour plot file.
Print nodal gas phase component concentrations to the main output file. This
record starts on a new line.
Print nodal gas phase component concentrations to the contour plot file.
The number of gas phase components to be outputted. This sub-record is
required only if Iprnt or Icon is .true, in 8a or 8b above. This sub-record starts
on a new line.
Enter ipt(69) component numbers of the corresponding components  to be
outputted. This sub-record is required only if Iprnt or Icon is .true, in 8a or 8b
above.
Print nodal aqueous phase component concentrations to the main output file.
This record starts on a new line.
Print nodal aqueous phase component concentrations to the contour plot file.
The number of aqueous phase components to be outputted. This sub-record is
required only if Iprnt or Icon is .true, in 9a or 9b above. This sub-record starts
on a new line.
Enter ipt(70) component numbers of the corresponding components  to be
outputted. This sub-record is required only if Iprnt or Icon is .true, in 9a or 9b
above.
                                                 93

-------
                                      Table 5.15 (continued).
Record  Type    Variable   Description
lOa

lOb
lOc
lOd
lib
lie
lid
 12a

 12b
 12c
 12d
 13a

 13b
 14a

 14b
 15a

 15b
 16a

 16b
 17a

 17b
 13a

 18b
logical   Iprht(17)
logical
integer
lcon(10)
ipt(71)
integer   icp
lla       logical   lprnt(18)
logical
integer
logical
integer
logical
logical

logical
logical

logical
logical

logical
logical

logical
logical
lcon(l 1)
ipt(72)
integer   icp
logical   lprnt(19)
lcon(12)
ipt(73)
integer  icp
logical   lprnt(29)
lcon(18)
lprnt(20)

lcon(13)
lprnt(21)

lcon(14)
lprnt(22)

lcon(15)
lprnt(23)

lcon(16)
lprnt(24)
 logical   lcon(17)
Print nodal organic liquid component concentrations to the main output file.
This record starts On a tiew line.
Print nodal organic liquid component concentrations to the contour plot file.
The number of organic liquid components to be outputted. This sub-record
is required only if Iprnt or Icon is .true, in lOa or lOb above. This sub-record
starts on a new line.
Enter ipt(71) component numbers of the corresponding components to  be
outputted. This sub-record is required only if Iprnt or Icon is .true, in lOa or
lOb above.
Print nodal solid phase component loadings to the main output file. This
record starts on a new line.
Print nodal solid phase component loadings to the contour plot file.
The number of solid phase component loadings to be outputted. This sub-
record is required only  if Iprnt or Icon is  .true, in lla or lib above. This
sub-record starts on a new line.
Enter ipt(72) component numbers of the corresponding components to  be
outputted. This sub-record is required only if Iprnt or Icon is .true, in 1 la or
lib above.
Print nodal biophase component concentrations to the main output file. .This
record starts on a new line.
Print nodal biophase component concentrations to the contour plot file.
The number of biophase component concentrations to be outputted. This sub-
record is required only  if Iprnt or Icon is .true, in 12a or 12b above.  This
sub-record starts on a new line.
Enter ipt(73) component numbers of the  corresponding components to  be
outputted. This sub-record is required only if Iprnt or Icon is .true, in 12a or
12b above.
Print total organic soil concentration to the main output file. This record starts
on  a new line.
Print total organic soil concentration to  the contour plot file.
Print nodal gas phase saturation to the main output file. This record starts on
a new line.
Print nodal gas phase saturation to the contour plot file.
Print nodal aqueous phase saturation to the main output file. This record starts
on  a new line.
Print nodal aqueous phase saturation to the contour plot file.
Print nodal NAPL saturation to the main output file.  This record starts on a
new line.
Print nodal NAPL saturation to the contour plot file.
Print gas phase velocity to the main output file. This record starts on a new
line.
Print gas phase velocity to the contour plot file.
Print aqueous phase velocity to the main output file.  This record starts on a
new line.
Print aqueous phase velocity to the contour plot file.
                                                 94

-------
                                      Table 5.15 (continued).
Record   Type    Variable   Description
Field 3 - Gas Phase time series plot switches:
         logical
         integer
         lplt(D

         ipt(81)
3a
3b
integer   icp

integer   icp
                             Set to .true, if the time series plot files should be generated for gas phase
                             components.
                             If Iplt = .true, then starting a new line, enter the number of gas phase compo-
                             nents to be reported in the time series plot file.
                             If Iplt = .true, enter the global component number and the nodal location for
                             which time series data should be outputted.
                             If Iplt = .true, enter the nodal location for which time series data should be
                             outputted.
                             Field 3a and 3b is repeated ipt(81) times.
Field 4 - Aqueous Phase time series plot switches:
1        logical   lplt(2)     Set to .true, if the time series plot files should be generated for aqueous phase
                             components.
2        integer   ipt(82)     If Iplt = .true, then starting a new  line, enter the number of aqueous phase
                             components to  be reported in the time series plot file.
3a       integer   icp        If Iplt = .true, enter the global component number, and the nodal location for
                             which time series data should be outputted.
3b       integer   icp        If Iplt = .true, enter the  nodal location for which time series data should be
                             outputted.
                             Field 3a and 3b is repeated ipt(82)  times. A maximum of 6 components for
                             the combined gas and aqueous phases can be defined for time series output.
                                                95

-------
                        Table 5.16:  Input Data Block M - Restart Identifier.
Record  Type      Variable   Description
Field I - Restart control switches:
1         logical    lctrl(26)   Specify .true, if initial saturation and component information should be read
                              from the restart file 'restart.file', where the file path and name is defined in
                              field 2 of this data block.
2         logical    lctrl(32)   Specify .true, if the run is a continuation of the previous run and .false, if the
                              run is a new run using the previous run as initial conditions.

Field 2 - Restart file identifier: (required only if lctrl(26)=.true.
1         char*20   infile(4)   Path and name of restart input file (must be in single quotes). This file is a
                              renamed copy of 'outpre.rst' generated as output.                '
                                                   96

-------
                    Table 5.17: Input Data Block N - Initial Pressure Conditions.
Record  Type    Variable    Description
Field I - Initial pressure distribution:
1        integer  ipt(75)     Variable indicating how initial conditions are specified: 1 = compute hydro-
                              static gas and aqueous phase distributions; 2 = input gas and aqueous pressures
                              for all nodes.
Field 2 - Water table depth (required only ifipt(75) - 1):
1
real      wtdpth      Water table depth (m).
Field 3 - Initial pressure:
1
2
3
integer
real
real
nd
p(2*rid-l)
p(2*nd)
Node number.
Aqueous phase pressure at node nd (Pa gauge).
Gas phase pressure at node nd (Pa gauge).
Field 3 is repeated for all nodes with data for each node beginning on a new
line.  The nodes do not need to be in sequential order.  A uniform pressure
distribution can be specified by specifying a single line of data containing a
negative node number and the uniform aqueous and gas pressures.
                                                 97

-------
                       Table 5.18: Input Data Block O - Velocity Computation.
Record  lype    Variable
Description
Field I - Velocity computation method:
1        logical  lctrl(18)       Setto.true.ifnodalvelocitiesshouldbeecffiputedbysolutionoffimteelement
                                 equations. Set to .false, if velocities should be computed as element averages,
                                 or if a steady state velocity field is assumed (i.e. flow equations are not solved
                                 - lctrl(l) = .false.).
Field 2 - Steady state velocity distribution (required only iflctrl(l) = .false.):
1        logical  Icssv          Set to .true,  if the steady state velocity distribution should be calculated from
                                 the pressure field by the method defined in field 1.  Set to .false, to  input
                                 velocity values at all nodes.
FieldS - Input velocity distribution (required only if Icssv = .false.):
1        logical  lev           Set to .true, if the user defined steady state velocity distribution has uniform
                                 components.
Field 4- Uniform velocity components (required only if lev = .true.):
1        real     qgx           Horizontal component of the uniform steady state gas phase Darcy velocity
                                 (m/s).
2        real      qgz           Vertical component of the uniform steady state gas phase Darcy velocity (m /
                                 s).
3        real      qax           Horizontal component of the uniform steady state aqueous phase Darcy ve-
                                 locity (m / s).
4        real      qaz           Vertical component of the uniform steady state aqueous phase Darcy velocity
                                 (m/s).
FieldS - Nonuniform velocity components (required only if lev = .false.):
 1         integer   i              Node or element number.
2         real      q(i)           Horizontal component,of the steady state gas phase Darcy velocity (m / s) at
                                 node or element i.
3         real      q(ipt( 1 )+i)    Vertical component of the steady state gas phase Darcy velocity (m / s) at node
                                  or element i.
4         real      q(2*ipt(l)+i)   Horizontal component of the steady state aqueous phase Darcy velocity (m /
                                  s) at node or element i.
5         real      q(3*ipt(l)+i)   Vertical component of the steady state aqueous phase Darcy velocity (m / s)
                                  at node or element i.
                                  Field 5 is repeated for all nodes if  lctrl(18)  = .true., or for all  elements if
                                  lctrl(18) = .false. Data for each node or element must start on a new line.
                                                    98

-------
            Table 5.19: Input Data Block P - Organic Liquid Saturation and Composition.
Record  Type     Variable
Description
Field 1 - Elements containing organic liquid saturation:
1        integer   inoel          Number of elements containing nonzero organic liquid saturation. A number
                                 less than zero indicates that the organic liquid saturation is uniform and con-
                                 tained in all elements. A value of zero must be entered if the organic liquid
                                 mass balance equations are not solved (lctrl(24)=.false.).
Field 2 - Uniform organic liquid saturation and composition (required only if inoel < 0):
1        real      soel(l)         Uniform organic liquid saturation for all elements.
2        real      omfel(ic)      Enter the organic liquid mole fraction of each organic component. There must
                                 be ipt(15) mole fractions specified and they must sum to 1.  Mole fractions
                                 are entered in sequential order as defined in block E, field 2 (i.e. component
                                 number  1 to ipt(15)).
Field 3 - Nonuniform organic liquid saturation and composition (required only if inoel > 0):
1        integer   iel            Element number.
2        real      soel(iel)       Organic  liquid saturation in element iel.
3        real      omfel(ic,iel)   Enter the organic liquid mole fraction of each organic component in element
                                 iel.  There  must be ipt(15) mole fractions specified and they must  sum to 1.
                                 Mole fractions are entered in sequential order as defined  in block  E, field 2
                                 (i.e. component number 1 to ipt(15)).
                                 Field 3 is repeated for all elements with nonzero organic liquid saturation
                                 (inoel elements). Data for each element must start on a new line.
                                                  99

-------
              Table 5.20: Input Data Block Q - Oxygen and Nutrient Initial Conditions.
Record  type     Variable
                       Description
Field 1 - Uniform gas phase conditions (required if oxygen is present in the gas phase):
1         logical   lunfx         Set to  .true,  if the initial oxygen and nutrient (if present) partial pressure
                                 in the gas phase is uniform.  Otherwise set to .false, for nonuniform initial
                                 conditions.  Skip this input if oxygen is absent from the gas phase (i.e. the
                                 oxygen partial pressure (cvp(ipt(15)+2)) is assigned a negative value).

Field 2 - Uniform oxygen and nutrient conditions in the gas phase (lunfx = .true.):
1         real      xog           Initial uniform oxygen partial pressure (i.e. mole fraction) in the gas phase.
2         real      xng           Initial uniform nutrient partial pressure (i.e. mole fraction) in the, gas phase.
                                 Not required if nutrient is absent (i.e. lctrl(9) = .false.).

Field 3 - Nonuniform oxygen and nutrient conditions in the gas phase (lunfx = .false.):
1         integer   hd            Node number.
2         real      xmf(nd+go)   Initial oxygen partial pressure (i.e. mole fraction) in the gas phase at node nd
                                 (go is an internally defined pointer).
                                 Initial nutrient partial pressure (i.e. mole fraction) in the gas phase at node nd
                                 (gn is an internally denned pointer).  Not required  if nutrient is absent (i.e.
                                 lctrl(9) = .false.).
                                 Field 3 is repeated for all nodes. Data for each node must start on a new line.

Field 4 - Uniform aqueous phase conditions (required if 02 is present in the aqueous phase):
1         logical   lunfx         Set to  .true,  if the initial oxygen and nutrient (if present) concentrations in
                                 the aqueous phase are uniform. Otherwise set to .false, for nonuniforrn initial
                                 conditions.  Skip this input if oxygen is absent from the aqueous phase (i.e.
                                 the oxygen  solubility (casol(ipt(15)+2)) is assigned a negative value).  Note
                                 that this  variable is read twice in this data block.
Field 5 - Uniform oxygen and nutrient conditions in the aqueous phase (lunfx = .true.):
1         real      xog          Initial uniform oxygen concentration (g /1) in the aqueous phase.
2         real      xng          Initial uniform nutrient concentration (g/1) in the aqueous phase. Not required
                                 if nutrient is absent (i.e. Ictrl(9) = .false.).
Field 6 - Nonuniform oxygen and nutrient conditions in the aqueous phase (lunfx = .false.):
real      xmf(nd+gn)
 1
 2
integer
real
nd
xmf(nd+ao)
          real      xmf(nd+an)
Node number.
Initial oxygen concentration (g/1) in the aqueous phase at node nd (ao is an
internally defined pointer).
Initial nutrient concentration (g/1) in the aqueous phase at node nd (ao is an
internally denned pointer). Not required if nutrient is absent (i.e. lctrl(9) =
.false.).
Field 6 is repeated for all nodes. Data for each node must start on a new line.
                                                    100

-------
                      Table 5.21: Input Data Block R - Boundary Conditions.
Record   Type     Variable     Description
Field 1 - Constant gas pressure nodes equivalent to the initial pressure:
1         integer   itypel       Specify the number of nodes with a constant gas pressure equal to the initial
                               gas pressure.
2         integer   ibc          Beginning on a new line specify the node number of all nodes with a constant
                               gas pressure equal to the initial gas pressure. There must be a total  of itypel
                               values.
Field 2 - Constant gas pressure nodes different from the initial pressure:
1         integer   ipt(18)      Specify the number of nodes  with a constant gas pressure that is  different
                               from the initial gas pressure.
                               Node number of a constant gas pressure node different from the initial gas
                               pressure at that node (required if ipt(18) > 0).
                               Constant gas pressure at node  ibc (Pa gauge).
                               Records 2 and 3 are repeated for all nodes, with data for each node starting
                               on a new line. There must be a total of ipt(18) lines.
       • Constant aqueous pressure nodes equivalent to the initial pressure:
          integer   itypel       Specify the number of nodes with  a constant aqueous pressure equal to the
                               initial aqueous pressure.
2         integer   ibc          Beginning on a new line specify the node number of all nodes with a constant
                               aqueous pressure equal to the initial aqueous pressure. There must be a total
                               of itypel values.
Field 4 - Constant aqueous pressure nodes different from the initial pressure:
1
2

3
Fields
1
integer   ipt(18)

integer   ibc

real      p(2*ibc)
2

3
integer   ipt( 1 9)

integer   ibc
real
         p(2*ibc-l)
                               Specify the number of nodes with a constant aqueous pressure that is different
                               from the initial aqueous pressure.
                               Node number of a constant aqueous pressure node different from  the initial
                               gas pressure at that node (required if ipt(19) > 0).
                               Constant aqueous pressure at node ibc (Pa gauge).
                               Records 2 and 3 are repeated for all nodes, with data for each node starting
                               on a new line. There must be a total of ipt(18) lines.
Field 5 - Gas phase component boundary conditions:
1
         integer  ipt(20)
2
3
         integer
         integer
4 & 5    real
         ibc
         ibcxmf
                  bcxmf
                  dfxmf
                     Specify the number of nodes for which gas phase component boundary con-
                     ditions are specified.
                     Node number (required if ipt(20) > 0).
                     An integer variable indicating the boundary condition type (1, 2, or 3) for
                     all gas phase components at the node ibc: 1  = constant mole fraction; 2 =
                     constant diffusive flux; 3 = mixed type (contact with a known fluid).
                     For each component in the gas phase provide two  values:  1) the partial
                     pressure (i.e. mole fraction) of the component in the contacting fluid at node
                     ibc, and 2) the molecular diffusivity divided by a characteristic length, DmfL
                     (m/s). Each pair of values must be listed in sequential order corresponding to
                     the component numbers. Only components that are present in the gas phase
                     are listed; component boundary conditions are not read for components which
                     are excluded from the gas phase (i.e. negative vapor pressure).
                                                101

-------
                                     Table 5.21 (continued).
Record   Type    Variable    Description
                             Records 2-5 are repeated for all nodes for which gas phasp component bound-
                             ary conditions are provided (ipt,(20) nodes). Data for each node must start on
                             a new line,
Field 6 - Aqueous phase component boundary conditions:
1

2
3
integer   ipt(21)
                             Specify the number of nodes for which aqueous phase component boundary
                             conditions are specified.                        \
         integer   ibc        Node number (required if ipt(21) > 0).
         integer   ibcxmf     An integer variable indicating the boundary condition type (1, 2, or'3) for all
                             aqueous phasp components at the node ibc:  1 = constant mole fraction; 2 =
                             constant diffusive flux; 3 = mixed type (contact with a known fluid).
4&S    real      bpxmf     For each component in the aqupous phasp provide two values:  1) the con-
                  dfxmf     centration of thp component concentration in the contacting fluid at node ibc
                             (g/1), and 2) the molecular diffusivity divided by a characteristic length, Dm/L
                             (m/s). Each pair of values must be listed in sequential order corresponding
                             to the component numbers.  Only components that are present in the aqueous
                             phase are listed; component boundary conditions are not read for components
                             which are excluded from the aqueous phase (i.e. negative solubility).
                             Records 2-5 are repeated for all nodes for which aqueous phase component
                             boundary conditions are provided (ipt(21) nodes).  Data  for each node must
                             start on a new line.

Field 7 - Gas phase boundary fluxes:
1        integer   ipt(22)     Specify the number of nodes for which a constant gas phase flux is to specified.
2
3
integer   ibc
real     source
                             Node number (required if ipt(22) > 0).
                             The constant gas phase flux referenced to atmospheric pressure and the steady
                             temperature at the node (m3/s).
                             Records 2-3 are repeated for all nodes for which gas phase fluxes are provided
                             (ipt(22) nodes). Data for each node must start on a new line.
FieldS - Aqueous phase boundary fluxes:
1        integer  ipt(23)     Specify the number of nodes for which a constant aqueous phase flux is to
                             specified.
2
3
integer
real
                  ibc        Node number (required if ipt(23) > 0).
                  source     The constant aqueous phase flux at the node (m3 / s).
                             Records 2-3 are repeated for all nodes for which aqueous phase fluxes are
                             provided (ipt(23) nodes). Data for each node must start on a new line.
                                                102

-------
              Table 5.22: Input Data Block S - Extraction/Injection Well Conditions.

Record  Type    Variable   Description

Field I - Include extraction/injection well:
1        logical  lctrl(12)   Specify .true, if a extraction/injection well should be simulated in an axisym-
                             metric domain.
Field 2 - Extraction/injection rate:
1        real     qwell      Enter the volumetric extraction (negative) or injection (positive) rate (scfm).
Field 3 - Well coordinates:
1        real     rwell      Enter the well radius (m). This must equal the nodal coordinate along the left
                             vertical boundary.
2        integer  ii         Minimum node number along the well screen.
3        integer  jj         Maximum node number along the well screen.
                                               103

-------
                 Table 5.23: Input Data Block T - Velocity Boundary Conditions.
Record  Type     Variable   Description
Field 1 - Specify bottom boundary (required only iflctrl(18) = .true.):
1        logical   lctrl(28)   Specify .true, if the bottom boundary is impervious.
Field 2 - Specify right boundary (required only iflctrl(lS) = .true.):
1        logical   lctrl(29)   Specify .true, if the right boundary is impervious.
FieldS - Specify left boundary (required only iflctrl(18) = .true.):
1        logical   lctrl(SO)   Specify .true, if the left boundary is impervious (note: this boundary is ad-
                             justed for the presence of a well).
Field4 - Specify top boundary (requiredonly iflctrl(18) = .true.):
1        logical   lctrl(31)   Specify .true, if the top boundary is impervious.
FieldS - Specify the cap length (required only iflctrl(Sl) = .true.):
1        real      caplen    Length of the impervious segment along the top boundary starting at the left
                             edge (m).
                                                  104

-------
                                         Section 6
                      DEMONSTRATION OF MISER
    Three example simulations are presented to illustrate usage of the MISER model. The first two
examples present simulations of hypothetical SVE and BV scenarios in domains wherein the water table is
at a large depth and is therefore excluded from the simulation.  The third example problem describes the
simulation of bioventing under more realistic field conditions.  In this simulation the contaminants are
positioned close to the water table such that the capillary fringe and water table are included in the
simulation. Simulation results illustrate the influence of contaminant migration and partitioning into the
capillary fringe region on the simulated bioventing performance.

    Hypothetical SVE and BV scenarios are simulated for a layered soil domain shown in Fig. 6.1. Input
files for the SVE simulation are included in Appendix G. The soil is a medium uniform sand, intersected
with a layer of slightly less permeable fine sand. The soil water is at residual levels throughout the domain.
All soil properties .are listed in Table 6.1.

    The organic liquid is pure toluene which is assumed to be present as an immobile residual. The initial
toluene mass is 239 kg with saturations ranging up to 3.5%. This initial distribution was generated with a
two dimensional multiphase flow simulator, M-VALOR [Abriola etal, 1992]. Initial toluene
concentrations in the aqueous and gas phases are assumed to be at equilibrium with the organic liquid when
present, and zero elsewhere. The constituent and transport properties used in the simulations may be found
in the input file listing given in Appendix G.

    Numerical simulations of SVE and BV remediation were obtained on a radially symmetric r-z
rectangular solution domain (41.67 m by 4.5 m). No flow boundary conditions were specified along the top
boundary over the radius of the impermeable cap, along the left boundary above and below the well screen,
                      Q
                                         10m
                      3m
                                                medium sand
                                                    fine sand
                                                medium sand
1 m
1 m
Figure 6.1: Problem depiction used in example simulations. Contours show the initial organic liquid distri-
bution. The contour interval is 0.005 with levels increasing inward.
                                             105

-------
Parameter
4>
kx (in2)
kz (in2)
Srw
h
a (I/Pa)
medium saiid
0.35
ixio-11
sxio-12
0.12
7.0
0.002
fine sand
0.33
6xlQ-12
4xl5-12
0.16
5.0
0.0008
                 Table 6.1: Soil properties used in example SVE and BV simulations.
Phase Pair
organic-gas
aqueous-gas
aqueous-organic
aqueous-solid
Mass Transfer
Coefficient (I/sec)
5.0 x wr4
5.0 x io-5
5.0 x 10~4
5.0 x 10~5
Minimum Element Deviation
frbffi Equilibrium
D.I
0.1
0.1
0.1

                 Table 6.2: Mass transfer coefficients used to simulate an SVE system.

and along the bottom boundary. Atmospheric pressure conditions were specified along the right boundary
and the portion of the ground surface open to the atmosphere.  Both aqueous and gas phases are assumed to
be in hydrostatic equilibrium initially. Other problem dependent conditions are described below.
6.1   SOIL VAPOR EXTRACTION

Remediation of the contaminated soil by SVE was simulated by the numerical application of a constant
extraction rate of 100 cubic feet per minute (scfm). Biodegradation 'is not included in this simulation. The
solution domain is developed with a generated "herring bone" grid using uniform vertical spacings of 0.25
m and horizontal spacing ranging from 1 cm near the well to 5 m at the right boundary. The solution
domain is divided into 1116 elements and 608 nodes.

    Mass transfer coefficients were selected to represent relatively fast organic liquid volatilization and
slower rates for desorption and aqueous/gas partitioning.  These later processes are considered primary
factors controlling long term tailing processes frequently  observed in SVE systems. Table 6.2 summarizes
the values of mass transfer coefficients used in this simulation.

    Fig. 6.2 shows a progression of predicted organic liquid saturation profiles. The greatest rate of organic
liquid is in the surface and bottom layers where the initial organic liquid saturations are smallest and gas
phase velocities are comparatively large. The organic liquid persists in the middle layer due to the larger
initial organic liquid mass present and due to effects from flow bypassing of the lower permeability zone.
The pattern of organic liquid removal is generally radially inward since the greatest mass transfer occurs at
the outward edge of the organic liquid zone.
                                               106

-------
    1 -

r  2.

    3_

    4.
            .
          *
                    time = 1 day
                                 time = 3 days
time = 5 days
                01234012340
                      radius (m)              radius (m)
                                                         1234
                                                         radius (m)
Figure 6.2:  Predicted organic liquid saturation distribution in SVE simulations with intermediate mass
transfer rates. The contour interval is 0.005 with levels increasing inward.
                    0
                           time = 20 days
                                           time = 100 days
         1-

         2_

         3-

         4-
                                   50
                                                         16Q\\
                                                            100\
                                                             5.0
                      0123401234
                            radius (m)                 radius (m)

                        Figure 6.3: Toluene sorbed (ppm) at 20 and 100 days.

    Fig. 6.2 shows that organic liquid is removed relatively quickly from the domain, in about 7 days.
However, toluene is retained on the solid phase and in the pore water throughout the simulation, due to low
solid-aqueous and aqueous-gas mass transfer rates. Comparison of the sorbed toluene mass at 20 and 100
days (Fig. 6.3) indicates that very little sorbed mass is removed during this period. Moreover, toluene mass
distributions plotted in Fig. 6.4 indicate that in this simulation the overall SVE efficiency is controlled by
the aqueous-solid desorption rate after the period of organic liquid removal.
6.2   BIOVENTING

Remediation of the contaminated soil by B V was simulated by the numerical application of a constant
injection rate of 1 cubic feet per minute (scfm) to supply oxygen and enhance biotransformation. Air
                                             107

-------
                                                 -NAPL
                                                 - welt fltix
                                                 • sofbed
                                     10
                                           —I—
                                            20
—l—
 30
—l—
 40
50
                                            times (day)

                              Figure 6.4: Toluene removal versus time.

injection produces outward radial movement of oxygen (electron acceptor), as well as for toluene
(substrate) due to volatilization from the organic liquid. Sorption is not included in this simulation. The
solution domain is developed with a generated "herring bone" grid using uniform vertical spacings of 0.25
m and horizontal spacing ranging from 1 cm near the well to 2 m at the right boundary. The solution
domain is divided into 1404 elements and 660 nodes.
    Because gas phase velocities are smaller in the BV system, the fluid-fluid mass transfer coefficients
used in this simulation were reduced one order of magnitude from those listed in Table 6.2. The resulting
progression of predicted organic liquid saturation profiles is shown in Fig. 6.5. Since the gas flow is radially
outward, organic liquid removal occurs from left to right in BV (injection) in Contrast with the right to left
progression observed in the SVE (extraction) results. Also note that the organic liquid persists substantially
longer in the BV system than in the SVE system due to diminished flow rate. Similar to the SVE results,
organic liquid persists in the lower portion of the lower permeability layer, where bypassing effects are
most pronounced.
    Biotransfonnation processes in the BV scenario were simulated using the assumption of equilibrium
partitioning between the aqueous and biophases  (i.e. bioreaction was modeled as a sink). The effect of
substrate inhibition was examined by setting the inhibitory threshold to 25% of the toluene aqueous
solubility. The presence of a limiting nutrient was not considered. Other biodegradation parameters
employed in this simulation are listed in Table 6.3.
    Fig. 6.6 shows the predicted growth of biomass over the course of BV simulation.  Due to substrate
inhibition, biomass growth is concentrated away from the NAPL contaminated core, developing a so-called
 'biofence.' Once the 'biofence' has developed, the toluene is removed from the gas phase over a relatively
 short distance, and there is little or no growth to the right of the 'biofence' due to an absence of substrate.
 Biomass growth is also observed to fill in regions close to the well after organic liquid has been removed
 and aqueous concentrations fall below the inhibitory threshold. The maximum oxygen depletion was on the
 order of 10%.
                                                108

-------
              time = 20 days
 time = 60 days
time = 100 days
1-

*
2-
•
3-
4-
(

	 0.5—--,
^^— 	 	 l.(K \
\ \
--^•"^M
^=^JJ
~^^
3123^
•

•
_
.
-
I (




_----"' 	 o.s
~~s^~i-n
^)

) 1 2 3 ^
•

•

.
-
1 (




^\

-------
    .constant flux  ^- impermeable cap
                      10m            20m
 -constant pressure
30 m        37.6 m
  -J	-4-0 no/
                                            m
                                 5x10"11  m2
                                 0.7x10"11  m2
               -6m

                 8m

               -10m

                 12m
                                                                     -14.2m
       no flow
       Figure 6.7: Simulation domain used in the field scale bioventing demonstration simulation.

and density driven flow and then partition into the capillary fringe region. MISER is applied to a single
well, axisymmetric domain with three horizontally stratified soil layers as shown in Figure 6.7. Soil
properties are listed in Table 6.4 and are roughly based on those of the Borden aquifer. An immobile
residual organic liquid distribution is present above the water table as shown in Figure 6.7. For the purposes
of illustration this organic liquid distribution was developed by simulating the migration from a organic
liquid spill event using an immiscible flow simulator, M-VALOR [Abriola et at., 1992]. The initial organic
liquid distribution shown in Figure 6.7 is composed of a binary mixture of benzene and xylene. All
chemical properties are listed in Table 6.5.

    To develop realistic initial conditions for the simulation of BV remediation, the MISER code was first
used to simulate the partitioning and migration of the organic liquid components over a 54 day
redistribution period during which time no stresses are applied at the well. To simulate this process the
domain was discretized into 2337 nodes and 4480 elements, with vertical discretization between nodes
ranging between 0.1 and 0.5 m, and horizontal discretization ranging between 0.05 - 2.0 m. Other transport
parameters used in the simulation are  listed in Table 6.6 and boundary conditions are shown in Figure 6.7.
The resulting contaminant and biomass distributions are shown in Figure 6.8. These distributions illustrate
the outward migration of contaminants from the core organic liquid distribution. The migration pathway is
primarily volatilization of organic liquid constituents into the soil gas wherein they can readily migrate by
diffusion and density driven flow. As the organic constituents in the gas phase migrate radially outward
they simultaneously partition into the soil water and subsequently sorb to the soil particles. The increase in
organic substrate in the soil water results in buildup of the biomass and corresponding depletion of oxygen
as shown in the bottom two plots in Figure 6.8. There is no biomass growth within the NAPL contaminated
                                               110

-------

p
k (m2)
c1*
^rw
n*

-------
Mass transfer coefficients diffusion problem
gas-M£L (I/day)
gas-aqueous (I/day)
NAPL-aqueous (i/day)
solid-aqueous (I/day)
Monod parameters
maximum substrate utilization (1/d)
half saturation constant (mg/1)
decay coefficient (1/d)
minimum biomass (mg/1)
maximum biomass (mgVl)
so
1
20
io
high set
1
0.5
0.1
0.001
20
BV simulation
50
1
20
1
low set
0.1
0.5
0.01
0.001
20
Table 6.6: Mass exchange and biokinetie parameters used in the Reid scale bioventihg demonstration simu-
lation.
156 days is observed to be densest along the outside fringe of the organic liquid zone and near the well
screen where organic liquid has been completely removed. High oxygen depletion is observed in the
corresponding regions of high biomass growth. The predicted biomass concentrations increase
substantially between 156 and 256 days, maintaining high concentrations until the end of the simulation at
356 days. This is explained by the increased availability of oxygen as shown in Figure 6.12 resulting from
the decreased oxygen demand due to the reduction of substrate concentrations as shown in Figure 6.10.
Notice that oxygen remains depleted in the capillary fringe region due to the poor accessibility to the air
stream. Consequently there is limited biomass growth in this region resulting in the persistence of the
organic substrate.
                                                112

-------
      NAPLsaturation     -\Q m     T°tal organic concentration (ppm)
    0.04 0.01



     /0.02
4 m
                              -8m
 biomass concentration (mg/l)      aqueous oxygen concentration (mg/l)
Figure 6.8: Initial conditions used for the field scale bioventing demonstration simulation.
                                   113

-------
      Icfrri
                                 10m
156 days
               256 days
                                    -4m
                                    -8m
356 days
                             NAPL saturation
Figure 6.9: Predicted organic liquid distributions at specified times for the field scale bioventing demonstration
simulation.
                                        114

-------
       1 cfm   16 days
                                  10m
 156 days
                                    -4 m  =
                                      8 m
                256 days
356 days
                     substrate concentration (mg/l)
Figure 6.10: Predicted benzene substrate distributions at specified times for the field scale bioventing demon-
stration simulation.
                                       115

-------
       icfm   16 days
                                20'm
                                   -4 m
                                     8m
               256 days
356 days
                    biomass concentration (mg/l)
Figure 6.11: Predicted biomass distributions at specified times for the field scale bioventing demonstration
simulation.
                                       116

-------
                                 20m
   156 days
                256 days
               O
                                    -4 m  -
                                    -8m
  356 days
O
                      oxygen concentration (mg/l)
Figure 6.12: Predicted oxygen distributions at specified times for the field scale bioventing demonstration
simulation.
                                       117

-------
                                Appendix A
     ELEMENT MATRICES FOR THE SIMULTANEOUS
SOLUTION OF THE PHASE MASS BALANCE EQUATIONS
   Integration of (3.17) gives to the element matrix equation,
                         3(P}e  . rn-
                     [A]e
                           dt
                                                         (A.1)
where [P}e is the vector of alternating aqueous and gas pressures at the three nodes of the element,
                     ipie _  f pk+l  pk+l pk+l pk+l pk+l pk+V
where k is an iteration counter.
   The consistent form of the mass matrix is developed from eqs. (3.17a) and (3.17b). It may be expressed
as,
where,
                                 e=l
          Aa£ = Aga =
                                     Ne
                                          f

                                         JSl
       f\ aa "~
                          - E^ /0
                            e=l   Ja' [
Evaluating the integrals, the element mass matrix [A~\e in consistent form is,
e _ 4>eAere
 ~  12
2dai  —1da,
                                              -d
                                                 a,
                                         2da2  —1
                                          da2  ~
                                   2d
                                    gl
                                               2d
                                                 g2
where,
                                    daj = -(
                                       51
                                 d,, =
                                        Si
                           -C
                                          —d
                                                             a-,,
                                                           2dg3
                                                                         (A.3)
                                                                         (A.4)
                                      118

-------
where Ae is the area of element e.
    It is often advocated to diagonalize the mass matrix [A] by the procedure of "mass lumping" in order to
reduce oscillatory behavior and improve computational stability \Celia etal, 1990; Abriola and Rath/elder,
1993]. Therefore an option is included in MISER for lumping of the mass matrix. The lumped mass matrix
is developed by,
,L_S  \ ALaa   A,
^-5lJ[ALga   A-


     e=\   Jae
          Ne     f
 = AJ, = £>./
         e=\   »'"<
                              AL =
                                                          PJ
where Sij is the Kronecker delta. Evaluating the integrals, the lumped mass matrix is,


(J)eAere
12


4dai
0
0
-44,
0
0
-4dAl
0
0
4dgl
0
0
0
4da2
0
0
-4da2
0
0
-442
0
0
4dg2
0
0
0
4da3
0
0
-44,
o •
0
-4da3
0
0
44, -
    The stiffness matrix developed from eqs. (3.17a) and (3.17b) may be represented by,

                                             Baa   Ba!,~\
where,
                                                         dz  dz
           Bag = Bga = 0
                                                         dz
                                                                                         (A.5)
                                                                                         (A.6)
                                                                                         (A.7)
                                             119

-------
Evaluating the integrals in (A.7) yields,
                         ESP-
where,
                                l2Ae
                o
                »
                o
                                              o
                                              o   ft
                                              a
              022
              oj2
              a
              a
 0   b
 Q   fea23
 0   ba
b     0
- J?I9
^22   &
£»«,   0
                                           0
                                           a
                                                                   (A.8)
   Vctij
                                                                   +
                                                               A'a,-    y=l
                                                                 7=1
and y3i and y,- are defined in (3.5). Notice that uaij = uaj[.
    The RHS matrix incorporating density gradient terms may be developed as,
where,

                 F° -
                                              - I "' \
                                            "['•I
                                                                    (A.9)

 Evaluating these integrals yields,
"T-S
&

&
fo
8x
gx
                                                                                            (A. 10)
                                                120

-------
wherein,
  + p2 +
                                                          <,. + E <,

                                                                 3s
                                                              + E ^
    The RHS matrix incorporating compositional effects on density and interphase mass exchange is
represented by:
                                               I  w   I
                                         *<=   7                                     (A-ll)
where,
                             Ne
                                                        Pa*;  3?
                           N<
                                                                     jNi \ dQ.e
Here it has been assumed that {E} can be evaluated with compositional information from the previous time
step. For the known composition, the terms dp*/dxgc are evaluated from the appropriate differentiation of
Amagat's Law (2.50) or the Ideal Gas Law (2.49). The temporal change in mole fraction, dxac/dt, and
interphase exchange terms, E*pc_, are also lagged by a single time step. Evaluating the integrals above,
yields,
(E}' =
                                              12
                                                     eg\
                                                   L  g^  J
                                                                                         (A.12)
and,
                                             g,.
                                                                           at
                                                                              3Mg.
                                                                                dt
                                              121

-------
    TheRHS vector [Q}e represents the phase sources and sinks,


                                          Qi = f  2* 1
                                          Kfl   I  /~\   I

where Qai is the prescribed extraction or injection rate of phase a at node i [L3/T] at the aquifer
temperature and pressure. Qa is negative for extraction. This vector is used to incorporate fluxes at
simulated injection or extraction wells.
                                           (A. 13)
122

-------
                                      Appendix B

ELEMENT MATRICES FOR THE SOLUTION OF DARCY'S
                                LAW EQUATION


    The element matrix equation for the solution of the Darcy velocities is derived from (3.23) and (3.24).
For purposes of conciseness only the expansion of the aqueous phase equation (3.23) will be shown here,

                                     [A]e {qax}e = {F}e                               (B.la)

                                    \.A}e {qa,Y = {Fa}e                               (B.lb)
where {xax}e and {xax}e are the vectors of x and z direction Darcy velocities at the three nodes of the
element e,
                                  {
-------
and,
                               E   ftyir   -
                                                      + fav + fan
The varia}3}e$ /fy an.d y; .are :tii
direction?, respectively.

    Finally the gravity term, {Fa,}eg, is expressed as,
       60
                     f ?

                                        f

(B.8a)


(B.8b)
                                                                                               (B-9)
 Pa3

 Pa?,
                                                  124

-------
                                   Appendix C
        ELEMENT MATRICES FOR THE SEQUENTIAL
    SOLUTION OF THE COMPONENT MOLE BALANCE
                                 EQUATIONS
   Integration of (3.36) gives the element matrix equation,
[A]e
                                  dt
where {xac }e is the vector of component mole fractions at the three nodes of the element e (1,2, 3),

                                txac I  — [Xai > Xa2 > Xa3 }ac

   The mass matrix is developed from eq. (3.37). It may be expressed as,
                                                                                (C.1)
                                                   (C.2)
                                                                                (C.3)

where in local coordinates the indices i and j can equal 1, 2, or 3. Evaluating the integrals, the element
mass matrix [A]e is,
                                            #11  #12 #13
                                            #21  #22 #23                         (C.4)
                                            #31  #32 #33
 ie   eracAere
where the individual elements of [A]e are defined as follows,

                              #11 = SSaiA*! + Sa2pa2 + Sa

                          a\i = #21 — SctiPai + Sa2Pa2 + 0.5

                          #13 = #31 = SctiPai +0.55a2/0a2 + Sa

                             #22 = Saipai + 3Sa2pa2 + Sa3pa3

                          #23 = #32 = Q.5Saipai + S^paz + S

                             #33 = SctiPai + Sct2pa2 + 3Sa3pa3

   An option is included in MISER for mass lumping of [A]e giving,
                                                  (C.5a)

                                                  (C.5b)
                                                  (C.5c)
                                                  (C.5d)
                                                  (C.5e)
                                                  (C.5f)
                     30Af
  #11 +#12+#13       0             0
       0        #21 + #22 + #23       0
       0             0        «3i + 032 + #33
                                                                                (C.6)
                                         125

-------
The stiffness matrix developed from eqs. (3.36) may be expressed as,
                                                                                            (C.7)
                                                                                             (c.s)
                                Bfj =
Evaluating the integrals, the element stiffness matrix [B]e is,


                                   [Bf = [B1]* + [B2]£ +
                                                                                            (C.ll)
where the terms [B1]6, [B2]e, and [B3] are defined as follows. First the advective portion of the stiffness

matrix can be expressed as,
                                           24
                                                      b\2
 with the individual terms defined as,
                                             Pi
a*, + 2Pd2^ctX2 +
fa +
                                              0H


                              Zo>,2 + 2pB3^J) ft -\


                                      Oa3qaX3 f ft ~


 Next the dispersive portion of the stiffness matrix is,
                                                          +
                                                                            "*3 1 Yl



                                                                               Y2



                                                                               Y3



                                                                               Yi
                                                                     +
                                                                           '   I 1/5
                                                                           «JT3 J





                                                                             J71



                                                                        '«3^3 ) Y2




                                                                        3a3^3 } K3
                                                                   y22  U23

                                                                   ^32  ^33
 (C.12)






(C.13a)



(C.13b)


(C.13c)


(C.I 3d)


(C.13e)


 (C.13f)


(C.13g)


(C.13H)


 (C.131)







  (C.I 4)
                                                126

-------
where the individual terms are defined as,
                                   , A
                         - A     „ A
                         = A      , A
                                                   XI       A
                                                   Y2      , A
                                                   72
                                                   73
                                   , A +    , w  + n     /3 +    zz
                                   , A + 
-------
The terms Fac are defined in Table 3.2. Upon assembly of the global RHS vector, the boundary integral
terms sum to zero except at the domain boundaries (see Section_3.11.2). Evaluating the remaining portion
of the integral which contains the exchange and reaction term, Facj, yields,
                             (F}B =
                                      12
                                                     (C.I 8)
    The development above applies to the mobile phases a = g, a. A similar development starting with
(3.39) for the organic liquid and (3.41) for the biophase leads to the same terms presented above except that
(C.12) and (C.14) are both omitted.
    Since significant differences exist for the solid phase development, only the mass matrix and RHS will
be shown below. Integrating (3.40), and assuming that the solid phase bulk density is constant yields for the
mass matrix,
                                                   2  1  1
                                          n'" AT~
                                  [A]e =
                                           12A*
                  2
                  1
and for the RHS,
                             {F}e =
AereMc
   12
                                                                                         (C.19)
                                                                                         (C.20)
                                               128

-------
                                    Appendix D
    ELEMENT MATRICES FOR THE SOLUTION OF THE
        ORGANIC PHASE MASS BALANCE EQUATION
   The governing matrix, equation for the solution of the organic phase mass balance is derived from
equation (3.47). Integration of (3.47) gives the element matrix equation,
                                  [AY
where {S0}6 is the vector of NAPL saturations at the three nodes of the element,
                                 [S0}e = {S0l, S02, S03}ac
   The mass matrix is developed from eq. (3.47). It may be expressed as,
                                                                                (D.I)
                                                                                (D.2)
                                                                                (D.3)
where in local coordinates the indices i and j can equal 1, 2, or 3. Evaluating the integrals, the element
mass matrix [A]e is,
                                                    #23
                                _ *M«r-
                            [A] ~~30AF

where the individual elements of [A]e are defined as follows,

                                  «H = 3/°0! + Po2 + Po3
                             012 = 021 = P*0l + Po2 + 0.5p*3
                                         •j: ,  f\ p* ^j
                             013 = 031 = Po, + 0.5p0,

                                                 2
                              023 = 0.32 = 0.5p* + p*2 + p
                                            t     2     3
[A] is then "mass lumped" to facilitate solution of the stacked NAPL saturation giving,
                     0eAere
                     30A?
                                +an + ai3        0             0
                                   0       ^21 + #22 + <^23        0
                                   0             0       031+ 032 + «33
                                                                                (D.4)
                                                                               (D.5a)
                                                                               (D.5b)
                                                                               (D.5c)
                                                                               (D.5d)
                                                                               (D.5e)
                                                                               (D.5f)
                                                                                (D.6)
                                         129

-------
The RHS vector developed from integration of (3.47) is,




                                f    f  * ,     r, &
                         Fac =  I  4 \E2jNj-$0.j-z
                               JO.'   \   J          d
where E* is defined in Table 3.1. Evaluating (D-7) gives,
eAere

  12
                                           +
                                                               + £0*3 -
                                                                     - 5*
This allows a direct solution for {S0}*+1 after assembly of the global matrices as,


                                         S*+1 = Ft/An


where AH ^ 0 and i is iterated over the total number of stacked variables.
                                                                                            (D.7)
(D.8)
                                                                                        (D.9)
                                               130

-------
                                            Appendix E

                           Description of Major Variables
 Integer Scalars


 ia              Number of nonzero entries in sparse
                matrix.
 nnhor           Maximum number of nodes in the
                horizontal direction in a generated grid.
 nnver           Maximum number of nodes in the
                vertical direction in a generated grid.


 Real Scalars


 b               Klinkenberg parameter; Table 5.13:
                Field 2.
 caplen          Radius of impermeable cap on the
                ground surface.
 kd              Decay coefficient; Table 5.12: Field 5.
 qwell           Extraction/injection rate; Table 5.22:
                Field 2.
 rwell           Well radius; Table 5.22: Field 3.
 tmassO          Initial total mass in domain.
 tmassl          Current time step total mass in domain.
 trefqg           Reference temperature.
 wtdpth          Depth to water table.
 wvis            Water viscosity; Table 5.13: Field 1.
 xbmax          Maximum biomass; Table 5.12: Field
                5.
 xbmin           Minimum biomass; Table 5.12:  Field
                5.
 xbok           Two compartment Kf multiplier; Table
                5.11: Fields.
 xbom           Two compartment m multiplier; Table
                5.11: Field3.
xden            Two compartment density multiplier;
                Table5.11: Fields.
xinit            Initial biomass; Table 5.12: Field 5.
xkex            Two compartment exchange coefficient
                multiplier; Table 5.11: Field 3.
zwell
Length of well screen.
Character Scalars
outpre
Integer Arrays
Output file prefix; Table 5.4: Field 2.
ibc(nnmx)       Nodal boundary condition locations;
                Table 5.21: Field 1 (gas pressures), 2
                (gas pressures), 3 (aqueous pressures),
                4 (aqueous pressures), 5 (gas phase
                components), 6 (aqueous phase
                components), 7 (gas phase boundary
                fluxes), and 8 (aqueous phase boundary
                fluxes).
ibcxmf(nmbc)    Nodal component boundary condition
                types; Table 5.21: Field 5 (gas phase
                components) and 6 (aqueous phase
                components).
idepth(nnmx)    Nodal depth reference.
icn(icnl)         Sparse matrix column indices.
icp(0:50)        Vector of control integers for
                component identification.
ikeep(icnl,5)     Solver work space.
ipt(0:90)         Vector of control integers.
    ipt(O)       Number of elements; Table 5.7:  Field
                7.
    ipt(l)       Number of nodes; Table 5.7: Field 7.
    ipt(2)       Number of stacked  variables.
    ipt(3)       Number of components in the gas
                phase.
    ipt(4)       Number of components in the aqueous
                phase.

    ipt(5)       Number of components in the NAPL
                phase.
                                                 131

-------
ipt(6)       Number of components in the solid
            phase.
ipt(7)       Number of components in the bio
            phase (includes biomass).
ipt(8)       Start of gas phase section in xmf
            ordering.
ipt(9)       Start of aqueous phase section ire xmf
            ordering.
ipt( 10)      Start of NAPL phase section in xmf
            ordering.
ipt( 11)      Start of solid phase section in xmf
            ordering.
ipt( 12)      Start of bio- phase section in xmf
            ordering.
ipt( 1'3)      Number of organic components in the
            gas phase.
ipt(14)      Number of organic components in the
            aqueous phase.
ipt( 15)      Number of organic components in the
            NAPL phase; Table 5.8:  Field 1.
ipt( 16)      Number of organic components in the
            solid phase.
ipt( 17)      Number of organic components in the
            bio phase; Table 5.12: Field 1.
ipt( 18)      Number of nodes with constant gas
            pressure; Table 5.21: Field2.
ipt( 19)      Number of nodes with constant
            aqueous pressure; Table  5.21: Field4.
ipt(20)      Number of nodes with gas phase
            component boundary conditions; Table
            5.21: Fields.
ipt(21)      Number of nodes with aqueous phase
            component boundary conditions; Table
            5.21: Field 6.
ipt(22)      Number of nodes with constant gas
            volumetric flux; Table 5.21: Field 7.
ipt(23)      Number of nodes with constant
            aqueous volumetric flux; Table 5.21:
            FieldS.
ipt(24)     Number of nodes along the well screen.
 ipl(25)     Print results every ipt(25) time steps if
            Iprnt(O) is true; Table 5.4:  Field 8.
 ipt(26)     Number of material property blocks;
            Table  5.7: Field 6.
 ipt(27)     Integer variable denoting the type of
            domain (ipt(27) = 0 - xz domain;
            ipt(27) =  1 -  rz domain); Table 5.5:
            Field  1.
ipt(28)      Device designator for performance
            output; Table 5.4: Field 3.
ipt(29)      Device designator for error messages;
            Table 5.4: Field 3.
ipt(30)      Maximum number of time steps; Table
            5.6: Fields.
ipt(31)      Maximum phase balance iterations,
            also used as the criterion for decreasing
            dt in phase balance; Table 5.6: Field 6.
ipt(32)      Maximum component balance
            iterations, also used as the criterion for
            decreasing dt in component balance
            routines; Table 5.6: Field 6.
ipt'(33)      Maximum' NAPL saturation iterations;
            Table 5.6': Field 6.
ipt(34)      Maximum number of iterations in
            phase balance for increasing dt; Table
            5.6: Field?.
ipt(35)      Maximum number of iterations in
            component balance routines for
            increasing dt; Table 5.6: Field 7.
ipt(36)      Flag from flow.f for time step
            modification.
ipt(37)      Flag from tran.f for time step
            modification.
i'pt(38)      Flag from' napls.f for time step
            modification.
ipt(39)      Integer flag determining the biokinetics
            type (1 - standard monod kinetics; 2 -
            monod kinetics with substrate
            inhibition; 3 - monod kinetics with
            lumped substrate inhibition; 4 - monod
            kinetics with saturation dependency; 5
            - monod kinetics with saturation
            dependency and substrate inhibition);
            Table 5.12: Field3.
 ipt(40)      Constant - ipt( 1) * 2.
 ipt(41)      Constant-ipt(l)* 3.
 ipt(42)      Constant - ipt(l) * 4.
 ipt(43)      Constant - ipt(l) * 5.
 ipt(44)      Constant -  ipt( 1) * 6.
 ipt(45)      Constant -  ipt(l) * 7.
 ipt(46)     Constant-ipt(l>* 8.
 ipt(47)     Constant -  ipt(l) * 9.
 ipt(48)     Constant -  ipt(l) * 10.
 ipt(49)     Constant -  ipt(2) * 2.
 ipt(50)     Constant -  ipt(2) * 3.
                                                132

-------
 ipt(51)      Constant - ipt(2) * 4.
 ipt(52)      Constant - ipt(2) * 5.
 ipt(53)      Constant - ipt(2) * 6.
 ipt(54)      Constant - ipt(2) * 7.
 ipt(55)      Constant - ipt(2) * 8.
 ipt(56)      Constant - ipt(2) * 9.
 ipt(57)      Constant - ipt(2) * 10.
 ipt(58)      Constant - ipt(3) + ipt(4).
 ipt(59)      Constant - ipt(3) + ipt(4) + ipt(5).
 ipt(60)      Constant - ipt(3) + ipt(4) + ipt(5) +
             ipt(6).
 ipt(61)      Constant - ipt(3) + ipt(4) + ipt(5) +
             ipt(6) + ipt(7).
 ipt(62)      Constant - ipt(18) + ipt(19) + ipt(20) +
             ipt(21).
 ipt(63)      Constant - ipt(62) + ipt(22).
 ipt(64)      Constant - ipt(63) + ipt(23).
 ipt(65)     Number of components present.
 ipt(66)      Constant - ipt(65) * ipt(l).
 ipt(67)     Constant - ipt(0) * 2.
 ipt(68)     Constant - ipt(O) * 3.
 ipt(69)     Number of gas phase components in
            output; Table 5.15: Field 2.
 ipt(70)     Number of aqueous phase components
            in output; Table 5.15: Field 2.
 ipt(71)     Number of NAPL components in
            output; Table 5.15: Field 2.
 ipt(72)     Number of solid phase components in
            output; Table 5.15: Field 2.
 ipt(73) ,    Number of bio phase components in
            output; Table 5.15: Field 2.
 ipt(74)     Constant - ipt(69) + ipt(70) + ipt(71) +
            ipt(72) + ipt(73).
 ipt(75)     Initial condition type; Table 5.17: Field
            1.
 ipt(76)     Restart input value of current time step
            number.
 ipt(77)     Not Used.
 ipt(78)     Not Used.
ipt(79)      Not Used.
ipt(80)      Current number of time steps.
ipt(81)      Number of time series plot gas phase
            components; Table 5.15:  Field 3.
ipt(82)      Number of time series plot aqueous
            phase components; Table 5.15: Field 4.
      ipt(83)

      ipt(84)


      ipt(85)

      ipt(86)

      ipt(87)

      ipt(88)
      ipt(89)
 irn(icnl)
 iw(icnl,8)
 matel(nelmx)

 matpt(nn6)
 nbdB(nxmax)


 nbdL(nzmax)

 nbdR(nzmax)


 nbdT(nxmax)

 nbw(0:2)
 nelpt(nelS)
 nodel(ne!3)

 nodept(nnmx)

 Real Arrays
a(icnl)
aby!2(nelmx)
aby30(nelmx)
amb(icnl)

area(nelmx)
bcf(nn2)
 Print mass balance every ipt(83) time
 steps if lprnt(25) is true; Table 5.4:
 Field 5.
 Print time series every ipt(84) time
 steps if lprnt(26) is true; Table 5.4:
 Field 6.
 Compute flow field every ipt(85) time
 steps; Table 5.5: Field 4.
 Number of nodes in the vertical
 direction.
 Number of nodes in the horizontal
 direction.
 Pointer for temperature dependencies.
 Constant - 5 * ipt(88).
 Sparse matrix row indices.
 Solver work space.
 Element material blocks; Table 5.7:
 Fields.
 Nodal material blocks.
 Node numbers along the bottom
 boundary of a generated rectangular
 domain.
 Node numbers along the left boundary
 of a generated rectangular domain.
 Node numbers along the right
 boundary of a generated rectangular
 domain.
 Node numbers along the top boundary
 of a generated rectangular domain.
 Sparse matrix band widths.
 Element stacking references.
 Element connectivity vector; Table 5.7:
 Fields.
 Nodal stacking references.
Global FEM matrix.
Element; rbar * area 712.
Element; rbar * area/ 30.
Global FEM matrix for phase mass
balance.
Element areas.
Nodal phase boundary fluxes.
                                               133

-------
bcxmf(nmbc)



bdisl(nmblk)

bdist(nmblk)

beta(nelS)
bfoc(nmblk)

bok(nbcmp)

bom(nbcmp)

bpermh(nmblk)

bpermv(nmblk)

bphi(nmblk)
bsden(nmblk)

bvga(nmblk)

bvgm(nmblk)
bvgn(nmblk)

bsrw(nmblk)

cc(nnstk)
casol(ncmp)



cden(ncmp)


ccx(nmf)


chcn(ncmp)
 cmassO(ncmp5)
 cmassl(ncmp5)
Nodal component boundary condition
in contacting fluid; Table 5.21: Field 5
(gas phase components) and 6
(aqueous phase components).
Block longitudinal dispersivities; Table
5.10: Fields.
Block transverse dispersivities; Table
5.10: Fields.
Nodal basis function ^-derivatives.
Block organic carbon contents; Table
5.10: Field 1.
Block component Freundlich  Kf
parameters; Table 5.11: Field 2.
Block component Freundlich  m
parameters; Table 5.11: Field 2.
 Block horizontal intrinsic
permeability; Table 5.10: Field 1.
 Block vertical intrinsic permeability;
Table 5.10: Field 1.
Block porosity; Table 5.10: Field 1.
Block bulk soil densities; Table 5.10:
Field 1.
Block van Genuchten a parameters;
Table 5.10: Field 2.
Block van Genuchten 1 — £.
Block van Genuchten n parameters;
Table 5.10: Field 2.
Block residual aqueous phase
saturations; Table 5.10: Field 2.
Nodal capacity coefficients.
Component aqueous solubility; Table
5.8: Field 2 (organic components), 3
(water, oxygen, and nitrogen), and 4
(nutrient).
Component densities; Table 5.8: Field
2 (organic components), 3 (water,
oxygen, and nitrogen), and 4  (nutrient).
Nodal gas, aqueous, NAPL, solid, and
bio phase mole component left hand
side exchange terms.
Component Henry's Law constants;
Table 5.8: Field 2 (organic
components), 3 (water, oxygen, and
nitrogen), and 4 (nutrient).
  Component initial storages.
  Component current time step storages
cmdiff(ncmp2)   Component gas and aqueous phase
                molecular diffusivities; Table 5.8:
                Field 2 (organic components), 3 (water,
                oxygen, and nitrogen), and 4 (nutrient).
cmf(ncmpp5)    Phase and component cumulative total
                boundary fluxes.
cmw(ncmp)      Component molecular weights; Table
                5.8: Field 2 (organic components), 3
                (water, oxygen, and nitrogen), and 4
                (nutrient).
cphex(ncmppS)   Phase and component cumulative
                exchange fluxes.
crsink(ncmpp5)   Phase and component cumulative
                reaction sinks.
csflux(ncmpp5)   Cumulative surface flux.
csink(ncmpp5)   Phase and component cumulative
                sinks.
cvp(ncmp)      Component vapor pressures; Table 5.8:
                Fie Id 2 (organic components), 3 (water,
                oxygen, and nitrogen), and 4 (nutrient).
cvvis(ncmp)     Component vapor viscosity; Table 5.8:
                Field 2 (organic components), 3 (water,
                oxygen, and nitrogen), and 4 (nutrient).
cwsink(ncmppS)   Phase and component cumulative
                well sinks.
d(nmd)         Element dispersivities; Table 5.10:
                Fields.
dden(nn6)       Nodal gas, aqueous, and NAPL phase
                mole and mass density derivatives.
den(nn6)        Nodal gas, aqueous, and NAPL phase
                current time step mole and mass
                densities.
dent(nn6)       Nodal gas, aqueous, and NAPL phase
                previous time step mole and mass
                densities.
denO(nnmx)     Initial gas phase mass density.
dfxmf(nmbc)    Nodal component boundary diffusive
                flux; Table 5.21: Field 5 (gas phase
                components) and 6 (aqueous phase
                components).
dtemp(nzmax6)   Depth temperature corrections; Table
                5.14: Field 4 (component vapor
                pressures), 5 (component vapor
                viscosity), 6 (component Henry's Law
                constants), 7 (component aqueous
                solubility), 8 (component maximum
                substrate utilization rates), and 9
                (biomass decay coefficients).
 first(ncmp)      Boundary fluxes at nodes with constant
                concentration conditions.
                                                   134

-------
 flux(ncmppS)    Phase and component boundary fluxes.
 fmb(icnl)        Global FEM right hand side vector for
                 phase mass balance.
 fuse(ncmp2)     Oxygen and nutrient use factors; Table
                 5.12: Field 4.
 gama(nelS)      Nodal basis function z-derivatives.
 gamma(ncsqd)   Nodal component coefficients for
                 vapor viscosity expression.
 kex(ncmp5)      Component aqueous/gas,
                 aqueous/NAPL, gas/NAPL,
                 aqueous/biophase, and aqueous/solid
                 exchange coefficients; Table 5.9: Field
                 1.
 khalf(ncmp)      Component half saturation constants;
                 Table 5.12: Field 4.
 kinhib(ncmp)    Inhibition constants; Table 5.12: Field
                 4.
 kmax(ncmp5)    Component aqueous/gas,
                 aqueous/NAPL, gas/NAPL,
                 aqueous/biophase, and aqueous/solid
                 minimum deviations from
                 equilibriums; Table 5.9: Field 1.
 krtd(ncmp)       Component retardation factors; Table
                 5.11: Fields.
 p(nn3)           Nodal gas phase, aqueous phase, and
                 capillary current time  step pressures;
                 Table 5.17:  Field 3.
 pex(nnlO)        Nodal gas, aqueous, NAPL, solid, and
                 bio phase mole and mass phase
                 exchange terms.
 pmob(nnstk4)    Nodal aqueous and gas phase x and z
                 mobilities.
 pmw(nnS)        Nodal gas, aqueous, and NAPL current
                 time step phase molecular weights.
 pmwt(nnS)       Nodal gas, aqueous, and NAPL
                 previous time step phase molecular
                 weights.
 pmwO(nnmx)     Initial gas phase molecular weights.
 por(nelmx)       Element porosity.
 pt(nn3)           Nodal gas phase, aqueous phase, and
                 capillary previous time step pressures.
 q(ne!4)           Gas phase and aqueous phase specific
                 fluxes; Table 5.18 Field 4 (uniform) or
                 5 (nonuniform).
rbar(nelmx)       Element radial coordinates.
rhs(nsolve)       Global FEM right hand side vector.
 rhsex(nmf)      Nodal gas, aqueous, NAPL, solid, and
                bio phase mole component right hand
                side exchange terms.
 rxn(nmf)        Nodal aqueous and bio phase
                component reaction terms.
 rxnp(nn2)       Nodal aqueous and bio phase reaction
                terms.
 sat(nnstkS)      Nodal gas phase.aqueous phase, and
                NAPL current time step saturations.
 satk(nnstk2)     Nodal gas phase and aqueous phase
                previous iteration saturations.
 satt(nnstkS)      Nodal gas phase,aqueous phase, and
                NAPL previous time step saturations.
 sflux(ncmpp5)   Phase and component boundary fluxes
                at ground surface.
source(nn2)      Nodal phase boundary fluxes; Table
                5.21 Field 7 (gas phase) and 8 (aqueous
                phase).
srw(nelmx)      Nodal aqueous phase residual
                saturations.
str 1 (ncmppS)    Current time step phase and
                component storages.
strO(ncmpp5)    Initial phase and component storages.
t(50)            Vector of real variables.
    t(l)        Initial time of simulation; Table 5.6:
                Field 1.
    t(2)        Maximum or final time of simulation;
                Table 5.6:  Field 1.
    t(3)        Initial time step size; Table 5.6:  Field
                5.
    t(4)        Minimum time step size;  Table 5.6:
                Fields.
    t(5)        Maximum time step size; Table 5.6:
                Fields.
    t(6)        Time step multiplier for increases;
                Table5.6: Fields.
    t(7)        Time step multiplier for decreases;
                Table5.6: Fields.
    t(8)        Current time step size.
    t(9)        Current simulation time.
    t(10)        Time weighting factor;  Table 5.6: Field
                2.
    t(l 1)        Delay period for initiation of
                bioreaction; Table 5.12: Field 5.
    t( 12)        Print results at t( 12) intervals if Iprnt(O)
                is false; Table 5.4: Field 8.
    t( 13)        Convergence criterion for pressures;
                Table 5.6: Field 4.
                                                   135

-------
    t(14)

    t(15)

    t(16)

    t(I7)
    t(18)
    t(19)
    t(20)
    t(21)

    t(22)

    t(23)

    t(24)

    t(25)

    t(26)

    t(27)

    1(28)

tcmp(nnmx)
tort(nclmx)
umax(ncmp)

vis(nnmx)
w(icnl)
xmf(nmf)


xmft(nmf)


xnode(nnmx)

xyield(ncmp)

znode(nnmx)


Logical Arrays
Convergence criterion for mole
fractions; Table 5.6: Field 4.
Convergence criterion for NAPL
saturations; Table 5.6: Field 4.
Convergence criterion for immobile
phases; Table 5.6: Field 4.
Not used.
Not used.
Not used.
Not used.
Horizontal component of gravity
vector; Table 5.5: Field 1.
Vertical component of gravity vector;
Table 5.5: Field 1.
Maximum gas phase cell Peclet
number.
Maximum aqueous phase cell Peclet
number.
Maximum gas phase cell Courant
number.
Maximum aqueous phase cell Courant
number.
Print mass balance at t(27) intervals if
lprnt(25) is false; Table 5.4: Field 5.
Print time series at t(28) intervals if
lprnt(26) is false; Table 5.4: Field 6.
Nodal temperatures.
Element tortuosity factors.
Maximum substrate use rate; Table
5.12: Field 4.
Nodal gas phase viscosity.
Solver work space.
Nodal gas, aqueous, NAPL, solid, and
bio phase current time step mole
fractions.
Nodal gas, aqueous, NAPL, solid, and
bio phase previous time step mole
fractions.
Nodal ^-coordinates; Table 5.7: Field
9.
Biomass yield coefficient; Table 5.12:
Field 4.
Nodal z-coordinates; Table 5.7: Field
9.
lcon(50)         Vector of logical switches to print
                specified variables to the contour plot
                file at specified print intervals.
     lcon(l)     Contour in molar form; Table 5.15:
                Field 2.
     lcon(2)     Contour gas phase pressures; Table
                5.15: Field 2.
     lcon(3)     Contour aqueous phase pressures;
                Table 5.15: Field 2.
     lcon(4)     Contour gas/aqueous phase pressures;
                Table 5.15: Field 2.
     lcon(5)     Contour gas phase mass and molar
                density; Table 5.15: Field 2.
     lcon(6)     Contour aqueous phase mass and
                molar density; Table 5.15: Field 2.
     lcon(7)     Contour NAPL phase mass and molar
                density; Table 5.15: Field 2.
     lcon(8)     Contour gas phase mole fractions;
                Table 5.15: Field 2.
     lcon(9)     Contour aqueous phase mole fractions;
                Table 5.15: Field 2.
     lcon( 10)    Contour NAPL phase mole fractions;
                Table 5.15: Field 2.
     lcon( 11)    Contour solid phase mole fractions;
                Table 5.15: Field 2.
     lcon( 12)    Contour bio-phase mole fractions;
                Table 5.15: Field 2.
     lcon( 13)    Contour gas phase saturation; Table
                5.15: Field 2.
     lcon(14)    Contour aqueous phase saturation;
                Table 5.15: Field 2.
     lcon(15)    Contour NAPL phase saturation; Table
                5.15: Field 2.
     lcon(16)    Contour gas phase Darcy velocities;
                Table 5.15: Field 2.
     lcon(17)    Contour aqueous phase Darcy
                 velocities; Table 5.15:  Field 2.
     lcon(18)     Contour total organic soil
                 concentration; Table 5.15:  Field 2.
 Ictrl(50)         Vector of logical control switches.
     lctrl(l)      Solve transient phase balance; Table
                 5.5: Field 2.
     lctrl(2)      Solve transient component balance;
                 Table 5.5: Field 2.
     lctrl(3)      Include bioreactions; Table 5.5: Field
                 2.
                                                    136

-------
     lctrl(4)     Compute/print element dimensionless
                 numbers; Table 5.5: Field 7.
     lctrl(5)     Generate a restart file; Table 5.4: Field
                 7.
     lctrl(6)     Not used.
     lctrl(7)     Mass lump flow equation; Table 5.5:
                 Field 3.
     lctrl(8)     Mass lump transport equation; Table
                 5.5: Field3.
     lctrl(9)     Switch defining if nutrient is to be
                 modeled; Table 5.8: Field 4.
     lctrl(lO)    Generate uniform temperature
                 distribution; Table 5.14: Field 1.
     lctrl(ll)    Not used.
     lctrl(12)    True if an extraction is to be simulated;
                 Table 5.22: Field 1.
     lctrl(13)    Make gas phase viscosity composition
                 dependent.
     lctrl(14)    Couple flow and  transport through
                 exchange; Table 5.5: Field 6.
     lctrl(15)    Print time series output; Table 5.4:
                 Field 6.
     lctrl(16)    Include bioreaction in  aqueous
                 transport; Table 5.12: Field 2.
     lctrl(17)    Model biomass a steady state; Table
                 5.12:  Field 2.
     lctrl(18)    Use nodal Darcy  velocities for
                 transport; Table 5.18: Field 1.
     lctrl(19)    Use two compartment sorption model;
             :    Table 5.11: Field 1.
     lctrl(20)'    Include Klinkenberg effect; Table 5.13:
                 Field 2.
     lctrl(21)    Calculate hydrodynamic dispersion;
                 Table 5.10: Field 4.
     lctrl(22)    Calculate density derivative terms.
     lctrl(23)    Print contour plot data; Table 5.4:
                 Field 4.
     lctrl(24)    NAPL is present  in the domain;  Table
                 5.5: Field 2.
     lctrl(25)    Consider sorption; Table 5.5: Field 2.
     lctrl(26)    Run is a restart; Table  5.16: Field 1.
lplt(20)          Vector of logical  switches to print
                 specified variables to the time series
                 file.
     lplt(l)      Generate time series output for the gas
                 phase; Table 5.15: Fields.
     lplt(2)       Generate time series output for the
                 aqueous phase; Table 5.15: Field4.
lprnt(0:30)       Vector of logical switches to print
                 specified variables to the output file at
                 specified print intervals.
     Iprnt(O)     T=print at specified time steps, f=print
                 by time increment; Table 5.4: Field 8.
     Iprnt(l)     Print grid information; Table 5.7: Field
                 1.
     lprnt(2)     Not used.
     lprnt(3)     Print initial conditions; Table 5.15:
                 Field 1.
     lprnt(4)     Not used.
     lprnt(5)     Not used.
     lprnt(6)     Compute and print mass balance
                 information; Table 5.4: Field 5.
     lprnt(7)     Not used.
     lprnt(8)     Print in molar form; Table 5.15: Field
                 2.
     lprnt(9)     Print nodal gas phase pressure; Table
                 5.15: Field 2.
     Iprnt(lO)    Print nodal aqueous phase pressure;
                 Table 5.15: Field 2.
     Iprnt(ll)    Print nodal gas/aqueous capillary
                 pressure; Table 5.15: Field 2.
     lprnt(12)    Print nodal gas phase mole and mass
                 density; Table 5.15: Field 2.
     lprnt(13)    Print nodal aqueous phase mole and
                 mass density; Table 5.15: Field 2.
     lprnt(14)    Print nodal NAPL mole and mass
                 density; Table 5.15: Field 2.
     lprnt( 15)    Print gas phase mole fractions; Table
                 5.15: Field2.
     lprnt( 16)    Print aqueous phase mole fractions;
                 Table 5.15: Field2.
     lprnt(17)    Print NAPL phase mole fractions;
                 Table 5.15: Field 2.
     lprnt(l8)    Print solid phase mole fractions; Table
                 5.15: Field 2.
     lprnt(19)    Print bio-phase mole fractions; Table
              '   5.15: Field 2.
     lprnt(20)    Print nodal gas phase saturation; Table
                 5.15: Field 2.
     lprnt(21)    Print nodal aqueous phase saturation;
                 Table 5.15: Field 2.
     lprnt(22)    Print nodal NAPL phase saturation;
                 Table 5.15: Field 2.
                                                     137

-------
lprnt(23)    Print gas phase Darcy velocities; Table
            5.15: Field 2.
lprnt(24)    Print aqueous phase Darcy velocities;
            liable 5.15: Meld 2.
lprnt(25)    T=print mass balance at specified time
            steps, f=print by time increment; Table
            5.4: FieldS.
lprnt(26)    T=print time series at specified time
            steps, f=print by time increment; Table
            5.4: Field 6.

lprnt(27)    T=print material balance in report
            form, f=print material balance in time
            series form with multiple output files;
            Table5.4: FieldS.
    lprnt(28)    T=print time series file in mole
                fractions, f=print time series file in
                concentrations; Table 5.4:  Field 6.
    lprnt(29)    T=print total organic soil
                concentration; Table 5.4: Field 6.


Character Arrays

cname(ncmp)    Component labels; Table 5.8: Field 2
                (organic components), 3 (water,
                oxygen, and nitrogen), and 4 (nutrient).
infile(4)         Input file labels; Table 5.4: Field 1.
outfile(8+ncmp)   Output file labels.
                                                 138

-------
                                                          Appendix F

                                         EXAMPLE MAKE FILE
      Below is a sample make file for compiling MISER on an IBM6000 or Sun Spare workstation platform.
In this example the source and object files are located in subdirectories called 'src' and 'obj', respectively.
The executable file is named  'miser'  and is  generated in the directory containing the makefile.
# makemiser - to compile and link MISER code on Sun Spare workstations.
#                    '                                       '
# Define aliases for compilation and linking.
xl= f77 -OS -o
xc = m -O5 -c -o
#
# Define paths to source and object files.
ps = ./src/
po = ./obj/
#
# Define an include file alias.
includes = $(ps)dimen.inc
#
# Define an object files alias.
objects = $(po)atri's.o  $(po)bcflux's.o $(po)bio's.o \
     $(po)cbal's.o  $(po)commnfs.o $(po)disper's.o  \
     $(po)error's.o $(po)fiow's.o $(po)grid's.o  \
     $(po)har's.o  $(po)inputl's.o$(po)input2's.o \
     $(po)miser's.o $(po)mobirs.o  $(po)molewfs.o  \
     $(po)mpex's.o  ${po)napls's.o  $(po)naplx's.o \
     $(po)prnfs.o  $(po)satw's.o $(po)solid's.o  \
     $(po)tlhs's.o $(po)trans's.o $(po)vel's.o\
#
# Link object files into an executable named 'miser'.
miser: $(objects) $(includes)
$(xl) $@ $(objects)
#
# Define object file dependencies.
$(po)atri's.o: $(ps)atri.f  $(includes)
$(xc)$@ $(ps)atri.f
$(po)bcflux's.o: $(ps)bcflux.f $(includes)
$(xc)$@ $(ps)bcflux.f
$(po)bio's.o:   $(ps)bio.f S(includes)
$(xc)$@ $(ps)bio.f
$(po)cbal's.o:  $(ps)cbal.f$(includes)
$(xc)$@ $(ps)cbal.f
$(po)commnt's.o: $(ps)commnt.f$(includes)
$(xc)$@ $(ps)commnt.f
$(po)disper's.o: $(ps)disper.f $(includes)
$(xc)$@ $(ps)disper.f
$(po)error's.o:  $(ps)error.f $(includes)
$(xc)$@ $(ps)error.f
$(po)flow's.o:  $(ps)flow.f $(includes)
$(xc)$@ $(ps)flow.f
$(po)grid's.o:  $(ps)grid.f S(includes)
$(xc)$@ $(ps)grid.f
$(po)har's.o:   $(ps)har.f
$(xc)$@ $(ps)har.f
$(po)inputrs.o: $(ps)inputl.f$(includes)
$(xc) $@ $(ps)inputl!f
$
-------
                                                        Appendix G

                                        EXAMPLE MT4 FILES
     Below are sample input files for the three example problems described in Section 6:  example 1 is the
SVE problem; example 2 is the first BV problem; and example 3 is the field scale BV problem.  Note that
data for example problems 2 and 3 ate included as comment lines using the # in column  1.

     The first input file should be named 'iriiset.dr and located in the directory with the executable code.
# This is the data file for input 1 for example 1 (SVE)
* Data for examples 2 (BV) and 3 (field scale BV) are included.
# Data fields can be separated by comment lines beginning with the '#'
H All data are input in free format.
H
((1======= BLOCK A: INPUT/OUTPUT FILES AND OP-

H
# Field 1 - Input files.
# Specify the name of D2 and the error message file.
» The file name must be in single quotes.
#
H far example 1 , the datafile for input2 is located in the subdirectory
Ndau
 'data/d2,cxampler  'miser.error'
H for example 2, the datafile for input2 is located in the subdirectory
ti 'dat3/d2.cxamplc2'  'miser.enor'
* for example 3, tire datafile for input2 is located in the subdirectory
Hdata
(f 'data/d2,example3'  'miser.error'
»
# Reid 2 - Prefix name for all output files.
» e.g. 'outprc.out', 'outprc.err', etc.
tt The prefix name must also be entered in single quotes.
*
H for example 1 , output is written to the tmp directory
 "Amp/examplel1
It for example 2, output is written to the tmp directory
» Vtmp/cxample2'
# for example 3, output is written to the tmp directory
H '/tmp/exampleS'
H
# Field 3 - Output unit numbers for error and performance information.
H Device numbers for:
* (1) printing error and warning messages, and
If (2) printing performance information.
H    0 * do not print information;
     6 « screen:
     21 = main output file (prefix. out);
     22 = error message file (prefix.err) (only for error messages);
     23 « convergence history file (prefix.cnv) (only for performance
        output),
 I* for examples 1,2 and 3, print information to the screen
  6 6
 tf
 H Field 4 - Contour plot file.
 H Logical switch to open and print contour plot data to the file
 # "outprc.con' (lclrl(23) = (or f).
 H
 It for examples 1,2 and 3
  t
 H
# Field 5 - Mass balance Output file.
# Enter either 1 or 3 lines of data.
# line 1: A logical switch to open and print mass balance results to
#     the file 'outpre.mb' (lprnt(6) = t or f).
# line 2: Only needed if lprnt(6) above is true, otherwise disregard.
      Enter a logical variable lprnt(25) indicating if the print
      interval is set by the number of time steps (true) or by a
#     constant time interval (false). Enter a logical variable
#     lprnt(27) indicating if the material balance is in report
#     form (t) orin multiple files in time series form (f).
# line 3: Only needed if lprnt(6) above is true, otherwise disregard.
#     Enter either the number of time steps ipt(83) or the uniform
#     print interval in seconds t(27).
#
# for examples 1, 2 and 3, print the mass balance every  10 days
 t
 f  f
 8.64d5
#
# Field 6 - Time series output file.
# Enter either 1 or 3 three lines of data.
# line 1: A logical switch to open and print time series results to
#    the file 'outpre.plt' (lctrl(15) = t or f).
# line 2: Only heeded if lctrl(15) above is true, otherwise disregard.
#    Enter a logical variable lprnt(26) indicating if the print
#    intervalis set by the number of time steps (true) or by a
#    constant time interval (false). Enter a second logical
#    switch lprnt(26) indicating the concentration units for
#    output (t=mole fraction, f=concentration).
# line 3: Only needed if lctrl(15) above is true, otherwise disregard.
#    Enter either the number of time steps ipt(84) or the uniform
#    print interval in seconds t(28).
#
# for examples 1,2 and 3
 f

# Field 7 -Restart file.
# Open and print restart data to the file 'outpre.rst'
 #(Ictrl(5) = torf).
 #
 # for examples 1,2 and 3
 t
 #
 # Field 8 - Uniform print interval to the main output file.
 # Enter two lines:
 #  (1) a logical variable indicating if the print interval is set
 #    by the number of time steps (true) or by a constant time
 #    interval (false);
 #  (2) either the number of time steps ipt(25) or the uniform print
 #    interval in seconds t(12).
 #
 # for examples 1, 2 and 3, print the main output file every 20 days
  f
  I.7280d6
                                                                  140

-------
           ======= TITLE CARDS ===========
#
$	
#
# Define an unspecified number of title cards, including zero, if none
# are desired. Title or comment cards are indicated with an '&' symbol
# in column one. These can be placed anywhere in the main output file,
# provided they are positioned in the input files between data fields.
#
&
&Sample data file for input 1: examples 1, 2, and 3.
#
#====== BLOCK B: GENERAL MODEL CONTROL OPTIONS ==
#
# Field 1 - Coordinate system.
# Specify: (1) an integer switch: 0=cross-sectional (x-z);
#         1 = axial-symmetric (r-z);
#      (2) horizontal component of the gravitational constant
#        (m/s"2);   .
#      (3) vertical component of the gravitational constant
#        (m/s"2);
#
# for examples 1,2 and 3
 1  O.dO  9.81dO
#
# Field 2 - Equation solution options.
# Define 3 logical variables (t or f) indicating which balance equations
# are to be solved:
#  (1) solve the phase balance eqs;
#  (2) solve the component transport eqs;
#  (3) solve napl equations
#  (4) solve solid phase equations
#  (5) solve biophase equations
# The flow equations can be solved without solving transport equations;
# the transport eqs can be solved with an input steady state flow
# distribution, option 2 must be true for options 3,4, or 5 to be true;
# for example 1
 t t t t f
# for example 2
#t t t f t
# for example 3
#t t t t  t
#
# Field 3 - Mass lumping options.
# Define two logical variables indicating if lumping of the mass matrix
# is to be performed in the solution of the flow eqs and in the
# solution of the transport equations.
# for examples 1,2 and 3
 tt
#
# Field 4 - Flow solution skipping option.
# Read an integer parameter denoting the number of time steps to be
# skipped between.solving for the flow equations.
#
# for examples 1,2 and 3
 0
#
# Field 5 - not used

# Field 6 - Coupling between flow and transport.
# Enter a logical variable indicating if mass exchange terms
# should be included in the solution of the flow equations.

# for examples 1, 2 and 3
 t
#
# Field 7 - Element dimensionless numbers.
# Enter a logical variable indicating if element dimensionless
# numbers are to be calculated for the transport solution
#
# for examples 1,2 and 3
 t
#
#=== BLOCK C: TIME STEP AND ITERATION CONTROL =
#
# Field 1 - Simulation time frame.
#The initial (t(l)) and final (t(2)) simulation time in seconds.
#
# for examples 1, 2 and 3, run simulation for 100 days
 O.dO  8.640d6
#
# Field 2 - Time weighting.
# Specify the time weighting parameter (t(10)): 0=explicit; l=implicit;
# 0.5 = Crank-Nicolson.
#
# for examples 1, 2 and 3
 l.dO
#
# Field 3 - Maximum number of time steps (ipt((30)).
#
# for examples 1,2 and 3
 100000000
#
# Field 4 - Convergence tolerance.
# Convergence tolerance in the solution of:
# the phase balance eqs t(13); the component transport eqs 1(14);
# the bioreaction eqs. t(15); the immobile phase eqs. t(16).
#
# for examples 1,2 and 3
 l.d-5     l.d-8   l.d-8   l.d-8
#
# Field 5 - Time step range.
# Initial time step size (t(3)) in seconds; the minimum time step size
# t{4)); and the maximum time step size (t(5)).
#
# for examples 1,2 and 3
 l.dO    l.d-4    3.6d3
#
# Field 6 - Maximum iterations for convergence.
# Maximum number of iterations for convergence in the solution of:
# the phase balance eqs ipt(31); the component transport eqs
#ipt(32); the bioreaction eqs. ipt(33) (ipt(33) currently not used).
#
# for examples 1,2 and 3
 15     30    30
#
# Field 7 - Maximum iterations for time step amplification.
# Maximum number of iterations for time step amplification in the
# solution of: the phase balance solution ipt(34), and in the
# solution of the transport eqs. ipt(35).
# The minimum must be less than the maximum number of iterations.
#
# for examples 1,2 and 3
7     7
#
# Field 8 - Time step multiplication factors.
# Empirical time step amplification t(6) and reduction t(7) factors.
# The time step is increased by a factor t(6) if the number of
# iterations for convergence is less than the minimum; conversely the
# step is reduced by the factor t(7) if the number of iterations for
# convergence is greater than the maximum.
#
# for examples 1, 2 and 3
 1.05dO     0.75dO
#
#== BLOCK D:  GRID PARAMETERS AND OPTIONS =====
#
# Field 1 - Output grid geometry.
# Enter a logical switch indicating if all grid information should be
# printed to the main output file?
#
# for examples 1,2 and 3
f
#
# Field 2 - Grid specification options.
# Generate the grid for a rectangular homogeneous domain?
# Enter an integer value: 0 = don't generate the grid, input all
#                element numbers and nodal coordinates.
#              1 = generate union jack grid.
#              2 = generate herring bone grid.
#
# for examples 1,2 and 3
2
                                                                      141

-------
* Held 3 - Number of blocks.
ft If a grid is 10 be generated (igrid>0), then enter the number of
ft blocks in the horizontal (nx) and vertical (nz) directions,
ft respectively, Skip if no grid is generated (igrid=0).
ft
ft for example I
 31  13
ft for example 2
ft 39  IS
ft for example 1
II40  56
ft
ft Held 4 - Horizontal Block spacing in generated grid.
ftIf a grid is to be generated (igrid>0), then enter:
ft first line • a logical variable indicating if the spacing is uniform,
ft         and the horizontal coordinate of the left boundary;
ft succeeding lines - horizontal spacing (one value if uniform, or nx
(f           values if nonuniform). Units are assumed to be
ft           melers.
ft Skip if no grid is generated (igrid=0).
ft
ft for example 1
 f 0,2SdO
 0.01d00.02d00.03dO
 0 (MdO 0 05dO 0,06dO O.OVdO O.OSdO 0.09dO 0.1 dO 0.12dO 0.15dO 0.20dO
 0,25dQ 0.3(10 0.4d00.5dOO,6d00.75d00.95dO 1.2dO 1.5dO 1.85dO
 2,25(10 2,75dO 3,35dO 4.dO 4.75dO S.dO S.dO S.dO
 ft for example 2
 ft f 0.250), then enter:
 ft first line - a logical variable indicating if the spacing is uniform,
 ft        and the horizontal coordinate of the left boundary;
 ft succeeding lines - horizontal spacing (one value if uniform, or nx
 ft           values if nonuniform). Units are assumed to be
 ft           meters.
 ft Skip if no grid is generated (igrid=0).
 ft
 ft for example 1 and 2
  I  O.dO
  0.25JO
 ft for example 3
 #f  O.dO
 ft 0.25(10 0.25dO 0,25dO 0.25dO
 ft 0.25dO 0,25dO 0.25dO 0.25dO
 ft 0.25dO 0.25dO 0.25dO 0.25dO
 ft 0.25dO 0.25dO 0.25(10 0.25dO
 ft 0.25(10 0.25dO 0.25dO 0.25dO
 ft 0,25(10 0.25(10 0.25dO 0.25dO
 ft 0.25dO 0.25dO 0.25dO 0.25dO
 * 0.20dO 0.20dO 0.10(10 O.lOdO  O.lOdO O.lOdO O.IOdO O.lOdO
 ft 0,10(10 O.lOdOO.lOdO O.ISdO  O.lSdO 0.20dO 0.20dO
  ft 0.25UO 0.25dO 0.25dO 0.25dO
 ft 0-30dO 0.40JO O.SOdO 0.5CWO  O.SOdO
  ft 0.50(10 O.SOdO O.SOdO 0.50dO
  H
  ft field 6 - Horizontally aligned material property blocks.
  ft If a grid is to be generated (igrid>0), then enter an integer number
  ft of horizontal material property blocks (ipt(26)).
  ft If the number of blocks is greater than 1, then beginning on the
  ft following  line, enter the material block number for each vertical
  spacing. There must be nz integer values in order from top to bottom.
# Skip if no grid is generated (igrid=0).
#
# for example 1 and 2
 2
   1 1 1222211 I 1 1 1 I 1  1 1
# for example 3
#3
#11111111
#22222222
#2222
#33333333
#33333333
#33333333
#33333333
#3333
#
# Field 7 - Grid dimensions.
# If a grid is to be input (igrid=0), then enter:
 * the number of elements (ipt(0)); the number of nodes (ipt(l))! and the
 t number of material property blocks (ipt(26)).
# Skip if the grid is generated (lgrid>0).
#
# Field 8 - Nodal incidence list.
# If a grid is to be input (igrid=0), then enter the nodal incidence
# list and the material property block number for each element.
# The element node incidence list consists of the arbitrary global
# element number followed by that element's three global node numbers.
# Each element has its own line. The element node numbers
 # start at an arbitrary node. If the z coordinate is positive
 # downwards proceed in the clockwise direction, otherwise proceed
 # in the counterclockwise direction.  If there is only one material
 # property block for the entire domain, the material property input
 # assignment for each element is omitted. The minimum material
 # property block is a two element quadrilateral.
 #
 # Field 9 - Nodal coordinates
 # If a grid is to be input (igrid=0), then enter the nodal coordinates.
 # For each node enter 1 line of data giving: the node number; horizontal
 # coordinate; and the vertical coordinate. Units are assumed to be
 # meters. Skip if the grid is generated (igrid>0).

 #==== BLOCK E: COMPONENT INFORMATION ======
 #
 # Field 1 - Number of NAPL components.
 # Specify the number of components in the NAPL (ipt( 15))
 #
 # for example I and 2
  1
 # for example 3
 #2
 #
 # Field 2 - NAPL component chemical properties.
 # For each NAPL component enter in order:
 #    (1) component number
 #    (2) component name (character variable in single quotes)
 #    (3) component molecular weight (g/mole)
 #    (4) component vapor pressure (atm)
 #    (5) component vapor viscosity (cPoise)
 #   (6) component liquid density (g/1)
 #   (7) component gas diffusivity (cm"2/s)
 #   (8) component aqueous diffusivity (cm"2/s)
  #   (9) component henry's constant (atm 1/g)
  #   (10) component aqueous solubility  (g/1)
  # Data for each component must start on a new line.
  # Note: a component can be excluded from the gas phase or the aqueous
  # phase by entering a negative value for  the vapor pressure or aqueous
  # solubility, respectively. Organic components should be entered in
  # order of volatility starting with the most volatile.
  # Skip this item if no NAPL components are specified (ipt(I5)=0).
  #
  # for example 1 and 2
   1  ' toluene '  92.1340dO 2.940d-2 7.0d-3     867.0dO
  8.5d-2  9.540d-6  5.70d-2  .5150dO
  # for example 3
  #1  'benzene '  78.10dO 0.102dO 7.5d-3    879.0dO
  #8.8d-2  9.0d-6 5.70d-2  1.78dO
  #2 'xylene ' 106.2dO 0.0092dO  7.0d-3    880. IdO
                                                                         142

-------
 #6.2d-2  7.2d-6 5,70d-2  .I75dO
 #
 # Field 3 - Chemical property data for water, oxygen, and nitrogen.
 # Enter the 10 parameter values listed above. The ordering is assumed
 # to be: water, oxygen, and nitrogen.
 # The component number is always: water = ipt(l 5)+l; oxygen = ipt(15)+2;
 #                  nitrogen = ipt(15)H-3
 # Any of these components can be eliminated by specifying negative
 # values for both the vapor pressure and water solubility.
 # Note, if water is eliminated then there is no aqueous phase pressure
 # and the flow equations cannot be solved.
 # If nitrogen is eliminated, then there is no gas phase, (i.e. the vapor
 # pressure must be negative for all components). The nitrogen
 # solubility is a dummy input; it is not used in computations.
 # for example 1
 2 ' water '   IS.OdO  -2.310d-2  9.750d-3   998.0dO
 .2450dO   O.OdO   O.OdO    l.OdO
 3 ' oxygen  '  32.0dO   -0.20dO   0.0192dO   998.0dO
 8.5d-2   2.I53d-5  O.OdO    -.009dO
 4 ' nitrogen  ' 28.02dO  l.OdO   0.0172dO  998.0dO
 O.OdO   O.OdO   O.OdO   -l.OdO
 # for example 2
 #2 'water   '   IS.OdO  -2.310d-2 9.750d-3  998.0dO
 #.2450dO   O.OdO   O.OdO    l.OdO
 # 3 ' oxygen '  32.0dO   0.20dO   0.0192dO  998.0dO
 #8.5d-2   2.153d-5  O.OdO     .009dO
 #4 ' nitrogen ' 28.02dO  l.OdO    0.0172dO  998.0dO
 # O.OdO   O.OdO    O.OdO   -l.OdO
 # for example 3
 #3 'water   '   IS.OdO  -0.0231dO 9.50d-3   998.2dO
 #.2450dO   O.OdO   O.OdO    l.OdO
 #4 'oxygen '  32.0dO   0.20dO   0.02dO  998.0dO
 #8.5d-2   2.153d-5  O.OdO     .009dO
 #5 ' nitrogen '  28.02dO  l.OdO    0.0174dO   998.0dO
 # O.OdO   O.OdO   O.OdO   -l.OdO
 #
 # Field 4 - Nutrient inclusion.  .
 # Enter a logical variable indicating whether a nutrient component is
# to be modeled.
 #
 # for examples 1, 2 and 3
 f
 #
 # Field 5 - Nutrient Chemical Properties.
 # If a nutrient is modeled, then specify the 10 chemical
 # property parameters listed above.
# The component number of nutrient is always = ipt(15)+4.
# Skip this item if no nutrient is modeled.
#
#=== BLOCK F: MASS EXCHANGE INFORMATION =====
#
# Field 1 - Interphase mass exchange coefficients.
# Enter: (1) component number which is identical to the order entered
#     above;  nitrogen = ipt(15)+3; nutrient=ipt(15)+4)
#    (2) aqueous/gas exchange coefficient (I/sec)
#    (3) aqueous/NAPL exchange coefficient (I/sec)
#    (4)gas/NAPL(l/sec)
#   (5) aqueous/biophase (1 /sec)
#    (6) aqueous/solid (I/sec)
# Note: a zero value for aqueous/biophase mass exchange coefficient
# indicates that the component does not partition between that phase
#pair.
# On a second line enter minimum deviations from equilibrium for each
# exchange coefficient entered on the previous line. DO NOT ENTER A
# VALUE LESS THAN 0.05DO.
# Enter: (1) component number which is identical to the order entered
#
#
#
#
#
#
#
# for example 1
# toluene
 1  5.0d-55.0d-45.0d-40.dO 5.d-5
 1  O.ldO O.ldO O.ldO O.ldOO.ldO
# water
  above; nitrogen = ipt(l 5)+3; nutrient=ipt(l 5)+4)
(2) aqueous/gas minimum deviations from equilibrium
(3) aqueous/NAPL minimum deviations from equilibrium
(4) gas/NAPL minimum deviations from equilibrium
(5) aqueous/biophase minimum deviations from equilibrium
(6) aqueous/solid minimum deviations from equilibrium
 2 O.dO  O.dO O.dO  O.dO  O.dO
 2 O.ldO O.ldO O.ldO O.ldOO.ldO
 # oxygen
 3 O.dO  O.dO O.dO  O.dO  O.dO
 3 O.ldO O.ldO O.ldO O.ldOO.ldO
 # nitrogen
 4 O.dO  O.dO O.dO  O.dO  O.dO
 4 O.ldO O.ldO O.ldO O.ldOO.ldO
 # for example 2
 # toluene
 # 1 5.0d-6 5.0d-5 5.0d-5 O.dO O.dO
 #1 O.ldO O.ldO O.ldO O.ldOO.ldO
 # water
 #2 O.dO  O.dO  O.dO  O.dO O.dO
 #2 O.ldO O.ldO O.ldO O.ldOO.ldO
 # oxygen
 # 3 5.0d-6 5.0d-5 5.0d-5 O.dO O.dO
 #3 O.ldO O.ldO O.ldO O.ldOO.ldO
 # nitrogen
 #4 O.dO  O.dO  O.dO  O.dO O.dO
 #4 O.ldO O.ldO O.ldO O.ldOO.ldO
^fpr example 3
 # benzene
 #1 1.157d-52.315d-45.787d-40.dO  1.157d-5
 #1 0.075dO  0.075dO 0.075dO 0.075dO 0.075dO
 # o-xy!ene
 #2 1.157d-52.315d-45.787d-40.dO  1.157d-5
 #2 0.075dO  0.075dO 0.075dO 0.075dO 0.075dO
 # water  \
 #3 O.dO  I O.dO   O.dO  O.dO O.dO
 #3 0.075dO  0.075dO 0.075dO 0.075dO 0.075dO
 # oxygen
 #4 1.157d-52.315d-45.787d-40.dO  1.157d-5
 #4 0.075dO  0.075dO 0.075dO 0.075dO 0.075dO
 # nitrogen
 #5 O.dO   O.dO   O.dO  O.dO O.dO
 #5 0.075dO  0.075dO 0.075dO 0.075dO 0.075dO
 #
 #=== BLOCK G: MATERIAL PROPERTY BLOCK DATA =
 #
 # Field 1 - Soil physical properties:
 # For each material property block specify:
 #   (1) material block number;
 #    (2) porosity;
 #    (3) horizontal permeability (m"2);
 #    (4) vertical permeability (m"2).
 #    (5) bulk soil density (gm/cm"3)
 #    (6) organic carbon content
 # Data for all  blocks must be defined.
 # Data for each block begins on a new line
 #
 # for example 1 and 2
 1 0.33dO  l.d-11  O.Sd-11  1.7dO O.OOldO
 2 0.35dO  0.6d-ll  0.4d-ll  1.7dO O.OOldO
 # for example 3
 #1  0.33dO  l.Od-Il  l.Od-11  1.7dO O.OOldO
 #2 0.33dO 5.0d-ll  5.0d-ll  1.7dO O.OOldO
 #3  0.33dO 0.7d-ll  0.7d-ll  1.7dO O.OOldO
#
 # Field 2 - Water retention parameters:
# For each material property block specify:
 #    (1) material block number;
#    (2) residual water saturation;
#    (3) van Genuchten n for  air/water retention data;
#    (4) van Genuchten alpha for air/water retention data (I/Pa).
# Data for all  blocks must be defined.
# Data for each block begins on a new line
#
# for example 1 and 2
 1 0.12dO 7.0dO   .002dO
 2 0.16dO S.OdO   .OOOSdO
# for example 3
#1  0.073dO  3.97dO  4.34d-4
#2  0.073dO  3.97dO  7.47d-4
#3  0.073dO  3.97dO  2.79d-4
#
# Field 3 - Dispersion parameters:
# For each material property block specify:
                                                                       143

-------
H    (I) material block number;
ft    (2) longitudinal dispersivity (m);
ft    (3) transverse dispersivity (m);
ft
ft for example 1 and 2
 t l.OdO  0.01dO
 I I OdO  0.01 dO
ft for example 3
M 1 0.5JO   0.01 dO
it 2 OS-JO   0.01 dO
»3 0.5JO   O.OloO
«
# Field 4 - Dispersion tensor computation.
fl Enter a logical variable (lclrl(21)) indicating that the
ft hydrodynamic dispersion tensor should be calculated. Enter false if
ft a known and. constant dispersion tensor is to be input.

ft for examples 1,2 and 3
 I
ft
It Field 5 • Dispersion tensor.
It If kttl(2l) above is false then enter the hydrodynamic dispersion
It tensor for each component present with two lines, the first line is
* for the gas phase and the second line is for the aqueous phase. The
If first entry on each line is Ihe component number.
H
ffnmz BLOCK H: SORPTION PARAMETERS =====

(t ReJd 1 - Sorption model (required if lclrl(25)=true):
ft Enter a logical variable (lctrl(19)) indicating if sorption is
It modeled as a one (false) or two (true) compartment process.
It Note; lire two compartment model is currently limited to conditions of
If a homogeneous soil domain and a single component NAPL.

It Tor examples land 3
 t

(t Field 2 - Single compartment Freundlich sorption parameters
H      (required if I«rK25)=true):
It For each material property block enier two groups of data:
H  (1) Ihe material block number, followed by the k parameter values
H    for each organic component in order
ft    from I to the number of components (micrograms/gram solid,
ft    with aqueous concentration in mg/1)
ft  (2) the material block number, followed by the n=l/m parameter
ft    (dimensionlcss) values ordered in the same way.
II
H for example 1
 I 7,72dO
 1 0.544dO
 2 7,72dO
 2 0,S44dO
H for example 3
#1  l,I6dO  0..16JO
 ft I 0.862dO 1.07dO
 II2  IJ6dO  0,36dO
 H2 0862JO 1.07dO
 ft 3  U6dO  0.36dO
 It 3 O.S62dO 1.07dO
 ft
 H Field 3 - Two compartment sorption data:
 K Tlic two compartment model has a slow and a fast compariment.
 H Both compartments are modeled with Ihe Freundlich equation.
 It Four parameters must be input:
 If  (I) multiplier to convert slow compartment kf parameter to the fast
 If    compartment value;
 H  (2) mtilliptler lo convert slow compartment n=l /m parameter to the
 H    compartment value;
 ft  (3) multiplier to convert slow compartment mass transfer
 If    coefficient to the fast compartment value;
 K  (4) mass fraction of solid phase in the fast compariment.
 H Skip this item if Ihe single compartment model is used
 »(lctrl(19)=false)
 It
 It Field 4 - Include retardation factor (required if Ictrl(25)=false).
 M Enter a logical variable indicating if retardation factors are  used.

 H for example 2
#f
#
# Field 5 - Retardation factors (required if lctrl(25)=false and
# lretrd=true)
# For each component give the component number and the retardation
# factor. Retardation factors must be entered for all components,
# however 1,0 implies no sorption.
^
#=== BLOCK I: BIOLOGICAL PARAMETERS ====
#
# Field I - Number of biodegradable substrates.
# Specify the number of biodegradable substrates, ipt(17). The biophase
# always contains oxygen and nutrient if present.
#
# for example 2
#1
# for example 3
#2
#
# Field-2 - Biodegradation control switches.
# Specify 2 logical variables indicating:
#   (1) if a steady state biomass is to used (value=true), or if a
#     transient, biomass is to be modeled (value=false).
#   (2) if biodegradation equations are modeled as a sink term
#     in.the aqueous transport equations (value=true),
#     otherwise their modeled as. rate-limed1 exchange to a
#     separate biophase (value=false).
#
# for examples 2 and 3
#f  t
#
# FieUfS - Growth kinetics option.
# Specify an integer value indicating the type of growth
# kinetics: (ONLY OPTIONS 1 AND 2 AVAILABLE NOW)
#    1 = standard Monod kinetics
#    2 = Monod kinetics with substrate inhibition
#    3 = Monod kinetics with lumped substrate inhibition
#    4 = Monod kinetics with saturation dependency
#     and substrate inhibition
#   5 = Monod kinetics with saturation dependency and
#     substrate inhibition
#
# for examples 2 and 3
#2
#
# Field 4 - Monod parameters:
# For each component in the biophase provide the following information:
#   (1) component number as defined in block E.
#   (2) electron acceptor use coefficient (gm-O2/gm-substrate)
#   (3) nutrient use coefficient (gm-nutrient/gm-substrate)
#   (4) maximum substrate use rate (gm-substrate/gm-biomass/sec)
#   (5) half saturation constant (gm-component/1)
#   (6) yield coefficient (gm-biomass/gm-substrate)
#   (7) inhibition constant (dimensionless) expressed as a fraction of
#     the aqueous solubility. For substrate and nutrient this
#     turns off metabolism when the concentration is above this
#     threshold concentration and for electron acceptor this
#     turns off metabolism when the concentration is below this
#     threshold concentration. In  both cases hyperbolic functions
#     are used.
#
# for example 2
 # toluene
 #1 2.19dO   1.5dO  1.157d-6  !7.4d-3 0.5dO   0.25dO
 # oxygen
 #3 2.I9dO   I.SdO  1.157d-6 O.Id-3  O.SdO  0.2dO
 # for example 3 (high set)
 # benzene
 #1 2.19dO  O.dO   1.157d-5 0.5d-3 O.SdO   0.5dO
 # o-xylene
 #2 2.I9dO
 # oxygen
 #4 2.19dO
 #   .
 # Field 5 - Decay and biomass range coefficients.
 # Specify:
 #   ( 1 ) the decay coefficient (sec)
 #   (2) the minimum biomass (g/1)
                O.dO  l.!57d-5 0.5d-3  O.SdO   O.SdO
                O.dO  1.157d-5 0.5d-3 O.SdO   0.5dO
144

-------
                l.d-6 2.d-2  l.d-6  8.64d4
#   (3) the maximum biomass (g/1)
#   (4) the initial uniform biomass (g/1)
#   (5) delay period for initiation of bioreaction (sec)
#
# for example 2
#1.157407d-7  l.d-3  100.0d-31.62d-38.64d4
# for example 3
#1.157407d-6
#
#===== BLOCK J: PHASE PARAMETERS =====
#
# Field 1  - Water phase viscosity.
# Specify the water phase viscosity (cPoise)
#
# for examples 1 and 2
 1.124dO
# for example 3
# 1.002dO
#
# Field 2  - Gas phase slip flow parameters.
# Specify:
#   (1) a logical variable indicating if the Klinkenberg
#     effect is to be modeled (value=true);
#   (2) the Klinkenberg parameter (arm). Set the parameter to zero
#     if the previous line is false.
# for examples 1,2 and 3
 f  O.dO
#
#====== BLOCK K: TEMPERATURE PARAMETERS =====
#
# Field 1 - Temperature distribution.
# Specify a logical variable indicating if temperature
# distribution is uniform (true).
#
# for examples 1, 2 and 3
 t
#
# Field 2 - Uniform temperature distribution.
# If the temperature distribution is uniform, enter a single uniform
# value (degree C); otherwise enter a temperature value for each node
# along the vertical edge of the domain.
#
# for examples 1,2 and 3
 20.dO
#
# Field 3 - Nonuniform temperature distribution.
# A vertical nonuniform temperature  distribution can be defined only in
# association with a generated rectangular grid.
# Temperature values are needed for each vertical node along the
# boundary starting at the surface, downward (ny+1 values).
# For each node enter 1 line of data giving the:
#   1) vertical depth of node (for error checking)
#   2) temperature .at the node (degree C)
#
# Field 4 - Temperature dependent chemical properties.
# Temperature dependent chemical properties are needed for each
# component for the following 6 properties:
#     (1)  component vapor pressure
#     (2)  component vapor viscosity
#     (3)  component Henry's law  constant
#     (4)  component aqueous solubility
#     (5)  component maximum specific utilization rate
H     (6)  biomass decay rate
# For each of these properties give the temperature dependent value at
# each of the ny+1 nodes along the vertical boundary.
# Provide the information for all 6 properties for a given component and
# then repeat for the next component.
# Use the original component ordering as in the component information
# section.  After all the component values give the kd values.
#
# Vapor pressure of component 1 at ny+1 nodes
#
 # Vapor viscosity of component 1 at ny+1 nodes
 #
 # Henry's law constant of component 1 at ny+1 nodes
 #
 # aqueous solubility of component 1 at ny+1 nodes
 #
 # maximum specific utilization rate of component 1 at ny+I nodes
 $
 # Repeat above for all NAPL components, then water, oxygen, nitrogen and
 # nutrient if present.
 # After all components have been entered, provide ny+1 nodal values for
 # the Kd coefficient.
 #
 #=== BLOCK L: OUTPUT CONTROL PARAMETERS =====
 #
 # Field 1 - Print initial conditions.
 # Enter a logical variable (LPRNT(3)) indicating if initial conditions
 # should be printed for selected variables.
 #
 # for examples 1, 2 and 3
 t
 #
 # Field 2 - Print switches.
 # Read print switches for specified variables, the first switch for
 # each variable is for the printed output, the second switch for
 # each variable is for the contouring output: Use component numbers
 # based established in block E above:
 # This input is currently set for minimal output. The user should
 # specify output of interest.
  t f    print/contour output in molar form
  t f    print/contour nodal gas phase pressure
  t f    print/contour nodal aqueous phase pressure
  f f    print/contour nodal gas/aqueous capillary pressure
  f f    print/contour nodal gas phase density
  ff    print/contour nodal aqueous phase density
  f f    print/contour nodal NAPL phase density
  t f    print/contour nodal gas phase components
     1  1
  11    print/contour nodal aqueous phase components
     1  1
  f f    print/contour nodal NAPL phase components
  f f    print/contour nodal solid phase loadings
  f f    print/contour nodal bio-phase components
  t f    print/contour element avg total organic soil mass fraction
  t f    print/contour nodal gas phase saturation
  t f    print/contour nodal aqueous phase saturation
  t f    print/contour nodal NAPL phase saturation
  t f    print/contour gas phase Darcy velocities
  f f    print/contour aqueous phase Darcy velocities
#
# Field 3 - Gas phase time series plot switches.
# Iine(l) - enter a logical variable indicating if time series plot
         output files should be generated for gas phase
   line(2) - If .true, enter the number of gas phase components;
         followed by the global component number and the
         associated node number for the location from which to
         output.
   A maximum of 6 components can be defined for the combined gas and
   aqueous phase below.
  f   time series plot nodal gas phase components
#
# Field 4 - Aqueous phase time series plot switches.
# Iine(l) - enter a logical variable indicating if time series plot
#       output files should be generated for gas phase
# line(2) - If .true, enter the number of gas phase components;
#       followed by the global component number and the
#       associated node number for the location from which to
#       output.
# Amaximumof6 components can be defined for the combined gas and
# aqueous phase below.
 f   time series plot nodal aqueous phase components
      In this example the second input file is named 'd2.examplel' and is located in a subdirectory called
'data.'
                                                                      145

-------
» This is the dan file for input2 for example 1 (SVE)
# Data for examples 2 (BV) and 3 (field scale BY) are included.
(t Data field can be separated by comment lines beginning with the '#'
H All 0, then for each element containing NAPL provide the
 # following information:
 #  (1) element number
 #  (2) The uniform nodal NAPL saturation;
 #  (3) NAPL mole fraction of each organic component.
 #    There must be ipt(15) mole fractions specified.
 #    Mole fractions are entered in sequential order (i.e. component
 #    numbers 1 to ipt(15). The mole fractions must sum to 1.

 # for examples  1 and 2 - this is a partial file.
  1.531656E-02.1000E+01
  2.562525E-02.1000E+01

  572.566822E-09 .1000E+01
  573 .566507E-09 .1000E+01
 # for example 3 - this is a partial file.
 # 1 0.326712E-01 0.5000E+00 0.5000E+00
 #20.285502E-010.5000E+00 0.5000E+00
 #  ...
 #2168 0.703352E-15 0.5000E+00 0.5000E+00
 # 2169 0.696703E-15 0.5000E+00 O.SOOOE^OO
 #
 #==  BLOCK  Q:  OXYGEN  AND  NUTRIENT  INITIAL  CONDI-
 TIONS =====
 #
 # Field 1 - Gas phase initial conditions.
 # Read a logical variable (lunfx) indicating if the gas phase initial
 # conditions for oxygen and/or nutrient are uniform.
  # Skip this input if oxygen is absent from the gas phase (i.e. the
  # oxygen vapor is assigned  a negative value)
  #
  # for examples 2 and 3
  #t
  #
  # Field 2 - Uniform gas phase conditions.
  # Enter the uniform gas phase initial conditions for oxygen and
  # nutrient.
  # Initial conditions are read as partial pressures (i.e. mole
  # fractions). Nutrient can only be present if oxygen is present.
  #  (I) the uniform oxygen partial  pressure in the gas phase
  #  (2) the uniform nutrient partial pressure in the gas phase. This
  #     item is omitted if nutrient is absent.
                                                                         146

-------
 #
 # for examples 2 and 3
 #0.20dO
 #
 # Field 3 - Nonuniform gas phase initial conditions for oxygen and
 # nutrient.
 # If lunfx=F, then for each node enter:
 #   (1) node number;
 #   (2) the uniform oxygen partial pressure in the gas phase
 #   (3) the uniform nutrient partial pressure in the gas phase
 # Nodes need not be in order.
 #
 # Field 4 - Aqueous phase initial conditions.
 # Read a logical variable indicating if the aqueous phase initial
 # conditions are uniform.
 # Skip this input if oxygen is absent from the aqueous phase (i.e. the
 # oxygen aqueous solubility is assigned a negative value)
 #
 # for examples 2 and 3
 #t
 #
 # Field 5 - Uniform  aqueous phase conditions.
 # Read the aqueous phase initial conditions for oxygen and nutrient.
 # Inital conditions are read as concentrations (g/L). Nutrient
 # can only be present if oxygen is present.
 # If lunfx=T, then enter:
 #  (1) the uniform  oxygen concentration (g/L) in the aqueous phase
 #  (2) the uniform  nutrient concentration (g/L) in the aqueous phase
 #
 # for examples 2 and 3
 #0.0090dO
 #
 # Nonuniform aqueous phase initial conditions for oxygen and nutrient.
 # If lunfx=F, then  for each node enter:
 #  (1) node number;
 #  (2) the uniform oxygen concentration (g/L) in the aqueous phase
 #  (3) the uniform nutrient concentration (g/L) in the aqueous phase
 # Nodes need not be in order.
 #
 #=== BLOCK R: BOUNDARY CONDITIONS =====
 #
 # field  1 - Constant gas pressure nodes equivalent to the initial
 # pressure.
 #  (1) Enter the number of nodes with a constant gas pressure equal
 #    to the initial gas pressure.
 #  (2) If nonzero, then starting on a new line, specify the node
 #    number of all such nodes.
 #
 # for example 1
 26
 457 476 495 514 533 552 571  590 591 592 593 594 595 596 597 598
 599 600 601 602 603 604 605'606 607 608
 # for example 2
 #34
 #742
 # 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760
 # 457 476 495 514 533 552 571 590 609 628 647 666 685 704 723
 # for example 3
 #76
 # 22   23   24  25  26   27  28  29   30
 # 31   32   33  34   35   36  37  38   39  40
 # 41   82  123  164  205  246  287 328  369 410
 # 451   492 533  574  615  656  697 738  779 820
 # 861   902 943  984 1025 1066 1107  1148  1189 1230
 #1271  1312 1353  1394  1435 1476 1517 1558 1599 1640
 #1681  1722 1763  1804  1845 1886 1927 1968 2009 2050
 #2091  2132 2173 2214  2255 2296 2337
 #
 # Field 2 - Constant gas pressure nodes different from the initial
 # pressure.
#  (1) Enter the number of nodes with a constant gas  pressure that is
#   different from  the initial gas pressure.
#  (2) If nonzero, then for each such node provide one line of data
 #   giving the node number and constant gas pressure (Pa gauge).
#
# for examples 1, 2 and 3
 0
#
 # Field 3 - Constant aqueous pressure nodes equivalent to the initial
 # pressure.
 #  (1) Enter the number of nodes with a constant aqueous pressure
 #    equal to the initial gas pressure.
 #  (2) If nonzero, then starting on a new line, specify the node
 #    number of all such nodes.
 #
 # for example 1
 26
 457 476 495 514 533 552 571 590 591 592 593 594 595 596 597 598
 599 600 601 602 603.604 605 606 607 608
 # for example 2
 #34
 #742
 # 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760
 # 457 476 495 514 533 552 571 590 609 628 647 666 685 704 723
 # for example 3
 #76
 # 22   23  24  25  26  27  28  29   30
 # 31   32  33  34  35  36  37  38   39  40
 # 41   82  123  164 205 246  287 328 369 410
 # 451   492 533 574 615  656 697  738  779  820
 # 861   902 943 984 1025 1066  1107 1148 1189  1230
 #1271  1312  1353  1394 1435 1476 1517 1558 1599 1640
 #1681  1722  1763  1804 1845 1886 1927 1968 2009 2050
 #2091  2132 2173  2214 2255 2296 2337
 #
 # Field 4 - Constant aqueous pressure nodes different from the initial
 # pressure.
 #  (1) Enter the  number of nodes  with a constant aqueous pressure
 #   that is different from the initial gas  pressure.
 #  (2) If nonzero, then for each such node provide one line of data
 #   giving the node number and constant aqueous pressure (Pa gauge)
 #
 # for examples 1,2 and 3
 0
 #
 # Field 5 - Gas phase component boundary conditions.
 # (1) Enter the number of nodes for which gas phase component
 #   boundary conditions are specified.
 #  (2) For each such node, starting on a new line
 #    enter the following information:
 #    (2a) the node number
 #    (2b) an integer variable indicating the boundary condition
 #       type for all gas phase components at the node.
 #       1 = constant mole fraction
 #       2 = specified diffusive flux
 #       3 = mixed type (contact with a known fluid).
 #    (2c) the boundary condition  values for each component in the
 #       gas phase. The values are listed in sequential order
 #       corresponding to the component numbers.  Only components
 #       that are  present in  the gas phase are listed.  Component
 #       boundary conditions are not provided for components which
#       are excluded from the gas phase (i.e. negative vapor
#       pressure).  Two values are needed for each boundary node
#       component. These values are used as needed to specify the
#       boundary condition.
#       1 = specified gas phase concentration (partial pressure)
#         in contacting fluid. The partial pressures must sum
#         to one (used for first type boundary).
#       2 = user supplied value of Dm/length.
#
# for example 1
 35
 420.dOO.d01.dOO.dO
 520.dOO.d01.dOO.dO
 620.dOO.d01.dOO.dO
 720.dOO.d01.dOO.dO
 820.dOO.d01.dOO.dO
 920,dOO.dO l.dOO.dO
 1020.dOO.d01.dOO.dO
 11 20.dOO.d01.dOO.dO
 1220.dOO.d01.dOO.dO
 45730.dOO.d01.dOO.dO
 47630.dOO.d01.dOO.dO
 49530.dOO.d01.dOO.dO
 51430.dOO.d01.dOO.dO
 53330.dOO.d01.dOO.dO
                                                                       147

-------
5S230.dOO.d01.dOO.dO
57130.dOO,d01.dOO.dO
5903O.d0O.dO l.dOO.dO
S9130.dOO.d01.dOO.dO
59230dOO.cK)l,dOO.dO
S9330.dOO.dOI.dOO.dO
S9430,dOO,d01.dOO,dO
59530.dOO,d01.dOO.dO
S9630dOO,d01.dOO,dO
59730.dOO.d01.dOO.dO
59330dOO.d01.dOO.dO
S9930dOO.d01.dOO.dO
60030.dOO.d01.dOO.dO
60130.dQO.d01.dOO.dO
6023 0,dOO.dO l.dOO.dO
60330dOO.d01.
-------
 59730.dOO.d01.dOO.dO
 59830.dOO.d01.dOO.dO
 59930.dOO.d01.dOO.dO
 60030.dOO.d01.dOO.dO
 601 30.dOO.d01.dOO.dO
 60230.dOO.d01.dOO.dO
 60330.dOO.d01.dOO.dO
 60430.dOO.d01.dOO.dO
 60530.dOO.d01.dOO.dO
 60630.dOO.d01.dOO.dO
 60730.dOO.d01.dOO.dO
 60830.dOO.d01.dOO.dO
 # for example 2
 #47
 #43 O.dO O.dO 1 .dO O.dO 0.009dO O.dO
 #53 O.dO O.dO 1 .dO O.dO 0.009dO O.dO
 #63 O.dO O.dO l.dO O.dO 0.009dO O.dO
 #73 O.dO O.dO 1 .dO O.dO 0.009dO O.dO
 #83 O.dO O.dO l.dO O.dO 0.009dO O.dO
 #93 O.d0 O.dO 1 .dO O.dO 0.009dO O.dO
 #103 O.dO O.dO 1 ,dO O.dO 0.009dO O.dO
 #113 O.dO O.dO l.dO O.dO 0.009dO O.dO
 #123 O.dO O.dO l.dO O.dO 0.009dO O.dO
 #133 O.dO O.dO l.dO O.dO 0.009dO O.dO
 # 14 3 O.dO O.dO l.dO O.dO 0.009dO O.dO
 #153 O.dO O.dO l.dO O.dO 0.009dO O.dO
 #163 O.dO O.d0 l.dO O.dO 0.009dOO.dO
 # 742 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 743 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 744 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 745 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 746 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 747 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 748 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 749 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 750 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 751 2 O.dO O.dO O.dO O.dO O.d0 O.dO
 # 752 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 753 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 754 2 O.d0 O.dO O.dO O.dO O.dO O.dO
 # 755 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 756 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 757 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 758 2 O.d0 O.dO O.dO O.dO O.dO O.dO
 # 759 2 O.dO O.dO O.dO O.dO O.dO O.dO
 # 760 2 O.dO O.dO O.dO O.dO O.dO O.dO
# 457 2 O.dO O.dO O.dO O.dO O.dO O.dO
# 476 2 O.dO O.dO O.dO O.dO O.dO O.dO
# 495 2 O.dO O.dO O.dO O.dO O.dO O.dO
 #5142 O.dO O.dO O.dO O.dO O.dO O.dO
# 533 2 O.dO O.dO O.dO O.dO O.dO O.dO
# 552 2 O.dO O.dO O.dO O.d0 O.dO O.dO
# 571 2 O.dO O.dO O.dO O.dO O.dO O.dO
# 590 2 O.dO O.dO 0,dO O.dO O.dO O.dO
# 609 2 O.d0 O.d0 O.dO O.dO O.dO O.dO
# 628 2 O.dO O.dO O.dO O.dO O.dO O.dO
# 647 2 O.dO O.dO O.dO O.dO O.dO O.dO
# 666 2 O.dO O.dO O.dO O.dO O.dO O.dO
# 685 2 O.dO O.dO O.dO O.dO O.dO O.dO
# 704 2 O.d0 O.dO O.dO O.dO O.dO O.dO
# 723 2 O.dO O.dO O.dO O.dO O.dO O.dO
# for example 3
#33
#22 2  O.dO O.dO O.dO O.dO 1.dO O.Od00.009dO O.dO
# 23 2  O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
#24 2  O.dO O.dO O.dO O.dO 1.dO O.OdO 0.009dO O.dO
#25 2  O.dO O.dO O.dO O.dO I.d00.0d00.009d0 O.dO
#26 2  O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
#27 2  O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
# 28 2  O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
#29 2  O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
#30 2  O.dO O.dO O.dO O.dO 1.dO O.OdO 0.009dO O.dO
#312  O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
#32 2  O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
#33 2  O.dO O.dO O.dO O.dO 1.dO O.OdO 0.009dO O.dO
# 34 2  O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
#35 2  O.dO O.dO O.dO O.dO 1.dO O.OdO 0.009dO O.dO
#36 2  O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
 #37 2 O.dO O.dO O.dO O.dO 1.dO O.OdO 0.009dO O.dO
 # 38 2 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 #39 2 O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
 #40 2 O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
 #412 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 # 493 3 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 # 534 3 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 # 575 3 O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
 #6163 O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
 # 657 3 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 # 698 3 O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
 # 739 3 O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
 # 780 3 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 # 821 3 O.dO O.dO O.dO O.dO l.dO O.OdO 0.009dO O.dO
 # 862 3 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 # 903 3 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 # 944 3 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 #9853 O.dO O.dO O.dO O.dO 1 .dO O.OdO 0.009dO O.dO
 #
 # Field 7 - Gas phase boundary flux.
 # Enter two lines of data:
    (1) Enter the number of nodes with a constant gas phase volumetric
      flux.
    (2) If nonzero, then for each such node provide one line of data
      giving the node number and gas phase flux referenced to
      atmospheric pressure and the steady temperature at the
      injected node (m~3/s).
# for examples 1,2 and 3
 0
#
# Field 8 - Aqueous phase boundary flux.
# Enter two lines of data:
    (1) Enter the number of nodes with a constant aqueous phase
      volumetric flux.
    (2) If nonzero, then for each such node provide one line of data
      giving the node number and aqueous phase flux (m~3/s).
# for examples 1,2 and 3
 0
#
*== BLOCK S: EXTRACTION / INJECTION WELL =====
#
# Field 1 - Include an extraction / injection well.
# Enter a logical variable (LCTRL(12)) indicating if an
# extraction/injection well is to be simulated.
#
# for examples 1,2 and 3
 t
# for example 3, generation of initial condition
#f
# Field 2 - Extraction / injection rate.
# Enter the total volumetric extraction/injection rate (scfin). A
# negative value indicates extraction, and a positive value indicates
# injection.
# Required only if LCTRL(12)=F
#
# for example 1
  -lOO.dO
# for examples 2 and 3
#1.0dO
# for example 3, generation of initial condition
# O.OdO
#
# Field 3 - Well coordinates.
# Specify:
# (1) the well radius (m);
# (2) two integers identifying the minimum and maximum node
#   numbers along the vertical well screen.
#   Note all nodes along the well screen must have a horizontal
#   coordinate equal to the well radius
# Not required if LCTRL(12)=F
#
# for example 1
 0.25dO 4 12
# for example 2
#0.25dO 416
# for example 3
                                                                        149

-------
* O.OSdQ 493 985

H^^, BLOCK R: VfeLOClTY BOUNDARY CONDITIONS

# Field 1 - Bottom boundary of domain.
ft Enter 8 logical variable (LCTRU28)) if the bottom boundary is
* impervious.

If for examples 1,2 and 3
 t

« Reid 2 - R.H.S. boundary of domain.
K Enter a logical variable (LCTRL(29)) if the R.H.S. boundary is
H impervious.
It
H for examples 1,2 and 3
 f

H Field 3 - L.H.S. boundary of domain.
* Enter a logical variable (LCTRL(30)) if the L.H.S. boundary is
# impervious. Nolc thai this boundary will be adjusted in the
# presence of a well
 SforbXarhples l,2ah(S3
  t
 #
 # Field 4 - fop b'oiinMy of domain.
 rf Enter a logical variable (LCtKL(3 1 )) if the lop Boundary is
 # irhpefvibus.
  Mictrit315 is true read the length bf trie cap, CAJPlfak the cap is
  # assumed Id extend frtirh the wbll td the inpUl value.
  # Not required if LCtRL(3 1 )=F
  #
  # for examples 1 and 2
   lO.OdO
  #fdr example 3
  #9.585dO
  END OF DAf A2
150

-------
                                                         Appendix  H

                                      SOURCE CODE LISTING
     Following is a source code listing of MISER. The main program is given first followed by all other
routines in alphabetical order.  The Harwell sparse matrix package is excluded.
Main Routine  - miser.f
c-
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c-
c
c-
c
  MISER.f - Numerical model of two-dimensional multiphase,
        multicomponent flow and transport. Designed
        for soil vapor extraction (SVE) and bioventing
        (BV) simulations. Nonequilibrium interphase
        mass exchange and kinetic bioreaction terms are
        included. Version 1.0-nonadaptive.

  Computational domain: xz, rz

  Project directed by: L.M. Abriola

  Written by: J.R. Lang and K.M. Rathfelder

  Version 1.0, January, 1997

  Required Control Flags:

   ipt(0) - number of elements
   ipt(l) - number of nodes
   ipt(2) - number of stacked variables
   ipt(25) - print results every ipt(25) time steps if lprnt(0)
        is true
   ipt(30) - maximum number of timesteps

  Control Flags computed internally in routine:

   lctrl(14) - logical variable controlling coupling of flow and
         transport solutions
           lctrl(14) = .true. - exchange couples flow and
                     transport solutions
           lctrl(14) = .false. - flow and transport
                      solutions not coupled


 program MISER

— Include parameter and type declarations, common block definitions,
— and dimension statements.

 include 'dimen.inc'
 character* 20 infile(4),outpre,outfile(8-Hicmp)

  Declare and define common block variables.

 common/cb2/ p(nn3)
 common /cb2b/ pt(nn3)
 common/cb3/ sat(nnstkS)
 common /cb3b/ satt(nnstk3)
 common /cb8/ vis(nnmx),pmw(nn3)
 common /cb9/ xmf(nmf)
   common /cb9b/ xmft(nmf)
   common /cblO/ den(nn6)
   common /cblOb/ dden(nn6),pmwt(nn3),dent(nn6)
   common /cbll/ pex(nnslO),rxnp(nn2)
   common /cb62/ rxn(nmf),cex(nmfs)
   common /cb62b/ rhsex(nmfs)
   common /cb90/ infile.outpre.outfile
   dimension pkeep(nnstk2)
C
C— Open input devices. The input and output devices are summarized
C— as follows: input; 11, file='infile(l)' - input for INPUT1 .f,
C—             read from console input
C—           13, file='infile(2)' - input for INPUT2.f,
C—             read from ifile( 1) by INPUT 1 .f
C—           14, file='infile(3)' - input for ERRMESSAGE.f,
C—             read from infile(l) by INPUTl.f
C—           28, file='infile(4)' - input for restarts,
C—             read from infile(2) by INPUT2.f
C—        output: 21, fi!e='outpre.out' - echo of input,'outpre'
C—             read from infile(l) by INPUTl.f
C—           22, file='outpre.err' - error messages,
C—             'outpre' read from infile(l) by INPUTl.f
C—           23, file='outpre.cnv' - convergence data when
C—             ipt(28) .gt. 0,
C—             'outpre' read from infile(l) by INPUTl.f
C—           24, file='outpre.con' - plotting data
C—             'outpre' read from infile(l) by INPUTl.f
C—           25, file='outpre.mb' - mass balance data,
C—             'outpre' read from infile(l) by INPUTl.f
C—           26, file='outpre.plt' - time series plot,
C—             'outpre' read from infile(l) by INPUT1 .f
C—           27, file='outpre.rst'  - restart data,
C—             'outpre' read from infile( 1) by INPUT 1 .f
C—
   open(ll,file='miser.dl',status='unknown')
   infile(l)='miser.dr
501 format (a)
C
C— Read the input from main input file.
C
   call INPUT 1
C
C— Initialize vectors as needed.
C
   Ikeep = .false.
   doli=l,10*ipt(2)
1    pex(i) = zerO
   do 2 i = l,(ipt(3)+ipt(4)+ipt(5)+ipt(6)-!-ipt(7)-l)*ipt(2)
    cex(i) = zerO
2    rhsex(i) = zerO
   do3i=l,ipt(l)*3
    dent(i+3*ipt(l)) = zerO
                                                                 151

-------
3     ddcn(i)
     pmwt(i) = pmw{i)
4     rxn(i) = z«0
     if (,not,|prni(0),and.(int(|<3yt(t2)) .gt. 0)) then
       lprn = .lrue,
     else
       Iprn = .false,
     end if
     if(lprnt(6),and..not.lprnt(25).and.(im(t(3)/!(27)).gt.O))
   +     llwn
       Ipcbul = .true,
     else
       Ipcbal = .false.
     end if
C
C— Finish input with INPUT2.f.
C
   call INPUTS
C
C— Use ATJU.f to compute clement areas.
C
   call ATRI
C
C — Initialize the simulation time, lime step, and time step number
C — if this run is not a restart.
C
   if(,not,lctrl(26))thcn
      1(9) s z«rO       ! initialize the simulation time
      l(S) = t(3)       1 initialize the time step
      islart = 1
   else
C —  Initialize variables.
C
    lsWp = . false.
    iukip = 0
    Iskip = zerO
    do33i = ljpt(49)
 33    pkccp(i)=zerO
    ipt(36)=0
    ipt(37)=0
    ipt(38)=0
    if(,noUclrltipt(6)+ipt(7))
  7      xmft(i) = xmf(i)
 C
 C— Solve the phase mass balance equations. This is not
 C— needed when a steady-state flow/saturation field has been input.
 C — When the component mass balance equations are also solved,
 C — update the Darcy velocities.
    if(mod(itsjdp,ipt(85)tl).eq.D)then
      if(ipt(85).ne,0) then
        tkeep = t{8)
        wl=t|;8)/!skip

        do44i = l,ipt(49)
44         pex(ipt(52')ti) - vy 1 *pex(ipt(52)fi) f w2*pkeep(i)
      end, It              '	
     end if
100   t(9) = t(9J +1,(8)  ! increment the cijrrent gjmulation time
     if(mod(i'tskip,ipt(85)+l).eq.b) then
      if(lctrl(14).and.its.eq.l) then
        lctrl(14) = .false.
        Ikeep = .true.
      end if
      if(lctrl(l))then
        if (lctrl(2).and.its.gt.l) cal) MQLEWT
        call FLOW (its.iter)
        if(ipt(36).lt.Q.and.ipt(85).gt.Q)then,
          ipt(36) = P     '
46        t(S) = t(S)/2.0dO
          if(t(8).l!.t(4)) then
            write(ipt(28),SOO) t(4)
            stop
          end if
          inter = 2*inter
          do47i = 1, inter
            if(i.gt.l) call CBAL(its,.true.
   +           ,.false.,.false.,i.eq.l)
47          if(ipt(36).ge.O) call FLOW(its,iter)
          if(ipt(36).lt.O) goto 46
        end if
        if(ipt(36).ge.O) then
          callCBAL(its,.true.,.false.,.false.,inter.eq.l)
          inter = 1
        end if
        if(lkeep) then
          lctrl(14) = .true.
          Ikeep = .false.
        end if
        if (lctrl(2).and.ipt(36).gt.O) then
          call BCFLUX
          call VEL
        end if
       end if
       if(ipt(85).ne.O) t(8) = tkeep
     else
       write (ipt(29),*) 'Skipping Flow Computation'
       tskip = tskip + 1(8)
       wl = t(8)/tskip
       w2 = rone-wl
       do66i = l,ipt(49)
 66       if(.not.lskip) pkeep(i) = wl *pex(ipt(52)+i) + w2*pkeep(i)
       if(lskip) Iskip = .false.
     end if
C
C — Save the values of the density vectors after pressure effects
C — have been included for calculation of the compositional density
C — derivatives. Save the phase molecular weights before compositional
C — effects are included.
C
      if(mod(itskip,ipt(85)+l).eq.0)then
        do!2i=l,ipt(l)
  12        pmwt(i) = pmw(i)
        do!3i=l,6*ipt(l)
  13        dent(i) = den(i)
      end if
 C
 C — tjse  TRANS.f to solve the component mass balance equations. This
 C — • is not needed when only the multiphase flow field is being
 C — calculated.
 C
      if (lctrl(2).and.(ipt(36).ge.O))
    +     call TRANS (its.ibconv)
 C
                                                                             152

-------
C— Check for time step reduction in solution of flow or transport
C— eqs. Adjust time step size and re-solve current time step.
C
     if «ipt(36).It.O).or.(ipt(37).lt.O).or.(ipt(38).lt.O)) then
       if (t(8).!e.t(4)) then   ! If dt = dtmin, don't reduce dt.
         write (ipt(28),500) t(4)   ! Print error and terminate.
         stop
       endif
       t(9) = t(9)-t(8)  ! Return simulation time to old value.
       tskip = tskip-t(S)! Reset cumulative time step
       t(8) = t(8)*t(7)  !  Decrease time step.
       itskip = itskip -1 ! Reset flow skipping counter
       Iskip = .true.
       if (t(8).lt.t(4)) t(8)=t(4) ! If dt< dtmin, setdt=dtmin.
       if (lctrl(J)) then ! Reset pressure and saturation values.
         if(mod(itskip,ipt(85)+l).eq.0)then
          do!5i = l,3*ipt(l)
 15           p(i) = pt(i)
         endif
         do!6i = l,3*ipt(2)
 16         sat(i) = satt(i)
         call SATW
       endif
       if(Iprn) Iprn = .false. ! don't print after next iteration.
       goto 100 ! Re-solve flow and transport with new time step.
     endif
C
C— Reset skipping variables.
C
     if(mod(itskip,ipt(85)+l).eq.0)then
       tskip = zerO
       do77i = l,ipt(49)
77       pkeep(i) = zerO
     endif
C
C— Check for time step increase.
C
     itsum = ipt(36)+ipt(37)+ipt(38)
 101   if(itsum.ge.3) then
       t(8) = t(8) * t(6)  ! increase time step
       if (t(8).gt.t(5)) t(8)=t(5)  ! constrain time step to dtmax
     endif
C
C— Always print at end of simulation.
C
     if(t(9).ge.t(2))then
C
C— Determine execution time of simulation.
C
c       call TSYSftend)
c       write(*,*) tend-timeO
       call prnt(its)
       stop
     endif
C
C— Perform mass balance calculation if desired.
C
     if(lprnt(6)) then
       if(lprnt(25)) then
         if(mod(its,ipt(83)) .eq. 0) Ipcbal = .true.
         call CBAL(its,.not.lctrl(l)
   +        ,lctrl(2),lpcbal,.not.lctrl(l))
         Ipcbal = .false.
       else if(.not.lprnt(25)) then
         call CBAL(its,.not.lctrl(l)
   +         ,lctrl(2),lpcbal,.not.Ictrl(l))
         if(lpcbal) then
           t(8) = t(3)  ! reset time step to previous value
           Ipcbal = .false.
         end if
         if(int((t(9)+t(8))/t(27)).gt.int(t(9)/t(27))) then
           Ipcbal = .true.
           t(3) = t(8)
           t(8) = t(8)-(t(9) + t(8)
   +          - int((t(9)+t(8))/t(27))*t(27))
         endif
         if (t(9)+t(8) .gt. t(2)) then IDoes time exceed tmax?
           t(8) = t(2) -1(9) iReduce time step so time=tmax.
           Ipcbal = .true.
         endif
       endif
     endif
C
C— Output results at intermediate times.
C                  ;
     if (lpmt(0)) then  ! output results after 'ipt(25)' time steps
       if(mod(its,ipt(25)).eq. 0) then
         call prnt (its)
       endif
     else  !  output results after a time increment of 't(ll)'
       if (Iprn) then
         call prnt (its)
         t(8) = t(3)   ! reset time step to previous value
         Iprn = .false.
       end if        ! check if print occurs at next time step
       if (int((t(9)+t(8))/t(12)) .gt. int(t(9Vt(12))) then
         if(lpcbal) then
           if(t(9)+t(8)-int((t(9)+t(8))/t(12))*t(12).gt.zerO)
   +          Ipcbal = .false.
         else
           t(3) = t(8)
         end if
         Iprn = .true.
         t(8)=t(8Ht(9) +1(8) - int((t(9)+t(8))/t(12))*t(12))
       endif
       if (t(9)+t(8) .gt. t(2)) then ! Does time exceed tmax?
         t(8) = t(2) -1(9) ! Reduce time step so time=tmax.
         Iprn — .true.
       endif
     endif
C
C— Loop to next time step.
C
 10 continue
C
C— Print the results and determine the execution time if the maximum
C— number of time steps is reached.
C
c   callTSYS(tend)
c   write(*,*) tend-timeO
   call prnt(its)
   stop
C
C— Formats:
500 format (/' Solution failed to converge'/
   +     ' at the minimum time step size =',e!2.4)
502 format (/ 'Maximum iterations of ',i4,' between solution of'/
   +     ' flow and transport equations was exceeded')
   end
Subroutine -  atri.f
                                                                           153

-------
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c-
ATRI.f - Subroutine which computes the area of each element.
      These areas arc used in the element matrices for both
      the (low and transport equations. Nodes are numbered
      counterclockwise in an element starting with an
      arbitrary node when z is positive downwards.  This
      routine stops program execution if one or more of the
      clement areas is less than zero.  In this case, all
      the element areas are printed out, as well as more
      detailed information about the problem elements.

Required Control Flags:

  ipl(27) - integer variable indicating type of domain
         ipt(27) = 0 - xz domain
         ipt(27) = 1  - rz domain
  letrl(2) - logical variable controlling presence of transport
        solution
         Ictrl{2) s .true. - compute transport solution
         lclrl(2) = .false. - skip transport solution
    subroutine ATRI
    include 'dimcn.inc'
C
C— Declare and define common block variables.
C
    common /cbl/ matcl(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +       matpt(nn6)
    common Aiblc/ xnode(nnmx),znode{nnmx),rbar(nelmx),area(nelmx)
    common /cblc/abyl2(nelmx),aby30(nelmx)
C
C— Loop over the elements.
C
    dolOOi-l.ipt(O)
C
C— Compute areas by taking the standard area coordinate determinant,
C— but subtract row 1 from rows 2 and 3 before taking the determinant
C— (i.e. area=det[L]/2).
C
     i3=i*3
     n3=nodel(i3)
     n2=nodel(i3-l)
     nl=nodel(i3-2)
     xl=xnode(nl)
     x2=xnode(n2)
     x3=xnpde(n3)
     zl=znode(nl)
     z2=zn.pde(n2)
     z3=znode(n3)
     area(i)=((x2-xl)*(z3-zl)-(x3-xl)*(z2-zl))/2.0dO
     if (area(i).Ie.zerf» Call ErrMessage (46,0,ipt(29))
 100 continue
c
c— Compute the radial centroid of each element fpr axisymetric
c— coordinates. This is set to pne if the xz coordinates are used.
C
    if(ipt(27).eq.0)then
     do!51i = l,ipt(0)
 151    rbar(i) = rpne
    else
     dol52j=Upt(0)
       j3 = 3*(i-l)
 152    rbar(i) = pfhird * (xnode(nodel(i3fl)) +
   +       xnpde(nodel(i3+2)) + xnpde(npdel(i3+3)))
    endif
C
C— Compute terms needed in cpmponent balance solution.
C
    if(lctrl(2)) then
     do!50i = l,ipt(0)
       aby!2(i) = rbar(i)*area(i)/12.0dO
 150   aby30(i) = rbar(i)*area(i)/30.0dO
    endif
c
    return
    end
 Subroutine -  bcflux.f
 c
 c
 c
 c
 c
 c
 c
 c
 c
 c
 c-
 BCFLUX.f - Subroutine which computes the boundary fluxes using
       lite flow solution.

 Required Control Flags:

   ktrl(12) - logical variable denoting presence of a well
           lctrl(12) - .true. - well present
           ktrl{12) = .false. - well not present
    subroutine BCFLUX
    include 'dimcn.inc'
    common/cb2/ p(nn3)
    common /cbfic/ lemp(nnmx)
    common /cb30/ ibc(nnmx)
    common /cb31/ sourcc(nn2)
    common /cb32/ bcf(nn2)
    common /cb42/ amb(icnl),fmb(nsolve)
 C
 C— Initial variables,
 C
    doIOOi=l,ipt<40)
  100   bcf(i) = zcrO
 C
 C—Compute gas phase boundary fluxes at all specified first type
 C— boundary nodes.
 C
    if(ipt(18).gt. 0)then
      do300jj = l,ip
       irowd2 = ib
       irow = 2 * irowd2
  300    bcf(irowd2) = fmb(irow)
      endif
 C
 C— Compute aqueous phase boundary fluxes at all specified first type
 C— boundary nodes.
 C
    if(ipt(19).gt. 0)then
      do320jj = l,ip
                                                                            irowd2 = ib
                                                                            irpw = 2*irowd2 -1
                                                                            irpwd2 = irowd2 + ipt( 1)
                                                                       320    bcf(irowd2) = fmb(irow)
                                                                           endif
                                                                      C
                                                                      C— Cpmpute gas phase bpundary fluxes at all nodes with cpnstant flux.
                                                                      C
                                                                          if (ipt(22) .gt. 0) then
                                                                           ii = ipt(62)
                                                                           do340i = l,ipt(22)
                                                                             igl =ibc(ii+i)
                                                                       340    bcf(igl) = spurce(i) * patm * temp(igl)
                                                                         +      /((patm + p(igl))*tstd)
                                                                           endif
                                                                      C
                                                                       154

-------
C— Compute aqueous phase boundary fluxes at all nodes with constant
C— flux.
C
   if(ipt(23).gt. 0)then
     ii = ii + ipt(22)
     do350i = l,ipt(23)
       ial = ipt(l) + ibc(ii+i)
       iii = ipt(22) + i
 350    bcf(ial) = source(iii)
     endif
C
C— Compute gas phase boundary fluxes at all well nodes.
C
   if(lctrl(12))then
     ii = ipt(64)
     jstrt = ipt(22) + ipt(23)
     do360i = l,ipt(24)
      igl = ib
      bcf(ig 1) = source(jstrt+i) * patm * temp(igl)
   +      /((patm + p(igl))*tstd)
C
C— Compute aqueous phase boundary fluxes at all well nodes when
C— operating in extraction mode.
C
      if (qwell.lt. zerO)then
        ial  = ipt(l) + ibc(ii+i)
        jstrt2 = jstrt + ipt(24) + i
        bcf(ial) = source(jstrt2)
      endif
 360  continue
   endif
   return
   end
Subroutine - bio.f
C	
C
C   BlO.f - Subroutine which computes the biological reaction
C        terms using Monod kinetics. Also update the biophase
C        mole fractions using the finite element method by
C        computing a mole balance if a biophase is considered.
C        The equations are solved sequentially at each node
C        until convergence. Only bioreactive components are
C        included in the biophase.
C
C   Arguments: iconv - integer flag for global convergence
C         ibconv - integer flag for bioreaction convergence
C
C   Required Control Flags:
C
C     t(15)-convergence criterion for bioreactions
C     ipt(39) - integer flag determining the kinetics type
C            1 - standard monod kinetics
C            2 - monod kinetics with substrate inhibition
C            3 - monod kinetics with lumped substrate
C            . inhibition
C            4 - monod kinetics with saturation dependency
C            5 - monod kinetics with saturation dependency
C              and substrate inhibition
C     lctrl(8) - logical variable controling type of FEM
C            solution for transport
C             lctrl(8)= .true. - use mass lumping
C             Ictrl(8) = .false. - full FEM solution
C     lctrl(9) - logical variable denoting presence of nutrient
C             lctrl(9) = .true. - nutrient considered
C             lctrl(9) = .false. - nutrient not considered
C     lctrl(l 6) - logical variable denoting method of including
C            biological reaction
C             lctrl(16) = .true. - include bioreaction in
C                         aqueous transport
C             lctrl(16) = .false. - solve FEM solution for
C                         rate limited biophase
C     lctrl(17) - logical variable indication steady state biomass
C              lctrl(17) = .true. - steady state biomass
C             lctrl(17) = .false. - transient biomass
C
C	
    subroutine BIO(iconv,ibconv)
    include 'dimen.inc*
    character* 10 cname(ncmp)
C
C— Declare and define common block variables.
C
    common /cbl/ matel(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +        marpt(nn6)
    common /cble/ abyl2(nelmx),aby30(nelmx)
    common/cb3/ sat(nnstkS)
   common /cb6b/ por(nelmx),srw(nnstk)
   common /cb6d/ dtemp(nzmax6),idepth(nnmx)
   common /cb7b/ cmw(ncmp),cvp(ncmp),cden(ncmp),
   +       chen(ncmp),casol(ncmp),cmdif(ncmp2)
   common /cb8/ vis(nnmx),pmw(nn3)
   common /cb9/ xmf(nmf)
   common/cb9b/ xmft(nmf)
   common /cblO/ den(nn6)
   common /cbl I/ pex(nns 10),rxnp(nn2)
   common 7cb40/ a(icnl),rhs(nsolve),w(icnl)
   common /cb41/ irn(icnl),icn(icnl),iw(icnl,8),ikeep(icnl,5)
   common /cb41b/ nbw(0:2),ia
   common /cb60/ khalf(ncmp),fuse(ncmp2),umax(ncmp),xyield(ncmp),
   +   kinhib(ncmp)
   common IcbSlI rxn(nmf),cex(nmfs)
   common /cb62b/ rhsex(nmfs)
   common /cb63/ kex(ncmp5),kmax(ncmp5)
   common /cb64/ bok(nbcmp),bom(nbcmp),krtd(ncmp)
   common /cb91/ cname
C
C— Dimension local arrays.
C
   dimension sum(3),xmonod(ncmp),xinhib(ncmp)
   +   ,xtmin(ncmp)
C
C— Data the minimum detectable limit.
C
   datadIimit/l.Od-9/
C
C—• Set pointers: iptbc points to the start of the biophase section
C— in icp; ib points to the start of biophase phase storage; ibs
C— points to the start of biophase stacked storage.
C
   iptbc = ipt(60)
   iptl=ipt(l)
   ipt2 = ipt(2)
   ig = ipt(3)
C
C— Set the biophase concentrations equal to the corresponding
C— aqueous phase concentrations when no mass transfer rate
C— is considered for aqueous/biophase interactions.
C
   if(lctrl(16))then
     isum = 0
     do2ia=l,ipt(4)
       if(icp(ig+ia).eq.icp(iptbc+isum+l))then
        na = ipt(9) + iptl * (ia-1)
        nb = ipt(12) + iptl * isum
        isum = isum + 1
        do 3 i = 1, iptl
 3          xmf(nb+i) = xmf(na+i)
       end if
                                                                       155

-------
 2    continue
   end if
C— Iterate over the nodes to compute the reaction terms..
C
   do!00i= I.iptl
C
   • Calculate the lumped organic substrate concentration and lumped
   • solubility for inhibition.
C-
C-
C
     if(ipl(39).cq,3) then
       subsum = zcrO
       solsum = zcrO
       do!01icb=l,ipt(17)
         tc = icp(iptbc+icb)
         if(ipt(39),eq.3)then
          ifflclrl(lO)) then
            solsum = casol(ic) + solsum
          else
            ilmp m (ic-l)*ipt(89)+3*ipt(88Hidepth(i)
            solsum = casol(ic) -f dtemp(itmp) + solsum
          end if
         end if
         nbc = ipt(12)-Kicb-l)*iptl + i
 101      subsum - subsum -f xmf(nbc)
     end if
     if(ktrl(10)) then
       Wl = W
     else
       itmp « iptC65)»ipt(89)+5*ipt(88}+idepth(i)
       kd« = kd +• dtemp(itmp)
     end if
     rxnp(i) = zcrO
     rxnp(i+iptl)szerO
C
C— Update the Monod expressions. xmonod(l) to xmonod(ipt(17)) are
C— for the substrates, xmonodCipt(17>H) is for the electron
C— - acceptor, and xmonod(ipt(17)+2) is for the nutrient when present.
C
     dol05icb =  l.ipt(7)-l
C
C
C
C
C
C
C
C
C
C
C
       ic = icp(iptbc+icb)
       xmonod(icb) = xmf(nbc) / ( xmf(nbc)
          4- kh»lf
-------
       ibo = ipt(7)-2
       ibn = ipt(7) - 1
       term = xmonod(ibo) * xmonod(ibn)
     else
       ibo = ipt(7) - I
       term = xmonod(ibo)
     end if
C
C— Update the biophase oxygen and nutrient (if present) mole
C— fractions.
C
     isum = 0
     do  120 icb = ipt(17)+l, ipt(7)-l
       ic = icp(iptbc+icb)
       isum = isum + 1
       nacrx = icb*ipt( 1) + i
       nac = ipt(9) + nacrx
       nbc = ipt(12) + (icb-l)*iptl + i
       xmfold = xmf(nbc)
       dxmf = xmf(nbcx) * sum(isum) * term/cmw(ic)
C
C— Limit bioreaction during initial startup period.
C
       if (t(9).It.t(ll)) dxmf = (t(9)/t(l l))*dxmf
C
C— Update the bio-reaction term.
C
       if(xmf(nbc).ne.zerO) then
         rxn(nac) = -dxmf/xmf(nbc)
         rxn(nbc) = -dxmf/xmf(nbc)
       else
         rxn(nac) = zerO
         rxn(nbc) = zerO
       end if
       rxnp(i) = rxnp(i) - dxmf
       rxnp(i+iptl) = rxnp(i+iptl) - dxmf
 120   continue
C
C— Update the biophase substrate mole fractions.
C
     isum = 0
     do!25ia = l,ipt(14)
       if(icp(ig+ia).eq.icp(iptbc+isum+l))then
         nac = ipt(9) + ipt(l) * (ia-1) + i
         nbc = ipt(12) + ipt(l) * isum + i
         isum = isum + 1
         ic = icp(iptbc+isum)
         if(lctrl{10)) then
          umaxt = umax(ic)
         else
          itmp = (ic-l)*ipt(89)+4*ipt(88)+idepth(i)
          umaxt = (umax(ic) + dtemp(itmp))
         end if
         xmfold = xmf(nbc)
         dxmf=umaxt*xmf(nbcx)*xmonod(isum)*term / cmw(ic)
C
C— Limit bioreaction during initial startup period.
C
         if (t(9).lt.t(l 1)) dxmf = (t(9)/t(l l))*dxmf
C
C— Update the bio-reaction term.
C
         if(xmf(nbc).ne.zerO) then
          rxn(nac) = -dxmf/xmf(nbc)
          rxn(nbc) = -dxmf/xmf(nbc)
         else
          rxn(nac) = zerO
          rxn(nbc) = zerO
         end if
         rxnp(i) = rxnp(i) - dxmf
         rxnp(i-Hiptl) = rxnp(i+iptl) - dxmf
       end if
 125   continue
 100 continue
c
c— Check the size of the bioreaction term.
c
   isumg = 0
 isuma = 0
 isumb = 0
 nbcx = ipt(12) + iptl * (ipt(7)-l)
 do!50ic = l,ipt(65)
   if(ic.eq.icp(isumg+I)) isumg = isumg + 1
   if(ic.eq.icp(ig+isuma+l)) isuma = isuma + 1
   if(ic.eq.icp(iptbc+isumb+l)) isumb = isumb + 1
   if(ic.eq.icp(isumg).and.ic.eq.icp(ig+isuma)
 +    .and.ic.eq.icp(iptbc+isumb)) then
    ngc = ipt(8) + iptl * (isumg-1)
    nac = ipt(9) + iptl * (isuma-1)
    nbc = ipt(12) + iptl * (isumb-1)
    do  I55iel = l,ipt(0)
      ieB = iel*3
      iell=ie!3-2
      iel2 = ie!3-l
      il=nodel(iell)
      i 1 s = nodept(i 1 )+ne!pt(ieI 1)
      i2 = nodel(ie!2)
      i2s = nodept(i2)+nelpt(iel2)
      i3 = nodel(ie!3)
      i3s = nodept(i3)+nelpt(ie!2)
      ifGctrl(lO)) then
        cvpt = cvp(ic)
        casolt = casol(ic)
      else
        itemp = (ic-l)*ipt(89)
        itemp2 = itemp + ipt(88)*2
        itmpl = itemp+idepth(il)
        itmp2 = itemp+idepth(i2)
        itmpS = itemp+idepth(i3)
        itmp21 = itemp2+idepth(il)
        itmp22 = itemp2+idepth(i2)
        itmp23 = itemp2+idepth(i3)
        cvpt = cvp(ic) + third*(dtemp(itmpl)
+          + dtemp(itmp2) + dtemp(itmp3))
        casolt = casol(ic) + third*(dtemp(itmp21)
+          + dtemp(itmp22) + dtemp(itmp23))
      end if
      ngcl = ngc + il
      nacl = nac + il
      nbcl = nbc -f il
      ngc2 = ngc + i2
      nac2 = nac + i2
      nbc2 = nbc + i2
      ngc3 = ngc + i3
      nac3 = nac + i3
      nbc3 = nbc + i3
      denl =den(il+iptl)
      den2 = den(i2+iptl)
      den3 = den(i3+iptl)
      keq = patm * casolt / cvpt
      if(lctrl(16))then
        if(ic.le.ipt(16)) then
         is = (ipt(3)+ipt(4)+ipt(5)+ic-l)*iptl
         ism = (matel(iel)-l)*ipt(15)+ic
         if(xmf(is+il).le.zerO) then
          efracl =zerO
         else
          efracl = ((xmf(is+il) / bok(ism)) ** bom(ism) )
+             / ( cmw(ic) * den(iptl+il) * 1.0d3 )
         end if
         if(xmf(is+i2).le.zerO) then
          efrac2 = zerO
         else
          efrac2 = ((xmf(is+i2) / bok(ism)) ** bom(ism))
+             / (cmw(ic) * den(iptl+i2) * 1.0d3 )
         end if
         if(xmf(is+i3).le.zerO) then
          efracS = zerO
         else
          efracS = ((xmf(is+i3) / bok(ism)) ** bom(ism))
+             / (cmwflc) * den(iptl+i3) * 1 .Od3 )
         end if
         extols = t(8) * por(iel) * kex(5*(ic-l)+5) *
+           (denl *(efracl-xmf(nacl)) +
+           den2 * (errac2-xmf(nac2)) +
+           den3 * (efrac3-xmf(nac3)))
                                                                        157

-------
156
157
         else
           extols = zert)
         end if
         xtot = por(icl) * (
             denl * sa({its+ipt2) * xmf(nacl) +
             dcn2 * sa|(i2stip|2) * xmf(nac2) +
             dcn3 * sal(i3s+ipt2) * xrnf(nae3) )
         cxttH = 1(8) * por(iel) * kex(5*(ic-l>H) *
             ( den 1 * (keq*xmf(ngo 1 >xmf(nac 1 )) +
             dcn2 * (keq*xmf(ngc2)-xmf(nac2)) +
             dcn3 * (keq*xmf(ngc3)-xmf(nac3)) ) + exjots
         rxtot = 1(8) * (rxn(nael)*xmf(nacl) +
             rxn{nae2)*xmf(nac2) + rxn(nac3)*xmf(nac3))
        else
         sbl = xbmax /pmw(iptl-ril)
         sb2 = xbmax / pmw(iptl+i2)
         sb3 ~ xbmax / pmw(iptl+i3)
         xtot * xbmax * (
             xmf(nbcl ) / pmw(ipcl +i 1 ) +
             xmf(nbc2)/pmw(iptl-fi2) +
             xmf(nbc3) / pmw(ipt 1 +i3) )
         cxicrt » 1(8) * por(iel) » kex(5*(ic-l)+4) *
             ( denl * (xmf(nacl)-xmf(nbcl)) t
             den2 « (xmf(nac2)-xmf(nbc2)) +
             den3 * (xmf(nac3)-xmf(nbc3)) )
         rxtol s t(8) * (rxn(nbcl)*xmf(nbcl) +
             rxn(nbe2)*xmf(nbc2) + ntn(nbc3)*xmf(nbc3))
        end if
        if(-rxtot,gt.xtot+extot) then
         rxnp(il) = rxnp(il)-rxn(nacl)*xmf(nbcl)
         rxnp(i2) = rxnp(i2) - rxn(nac2) * xmf(nbo2)
         rxnp(i3) = rxnp(i3) - rxn(nac3) * xmf(nbc3)
         ntnp(il+ipH) = txnp(il+iptl)
             - rxn(nbel) * xmf(nbcl)
         rxnp(i2+iptl) * rxnp(i2+iptl)
             - rxn(nbc2) * xntf(nbc2)
         rxnp(i3+iptl) ~ rxnp(i3+iptl)
             - rxn(nbc3) * xmf(nbc3)
         rxn(nacl) = zciO
         rxn(nac2) = zcrt)
         txn(nac3) = zciO
         ifl(isumb.gt,ipt(17))then
             rxn(nica+il) = zetO
             rxn(nica+i2) = zeiO
             rxn(nica+i3) = zeiO
             continue
           dol57il = 1,ipl(7)
             nlcb = (ii-l)*iptl
             rxn(nicb+il) = zerO
             rxn{nicb+i2) = zetO
             rxn(nicb+i3) = zerO
             continue
          end if
        end if
        continue
 155
     end if
 ISO continue
C
C — Return when no mass transfer rate limitation is considered for
C— aqucous/biophase interactions.
C
   if(letrl{16)) then
     RETURN
   end if
C
C— Now sequentially solve for the biophase mole fractions.
C
   do200kbio=I,ipt(7)-l
     iptc = iplbc + icbio
     icpt = (iptc-I)*iptl
     iepts = (ip|c-l)*ipt2
     ic = icp(iptc)
C
O — Zero tire finite clemem matrices.
C
     do210i = l,iptl
                                                                                rhs(i) = zerO
                                                                                nrqw = (i-l)*
 21 Q
C
                                                                                    a(rirg\v+j) = zerO
                                                                           — Cprnpiite the local flnjte element matrices.
C-^ Set the pointers tp the local nod.es 1J, 12, an.d. !3. The
C^ postscript s is for stacked local node?, p is for phase, and
C^— p is for component.  Compute cpnstants.
C
      ie!3 = i*3
      iell = ie!3-2
      ieI2 = ie!3-l
      il=nodel(iell)
      ils = nodept(il)+nelpt(iell)

      ilc = icpt + il
      ilps = icpts+ ils
      i2 = nodel(iel2)
      i2s = nodppt(i2)+nelpt(ie!2)

      i2c = iept +- i2
      j2cs = icpts + i2?
      i3 = nodel(iel3)
      i3s = nodept(i3)+nelpt(iel3)
      i3s = 13
      i3c = icpt +• i3
      i3cs = icpts + i3s
C
C— Compute the biomass "saturation".  This is based on the
C— maximum allowable biomass and uses water properties.
C
      sb = xbmax / por(i)
      sbl = sb/den(ipt(41)+il)
      sb2 = sb / den(ipt(41)+i2)
      sb3 = sb / den(ipt(41)+i3)
      term = aby30(i)/t(8)
C
C— Compute the mass matrix in lumped form.
C
      aU = term*(sbl*3.0dOi + sb2    +sb3    )
      al2 = term*( sbl    + sb2   •)• sb3/2.0dO )
      a!3 = term*( sbl    + sb2/2.0dO + sb3    )
      a21 = a!2
      a22 = term*(sbl    + sb2*3.0dO + sb3    )
      a23 = term*( sbl/2.0dO + sb2   + sb3    )
       a31 = a!3

       a33 = term*( sbl    +sb2   -hsb3*3.0dO)
       if(lctrl(8)) then
         all =all+al2 + al3
         a!2 = zerO
         a!3 = zerO
         a22 = a21 + a22 + a23
         a21 = zerO
         a23 = zerO
                                                                                   a31 =zerO
                                                                                   a32 = zerO
                                                                                 end if
                                                                          C
                                                                          C— Now compute the exchange matrix. First consider the terms
                                                                          C— multiplied by the biophase mole fraction. These terms are the
                                                                          C— phase mole exchange and the phase mole reaction.
                                                                          C
                                                                                 pexl =-rxn(ilc)
                                                                                 pex2 = -rxn(i2c)
                                                                                 pex3 = -rxn(i3c)
                                                                                 bl 1 = aby30(i) * (pexl*3.0dO + pex2   + pex3    )
                                                                                 b!2 = aby30(i) * (pexl    + pex2    + pex3/2.0dO)
                                                                                 b 13 = aby30(i) * (pex 1    + pex2/2.0dO + pex3   )
                                                                                 b21=b!2
                                                                                 b22 = aby30(i) * (pexl    + pex2*3.0dO + pex3    )
                                                                                 b23 = aby30(i)*(pexl/2.0dO-l-pex2    +pex3   )
                                                                                 b31=b!3
                                                                        158

-------
       b32 = b23
       b33 = aby30(i) * (pexl
                             pex2    + pex3*3.0dO)
 C—  Now compute the right hand side terms. These terms are the
 C—  component mole exchange and the component mole reaction.
 C
       rhsl =por(i)*rhsex(ilcs)
       rhs2 = por(i)*rhsex(i2cs)
       rhs3 = por(i)*rhsex(i3cs)
       fl=aby!2(i)*(2.0dO*rhsl+    rhs2+    rhs3)
       f2 = aby!2(i)*(    rhsl+2.0dO*rhs2+    rhs3)
       f3 = aby!2(i) * (    rhsl +    rhs2 + 2.0dO*rhs3)
 C
 C—  Assemble global matrix and right hand side vector in banded form
 C
       irowl =(il-l)*nbw(l)
       irow2 = (i2-l)*nbw(l)
       irow3 = (i3-l)*nbw(l)
       icolll = 1 + nbw(0)
       icol!2 = icoll 1 + (i2 - il)
       icol!3 = ic
       ico!22 = ic
       ico!21 = ico!22 + (il - i2)
       ico!23 = ico!22 + (i3 - i2)
       ico!33 = icolll
       icol31=ico!33 + (il-i3)
       abll=alH-t(10)*bll
       abl2 = al2 + t(10)*bl2
       abl3=a!3 + t(10)*bl3
       ab21 = a21 + t(10)*b21
       ab22 = a22 + t(10)*b22
       ab23 = a23 + t(10)*b23
       ab31 =a31+t(10)*b31
       ab32 = a32 + t(10)*b32
       ab33 = a33 + t(10)*b33
       a(irowl + icolll) = a(irowl + icoll 1) + abl 1
       a(irowl 4- icol!2) = a(irowl + icol!2) + ab!2
       a(irowl + icollS) = a(irowl + icol!3) + ab!3
       a(irow2 + ico!21) = a(irow2 + ico!21) + ab21
       a(irow2 + ico!22) = a(irow2 + ico!22) + ab22
       a(irow2 + ico!23) = a(irow2 + ico!23) + ab23
       a(irow3 + ico!31) = a(irow3 + ico!31) + ab31
       a(irow3 + ico!32) = a(irow3 + ico!32) + ab32
       a(irow3 + ico!33) = a(irow3 + ico!33) + ab33
       rhs(il) = rhs(il) + fl - bll * xmft(ilc)
          - b!2 * xmft(12c) - b!3 * xmft(i3c)
       rhs(12) = rhs(i2) + f2 - b21 * xmft(ilc)
          - b22 * xmft(i2c) - b23 * xmft(i3c)
       rhs(i3) = rhs(i3) + i3 - b31 * xmft(ilc)
   +      - b32 * xmft(i2c) - b33 * xmft(i3c)
 220  continue
 C
 C— Collapse full matrix into sparse form used by Harwell. Also
 C— scale array by dividing rows through by the diagonal value
 C
     ia = 0
     do230irow= l,ipt(l)
       nrow.= (irow-l)*nbw(l)
       aii = rone / a(nrow+l+nbw(0))
       rhs(irow) = rhs(irow) * aii
       do230icol = l,nbw(l)
         if (a(nrow+ico!) .ne. zerO) then
          ia = ia + 1
          a(ia) = a(nrow+icol) * aii
          irn(ia) = irow
          icn(ia) = icol+irow-nbw(0)-l
         endif
 230  continue
 C
 C— Solve the linear system using Harwell routines.
 C
   callma28ad(ipt(l),ia,a,icnl,irn,irnl,icn,u,ikeep,iw,w,iflag)
   if (iflag.lt. 0)then
     write (ipt(28),*) Mflag return from harwell is '.iflag
     write (ipt(28),*) 'bio component is: ', cname(ic)
   endif
   call ma28cd (ipt(l),a,icnl,icn,ikeep,rhs,w,mtype)
 C
 C— Update the solution and determine the max norm of the updated
 C— solution.
 C
     dxmf =zerO
     xmfrnax = xround
     do 240 i = l+iptc,iptl+iptc
       xmfold=xmf(i)
       xmf(i) = xmft(i) + rhs(i-iptc)
       xmfmax = dmax 1 (xmfmax,dabs(xmf(i)))
 240     dxmf = dmaxl(dxmf,dabs(xmf(i)-xmfold))
     if(dxmf/xmfmax.gt.t(15)) ibconv = ibconv + 1
 200 continue
 C
 C—  Biological equation set is converged if each component equation
 C—  has converged (i.e. ibconv = 0).

   if(ibconv.gt.O) iconv = iconv + 1
   return
   end
Subroutine  - cbal.f
C-
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
CBAL.f - Subroutine which computes the mole balance check for the
     aqueous and gas phase components and phases.

Arguments: its - integer time step
      Ibalp - compute the phase mass balance when true
      Ibalc - compute the component mass balance when true
      Ipcbal - print the mass balance information when true
      Ifirst - indicates the first call during a time step

Required Control Flags:

  lctrl(l) - logical variable controlling presence of flow
        solution
         lctrl(l) = .true. - compute flow solution
         lctrl(l) = .false. - skip flow solution
  Ictrl(2) - logical variable controlling presence of transport
        solution
        lctrl(2) = .true. - compute transport solution
        lctrl(2) = .false. - skip transport solution
lctrl(12) - logical variable denoting presence of a well
        lctrl(12) = .true. - well present
        lctrl(12) = .false. - well not present
lctrl( 16) - logical variable denoting method of including
      biological reaction
        lctrl(16) = .true. - include bioreaction in
                   aqueous transport
        lctrl(16) = .false. - solve FEM solution for
                    rate limited biophase
C
C
C
C
C
C
C
C
C
c
c
c
C  WARNING:  THIS  ROUTINE  IS  DIMENSIONED  FOR  9 COMPO-
NENTS WHEN USING
C      REPORT STYLE OUTPUT
C		
   subroutine CBAL (its,lbalp,lbalc,lpcbal,lfirst)
   include 'dimen.inc'
   character*10 cname(ncmp)
                                                                      159

-------
   common /cbt/ matel{nelmx),nodcl(nel3),nodept(nnmx),nelpt(neI3)>
  +   nu!pl(nn6)
   common kbld xnode(nnmx)^node(nnmx),rbar(nelmx),area(nelmx)
   common /cb2/ p(nn3)
   common /cb3/ sat{nnstk3)
   common /eb6b/ por(nelmx),srw(nnstk)
   common /cb6c/ lcmp(nnmx)
   common /cb7b/ cmw(ncmp),cvp(ncmp),cden(ncmp),
  +>   ehcn(ncmp)p«ol(ncnip),cmdif(ncmp2)
   common /cb8/ vis(nnmx),pmw(nn3)
   common /cb9/ xmf(nmf)
   common /cbl(V dcn(nn6)
   common /cbl l/pex(nnslO),rxnp(nn2)
   common /cb30/ ibe(nnmx)
   common /cb32/ bef(mi2)
   common /cb31/ sourcc(nn2)
   common /cb42/ amb{ienl),fmb(nsolve}
   common /cb62/ rxn{nmf),ccx(nmfs)
   common /cbfrV bok(nbcmp),bom(nbcmp),lcrtd{ncmp)
   common /cbfrlb/ bsdcn(nmblk)
   common /cb84/ ibcxmf(nmbe),bcxmf(nmbc),dfxmf(nmbc)
   common /cb85/ flux(ncmpp5),sflux(ncmpp5),first(ncmp)
   common /cbS67 Strl(ncmpp5),str0(ncmpp5),cmf(ncmpp5),csink(ncmpp5)
   +   ,cwsink(ncmpp5),csflux(ncmpp5),cmassl(ncmp5),cmassO(ncmp5)
   +   ,cphex(ncmpp5),crsink(ncmpp5),tmassl .ImassO
   common /cb9 1 / cname
   dimension 5tr(nempp5)jesid(ncmppS),sink(ncmpp5),wsink(ncmpp5)
   +  ,cmass(ncmp5),phex(ncmpp5),perrl(ncmppS),perr2(ncmpp5)
   +   ,rsir.k(ncmpp5)
C
C—  Describe variables: strl(l-S) arc the total mass storage of each
C —  phase al H-l , strl (6..) are the total mass storage of each
C —  component at H-l; str(...) are the total mass storages at t;
C —  strO(,..) are the initial mass storages; residual(...) are the
C—  changes in phase and component mass not accounted for by sinks,
C —  sources, phase exchange, etc.; cmf(...) are the cumulative total
C —  mass fluxes for the phases and components; sink(...) are the
C —  tout mass sinks for the phases and components; csink(...) are
C —  llie cumulative total mass sinks for the the phases and components;
C —  wslnk(,,,) are the total mass sinks at the well for the phases
C—  and components; cwsink(...) are the cumulative total mass sinks
C—  at the well for the phases and components; sflux(...) are the
C—  total mass fluxes at the surface for the phases and components;
C— ciflux(.,,) are the cumulative total mass fluxes at the surface
C — fot lire phases and components; cmass !(...) are the mass storages
C— of each component in each phase at H-l ; cmass(...) are the mass
C — storages of each component in each phase at t; cmassO(...) are
C — the initial mass storages of each component in each phase;
C — rsink(.,.) arc the total mass reation  sinks for the phases
C— and components; crsinkf....) are the cumulative total mass reaction
C — sinks for the phases and components
C
   istop = ipt(65)
   ipUx3sip((41)
C— Initialize mass storage vectors.
C
    if(llinl) then
     ifuis nc.O) muss = imassl
     tnussl sa zcrO
     lphcx=zcrO
     bmnss = zerO
C
C — Save previous mass storage.
C
     doIOi=l,istop+5
       if(ktrl(l)) then
         flux(i) = zerO
         sflux(i) = zcrO
       end if
       sink(i) m zcrO
       rsink(i) = zcrO
       wsink(i) = zcrO
       resid(i) * zerO
       phcx(i) = zerO
       if(its.nc.O) str(i) = strl(i)
  10     strl(i) = zerO
    .do 11 i= l,istop*5
      if(its.ne,0) cmass(i) = cmassl(i)
11     cmass l(i) = zerO
   end if

Z — First compute the mass storage of the phases.

   do 100 jel = l,ipt(0)
    n3 = Gel-J)*3
    il = nodel(n3+l)  ! element node numbers
    i2 = node1(n3+2)
    i3 = nodel(n3+3)
    igl = il      ! nodel gas phase storage locations
    ig2 = i2
    ig3 = i3
    ial = ipt(l)+igl  ! nodel aqueous phase storage locations
    ia2 = ipt(l)+ig2
    ia3 = ipt(l)+ig3
    inl = ipt(l)tial  ! nodel napl phase storage locations
    in2 = ipt(l)+ia2
    in3 = ipt(l)+ia3
    ndstkl = nodept(il) + nelpt(n3+l) ! node position in stack
    ndstk2 = npdept(i2) + nelpt(n3+2)
    ndstkS = nodept(i3) + nelpt(n3+3)
    igls = ndstkl    ! gas phase stacked node numbers
    ig2s = ndstk2
    ig3s = ndstkS
    ials = ipt(2)+igls ! aqueous phase stacked node numbers
     ia2s = ipt(2)+ig2s
     ia3s = ipt(2)+ig3s
     inls = ipt(2)+ials ! napl phase stacked node numbers
     in2s = ipt(2)+ia2s
     in3s = ipt(2)+ia3s
     isls = ipt(2)+inls ! solid phase stacked node numbers
     is2s = ipt(2)+in2s
     is3s = ipt(2)+in3s
     ibis = ipt(2)+isls ! bio phase stacked node numbers
     ib2s = ipt(2)+is2s
     ib3s = ipt(2)+is3s
     xbio = rbar(jel) * area(jel) * third
     x = xbio * por(jel)
C
C — First the gas phase mass storage and exchange terms.
C
     if(lbalp) then
       strl(l) = strl(l) + x *  (
   +      den(iptlx3+igl) * sat(igls) +
   +      den(iptlx3+ig2) * sat(ig2s) +
   +      den(iptlx3+ig3) * sat(ig3s) )
       phex(l) = phex(l) + x * t(8) * ( pex(ipt2x5+igls)
   +      + pex(ipt2x5+ig2s) + pex(ipt2x5+ig3s) )
C
C — Now the aqueous phase  mass storage and exchange terms.
C
       strl(2) = strl(2) + x*(
   +      den(iptlx3+ial) * sat(ials) +
   +      den(iptlx3+ia2) * sat(ia2s) +
   +      den(iptlx3+ia3)*sat(ia3s))
       phex(2) = phex(2) + x * t(8) * ( pex(ipt2x5+ials)
   +      + pex(ipt2x5+ia2s) + pex(ipt2x5+ia3s) )
      Now the gas phase component mass storages.

      end if
      if(lbalc) then
       do 15 i = l,ipt(3)
         ic = icp(i)
         igasc = (i-l)*ipt(l)
         eel  = x * cmw(ic) * (
            den(igl) * sat(igls) * xmf(igasc+il) +
            den(ig2) * sat(ig2s) * xmf(igasc+i2) +
            den(ig3) * sat(ig3s) * xmf(igasc+i3) )
         cmass l(ic) = cmass l(ic) + eel
         str 1 (5+ic) = strl (5+ic) + eel
         continue

      Now the aqueous phase component mass storages.
                                                                        160

-------
 20
C
c—
C
c—
c
 25

C
c—
c
c
c-
c
 30
C
C—
  do20i = l,ipt(4)
    ipiptS = i + ipt(3)
    ic = icp(ipipt3)
    iaqc = (ipipt3-l)*ipt(l)
    eel = krtd(ic) * x * cmw(ic) * (
       den(ial) * sat(ials) * xmf(iaqc+il) +
       den(ia2) * sat(ia2s) * xmf(iaqc+i2) +
       den(ia3) * sat(iaSs) * xmf(iaqc+i3))
    cmass 1 (istop+ic) = cmass 1 (istop+ic) + eel
    strl(5-t-ic) = strl(5+ic) + eel
   continue

Now the napl phase mass storage and exchange terms.

  if(ipt(5).gt.O) then
    srrl(3) = strl(3) + x*(
       den(iptlx3+inl) * sat(inls) +
       den(iptlx3+in2) * sat(in2s) +
       den(iptlx3+in3) * sat(in3s))
    phex(3) = phex(3) + x * t(8) * (pex(ipt2x5+inls)
       + pex(ipt2x5+in2s) + pex(ipt2x5+in3s))

Now the napl phase component mass storages. This form assumes
that all the organic components are present in the napl phase.

    do25i = l,ipt(5)
     ipiptS = i + ipt(58)
     ic = icp(ipiptS)
     inc = (ipipt5-l)*ipt(l)
     eel = x * cmw(ic) * (
         den(inl) * sat(inls) * xmf(inc+il) -1-
         den(in2) * sat(in2s) * xmf(inc+i2) +
         den(in3) * sat(in3s) * xmf(inc+i3))
     cmass l(2*istop+ic) = cmass l(2*istop+ic) + eel
     strl(5+ic) = strl(5+ic) + eel
     continue
  end if

Now the solid phase mass balance and exchange terms.

  if(ipt(6).gt.O) then
    phex(4) = phex(4) + xbio * t(8) * ( pex(ipt2x5+isls)
       •J- pex(ipt2x5+is2s) + pex(ipt2x5+is3s))

Now the solid phase component mass balances.

    do30i = l,ipt(6)
     ipiptS = i + ipt(59)
     ic = icp(ipiptS)
     isc = (ipipt5-l)*ipt(l)
     if(xbok.gt.zerO) then
       if(i.eq.l)then
         solden = (rone-xden)*bsden(matel(i))
       else if(i.eq.2) then
         isum = ipt(3)+ipt(4)+ipt(5)
         ic = icp(isum+i-l)
         solden = xden*bsden(matel(i))
       end if
       eel = solden *
          ( xmf(isc+i 1) + xmf(isc+i2) + xmf(isc+i3))
          * xbio
     else
       eel = bsden(matel(jel)) *
          (xmf(isc+il) + xmf(ise+i2) + xmf(isc+i3))
           * xbio
     end if
     cmassl(3*istop+ic) = cmassl(3*istop+ic) + eel
     strl(5+ic) = strl(5+ic) + eel
     strl(4) = strl(4)  + cel
     continue
  end if

Now the biophase mass balance and reaction terms.
This assumes a constant biophase volume.

  if(ipt(7).gt.O) then
    do35i = l,ipt(7)-l
     ipipt6 = i + ipt(60)
          ic = icp(ipipt6)
          ibioc = (ipipt6-l)*ipt(l)
C
C— First consider a separate biophase.
C
          if(.not.lctrl(16))then
            strl(5) =strl(5) + xbio * xbmax * 3.0dO
            phex(5) = phex(5) + xbio * t(8) * (pex(ipt2x5+ibls)
   +           + pex(ipt2x5+ib2s) + pex(ipt2x5+ib3s))
            eel = xbio * cmw(ic) * (
   +           xbmax/pmw(ial)*xmf(ibioc+il) +
   +           xbmax/pmw(ia2) * xmf(ibioc+i2) +
   +           xbmax/pmw(ia3) * xmf(ibioc+i3))
C
C— Now the bio reaction mass sinks.
C
            sel = xbio * cmw(ic) * (rxn(ibioc+il)
   +           * xmf(ibioc+i 1) + rxn(ibioc+i2)
   +           * xmf(ibioc+i2) + rxn(ibioc+i3)
   +           * xmf(ibioc+i3)) * t(8)
C
C
C— Now sum the bio reaction mass sinks into the mass balance.
C
            cmass l(4*istop+ic) = cmass l(4*istop+ic) + eel
            rsink(5) = rsink(5) + sel
            rsink(5+ic) = rsink(5-i-ic) + sel
            strl(5) = strl(5) + cel
            strl(5+ic) = strl(5+ic) + eel
C
C— Otherwise sum the bioreaction sinks when a separate biophase
C— is not considered. Use biophase reaction terms since they are
C— the same  as the aqueous phase reaction terms.
C
          elseif(lctrl(16))then
            sel = xbio * cmw(ic) * (rxn(ibioc+il)
   +           * xmf(ibioc+i 1) + rxn(ibioc+i2)
   +           * xmf(ibioc+i2) + rxn(ibioc+i3)
   +           * xmf(ibioc+i3)) * t(8)
C
C—• Now sum the bio reaction mass sinks into the mass balance. When
C— a separate biophase is not considered the reaction terms are
C— used for the aqueous phase mass balance.
C
            rsink(2) = rsink(2) + sel
            rsink(5+ic) = rsink(5+ic) + sel
          end if
 35       continue
C
C— Now sum the biomass. Do not include the biomass in the phase mass.
C
        ibioc  = ipt(12) + (ipt(7)-l) * ipt(l)
        eel =  xbio * ( xmf(ibioc+i 1) + xmf(ibioc-t-i2) +
   +        xmf(ibioc+i3))
        bmass = bmass -t- eel
      end if
     end if
 100 continue
C
C— Now initialize variables and return if this is the first call.
C
    if(its.eq. 0)then
     do200i = l,5+istop
      cphex(i) = zerO
      csink(i) = zerO
      cwsink(i) = zerO
      crsink(i) = zerO
      csflux(i) = zerO
      cmf(i) = zerO
 200    strO(i)=strl(i)
     do210i = l,5*istop
 210    cmassO(i) = cmassl(i)
     tmassO = zerO
     tcsink = zerO
     tcwsink = zerO
     tcrsink = zerO
     tcflux = zerO
     tcphex =  zerO
                                                                         161

-------
220
     do220isl,5
     liiussl =tmassO
     if(lprnt{27))thcn
      write (25,501) ils,((9)
      wrilc{25,502) 'Phase mass (kg)
          ,(sttO(i),!=l,S),lmiissO
      do230ii = l,istop
230
240
  •f
          write<25,503) cname{ii)
            ,(ctnassO(!ii*istop+ii),m=0,4),strO(i)
        if(tctrl(3)) write(25,S03) cname(ii)
            1zctO,zcrO,zetO,zcrO,bmass,zerO
     else
      wriic(25,504)
      wriIc(25,500)zetO,(sli
-------
 c-
 c-
 c
   +
 355
     Compute aqueous phase component boundary flux at constant flux
     nodes. Note: the surface flux is included in the boundary flux.

         if(lbalc) then
           do355i = I,ipt(4)
            ipipt3 = i + ipt(3)
            ic = icp(ipipt3)
            icxmf = ipt(9) -f (i-l)*ipt(l) + ibc(jj+ii)
            if(ibcxmf(nbc).eq.3) then
              fkeep = den(nbc) * bcf(nbc) * bcxmf(icxmf)
                 * cmw(ic) * t(8)
              flux(ic+5) = flux(ic+5) + fkeep
            else if(ibcxmf(nbc).eq.2) then
              fkeep = den(nbc) * bcf(nbc) * xmf(icxmf)
                 * cmw(ic) * t(8)
              flux(ic+5) = flux(ic+5) + fkeep
            else if(ibcxmf(nbc).eq.l) then
              fkeep = flrst(icxmf)
              if(lbalc) flux(ic+5) = flux(ic+5) + fkeep
            end if
            if(znode(nbc-ipt(l)).eq.zerO)
                sflux(ic+-5) = sflux(ic+5) + fkeep
            continue
         endif
         if(lbalp) then
           nbcd = ipt(41)+nbc
           ipt22 = ipt(22)
           sink(2) = sink(2) + den(nbcd)
              * source(ipt22+jj) * t(8)
         end if
         continue
     endif

     Now compute the gas phase flux at the well.

     if(lctrl(12))then
       ii = ipt(64)
       jstrt=ipt(22) + ipt(23)
       do360jj = l,ipt(24)
         nbc = ibc(ii+jj)
         nbcd = ipt(41) + nbc
         deng = den(nbcd)
C
C— Now compute the gas phase component flux at the well.
C
         pmwbc = zerO
         do365i = l,ipt(3)
          ic = icp(i)
          icxmf = (i-l)*ipt(l)+ibc(ii+jj)
          if(ibcxmf(nbc).eq.3) then
            xmfbc = bcxmf(icxmf)
            pmwbc = pmwbc + bcxmf(icxmf) * cmw(ic)
            fkeep = den(nbc) * bcf(nbc)  * xmfbc
   +           * cmw(ic) * t(8)
          else if(ibcxmf(nbc).eq,2) then
            fkeep = den(nbc) * bcf(nbc)  * xmf(icxmf)
   +           * cmw(ic) * t(8)
            flux(ic+5) = flux(ic+5) + fkeep
          else if(ibcxmf(nbc).eq.l) then
            fkeep = first(icxmf)
            if(lbalc) flux(ic+5) = flux(ic+5) + fkeep
          else
            xmfbc = xmf(icxmf)
          end if
          if(lbalc) wsink(5+ic) = wsink(5+ic) + fkeep
          continue
         if(ibcxmf(nbc).eq.3) deng = den(nbc) * pmwbc
         if(lbalp) wsink(l) = wsink(l) + deng * t(8) *
            source(jstrt+jj) * patm * temp(nbc)
            / ({patm + p(nbc)) * tstd)
 350

C
C—
C
 365
     Now compute the aqueous phase flux at the well when extracting.

        if (qwell.lt. zerO)then
          nbcw = ip
C
C—
C
     Now compute the aqueous phase component flux at the well.
           ifflbalc) then
            do370i = l,ipt(4)
              ipipt3 = i + ipt(3)
              ic = icp(ipipt3)
              icxmf = ipt(9) + (i-1 )*ipt( 1) + nbc
              fkeep = den(nbcw) * bcf
-------
400
•105
wile (25,502) 'Sources    (kg)',
    (sink(i),i=l,5),tsink
write (25,502) 'Well sources  (kg)',
    (Wink(i),i=l,5),lvvsink
write (25,502) 'Reactions   (kg)',
    («ink(i),i=l,5),lrslnH
write (25,502) 'Phase transfer (kg)*,
    (pbex(i),i=l,5),tpoex
do 400 1=1,5
    resid(i) = strl(i) - str(i) - flux(i)
     -\vsinfc(i)-ph«(i)
write (25,502) 'Residual    (kg)'
    ,(resid(i),i=l,S),tmassl T tmass
    - tflux - twsink - tphex
do 405 1=1,5
  iftstrO(i),gt,zerO) then
    pcrrl(i) » 1.0d2*dabs(resid(i))/strO(i)
  else
 •106
 407
  end if
  continue
if(tm.issO gt.zerfl) then
  write (25,502) 'Time step errorl(%)',
      (pcrrl(i),i=;l,5), 1.0d2*dabs(tmassl - trnass
      - tflux - twsink - tphex)/tmassQ
else
  write (25,502) 'Time step errorl(%)',
      (pcrrl(i),i=l,5), zerO
end if
do 406 i- 1,5
  term = dmaxl(dabs(wsink(i))+dabs(flux(i))+dabs(phex(i)),
      dabs(strl(i)-slr(i)))
  if(tcrm.ne,zerO) then
    perrl(i) « 1.0d2*dabs(resid(i))/term
  else
    perrl(i) = zcrO
  end if
  continue
lcrm=!dmaxl(dabs(twsink)+dabs(tflux>Hlabs(tphex),
    dabs(tmassl-tmass))
if(tcrm.ne,zcrO) then
  tpcrrl = 1.0d2*dabs(lmassl - tmass - tflux - twsink
      - tphcxyierm
cite
  tpcrrl = zerO
end if
write (25302) 'Time step error2(%)',
 do 407 i- 14
   if(slrl(i)-slr(i),ne.zeK)) then
    pcrrl(i) = 1.0d2*(rone-(dabs(wsink(i)+flux(i)
        +phex(i» / (dabs(strl (i)-str(i)))))
   else
    pcrrl(i) = zerO
   end if
   continue
 iftlnussl-lmass.ne.zcrO) then
   tpcrrl = 1.0d2*(rone-(dabs(twsink+tfiux+tphex)
      / (dabs(tmassl -tmass))))
 else
   Ipctrl =zerO
 end if
 write (25,502) 'Time step cnor3(%)',
     (pcrrl(i),i=l, 5), tpcrrl
 write (25,509)
 write (25,502) 'Delta storage (kg)',
     (strl(i)-strO(i),i=l,5),tmassl-tmassO
 write (25,502) 'Boundary flux  (kg)',
     (cmf(i),i=l,5),tcflux
 write (25^02) 'Sources    (kg)',
     (csink(i),i=l,5),tcsink
 write (25,502) 'Well sources  (kg)',
     (cwsink(i),i=lj),tcwsink
 write (25,502) 'Reactions    (kg)',
     (crsink(i),i=l,5),tcrsink
 write (25,502) 'Phase transfer (kg)',
     (cphcx(i),i=l,5),tcphex
 do410i=l,5
410       resid(i) = strl(i).- strO(i) - cmf(i)
  +        - cwsink(i)- crsink(i) - cphex(i)
        write (25,502), 'Residual    (kg)'
  +       ,(resid(ij,i=rl,5),tmassl  - tmassO.
  +       - tcwsink - (cflux
      4o 425 ( = 1,5.
        if(strO(i).gt.zerO) then
          perr2(i) = 1.0.d2*dab5(resid(i))/strp(i)
        else
          perr2(i) - zerO
        end if
425     continue
      if(tmass0.ne.zerO) then
        write (25,502) 'Cumulative errl (%)',
  +        (perr2(i),i=l,5),dabs(tmassl -tmassO
  +        - tcwsink - tcflux - tcphex)* 1 .Od2/tmassO
      else
        write (25,502) 'Cumulative errl (%)',
  +        (perr2(i),i=l,5),zerO
      end if
      do 426 i = 1,5
        term = dnjaxKdabs(pwsink(i)),H-daibs(cnu:(i))
  +        +dabs.(cphLex(i)))d8bs(s.tcl(i)-SjrO,(i»)
        if(term.ne1.zetO)i
  +        then
          perr2(i) = 1.0d2*dabs(resid(i))/term
        else
          perr2(i) = zerO
        end if
 426     continue
       term = dmaxl(dabs(tcwsink)+dabs(tcflux)+dabs(tcphex),
   +       dabs(tmassl - tmassO))
       if(term.ne.zerO) then
         tperrZ = 1.0d2*dabs(tmassl - tmassO - tcwsink - tcflux
   +        - tcphex)/term
       else
         tperr2 = zerO
       end if
       write  (25,502) 'Cumulative err2 (%)',
   +       (perr2(i),i=l,5), tperr2
       do 427 i = 1,5
         if(strl(i)-strO(i).ne.zerO) then
           perr2(i) = 1.0d2*(rone-(dabs(cwsink(i)+cmf(i)
   +          +cphex(i)) / (dabs(strl (i)-strO(i)))))
         else
           perr2(i) =zerO
         end if
 427       continue
       if(tmassl - tmassO.ne.zerO) then
         tperr2 = 1.0d2*(rone-(dabs(tcwsink+tcflux+tcphex)
   +         / (dabs(tmassl - tmassO))))
       else
         tperr2 = zerO
       end if
       write (25,502) 'Cumulative err3 (%)',
   +       (perr2(i),i=l,5), tperr2
       if(Ictrl(3)) write(25,502) 'Biomass     (kg)',
   +       zerO,zerO,zerO,zerO,bmass,zerO
                                                                                 — Write the component material balance report.

                                                                                      if(lctrl(2)) then
                                                                                        write (25,506) its,t(9),(cname(i),i=l,istop)
                                                                                        write (25,502) 'Gas Phase    (kg)',
                                                                                  +        (cmassl(i),l=l,istop)
                                                                                        write (25,502) 'Aqueous Phase (kg)',
                                                                                  +        (cmassl(istop+i),i=l,istop)
                                                                                        write (25,502) ' NAPL      (kg)' ,
                                                                                  +        (cmass 1 (2*istop+i),i= 1 ,istop)
                                                                                        write (25,502) 'Solid Phase  (kg)',
                                                                                  +        (cmass l(3*istop+i),i=l,istop)
                                                                                        write (25,502) 'Biophase    (kg)',
                                                                                  +        (cmassl(4*istop+i),i=l,istop)
                                                                                        write (25,502) 'Total      (kg)',
                                                                                  +        (strl(5+i),i=l,istop)
                                                                                        write (25,508)
                                                                                        write (25,502) 'Delta storage  (kg)',
                                                                                  +        (strl(i+5)-str(i+5),i=l,istop)
                                                                      164

-------
        write (25,502) 'Boundary flux (kg)',
  +        (flux(i+5),i=l,istop)
        write (25,502) 'Surface flux  (kg)',
  +        (sfiux(i+5),i=l,istop)
        write (25,502) 'Sources     (kg)',
  +        (sink(i+5),i=l,istop)
        write (25,502) 'Well sources  (kg)',
  +        (wsink(i+5),i=l,istop)
        write (25,502) 'Reactions    (kg)',
  +        (rsink(i+5),i=l,istop)
        do 430 i = 6,istop+5
430        resid(i) = strl (i) - str(i)
  +•          - wsink(i) - rsink(i) - fiuxffl
        write (25,502) 'Residual    (kg)'
  +        ,(resid(i+5),i=l,istop)
        do 435 i = 6,istop+5
          if(strO(i).gt.zerO) then
            perrl© = 1.0d2*dabs(resid(i))/strO(i)
          else
            perrl(i) = zerO
          end if
435      continue
        write (25,502) 'Time step errorl(%)',
  +        (perrl(i+5),i=l,istop)
        do 436 i = 6,istop+5
          term = dmaxl(dabs(rsink(i))+dabs(wsink(i))
  +          +dabs(flux(i)),dabs(strl(i)-str(i)))
          if(term.ne.zerO) then
            perrl(i) = 1.0d2*dabs(resid(i))/term
          else
            perrlffi = zerO
          end if
436      continue
        write (25,502) 'Time step error2(%)',
  +        (perrl(i+5),i=l,istop)
        do 437 i = 6,istop+5
          if(strl(i)-str(i).ne.zerO) then
            perrl(i) = 1.0d2*(rone-(dabs(rsink(i)+wsink(i)
  +           +flux(i)) / (dabs(strl(i)-str(i)))))
          else
            perrl(i) = zerO
          end if
437      continue
        write (25,502) 'Time step error3(%)',
  +        (perrl(i+5),i=l,istop)
        write (25,509)
        write (25,502)'Delta storage  (kg)',
  +        (strl(i-t-5)-strO(i+5),i=l,istop)
        write (25,502) 'Boundary flux (kg)',
  +        (cmf(i+5),i=l,istop)
        write (25,502) 'Surface flux (kg)',
  +        (csflux(i+5),i=l,istop)
        write (25,502) 'Sources     (kg)',
  +        (csink(i+5),i=l,istop)
        write (25,502) 'Well sources  (kg)',
  +        (cwsink(i+5),i=l,istop)
        write (25,502) 'Reactions    (kg)',
  +        (crsink(i+5),i=l,istop)
        do 440 i = 6,istop+5
440        resid(i) = strl(i) - strO(i) -
  +          cwsink(i) - crsink(i) - cmf(i)
        write (25,502) 'Residual    (kg)'
  +        ,(resid(H-5),i=l,istop)
        do 445 i = 6,istop+5
          if(strO(i).gt.zerO) then
            perr2(i) = 1.0d2*dabs(resid(i))/strO(i)
          else
            perr2(i) = zerO
          end if
445      continue
        write (25,502) 'Cumulative errl (%)',
  -I-      (perr2(i+5),i=l,istop)
        do 446 i = 6,istop+5
          term = dmaxl(dabs(crsink(i))-Hlabs(cwsink(i))
  +          +dabs(cmf(i)),dabs(strl(i)-strO(i)))
          if(term.ne.zerO) then
            perr2(i)= 1.0d2*dabs(resid(i))
   +          /term
          else
            perr2(i) = zerO
          end if
 446      continue
         write (25,502) 'Cumulative err2 (%)',
   +        (perr2(i-t-5),i=l,istop)
         do 447 i = 6|istop+5
          if(crsink(i)+cwsink(i)+cmf(i).ne.zerO)then
            perr2(i) = 1.0d2*(rone-(dabs(crsink(i)+cwsink(i)
   +            +cmf(i))/(dabs(strl (i)-strO(i)))))
          else
            perr2(i) = zerO
          end if
 447      continue
         write (25,502)'Cumulative err3 (%)',
   +        (perr2(i+5),i=l,istop)
       end if
     else
C
C— Write the time series style phase material balance.
C
       if(tmass0.ne.zerO) then
         tperrl = dabs(tmassl - tmass - tsink
   +        - twsink-tflux)*1.0d2/tmassO
       else
         tperrl = zerO
       end if
       Write(25,500)t(9y3600.0d0/24.0d0,(strl(i),i=l,5)
   +.      ,tmassl,tcflux,tcsink,tcwsink,tcrsink,tperrl
C
C— Write the time series style component material balance.
C
       if(lctrl(2)) then
         do455i=l,ipt(15)
 455        write(28+i,500) t(9)/3600.0dO/24.0dO
   +          ,(cmassl(ii*istop+i),ii=0,4),strl(i+5),cmf(i+5)
   +          ,csink(i+5),cwsink(i+5),crsink(i+5),csflux(i+5)
       end if
     end if
    end if
    do450i = l,ipt(65)
 450   first(i) = zerO
    return
C
C— formats
 500 format(ell.5,llell.4)
 501 format(/'** TIME STEP =',i6,5x,'SIMULATION TIME (s) =',e!5.5/
   + 'INITIAL REPORT',8x,'Gas',8x,'Aqueous',4x,'NAPL',7x,'Solid'
   + ,6x,'Biophase',3x,'Total')
c502 format(
c   +",al9,9ell.4)
 502 format(
   + ' ',a,9ell.4)
 503 format (
   + ' ',alO  ,'(kg)  ',9ell.4)
 504 format ('Phase totals (kg); errors (%)',/
   +'  time (day) ','Gas',8x,'Aqueous',4x,'NAPL',7x,'SoIid',6x
   + ,'Biophase',3x,'Totar,6x,'Flux',7x,'Source',5x,'WeH',7x,
   + 'Reaction',3x,'Step err')
 505 format (alO.'totals (kg); errors (%)',/
   + '  time (day) ','Gas',8x,'Aqueous',4x,'NAPL',7x,'Solid',6x
   + ,'Biophase',3x,'Totar,6x,'Flux',7x,'Source',5x,'WeH',7x,
   + 'Reaction',3x,'Surface')
 506 format(/'** TIME STEP =',i6,5x,'SIMULATION TIME (s) =',e!5.5/
   + 'COMPONENT REPORT ,6x,9all)
 507 format(/'** TIME STEP =',i6,5x,'SIMULATION TIME (s) =',el5.5/
   + 'PHASE REPORT',10x,'Gas',8x,'Aqueous',4x,'NAPL',7x,'Solid'
   + ,6x,'Biophase',3x,'Total')
 508 format('Time step balance')
 509 formatOCumulative balance')
c
    end
                                                                         165

-------
Subroutine - commnt.f
c~
c
c
c
c
c
c
c
c
c-
COMMNT.f - Subroutine which reads comment lines from 'infrom'
      and ignores lines starting with '#' and prints to
      'outto* lines starting with '&'.

Argument list - infrom: integer; number of input device
        ioutto: integer; number of output device
   subroutine COMMNT(infrom,ioutto)
   integer infrom.ioutto
   cliaraetcr*80 echo
1  read (infrom,501) echo
  if(ecbo(:l).eq.'#')then
    goto 1
  elsei£(echo,(:l) .eq. '&') then
    writeftoutto.SOI) .echo(2:)
    goto 1
  end if
  backspace infrom
501 format (a)
  return
  end
Include File  - dimen.inc
c
c
c
c-
DIMEN.inc - Declares array dimensions of common block variables.
    implicit rcal*8 (a-h,k,o-x,z), logical (1), integer (i-j,m-n)
   +•    , charactcr*20 (y)
c
c— Define array dimensions:
c   nnmx = maximum number of nodes
c   nclnix = maximum number of elements
c   nmblk = maximum number of material property blocks
c   nxmax = maximum number of horizontal blocks in the generated grid
c   nzmax = maximum number of vertical blocks in the generated grid
c   nnslk = maximum number nodal variables in stacked storage
c   ncmpo = maximum number of organic components to be simulated
C   ncmpb = 1 if bioJegradation is to be considered
c   ncmp = maximum number of total components to be simulated
c      = 3(always) + ncmpb + ncmpo + 1 (if nutrient is considered)
c   nonp2 = 2 x maximum number of total components to be simulated
c   nempS = 5 x maximum number of total components to be simulated
c   nsolvc a maximum number of unknowns in the linear system
c       = nn2
c   ienl - number of nonzero entries in the coefficent matrix
c   irnl = number of nonzero entries in the coefficent matrix
c   maxdima = maximum number of elements in matrix A in Ax=b
c   nmd = maximum number of dispersion coefficients
e   nmbc = maximum number of component boundary conditions
c   !nnstk = nnmx+nnmx/3,
    parameter (nnmx = 2350, nelmx = 4500, nxmax = 100, nzmax = 100,
    •f      nmblk = 3, ncmpb =1, ncmpo = 2, ncmp = ncmpo+ncmpb+3,
    +      nc!3 m 3*nclnix,nel4 = 4*nelmx,
    +      nn2 = 2*nnmx, nn3 = 3*nnmx, nn4 = 4*nnmx, nn6 = 6*nnmx,
  +      nnstk = nnmx*1.05,nnslO= 10*nnstk,
  JT      nnstk2 = 2*nnstk, nnstkS = 3*nnstk,
  +      nnstk4 = 4*nnstk, nnstkS = 8*nnstk,
  +      ncmp2 = 2*ncmp,ncmp5 = 5*ncmp, nbcmp = ncmp*nmblk,
  + ncmppS = ncmp+5, ncsqd = ncmp*ncrnp*nnmx,
  +      nzmax6 = 6^nzmax,nmd = 6*nelmx,nmbc = 2*ncmp*nnmx,
  +      nmf = nnmx*(ncmp+2*(ncmp- 1+ncmpo)),
  +      nmfs = nnstk*(ncmp+2*(ncmp-l+ncmpo)))
   parameter (nsolve = nn2, icnl = 900000, irnl = 900000)
   parameter (patm=101327.0dO,pi=3.14159265360dO,third=1.0dO/3.dO,
  +      pthird=2.0dO*pi*third,tstd = 293.150dO
  +      ,tabs = 273.150dO,zerO=O.OdO,rone=1.0dO)
C
C— R in (m"3 Pa) / (mole degree K)
   parameter (r = 0.082060dO * 101327.0dO / lOOO.OdO)
   parameter (srwmin = 1.0d-16,sgtest = O.OSOdO)
   parameter (u=0.10dO, mtype=l)
C
C— Parameter values to modify code
C
   parameter (xmmo=1.0d-3,xround=1.0d-I6,smino=1.0d-16)
C
C— Include logical control variables
   common /cbl/ lctrl(50),lprnt(0:30),lcon(50),lplt(20)
C
C— Include integer control variables
   common /cbi/ipt(0:90),icp(0:50)
C
C— Include real*8 scalars
   common /cbs/ t(50),b,xkex,xden,xbom,xbok,wvis,kd,xinit,xbmin
   + ,xbmax,qwell,rwell,zwell,trefqg,wtdpth,caplen
 Subroutine - disper.f
 c-
 c
 c
 c
 c
 c
 c
 c
 c
 c
 e
  DISPER.f - Subroutine which computes the phase dependent
        portion of the dispersion tensor and the tortuosity.

 Arguments: iphasc - integer scalar denoting the phase
             gas phase:   iphase = 1
             aqueous phase: iphase = 2

 Required Control Flags:
C    lctrl(l 8) - logical variable denoting type of q calculation
C           Ictrl(l 8) = .true. - nodel FEM q
C           lctrl(l 8) = .false. - element average q
C
C	•
    subroutine DISPER(iphase)
    include 'dimen.inc'
C
C— Declare and define common block variables.
C
    common /cbl/ matel(oelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
                                                                   166

-------
   +       matpt(nn6)
    common /cb2c/ q(ne!4)
    common/cb3/ sat(nnstkS)
    common /cb6b/ por(nelmx),srw(nnstk)
    common /cb70/ d(nmd),tort(nelmx),bdist(nmblk),bdisl(nmblk)
    ipt2s = (iphase-l)*ipt(2)
    iptl = ipt(l)
    iptO = ipt(0)
C
C— Compute the tortuosity after Millington and Quirk (1961).
C— Averaged saturations are used since the dispersion tensor is an
C— element wise constant.
C
    do 100i=l,ipt(0)
     ie!3 = i*3
     iell=ie!3-2
     ie!2 = ieI3-l
     il=nodel(iell)
     i 1 s = nodept(i I )+nelpt(iel 1)
     ilps = ils + ipt2s
     i2 = nodel(ie!2)
     i2s = nodept(i2)+nelpt(ie!2)
     i2ps = i2s 4- ipt2s
     i3 = nodel(ieB)
     i3s = nodept(i3)+nelpt(iel3)
     i3ps = i3s + ipt2s
     satavg = third * (sat(ilps)+sat(i2ps)+sat(i3ps))
     poravg=por(i)
C
C— Millington and Quirk (1959).
C
c     tort(i) = ((poravg*satavg)**(third * lO.OdO)) / poravg**2
C
C— Millington and Quirk (1961) for variably saturated media.
C
     tort(i) = ((poravg*satavg)**(third * 7.0dO)) /poravg**2
C
C— Calculate averaged q.
C
     if(lctrl(18))then
       iptq = (iphase-l)*iptl*2
       qx = dabs(third * (q(iptq+il)+q(iptq+i2)+q(iptq+i3)))
       qz = dabs(third * (q(iptq+iptl+il)+q(iptq-t-iptl+i2)
            +q(iptq+iptl+i3)))
     else
       iptq = i+(iphase-l)*ipt(67)
       qx = dabs(q(iptq))
       qz = dabs(q(iptq+iptO))
     end if
     qxz = dsqrt(qx**2 +• qz**2)

     Convert q to velocity.

     if(satavg.ge.sgtest) then
       vxz = qxz/(poravg*satavg)
     else
       vxz = zerO
     end if
     id = (iphase-l)*ipt(68)
C— Calculate dispersion.
C
     if(dabs(qxz).gt.l.0d-15) then
       idp3xi = id+3*i
       imat = matel(i)
       d(idp3xi-2) = bdist(imat)*vxz
   +      + bdisl(imat)*(qx*qx)/(qxz*poravg*satavg)
       d(idp3xi-l) = bdisl(imat)*dabs(qx*qz)/(qxz*poravg*satavg)
       d(idp3xi) = bdist(imat)*vxz
   +      H- bdisl(imat)*(qz*qz)/(qxz*poravg*satavg)
     else
       idpSxi = id+3*i
       d(idp3xi-2) = zerO
       d(idp3xi-l) = zerO
       d(idp3xi) = zerO
     end if
 100 continue
   return
   end
Subroutine  - error.f
c	
c
C   ERRMESSAGE.f - Finds and prints error and warning messages
C             from the error file.
C             Warning if itype = 1; fatal error if itype = 0
C
C	
   subroutine ErrMessage (MessNum.itype.ierr)
   implicit real*8 (a-h,k,o-z), logical (1), integer (i-j,m-n)
   character Iine*80
c
c— Find the specified error or warning in the error file.
   rewind (14)
 1   read (14,800) line
 800 format (a)
   If(line(:l).eq.'#')then
     GoTol
   Else
     backspace 14
     read (14,*) number.nlines
   Endif
c—• Print the error or warning to the screen and the error file if
c— opened.
   If (number .eq. MessNum) then
     write (terr,*)
     If (itype .eq. l)then
       write (ierr,*) '***** WARNING *****'
     Else if (itype .eq. 0) then
       write (ierr,*) '***** FATAL ERROR *****'
     Endif
     Doi = l.nlines
       read (14,800) line
       write (ierr,*) line(2:80)
     EndDo
   Else
     GoTo 1
   Endif
c
c— If a fatal  error then teminate execution.
   If (itype .eq. 0) stop
   return
   end
Subroutine  - flow.f
                                                                       167

-------
c-
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c-
FLOW.f - Subroutine which solves Ihe phase balance equations.
     Solution of the mobile aqueous and gaseous phases is
     done simultaneously.

Required Control Rags;

  t( 13) - convergence criterion for pressures
  ipl(27) - integer variable indicating type of domain
         ipl(27) >* 0 - xz domain
         ipt(27) = 1 - rz domain
  iplOl) - maximum phase balance iterations, also used as the
       criterion for decreasing dt in phase balance
  ipt(34) - maximum number of iteriations in phase balance for
       increasing dt
  IctrU?) - logical variable controlling type of FEM
        solution for flow
          lctrl<7)= .inic. - use mass lumping
          lctrt(7) = .false. - full FEM solution
  lctrl(12) - logical variable denoting presence of a well
          Ictrl(12) = -true. - well present
          Ictrl(12) = .false. - well not present
  lclrl(|3) - logical variable denoting compositional dependence
        of the gas phase viscosity
          lctrl(13) = .true. - gas phase viscosity is
                      dependent on composition
          lctrl(13) = .false. - gas phase viscosity is not
                      dependent on composition
  lctrl(14) - logical variable controlling coupling of flow and
        transport solutions
          lelrl(14) - .true, - exchange couples flow and
                      transport solutions
          lctrl{14) = .false. - flow and transport
                      solutions not coupled

Control Flags computed internally in routine:

  !pt<36) - flag specifying time step modification
    subroutine FLOW (its,iO
    include 'dimen.inc'
    common /cbl/ malcl(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +       m.iipt(nn6)
    common /cblc/ xnode(nnmx),znode(nnmx),rbar(nelmx),area(nelmx)
    common /cbloV gama(nel3),beta(ncl3)
    common/cb2/ p(nn3)
    common /cb2W pt(nn3)
    common/cb3/ sat(nnstk3)
    common /ch-l/ sa!k(nnslk2).cc(nnstk)
    common /cbSa/ bphi(nmblk),bpermh(nmblk),bpermv(nmblk)
    common /cb6V pmob(nnstk4)
    common /cbfib/ por(nelmx),srw(nnstk)
    common /cbfic/ temp(nnmx)
    common /cb6d/ dtemp(nzmax6),idepth(nnmx)
    common /cb7/ cvvis(ncmp),gamma(ncsqd)
    common /cbS/ vis(nnmx),pmw(nn3)
    common/cb9/ xmf(nmf)
    common /cblO/ den(nn6)
    common /cblOW dden(nn6),pmwt(nn3),dent(nn6)
    common /cbl I/ pex(nnslO),rxnp(nn2)
    common /cb30/ ibc(nnmx)
    common /cb31/ source(nn2)
    common /cb40/ a(icnl),rhs(nsolve),w(icnl)
    common /cb41/ irn(icnl),icn(icnl),iw(icnl,8),ikeep(icnl,5)
    common /cb41b/ nbw(0:2),ia
    common /cb42/ amb(icnl),fmb(nsolve)
    - Local arrays.
     dimension ael(36),bel(36),fel(6),nd(3),dn(3),c(l 1)
     dalaisparge/0/

    - Initialize current iterations saturations.
     Doi*l,2'ipt(2)
      satk(i) = sat(i)
     EiulDo
   Update gas phase viscosity.
  If (Ictrljl 3)) then ! compute a mixture viscosity
    Do node = l,ipt(l)
     yis(node) = zerO
     Doj = l,ipt(3)
       ii = icp(i)
       if(lctrl()0)) then
         cvvist = cvyis(ii)
       else
         cwist = cvvis(ii)
  t         + dtemp(ipt(88)+(ii-l)*ipt(89)+idepth(node))
       end if
       i3 = (i-1) * ipt(3) + (node-l)*ipt(3)*ipt(3)
       sum = O.OdO
       Doj = l,ipt(3)
         sum = sum + xmf((jj-l)*ipt(I)+node) * gamma
-------
         if (isparge .eq. 0) then
          source(ipt2+i) = source(ipt2+i) + zel * pmob(ndstkl) *
   +          qwell * sum ! gas discharge at top node
          source(ipt2+i+l) = source(ipt2+i+l) + zel *
   +      pmob(ndstkl) * qwell * sum  ! lower node gas discharge
         else if (isparge .eq. 1) then
          source(ipt2+i) = source(ipt2+i) +
   +                zel*qwell/zwell/2.0dO
          source(ipt2+i+l) = source(ipt2+i+l) +
   +                 zel*qwell/zwell/2.0dO
         endif
         if (qwell.It. O.OdO) then
          source(ipt2+ipt(24)+i) = source(ipt2+ipt(24)+i) +
   +             zel * pmob(2*ipt(2)+ndstkl) * qwell * sum
          source(ipt2+ipt(24)+i+l) = source(ipt2+ipt(24)+i+l) +
   +          zel * pmob(2*ipt(2)+ndstk2) * qwell * sum
         endif
 63     continue
     end if
c
c— Zero the local 'a' and 'rhs' vectors.
     Doi = l,2*ipt(l)*nbw(2)
       a(i) = zerO
     EndDo
     Doi = l,2*ipt(l)
       rhs(i) = zerO
     EndDo
c
c— Loop over the number of elements.
     do 101 jel = l,ipt(0)
       i3 = (jel-l)*3
       mblk = matelQel)
       ndl = nodel(i3+l)  ! element node numbers
       nd2 = nodel(i3+2)
       nd3 = nodel(i3+3)
       nd(l) = nodel(i3+l) ! element node numbers
       nd(2) = nodel(i3+2)
       nd(3) = nodel(i3+3)
       ndstkl = nodept(ndl) + nelpt(i3+l)! node position in stack
       ndstk2 = nodept(nd2) + nelpt(i3+2)
       ndstkS = nodept(nd3) + nelpt(i3+3)
       c(9) = rbar(jel) / (12.0dO  * area(jel)) ! element constants
       c(10) = rbar(jel) * area(jel) * porQel) / (t(8) * 12.0dO)
       c(ll) = rbar(jel)/24.0dO
c
c— Compute the element mass matrix; either lumped or consistent.
       if(lctrl(7))then
         Do i = 1,36
          ael(i) = zerO
         EndDo
         c(l) = -4.dO * c(10) * cc(ndstkl)
         c(3) = 4.dO * c(10) * sat(ndstkl)
         ael(l) =  c(l)
         ael(4) = -c(l)
         ael(7) = -c(l)
         ael(10) = c(3) * (l.OdO  / (r*temp(ndl)*den(ndl))) + c(l)
         c(l) = -4.dO * c(10) * cc(ndstk2)
         c(3) = 4.dO * c(10) * sat(ndstk2)
         ael(14) = c(l)
         ael(17) = -c(l)
         ael(20) = -c(l)
         ael(23) = c(3) * (l.OdO  / (r*temp(nd2)*den(nd2))) + c(l)
         c(l) = -4.dO * c(10) * cc(ndstk3)
         c(3) = 4.dO * c(10) * sat(ndstk3)
         ael(27) = c(l)
         ael(30) = -c(l)
         ael(33) = -c(l)
         ael(36) = c(3) * (l.OdO  / (r*temp(nd3)*den(nd3))) + c(l)
       else
         c(l) = -c(10) * cc(ndstkl)
         c(3) = c(10) * sat(ndstkl)
         ael(l) = 2.0dO*c(l)
         ael(2) = c(l)
         ael(3) = c(l)
         ael(4) = -2.0dO*c(l)
         ael(5) = -c(l)
         ael(6) = -c(l)
         ael(7) = -2.0d0*c(l)
         ael(8) = -c(l)
         ael(9) = -c(l)
         ael(l 1) = c(3) * (l.OdO/ (r*temp(ndl)*den(ndl))) + c(l)
         ael(12) = ael(ll)
         ael(10) = 2.0dO*ael(ll)
         c(l) = -c(10) * cc(ndstk2)
         c(3) = c(10)*sat(ndstk2)
         ael(I3) = c(l)
         ael(14) = 2.0dO*c(l)
         ael(15) = c(l)
         ael(16) = -c(l)
         ae!(17) = -2.0dO*c(l)
         ael(18) = -c(l)
         ael(19) = -c(l)
         ael(20) = -2.0dO*c(l)
         ael(21) = -c(l)
         ael(22) = c(3) * (l.OdO/ (r*temp(nd2)*den(nd2))) + c(l)
         ael(23) = 2.0dO*ael(22)
         ael(24) = ael(22)
         c(l) = -c(10)*cc(ndstk3)
         c(3) = c(10)*sat(ndstk3)
         ael(25) = c(l)
         ael(26) = c(l)
         ael(27) = 2.dO*c(l)
         ael(28) = -c(l)
         ael(29) = -c(l)
         ael(30) = -2.dO*c(l)
         ael(31) = -c(l)
         ael(32) = -c(l)
         ael(33) = -2.dO * c(l)
         ael(34) = c(3) * (l.dO / (r*temp(nd3)*den(nd3))) + c(l)
         ael(35) = ael(34)
         ael(36) = 2.d0*ael(34)
       endif
c
c— Compute the element stiffness matrix for the aqueous equation.
       imbxl = 2*ipt(2)+ndstfcl
       imbx2 = 2*ipt(2)+ndstk2
       imbx3 = 2*ipt(2)+ndstk3
       imbzl = 3*ipt(2)+ndstkl
       imbz2 = 3*ipt(2)+ndstk2
       imbzS = 3*ipt(2)+ndstk3
       c(3) = pmob(imbzl) + pmob(imbz2) + pmob(imbz3)
       c(4) = bpermh(mblk) * c(3)  ! c(4)=sum of x mobilities
       dn(l) = den(4*ipt(l)+ndl)
       dn(2) = den(4*ipt(l)+nd2)
       dn(3) = den(4*ipt(l)+nd3)
       c(5) = pmob(imbzl)/dn(l) -t- pmob(imbz2)/dn(2) +
   +       pmob(imbz3)/dn(3)
       c(6) = bpermh(mblk) * c(5)  ! c(6)=x mobil/density
       c(7) = beta(i3+l)*dn(l) + beta(i3+2)*dn(2) +
   +       beta(i3+3)*dn(3)     ! c(7)=sum of density * beta
       c(8) = gama(i3+l)*dn(l) + gama(i3+2)*dn(2) +
   +       gama(i3+3)*dn(3)    ! c(8)=sum of density* gamma
       c(l) = c(9) * (c(4)*beta(i3+l) - 0.250dO *
   +            (c(6)+pmob(imbxl)/dn(l)) * c(7))
       c(2) = c(9) * (c(3)*gama(i3+l) - 0.250dO *
   +            (c(5)+pmob(imbzl)/dn(l)) * c(8))
       bel( 1) = beta(i3+1 )*c( 1) + gama(i3+1 )*c(2)
       bel(13) = beta(i3+2)*c(l) + gama(i3+2)*c(2)
       bel(25) = beta(i3+3)*c(l) + gama(i3-H3)*c(2)
       c(l) = c(9) * (c(4)*beta(i3+2) - 0.250dO *
   +            (c(6)+pmob(imbx2)/dn(2)) * c(7))
       c(2) = c(9) * (c(3)*gama(i3+2) - 0.250dO *
   +            (c(5)+pmob(imbz2)/dn(2)) * c(8))
       bel(2) = beta(i3+l)*c(l) + gama(i3+l)*c(2)
       bel(14) = beta(i3+2)*c(l) + gama(i3+2)*c(2)
       bel(26) = beta(i3+3)*c(l) + gama(i3+3)*c(2)
       c(i) = c(9) * (c(4)*beta(i3+3) - 0.250dO *
   +       '    (c(6Hpmob(imbx3)/dn(3)) * c(7»
       c(2) = c(9) * (c(3)*gama(i3+3) - 0.250dO *
   +            (c(5)+pmob(imbz3)/dn(3)) * c(8))
       bel(3) = beta(i3+l)*c(l) + gama(i3-H)*c(2)
       bel(15) = beta(i3+2)*c(l) + gama(i3+2)*c(2)
       bel(27) = beta(i3+3)*c(l) + gama(i3+3)*c(2)
c
c— Compute the element rhs vector for the aqueous equation.
       c(2) = 4.dO * (dn(l)*pmob(imbzl) + dn(2)*pmob(imbz2) +
                                                                        169

-------
   +           dn(3)*pmob(imbz3))      ! haz
      c( 1 ) * bpcrmh(mblk) * c(2)         ! hax
      fcl(l) " (t(2I) * (bela(i3-H)Ml) -
   +             (c(4)+pmobpmob(imbz3)/dn(3)) * c(8))
      bel(12) = beta(i3s-l)*c{l) + gama(i3+l)*c(2)
      bel(24) = beta(i3t2)*c(l) + gama(i3+2)*c(2)
      bel(36.) = beta(i3+3)*c(l) + gama(i3+3)*c(2)

c— Compute the elementihs vectorfor the gas equation.
      c"(2) = 4.dO * (dn(l)*pmbb(imbzl) + dn(2)*pmob(imbz2) +
   +            dn(3)*pmob(imbz3))        ! hg±
      c(l) = bpermh(mblk) * c(2)            ! 'hgx
      fel(4) = (t(21) * (beta(i3-H)*c(l) -
   +            (c(4)+pmob(imbxl))*c(7)) +
   +         t(22) * (gama(i3+1 )*c(2) -
   +            (c(3)+pmob(imbzl))*c(8)))*c(ll)
      fel(5) = (t(21) * (beta(i3+2)*c(l) -
   +            :(c(4)*pmob(imbx2))*c(7)) *
   +         t(22) * (gama(i3+2)*c(2) -
   +            (c(3)+pmob(imbz2))*c<8))) * c(l 1)
      fel(6)=
-------
     ii = jj+ipt(22)
     If (ipt(23) .gt. 0) then  ! nodes with constant aqueous flux
       Doi = l,ipt(23)
        irowg = 2*(ibc(ii+i)-l) + 1
        rhs(irowg) = rhs(irowg) + source(ipt(22)+i)
       EndDo
     Endlf
     If(ipt(22).gt. 0)then
       Do i = I ,ipt(22)      ! nodes with constant gas flux
        irowg = 2*ibc(jj-M)
        rhs(irowg) = rhs(irowg) + source(i) * patm *
   +        temp(ibc(ij+i)) / ((patm + p(ibc(jj+i))) * tstd)
       EndDo
     Endlf
c
c — Adjust rhs vector for flow at nodes along the well screen.
     If(lctrl(12))then
      iptbc = ipt(18)+ipt(19)+ipt(20)+ipt(2I)+ipt(22)+ipt(23)
      ii = ipt(22)+ipt(23)
      jj = ii+ipt(24)
      Doi = l,ipt(24)
        irowg = 2*(ibc(iptbc+i)-l) + 1
        if (qwell.It.O.OdO) rhs(irowg) = rhs(irowg)+source(jj+i)
        irowg = irowg + 1
        rhs(irowg) = rhs(irowg) + source(ii+i) * patm *
   +•          temp(ibc(iptbc+i)) / ((patm+
   +          p(ibc(iptbc+i))) * tstd)
      EndDo
     Endlf
c
c — Save matrices for mass balance computation.
     If (lprnt(6).or.lctrl(2)) then
       Doi = l,2*ipt(l)*nbw(2)
        amb(i) = a(i)
       EndDo
       Doi = I,2*ipt(l)
        fmb(i) = rhs(i)
       Enddo
     Endlf
c
c — Adjust rows of global matrix for constant pressure conditions
     If (ipt(l 8).gt.O) then ! Constant gas pressure nodes
      Doi = l,ipt(18)
        ii = (2*ibc(i)-l)*nbw(2)
        Do j  = ii+ 1 ,ii+nbw(2)
          a(j) = zerO
        EndDo
        a(ii+nbw(l)+l) = l.OdO
        rhs(2*ibc(i)) = zerO
      EndDo
     Endlf
     If (ipt(l 9).gt.O) then ! Constant aqueous pressure nodes
      Do i = l,ipt(19)
        ii = 2*(ibc(ipt(18)+i)-l)*nbw(2)
          a(j) = zerO
        EndDo
        a(ii+nbw(l)+l) = 1.0dO
        rhs(2*ibc(ipt(18)+i)-l) = zerO
      EndDo
     Endlf
c
c— Collapse banded storage of linear system into sparse matrix form
c — used by Harwell. At the same time scale array by dividing rows
c — • through by value on the main diagonal,
     ia = 0
     nx = 0
     do 29 irow = l,2*ipt(l)
      aii =  1 .OdO / a(irow*nbw(2)-nbw( 1 ))
      rhs(irow) = rhs(irow) * aii
      do 30 j = l,nbw(2)
        nx = nx + 1
        if (a(nx) .ne. O.OdO) then
          ia = ia + 1
          a(ia) = a(nx) * aii
          irn(ia) = irow
          icn(ia) = nx - (irow-l)*nbw(2) + irow - nbw(l) - 1
        endif
 30
 29
  continue
continue
c— Solve linear system using Harwell.
     call ma28ad (2*ipt(l),ia,a,icnl,irn,irnl,icn,u,
   +         ikeep,iw,w,iflag)
     if (iflag.lt. 0)
   +    write (ipt(28),*) 'flow iflag return from harwell is '.iflag
     call ma28cd (2*ipt(l),a,icnl,icn,ikeep,rhs,w,mtype)
c
c— Transfer solutions to the pressure vectors. Calculate the capillary
c— pressure and the maximum relative differences.
     pa = zerO
     dpa = zerO
     pg = zerO
     dpg = zerO
     Doi = l,ipt(l)  ,
       pkpl =pt(ipt(l)+i) + rhs(2*i-l)
       pa = dmaxl (pa, abs(pkpl))
       dpa = dmaxl (dpa, abs(pkpl-p(ipt(l)+i)))
       p(ipt(l)+i) = pkpl
       pkpl = pt(i) + rhs(2*i)! gas P at k+1 iteration
       pg = dmaxl (pg, abs(pkpl))
       dpg = dmaxl (dpg, abs(pkpl-p(i)))
       p(i) = pkpl
       p(2*ipt(l)+i) = P(i)-p(ipt(l)+i)
     EndDo
c
c— Update saturation and save previous iterate values.
     call SATW
     Doi = l,2*ipt(2)
       satk(i) = sat(i)
     EndDo
c
c— Update gas phase mass and molar density as a function of pressure.
     n3 = ipt(41)
     Doi = l,ipt(l)
       den(i) = (patm+pffi) / (r*temp(i))
       den(n3+i) = pmw(i) * den(i)
     EndDo
c
c— Check convergence.
     if (dpa/pa .le. t(13) .and. dpg/pg .le. t(13)) then
       if (ipt(28).gt.O) write (ipt(28),200)
   +           its,it,lctrl(14),t(9),t(9)/86400.dO,t(8)
       If (it .le. ipt(34)) then   ! update time step adj. flag
         ipt(36) = 1
    . . Else
         ipt(36)=0  •
       Endlf
c
c— Compute fluxes for mass balance
       if(lprnt(6).or.lctrl(2))then
         do 800 irow = 2,ipt(40),2
          if (irow .le. nbw(l)) then
            jstrt = nbw(l) + 2 - irow
            jend = nbw(2)
          else if (irow .ge. ipt(40)-nbw(l)) then
            jstrt = 1
            jend = nbw(2) - nbw(l) + 2*ipt(l) - irow
          else
            jstrt = 1
            jend = nbw(2)
          endif
           sum = O.dO
           do805j=jstrtjend
 805          sum = sunn-amb(nbw(2)*(irow-l)+j)
   +            *rhs(irow-nbw(l)-l+j)
 800         fmb(irow) = (sum-fmb(irow))
        do 820 irow = l,ipt(40)-l,2
          if (irow .le. nbw(l)) then
           jstrt = nbw(l) + 2 - irow
           jend = nbw(2)
          else if (irow .ge. ipt(40)-nbw(l)) then
           jstrt = 1
           jend = nbw(2) - nbw(l)  + ipt(40) - irow
          else
           jstrt = 1
                                                                         171

-------
           jcnd = nbw(2)
          cndif
          sum = 0.dO
          do825j=jstrtjcnd
 S2S         sum = sum + amb(nbw(2)*(irow-l)+j)
   +           * ths(irow-nbw(l)-l+j)
 820       fmb(irow) = (sum - fmb(irow))
       endif
       return
     cmlif
c
c—Convergence not achieved. Iterate unless ipt(31) has been reached.
 100 continue
c
c— Max iterations exceeded; increment flag for time step reduction.
   it = it-1
                                                                          ipt(36) = -l
                                                                          If(ipt(28).gt.0)then
                                                                           write(ipt(28),*)'»> Time step reduction in flow it>=',ipt(31)
                                                                           write (ipt(28),500) its,t(9),t(8),it
                                                                          Endif
                                                                      c
                                                                      c— Formats.
                                                                       200 format ('Flow sol converged at step =',i6,
                                                                         +     '  iterations =',13,' Ictrl(14) =',13/
                                                                         +     '  Time (s,d) =',2el2.4,
                                                                         +     '  time step (s) = ',e!0.4)
                                                                       500 format ('flow sol: t step=',i4,'  tlme=',el0.4,' dt=',e!0.4,
                                                                         +' its =',i4)
                                                                          return
                                                                          end
Subroutine - grid.f
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c-
GRID.U  - Subroutine which generates a union jack based
     subdivision of a rectangular grid.
     On input this subroutine reads the number of rectangular
     spaces in the x-direction (nx) and the z-direction (nz).
     The spacing can be uniform or nonuniform in each
     direction.
     Input logical variables (Ix) and (Iz), if true,
     indicate if the spacing is uniform in the x and z
     directions respectively.
     If Ix or Iz ore true, then a corresponding uniform
     spacing is input (udelx or udelz).
     If Ix or Iz arc false, then nx anf nz values of the
     spacing is input.
     On output, Grid.f gives the number of nodes itp(l), the
     number of elements ipt(O), the nodel coordinates xnode
     and znode, and the clement incidence list nodel.
    subroutine gridu
    include 'dimcn.ine'
    common /cbl/ matel(nclmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +       matpi(nn6)
    common /cblc/ xnode(nnmx),znodc(nnmx),rbar(nelinx),araa(nelmx)
    common /cb95/ nbdL(nzmax),nbdR(nzmax),nbdT(nxmax),nbdB(nxmax),
   +        nnhor.nnvcr
C
C— Dimension local arrays.
C
    dimension delx(nxmax),delz(nzmax),imblk(nzmax)
c
C— read the number of rectangular spaces in the x and z directions
    call commntt 11,21)
    read(ll,*)nx,nz
    ipt(86) * nz +1
    ipt(87) = nx + I
    if (nx.lc.O .or. nx.gt.nxmax) call En-Message (15,0,ipt(29))
    if (nz,le.O .or, nz.gt.nzmax) call ErrMessage (16,0,ipt(29))
c
c—read horizontal spacing;
    call commnt(l 1,21)
    read (11,*) ldcl,xzcro  ! is horizontal spacing uniform
    if(Idcl)thcn
      read (11,*) delx(l)  ! uniform spacing in x-direction
      do!0i-2,nx
  10    Jelx(i) = delx(l)
    else
      rcad(ll,*)delx(l)
      if (iklxt 1) ,ll, O.OdO) then 'make unifrom grid linear in In r.
       rmult = (-delxUXxzero) ** (1.0dO/dble(nx))
       rad = xzero
       Do i « I ,nx
        radpl = rad * rmult
        delx(i) = radpl -rad
        rad=radpl
      EndDo
     else
      backspace 11
      read (11,*) (delx(i),i=l,nx) ! nonuniform x spacing
     endif
   endif
   Doi = l,nx
     If (delx(i) .Ie. O.OdO) Call ErrMessage (17,0,ipt(29))
   EndDo
c
c— read vertical spacing
   call commnt(l 1,21)
   read (11,*) Idel.zzero    ! is vertical spacing uniform
   if(ldel)then
     read (11,*) delz(l)    ! uniform spacing in z-direction
     do 11 j — 2,nz
 11      delz(j) = delz(l)   .
   else
     read (11,*) (delz(j)j=l,nz)  ! nonuniform z spacing
   endif
   Doj = l,nz
     If (delz(j) -le. O.OdO) Call ErrMessage (18,0,ipt(29))
   EndDo
c
c— Calculate the number of elements and nodes.
   ipt(0) = 4  * nx * nz        ! number of elements
   ipt(l) = 2*nx*nz + nx + nz +  1   ! number of nodes
   if (ipt(0) .gt. nelmx) Call ErrMessage (19,0,ipt(29))
   if (ipt(l) .gt. nnmx) Call ErrMessage (20,Q,ipt(29))
   nnhor = nx + 1
   nnver = nz + 1
c
c— Read the  number of horizontally aligned material property blocks,
c— followed  by the material block number for all vertical spacings.
   call commnt( 11,21)
   read(ll,*)ipt(26)
   If(ipt(26).lt. l)Then
     Call ErrMessage (24,0,ipt(29))
   Elself(ipt(26).eq. IJThen
     Doi = l,nz
       imblk(i) = 1
     EndDo
   Else
     Read  (11,*) (imblk(i),i=l ,nz)
     Do i = 1 ,nz
       if (imblk(i).lt.l  .or. imblk(i).gt.ipt(26))
   +      Call ErrMessage (24,0,ipt(29))
     EndDo
   Endif
                                                                        172

-------
 c— Assign nodel coordinates.Number nodes along the shortest dimension.
    if (nx .le. nz) then  ! number nodes horizontally
      nd= 1
      z = zzero
      x = xzero
      xnode(nd) = x
      znode(nd) = z
      do20i = l,nx
       nd = nd + 1
       x = x + delx(i)
       xnode(nd) = x
 20      znode(nd) = z
      do 21 j = l,nz
       nd = nd + 1
       z = z + delz(j)*0.50d0
       x = xzero + delx(l) * O.SOdO
       xnode(nd) = x
       znode(nd) = z
       if(nx.gt. l)then
         do22i = l,nx-l
           nd  = nd + 1
           x = x + (delx(i)+delx(i+l)) * O.SOdO
           xnode(nd) = x
 22         znode(nd) = z
       endif
       nd = nd + 1
       x = xzero
       z = z + delz(j)*0.50dO
       xnode(nd) = x
       znode(nd) = z
       do 21 i = l,nx
         nd =  nd + 1
         x = x + delxffi
         xnode(nd) = x
 21       znode(nd) = z
   else  ! number nodes vertically
     nd = l
     z = zzero
     x = xzero
     xnode(nd) = x
     znode(nd) = z
     do30j = l,nz
       nd = nd + 1
       z = z + delz(j)
       xnode(nd) = x
 30     znode(nd) = z
     do31i = l,nx
       nd = nd + 1
       x = x + delx(i) * O.SOdO
       z = zzero + delz(l) * O.SOdO
       xnode(nd) = x
       znode(nd) = z
       if(nz.gt. l)then
         do32j = l,nz-l
          nd = nd + 1
          z =  z + (delz(j)+delz(j+l)) * O.SOdO
          xnode(nd) = x
 32        znode(nd) = z
       endif
       nd = nd + 1
       x = x + delx(i) * O.SOdO
       z = zzero
       xnode(nd) = x
       znode(nd) = z
       do 31 j  = l,nz
         nd = nd + 1
         z = z  + delz(j)
         xnode(nd) = x
 31      znode(nd) = z
c— define the incidence lists
   jel = 0
   i3=-3
   if (nx .le. nz) then  ! number elements horizontally
     do40j = l,nz
      do 40 i = l,nx
        ndul = (j-l)*(2*nx+l) + i
        ndur = ndul + 1
        ndmd = ndur + nx
        ndll = ndmd + nx
        ndlr = ndll+l
        If (i.eq.l) then iidentify boundary nodes(left and right)
          nbdL(j) = ndul
          if (j.eq.nz) nbdL(j+l) = ndll
        Else if (i.eq.nx) then
          nbdR(j) = ndur
          if (j.eq.nz) nbdR(j+l) = ndlr
        Endif
        If (j.eq.l) then 'identify boundary nodes(top and bottom)
          nbdT(i) = ndul
          if (i.eq.nx) nbdT(i+l) = ndur
        Else if (j.eq.nz) then
          nbdB(i) = ndll
          if (i.eq.nx) nbdB(i+l) =ndlr
        Endif
        jel=jel + l
        i3 = i3 + 3
        nodel(i3+l) = ndul
        nodel(i3+2) = ndur
        nodel(i3+3) = ndmd
        matel(jel) = imblk(j)
        jel = jel + 1
        i3 = i3 + 3
        nodel(i3+l) = ndur
        nodel(i3+2) = ndlr
        nodel(i3+3) = ndmd
        matelQel) = imblk(j)
        jel = jel + 1
        i3 = i3 + 3
        nodel(i3+l) = ndmd
        nodel(i3+2) = ndlr
        nodel(i3+3) = ndll
        matel(jel) = imblkQ)
        jel = jel + 1
        nodel(i3+l) = ndul
        nodel(i3+2) = ndmd
        nodel(i3+3) = ndll
        matel(jel) = imblk(j)
40       continue
   else  ! number elements vertically
    do50i = l,nx
      do50j = I,nz
        ndll = ndul + 1
        ndmd = ndll -f nz
        ndur = ndmd + nz
        ndlr = ndur + 1
        If (i.eq. 1) then Hdentify boundary nodes(Ieft and right)
         nbdL© = ndul
         if (j.eq.nz) nbdL(j+l) = ndll
        Else if (i.eq.nx) then
         nbdR(j) = ndur
         if (j.eq.nz) nbdR(j+l) = ndlr
        Endif
        If (j.eq.l) then (identify boundary nodes(top and bottom)
         nbdT(i) = ndul
         if (i.eq.nx) nbdT(i+l) = ndur
        Else if (j .eq.nz) then
         nbdB(i) = ndll
         if (i.eq.nx) nbdB(i+l) = ndlr
        Endif
       jel = jel + 1
        i3=i3 + 3
        nodel(i 3+1) = ndul
        nodel(i3+2) = ndur
        nodeI(i3+3) = ndmd
        mate! (jel) =imblk(j)
       jel = jel + 1
       nodel(i3+l) = ndur
       nodel(i3+2) = ndlr
       nodel(i3+3) = ndmd
       matelQel) = imblkQ)
       jel = jel + 1
                                                                       173

-------
        nodcI(i3-H)
        rtQdcl(i3+2)=ndlr
        nodd(i3+3) =
        malel(jcl) = i
 SO      continue
   endif
   return
   end
C	—	
C   GRID.HB - Subroutine which generates a non-symetric triangular
C         grid system based subdivision of a rectangular grid
C         (Similar to the grid used by howard).
C         On input this subroutine reads the number of rectangular
C         spaces in the x-direction (nx) and (he z-direction (nz).
C         The spacing can be uniform or ponuniform in each
C         direction.
C         Input logical variables (Ix) and (Iz), if true,
C         indicate if the spacing is uniform in the x and z
C         directions respectively.
C         If Ix or Iz are true, then a corresponding uniform
C         spacing is input (udelx or udelz).
C         If Ix or Iz are false, then nx anf nz values of the
C         spacing is input,
C         On output, Grid.f gives the number of nodes itp( 1), the
C         number of elements ipt(0), the nodel coordinates xnode
C         and znodc, and the element incidence list nodel.
C
C	
    subroutine gridhb
    include 'dimcn.ine'
    common /cbl/ matcl(nclmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +•        malpt(nn6)
    common /cblc/ xnode(nnmx),znode(nnmx),rbar(nelmx),area(nelmx)
    common /d>95/ nbdL(nzmax),nbdR(nzmax),nbdT(nxmax),nbdB(nxmax),
   +        nnhor,nnver
C
C— Dimension local arrays.
C
    dimension delx(nxmax),delz(nzmax),imblk(nzmax)
c
 c— read the number of rectangular spaces in the x and z directions
    call commnt (11,21)
    read (11,*) nx.nz
    ipt(86) = nz + I
    ipt(87) = nx + 1
    if (nx.lc.O .or. nx.gt.nxmax) call ErrMessage (15,0,ipt(29))
    if (nz,lc.O .or. nz.gt.nzmax) call ErrMessage (16,0,ipt(29))
 c
 c— read horizontal spacing:
    call commntU 1,21)
    read (11,*) Idcl.xzcro  ! is horizontal spacing uniform
    if(ldel)lhcn
      read (11,*) dclx(l) 1 uniform spacing in x-direction
      do 10i = 2,nx
 10    dclx(i)-delxd)
    else
      read(ll.*)delx(I)
      if (dclxt 1) .11. O.OdO) then Imake uniform grid linear in In r.
        rmult«(-dclx(l)/xzcro) ** (1.0dO/dble(nx))
        rail = xzero
        Doi = l,nx
         ntdpt = rad * rmult
         dclx(i) = radpl-rad
         rad = radpl
        EndDo
      else
        backspace 11
        read (11,*) (delx(i),i=l,nx)! nonuniform x spacing
      endif
    endif
    Doi= l,nx
                                                                               If ,(dejx(i) .le. O.OdO) Call ErrMessage .(17,0,ipt(29))
                                                                             .EndDo
  - read vertical spacing
   .cal)commntOH,2J)
   read ;(•»,*) JdeUzerp
                                                                                                    ! js vertical spacing uniform
                                                                               read ()!,*) dejzp)    ! uniform spacing in z-direction
                                                                               doll j-l,nz
   else
     read .(11,*) £delzi(j)j=l,nz)! nonuniform z spacing in
   endif
   Doj = l,nz
    If (delzO) .le. O.OdO) Call ErrMessage (18,0,ipt(29))
   EndDo

c— Calculate the number of elements and nodes.
   ipt(0) = 2 * nx * nz        ! number of elements
   ipt(I) a (nx+1) * (nz+1)      ! number of nodes
   if (ipt(O) .gt. nelmx) Call ErrMessage (19,0,ipt(29))
   if (iptO) .gt. nnmx) Call ErrMessage (20,0,ipt(29))
   nnhor = nx +1
   nnver = nz -f-1

c— Read the number of horizontally aligned material property blocks,
c— followed by the material block number for all vertical spacings.
   call commnt (11,21)
   read(ll,*)ipt(26)
   If(ipt(26).lt. l)Then
     Call ErrMessage (24,0,ipt(29))
   Else If (ipt(26).eq.l) Then
     Do i = l,nz
       imblk© = 1
     EndDo
   Else
     Read(ll,*)(imblk(i),i=l,nz)
     Do i = 1 ,nz
       if (imblk(i).lt.I .or. imblk(i).gt.ipt(26))
   +      Call ErrMessage (24,0,ipt(29))
     EndDo
   Endif
c
c— Assign nodel coordinates. Number nodes along the shortest
c— dimension.
   if (nx .le. nz) then  ! number nodes horizontally
     nd = l
     z = zzero
     x = xzero
     xnode(nd) = x
     znode(nd)= z
     dp20i = l,nx
       nd = nd + 1
       x = x +• delx(i)
       xnode(nd) = x
 20     znode(nd) = z
      do 21 j = 1 ,nz
       nd = nd + 1
       x = xzero
       z = z + delz(j)
       xnode(nd) = x
       znode(nd) = z
        do21i = l,nx
         nd = nd + 1
         x = x + delx(i)
         xnode(nd)= x
 21       znode(nd) = z
    else ! number nodes vertically
      nd = l
      z = zzero
      x = xzero
      xnode(nd)= x
      znode(nd) = z
      do30j = l,nz
        nd = nd + 1
        z = z + delz(j)
        xnode(nd) = x
  30     znode(nd) = z
                                                                        174

-------
 31
  do 31 i = I,nx
   nd = nd + I
   x = x + delx(i)
   z = zzero
   xnode(nd) = x
   znode(nd) = z
   do 31 j = l,nz
     nd = nd + 1
     z = z + delz(j)
     xnode(nd)=x
      znode(nd) = z
endif
c — define the incidence lists
    jel = 0
    13 = -3
    if (nx .le. nz) then  ! number elements horizontally
     do40j = l,nz
       if (2*(j/2) .eq.j) then
        idir=l
       else
        idir = -I
       endif
       do40i= l,nx
        ndul = Q-l)*(nx+l) + i
        ndur = ndul + 1
        ndll = ndul + nx + 1
        ndlr = ndll +  1
        If (i.eq.l) then lidentify boundary nodesfleft and right)
          nbdL(j) = ndul
          if (j.eq.nz) nbdL(j+l) = ndll
        Else if (i.eq.nx) then
          nbdR(j) = ndur
          if (j.eq.nz) nbdR(j+l) = ndlr
        Endif
        If (j.eq.l) then lidentify boundary nodes(top and bottom)
          nbdTffl = ndul
          if (i.eq.nx) nbdT(i+l) = ndur
        Else if (j.eq.nz) then
          nbdB(i) = ndll
          if (i.eq.nx) nbdB(i+l) = ndlr
        Endif
        if (idir.lt. 0)then
          jel = jel + 1
          13 = i3 + 3
          nodel(i3+l) = ndul
          nodel(i3+2) = ndlr
          nodel(i3+3) = ndll
          matel(jel) = imblk®
          jel=jel-H
          i3=i3 + 3
          nodel(i3+l) = ndul
          nodel(i3+2) = ndur
          nodel(i3+3) = ndlr
          matel(jel) = imblk(j)
          idir = -idir
        else if (idir.gt. 0) then
          nodel(i3+l) = ndul
          nodel(i3+2) = ndur
          nodel(i3+3) = ndll
          matel(jel) = imblk(j)
          jel = jel + 1
          i3 = 13 + 3
          nodel(i3+l) = ndur
         nodel(i3+2) = ndlr
         nodel(i3+3) = ndll
       •  matelflel) = imblk(j)
         idir = -idir
       endif
40       continue
   else  ! number elements vertically
    do50i = l,nx
      if (2*(i/2) .eq.i) then
       idir = 1
      else
       idir = -l
      endif
      do50j = l,nz
                                                                                ndll = ndul + 1
                                                                                ndur = ndul + nz + 1
                                                                                ndlr = ndur + 1
                                                                                If (i.eq.l) then lidentify boundary nodes(left and right)
                                                                                 nbdL(j) = ndul
                                                                                 if Q.eq.nz) nbdL(j+l) = ndll
                                                                                Else if (i.eq.nx) then
                                                                                 nbdR(j) = ndur
                                                                                 if (j.eq.nz) nbdR(j+l) = ndlr
                                                                                Endif
                                                                                If (j.eq. 1) then lidentify boundary nodes(top and bottom)
                                                                                 nbdT(i) = ndul
                                                                                 if (i.eq.nx) nbdT(i+l) = ndur
                                                                                Else if (j.eq.nz) then
                                                                                 nbdBffl = ndll
                                                                                 if (i.eq.nx) nbdB(i+l) = ndlr
                                                                                Endif
                                                                                if (idir. It. 0) then
                                                                                 jel = jel + 1
                                                                                 nodel(i3+l) = ndul
                                                                                 nodel(i3+2) = ndur
                                                                                 nodel(i3+3) = ndlr
                                                                                 matel(jel) = imblk(j)
                                                                                 jel = jel + 1
                                                                                 i3=i3 + 3
                                                                                 nodel(i3+l) = ndul
                                                                                 nodel(i3+2) = ndlr
                                                                                 nodel(i3+3) = ndll
                                                                                 matel(jel) = imblk(j)
                                                                                 idir = -idir
                                                                               else if (idir .gt. 0) then
                                                                                 jel = jel + 1
                                                                                 nodel(i3+l) = ndul
                                                                                 nodel(i3+2) = ndur
                                                                                 nodel(i3+3) = ndll
                                                                                 matel(jel) = imblk(j)
                                                                                 jel = jel +1
                                                                        50
                                                                                 nodel(i3+l) = ndur
                                                                                 nodel(i3+2) = ndlr
                                                                                 nodel(i3+3) = ndll
                                                                                 matel^el) = imblk(j)
                                                                                 idir = -idir
                                                                               endif
                                                                                continue
                                                                          endif
                                                                          return
                                                                          end
Subroutine  - inputl.f
                                                                       175

-------
c-
c
c
c
c
c
c
c
c
c
c
c
c
c
c-
INPUTKf • main input routine.  Reads model control information,
       fluid and soil parameters, and grid information.

Control Flags conputed internally in routine:

  Ictrl(l3) - logical variable denoting compositional dependence
        of the gas phase viscosity
          lclrl(l 3) = .true. - gas phase viscosity is
                      dependent on composition
          ktrl{13) = .false. - gas phase viscosity is not
                      dependent on composition
   subroutine 1NPUT1
   include 'dimen,ine'
   charaeter*20infile(4),outpre,outfile(8+ncmp)
   character* 1C cnamc(ncmp)
   ch»rw:lct*3 cmb(10)
   common /ebU matel(nclm)(),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +       matpt(nn6)
   common /cblc/ xnode(nnmx),znode(nnmx),rbar(nelmx),area(nelmx)
   common /cbld/ gama(ne13),beta(neI3)
   common /cbSa/ bphKnmblk),brjenrfi(nmblk),bpermv(nmblk)
   common KbSbt bvgn(nmblk),bvga(nmblk),bvgm(nmblk),bsrw(nmblk)
   common /cb5c/bfoc(nmblk)
   common /cbfic/ temp(nnmx)
   common /cbfioV dtemp(nzmax6),idepth(nnmx)
   common /cb7/ cwis(ncmp),gamma(ncsqd)
   common /cbTW cmw(ncmp),cvp(ncmp),cden(ncmp),
   +        chcn(ncmp),casol(ncmp),cmdif(ncmp2)
   common /cb8/ vis(nnmx),pmw(nn3)
   common /cb41b/ nbw(0:2),ia
   common /cboW khalf(ncmp),fuse(ncmp2),umax(ncmp),xyield(ncmp),
   +        kinhib(ncmp)
   common /cb63/ kex(ncmp5),krnax(ncmp5)
   common /cb64/ bok(nbemp),bom(nbcmp),krtd(ncmp)
   common /cb64b/ bsden(nmblk)
   common /cb70/ d(nmd),tort(nelmx),bdist(nmblk),bdisl(nmblk)
   common /cb90/ infilc.outpre.outfilc
   common /cb9I/ cname
   common /cb95/ nbdL(nzmax),nbdR(nzmax),nbdT(nxmax),nbdB(nxmax),
   +>        nnhor.nnvcr
 C
 C-
 c
 Dimension local arrays.

dimension mp(4),zdeplh(nzmax)
 C--  r-	i READ INPUT/OUTPUT FILES AND OPTIONS =====
 c
 c— Read the name of input file 2 (ICs and BCs) and open as unit 13;
 c— define the error and warning message input data file as unit 14.
    call commm{! 1,21)
    r«id(ll,»)infile<2).infile(3)
    opcn(13,file=infi!c(2),status='unknown')
    opcn(14,filc=infile(3),status='unknown')
 e
 c— Read the prefix name of all output files; determine output file
 c— names: and open the main output file.
    call commntO 1,21)
    rcad(Il,*)outpre
    ti = indcx(oulpre,' *)•!
    oulfilc( I) = outpre(l ;iiy/'.out'   ! main output file
    oulfile(2) = outpre(l ;iiy/'.err'   ! error messages
    ou(filc(3)« outpre(l :!iV/'.cnv'   ! performance output
    outfilc(4) = outpre(l:ii)//'.con'    ! contourdata
    ouifilc(S) = outpreO :iiV/'.mb'    ! mass balance checks
    oulfi1e(6) soulpre{l:iiV/'.pU>   ! time series plot data
     outfitc(7) = outpre(l:iiy/'.rst'    ! restart file
     open (21 ,filc=outfile(l ),status='unknown')
 C
 C— Read the device specifications for error messages and
 C— performance output.
 C— 0 is no output; 6 is the screen;
 C— 21 Is the .out file; 22 is the ,err file (only for error messages)
 C— , 23 is the ,cnv file (only for performance output).
     call commnUl 1,21)
   read(ll,*)ipt(29),ipt(28)

 - Open outfile(2) if ipt(29) = 22. Error message/runtime information.
   if(ipt(29).eq.22)then
    open (22,flie=outfile(2),status=>unknown')
   else if (ipt(29) .eq. 6) then
    outfile(2) = 'To Screen
   else if (ipt(29) .eq. 0) then
    outfile(2) = ' None Opened     '
   else if (ipt(29) .eq. 21) then
    outfile(2) = outfile(l)
   else
    call ErrMessage (62,0,6)
   endif

 — Open outfile(3) if ipt(28) = 23.  Performance and iteration output.
   if(ipt(28).eq. 23) then
    open(23,file=outfile(3),status='unkno\vn')
   elseif(ipt(28).eq. 6) then
    outfile(3) = To Screen      '
   else if (ip<(28) .eq. 0) then
    outfHe(3) = ' None Opened     '
   else if (ipt(2S) .eq. 21) then
    outfile(3) = putfile(l)
   else
    call ErrMessage (61,0,ipt(29))
   endif

 — Read a logical parameter indicating if contour plot data should be
c— printed to the file 'outpre.con'. Open the file, if yes.
   call commnt(l 1,21)
   read(ll,*)lctrl(23)
   if(lctrl(23))then
     open(24,file=outfile(4),status='unknown')
   else
     outfile(4) = 'None Opened     '
   endif

c— Read A logical parameter indicating if mass balance checks
c— should be computed and printed to the file 'outpre.mb'.  Open the
c—file, if yes.
   call commnt(l 1,21)
   read(ll,*)lprnt(6)
   if(lprnt(6))then
     open(25,file=outfile(5),status='unknown')
   else
     outfile(5) = 'No Mass Balance   '
   endif
c
c— Read the uniform material balance print interval, either
c— by the number of time steps or a specified time increment. Also
c— read a logical variable controlling the type of material balance
c— output (report style if true).
   if(lprnt(6)) then
     read(ll,*) lprnt(25),lprnt(27)
     if(lprnt(25)) then
       read(U,*)ipt(83)
     else
       read(ll,*)t(27)
     end if
   endif
c
c— Read a logical parameter indicating if time series plot data
c— should be printed to the file 'outpre.plt'.  Open the file, if yes.
   call commntO 1,21)
   read(ll,*)lctrl(15)
    if(lctrl(15))then
     open(26,file=outfile(6),status='unknown')
    else
     outfile(6) = 'None Opened    '
    endif
 c
 c— Read the uniform time series print  interval, either by
 c— the number of time steps or a specified time increment. Also read
 c— a logical variable controlling the form in which the component
 c— information is outputted (t=mole fraction, f=concentration).
    if(lctrl(15))then
     read(ll,*) lprnt(26),lprnt(28)
                                                                        176

-------
     if(lprnt(26)) then
       read(ll,*)ipt(84)
     else
       read(ll,*)t(28)
     end if
    end if
c
c— Read a logical parameter indicating if restart data
c— should be printed to the file 'outpre.rst'.  Open the file.
    call commnt(l 1,21)
    read(ll,*)Ictrl(5)
    if(lctrl(5))then
     open(27,file=outfile(7),status='unknown')
    else
     outfile(7) = 'No Restart Available'
    endif
c
c— Write to the main output file: banner, title cards, I/O file names.
    write (21,500)
    call commnt (11,21)
    backspace 11                                       -         <
    write (21,501) (infile(i),i=l,3),(outfile(i),i=l,7)
c
c— Read and write the uniform print interval, either by the number of
c— time steps or a specified time increment.
    call commnt(l 1,21)
    read(ll,*)lprnt(0)
    if(Iprnt(0))then
     read(ll,*)ipt(25)
     write (21,529) ipt(25)
    else
     read(ll,*)t(12)
     write (21,530) t(12)
    endif
c
c— Write the uniform material balance print interval and the type of
c— material balance.
    if(lprnt(6)) then
     if(lprnt(27)) then
       write(21,553)
     else
       write(21,554)
     endif
     if(lprnt(25)) then
       write(21,549) ipt(83)
     else
       write(21,550) t(27)
     endif
    endif
c
c— Write the uniform time series print interval and the form in which
c— the component information is outputed (t=mole fraction,
c— f=concentration).
    if(lctrl(15)) then
     if(lprnt(28)) then
       write(21,557)
     else
       write(21,558)
     endif
     if(lprnt(26)) then
       write(21,551)ipt(84)
     else
       write(21,552)t(28)
     endif
    endif
  ===== BLOCK B - GENERAL MODEL CONTROL OPTIONS =

   if(ipt(29).ne.O) write (ipt(29),*)
   •J-           'Reading Model Control information'
c— Read the coordinate system: 0=xz; l=rz.
c— Read the horizontal and vertical gravity components.
c— Error check: ipt(27) (0-1)
   call commnt(l 1,21)
   read (11,*) ipt(27),t(21),t(22)
   if (ipt(27).lt.O .or. ipt(27).gt.l) call ErrMessage (l,0,ipt(29))
c— Read a logical variables defining which balance equations are
c— solved:
c— lctrl(l)=> solve flow equations
c— lctrl(2) => solve transport equations
c— Ictrl(24) => solve napl equations
c— lctrl(25) => solve solid phase equations
c— lctrl(3) => solve biophase equations
    call commnt(ll,21)
    read (11,*) lctrl(l),Ictrl(2),lctrl(24),lctrl(25),lctrl(3)
    if(Ictrl(2)) then
     lctrl(22) = .true.
    else
     lctrl(22) = .false.
    endif
c
c— Error Check: lctrl(24),lctrl(25),lctrl(3)=true only if lctrl(2)
c— = true.
    if (lctrl(24) .and. .not. Ictrl(2)) Call ErrMessage (76,0,ipt(29))
    if (lctrl(25) .and. .not. Ictrl(2)) Call ErrMessage (75,0,ipt(29))
    if (lctrl(3) .and. .not. lctr!(2)) Call ErrMessage (42,0,ipt(29))
c
c— Read mass lumping options in the solution of the flow eqs
c— (lctrl(7)) and the transport eqs (lctrl(8)).
    callcommnt(ll,21)
    read(ll,*)lctrl(7),lctrl(8)                       '
c
c— Read an integer parameter denoting the number of time steps to be
c— skipped between solving for the flow equations.
    call commnt(l 1,21)
    read(ll,*)ipt(85)
c
c— Read in coupling term between flow and transport. lctrl(14)
c—• indicates if mass exchange terms are to be included in the
c—solution of the flow eqs.                :
    call commnt(l 1,21)
    read(ll,*)lctrl(14)
    if (lctrl(l) .and. .not. lctrl(2)) lctr!(14)=.false.
c
c— Lelnum indicates if element dirnensionless  numbers are to be
c— calculated for the transport solution and written to ipt(28).
    call commnt(l 1,21)
    read(ll,*)Icrrl(4)
c
c— Write the general model control information.
    write (21,502) ipt(27),t(21),t(22),lctrl(l),ipt(85),lctrl(2)
   +   ,lctrl(24),lctr!(25),lctrl(3),lctrl(7),lctrl(8)
   +   ,lctrl(14),lctrl(4)
c
c== TIME STEP/ITERATION CONTROL OPTIONS =====
c
    if(ipt(29).ne.O)  write (ipt(29),*)
   +         'Reading Time Step/Iteration Control information'
c
c— Read the initial and final simulation time (sec).
c— Error check: t(2)>t(l); t(l) and t(2) .ge. 0.
    call commnt(l 1,21)
    read(ll,*)t(l),t(2)
    if (t(l).lt.zerO) call En-Message (2,0,ipt(29))
    if (t(l).ge.t(2)) call ErrMessage (3,0,ipt(29))
c
c— Read the time weighting factor.
c— Error check: O.ge.weight.le. 1
    call commnt(l 1,21)
    read(ll,*)t(10)
    if(t(10).lt.zer0.or.t(10).gt.rone)
   +   call ErrMessage (13,0,ipt(29))
c
c— Read the maximum number of iterations.
c— Error check:ipt(30)  .gt. 0.
    call commntO 1,21)
    read(ll,*)ipt(30)
    if (ipt(30).le.O) call ErrMessage (4,0,ipt(29))
c
c— Read the convergence tolerance for the flow, transport, NAPL
c— saturation and immobile transport eqs.
c— Error check: tol>0.
    call commnt(l 1,21)
    read (11,*) t(13),t(14),t(15),t(16)
                                                                          177

-------
   if (t(13).lt.zcrO .or. l(14),It.zerO .or. t(15).lt.zerf>
   +   ,or, t( 16).lt.zcrO) call ErrMessage (9,0,ipt(29))
c
c— Read the inilial, minimum and maximum time step size (s).
e— Error check: dtmin0; dtmin.le.dtinitial.le.dtmax
   call commnt(l 1,21)
   read(ll,*)t(3),t<4).t(5)
   if(K4)Je.zcrt» call ErtMessage (5,0,ipt(29))
   if (IW8I.K5)) ca« ErrMessage (6,0,ipt(29»
   if (t(3).lu(4) .or, t(3),gt,t(5» call ErrMessage (7,0,ipt(29))
e
c— Read (lie maximum number of iterations for the flow, transport, NAPL
c— saturation, and immobile eqs.
   call commntU 1,21)
   read (11,») ipt(31),ipt(32),ipt(33)
c
c— Read tire minimum number of iterations for the flow, and transport
c—cqs. Error check: itmin«dtmax.
   call commnt(l 1,21)
   rcad(ll.')ipt(34),ipt(35)
   if (ipt(34),gt.ipt(31) .or. ipt(35).gt.ipt(32) .or.
   +   ipt(35).gt.lpt(33)) call ErrMessage (8,0,ipt(29))
c
c— Read the empirical time step amplification and reduction factors.
c—Error check: t(6).gc,lU(7).Ie.l.
    call commnt(l 1,21)
    rcad(ll,*)t(6),t(7)
    if (l(6).U,rone) call ErrMessage (10,0,ipt(29))
    if (t(7),gt,rone) call ErrMessage (1 l,0,ipt(29))
c
c— Write the time step control information.
    write (21403) t(l),t(2),t(10),ipt(30),t(13),t{14),t(15),t(16),
   +        t(3),t(4),t(5),ipt(3 l),ipt(32),ipt(33),
   +        ipt(34)jpt(35),t(6),t(7)
c
c— Initialize the time step.
    1(8) = 1(3)
c
CM^.i»u^^ GRID PARAMETERS AND OPTIONS =m
e
    if(ipl(29),ne.O) write (ipt(29),»)
   +           'Reading Grid Parameters and Options'
C
o— Read a logical variable indicating if grid info should be printed
c— to lite main output file.
    call commnt(l 1,21)
    read(ll,*)Iprnt(l)
 c
 c— Generate the grid?
 c  0 = don't generate the grid;
 c  1 - generate a union jack grid;
 c  2 = generate a herring bone grid.
 c— Error check: igrid (0-2)
 c— Error check: number of nodes and elements.
    Call commnK 11,21)
     Read (II,*) igrid
     If (igrid.It.O .or. igrid,gt.2) call ErrMessage (14,0,ipt(29))
     irtigrid.cq. l)Thcn
       if(ipt(29).nc.O) Write (ipt(29),*)
    +             'Generating a uniform union jack grid'
       Call gridu
     Else If (igrid .cq. 2) Then
       if(ipt(29),nc.O) Write (ipt(29).*)
    +             'Generating a uniform herring bone grid'
       Call gridhb
     Endlf
 c
 c— Input the grid,
     If (igrid .eq.O) Then
 c
 e— Read the number of elements, number of nodes, and the number of
 c— material property blocks.
 c— Error check: number of nodes, elements, material property blocks.
       Call commntU 1,21)
       Read (tl,*)ipt(0),ipt(l),ipt(26)
       write (6,*) ipl(0),ipt(l),ipt(26)
       if (ipt(O) .gt. nelmx) Call ErrMessage (19,0,ipt(29))
       if(ipt(l) ,gt. nnmx) Call ErrMessage (20,0,ipt(29))
     if (ipt(26) .gt. nmblk) Call ErrMessage (21,0,ipt(29))

C— Read the nodal incidence list and material property block
C— for each element.  The element node incidence list consists of
C— the arbitrary global element number followed by that element's
C— three global node numbers. Each element has its own line.  The
C— element node numbers start at an arbitrary node. If the z
C— coordinate is positive downwards proceed in the clockwise
C— direction, otherwise proceed in the counterclockwise direction.
C— If there is only one material property block for the entire
    - domain, the material property input assignment for each element
    - may be omrnited; The minimum material property block is a two
    element quadralateral.
    Error check: node and material block numbers are within the
c— defined range.
     call commnt(l 1,21)
     if(ipt(26).eq.l)then
       do!00i = l,ipt(0)
         read(ll,*)ii,nodel(ii*3-2),nodel(ii*3-l),nodel(ii*3)
 100       matel(ii) = 1
     else
       dol!0i = l,ipt(0)
 110       read(ll,*)ii,nodel(ii*3-2),nodel(ii*3-l>,nodel(ii*3)
    +            ,matel(ii)
     endif
     Dol20i=l,ipt(0)
       i3 = 3*i
       If (matel(i).lU .or. matel(i).gt.ipt(26))
    +     Call ErrMessage (24,0,ipt(29))
       If (nodel(i3-2).lt.l .or. nodel(i3-2).gt.ipt(l) .or.
    +       nodel(i3-l).lt.l .or. nodel(i3-l).gUpt(L) .or.
    +       nodel(i3).lt.l .or. nodel(i3).gt.ipt(l))
    +     Call ErrMessage (25,0,ipt(29))
 120   continue
 c
 c— Read the nodal coordinates.
      call commnt( 11,21)
      do!30i=l,ipt(l)
 130     read(ll,*)j,xnodeO),znode(j)
    Endlf
 C
 C— Compute the pointers for the nodal storage vectors.  Multiple
 C— entries are needed for each node whose contiguous elements have
 C— different material properties.  Pressure is always continuous,
 C— while as an example saturation is not when adjacent elements
 C— have different saturation/pressure relationships. The number
 C— of entries at a given node is equal to the number of different
 C— contiguous material property sets. This routine is configured to
 C— allow a maximum of four different material property sets to be
 C— contiguous at a given node.
 C
    if (ipt(29).ne.O) write (ipt(29),*)
    +           'Computing pointers for stacked storage'
    dol40i=l,ipt(l)+l
      nodept(i)=i
  140 continue
    do!50i=l,4*ipt(l)
      matpt(i)=0
  150 continue
    do!60i=l,3*ipt(0)
      nelpt(i)=0
  160 continue
 C
 C— First, determine the number of different material property
 C— sets that are contiguous at each node.  Search the entire
 C— node incidence list node by node, storing the material property
 C— identifiers in the local array mp.
 C
     do!70i=l,ipt(l)
 C
 C— Initialize local counters to zero before each element search.
 C
       i4max=0
       do!75j=l,4
         mp(j)=0
  175    continue
       do 180 ii=l,ipt(0)
         do 18013=2,0,-1
                                                                           178

-------
 C— If the node incidence list for element ii contains node i, check
 C— if matel(ii) is contained in one of the four entries of mp for
 C— node i.
 C
         if(nodel(3*ii-i3).eq,i) then
           do!85i4=l,4
 C
 C— If matel(ii) is already an entry in mp, create the corresponding
 C— entry in nelpt and go to the next element.
 C
            if(matel(ii).eq.mp(i4)) then
              nelpt(3*ii-i3)=i4-I
              go to 180
 C
 C— Store a new value of matel(ii) in the first zero entry of mp.
 C— Keep track of the number of nonzero entries in mp for node i in
 C— in isum. Create the corresponding entry in nelpt and continue on
 C— to the next element.
 C
            else if(mp(i4).eq.O) then
              mp(i4)=matel(ii)
              nelpt(3*ii-i3)=i4-l
              if(i4.gt.i4max+l) !4max=i4-l
              goto 180
            end if
 C
 C— If all entries of mp for node i are nonzero and matel(ii) is
 C— not contained in mp, too many contiguous material properties
 C— have been defined. Write an error message and stop.
 C
            if(i4.eq.4) then
              write(ipt(29),*)' ATTENTION: EXCESS MATERIAL',
   +           ' PROPERTY at Node Number',!
              Call ErrMessage (22,0,ipt(29))
            end if
 185        continue
         end if
 180   continue
 C
 C— Use i4max and mp to construct nodept and matpt. The value of
 C— nodept for node H-l is the value of nodept for node i plus the
 C— number of stacked entries for node i (i4max). Matpt is the nonzero
 C— values of mp in order, nodept has dimension itp(l)-)-l to allow
 C— for determination of the number of stacked variables at the last
 C— global node.
    nodept(i+l) = nodept(i)+i4max+l
    do 170i5=0,i4max
     matpt(nodept(i)-»-i5)=mp(i5+l)
 170 continue
C
C— Define the dimension of stacked nodal storage.
 c— Error check: number of nodal variables in stacked storage.
    ipt(2) = nodept(ipt(l)+!)-!
    if (ipt(2) .gt. nnstk) Call ErrMessage (23,0,ipt(29))
c
c— Determine the full bandwidth of the global matrix; one each for
c— the transport solution and the flow solution.
    nbw(0) = 0
    do!90i=l,ipt(0)
     i3 = (i-l)*3
 190   nbw(0) = max(nbw(0), iabs(nodel(i3+2)-nodel(i3+l)),
   +         iabs(nodel(i3+3)-nodel(i3+2)),
   +         iabs(nodel(i3+3)-node!(i3+l)))
    nbw(l) = 2*nbw(0) + l
    nbw(2) = 2*nbw(l)-H
c
c—Compute elemental areas
    call ATRI
c
c— Compute beta and gamma coefficients for computation of integration
c— Also compute radial centroid of each element for axysymetric
c— coordinates. This is set to one if the xz coordinates are used.
    do 200 i = l,ipt(0)
     i3 = 3*(H)
     beta(i3+l) = znode(nodel(i3+2)) - znode(nodel(i3+3))
     beta(i3+2) = znode(nodel(i3+3)) - znode(nodel(i3+l))
     beta(i3+3) = znode(nodel(i3+l)) - znode(nodel(i3+2))
      gama(i3+l) = xnode(nodeI(i3+3)) - xnode(nodel(i3+2))
      gama(i3+2) = xnode(nodel(i3+l)) - xnode(nodel(i3+3))
      gama(i3+3) = xnode(nodel(i3+2)) - xnode(nodel(i3+l))
  200 continue
 c
 c— Output basic grid information.
    write (21,504) igrid,nelmx,ipt(0),nnmx,ipt(l),nmblk,ipt(26),nnstk,
    +        ipt(2),nbw(l),nbw(2)
 c
 c— Output the boundary nodes for the case when the grid is generated.
    If(igrid.ne.0)then
      write (21,559)
      write (21,560) 'Left boundary',(nbdL(i),i=l,nnver)
      write (21,560) 'Right boundary',(nbdR(i),i=l,nnver)
      write (21,560) 'Top boundary',(nbdT(i),i=l,nnhor)
      write (21,560)'Bottomboundary',(nbdB(i),i=l,nnhor)
    Endlf
 c
 c— Output nodel coordinates, and incidence list.
    If(lprnt(l))Then
      If(ipt(27).eq.O)Then
       Write (21,505)
      Else
       Write (21,506)
      Endlf
      Do210i=l,ipt(l)
 210    Write (21,507) i,xnode(i),znode(i)
      Write (21,508)
      Do220i = l,ipt(0)
       i3 = 3*i
 220     Write (21,509) i,nodel(i3-2),nodel(i3-l),nodel(i3),
   +           matel(i),area(i)
    Endlf
 c
 c— Generate grid based pointers.
    ipt(40) = ipt(l)*2
    ipt(4I) = ipt(l)*3
    ipt(42) = ipt(l) * 4
    ipt(43) = ipt(l)*5
    ipt(44) = ipt(l) * 6
    ipt(45) = ipt(l)*7
    ipt(46) = ipt(l)*8
    ipt(47) = ipt(l) * 9
    ipt(48) = ipt(l) * 10
    ipt(49) = ipt<2)*2
    ipt(50) = ipt(2)*3
    ipt(51) = ipt(2)*4
    ipt(52) = ipt(2)*5
    ipt(53) = ipt(2)*6
    ipt(54) = ipt(2)*7
    ipt(55) = ipt(2)*8
    ipt(56) = ipt(2)*9
    ipt(57) = ipt(2)*10
    ipt(67) = ipt(0) * 2
    ipt(68) = ipt(0) * 3
c
c====== COMPONENT CHEMICAL PROPERTIES =====
c
   if(ipt(29).ne.O)  write (ipt(29),*)
   +           'Reading Component Chemical Properties'
c
c— Read the number of organic components.
c— Error check: ipt(l 5) must be nonnegan've.
c— Error check: If NAPL (lctrl(24)=t),sorption (lctrl(25)=t)> or
c—        biodegradation (lctrl(3)=t) is considered ipt(15)>0,
   call commnt (11,21)
   read(ll,*)ipt(15)
   if (ipt(15) .It. 0) Call ErrMessage (26,0,ipt(29))
   if (ipt(15) .gt. ncmp) Call ErrMessage (43,0,ipt(29))
   if (ipt(15) .eq. 0 .and. Ictrl(24)) Call ErrMessage (80,0,ipt(29))
   if (ipt( 15) .eq. 0 .and. lctrl(25)) Call ErrMessage (87,0,ipt(29))
   if (ipt(15) .eq. 0 .and. lctrl(3)) Call ErrMessage (88,0,ipt(29))
c
c— Read the organic component chemical properties.
c— Input units assumed: molecular weight (g/mole)
                vapor pressure = arm
                vapor viscosity = centipoise
                liquid density = g/1
                                                                        179

-------
c—             vapor diffusivity = cm"2/s
c—             liquid diffusivity = cm"2/s
c—             henry's constant = arm I/g
c—             aqueous solubility = g/l
c— Error checfc values must be nonegative except vapor pressure
c—        and solubility.
   call commnUt 1,21)
   If(ipl05).gt.O)Thcn
     Oo230i«l,ipKtS)
       read (11,*) ic,cnameOc),cmvv(ic),cvp(ic),cvvis(ic)
   +       ,cdcn(ic),cmdif(2*ic-l),cmdif(2*ic),chen(ic)
   +       .casoKic)
       if (Ic ,nc. i) Call ErrMessage (44,0,ipt(29))
       if (cmw(ic),l(.zerO) Call ErrMessage (89,0,ipt(29))
       If (cwis(ic).lt.zerO) Call ErrMessage (90,0,ipt(29))
       if (cdcn(ic),lt.zerO) Call ErrMessage (91,0,ipt(29))
       if (cmdif(2*ic-l).It.zctO) Call ErrMessage (92,0,ipt(29))
       if (cmdif(2*ic),lt.zerO) Call ErrMessage (92,0,ipt(29))
       if (chen(ic).lt.zerO) Call ErrMessage (93,0,ipt(29»
 230   continue
c
c— If lprnl(27) is false, open an additional material balance output
c— file for each component.
     dam  cmb(l ),cmba),cmb(3),cmb(4),cmb(5),cmb(6),cmb(7),cmb(8)
   +    ,mb<9),cmb(10)/'r,>2Y3Y4V5V6V7V8Y9','10>/
     ifCncmp,gt,10) Cal! ErrMessage (I26,0,ipt(29))
     call commntd 1,21)
     if(lptm(6),»nd,.not.lpmt<27)) then
       li = !ndex(oulprc,' ')-l
       do22Si = l.ipt<15)
         iii=index(cmb(i),")-l
         otMfikKSti) = outpre(l :iiy/'.mb'//cmbCO(l :iii)
  225      open (28+i,file=outfile(8+i),status='unknown')
         writc<21,55S)
         write(21,556)(cnarne(i),28+i,outfile(8+i),i=l,ipt(15))
       end if
    Endlf
 c
 c— Read chemical property data for water, oxygen, and nitrogen
 c— Error cheek; values must be nonegative except vapor pressure
 0—        and solubility.
    if (iplUSHS .gt. ncmp)Call ErrMessage (43,0,ipt(29))
    call comnwl(l 1,21)
    Do 240 i - ipt(15H-l,ip«15>+3
      read(ll,*)ic,cnarnc(i),cmw(i),cvp(i),cvvisfO,cden(i),
    4.         cmdif(2»i-l),cmdif(2*i),chen(i),casol(i)
      if (ic ,ne. i) Call ErrMessage (44,0,ipt(29))
       if (cmw(ie).It.zerO) Call ErrMessage (89,0,ipt(29))
       if (cvvis(ic).lt,zerO) Call ErrMessage (90,0,ipt(29))
       if (cden(ic),It.zerO) Call ErrMessage (91,0,ipt(29))
       if (cmdif(2*ic-l).H.zerO) Call ErrMessage (92,0,ipt(29))
       if(cmdif(2*ic).U.zerO) Call ErrMessage (92,0,ipt(29»
       if (chcn(ic),lt,zerO) Call ErrMessage (93,0,ipt(29))
  240  continue
  c
  e— Error clieck: oxygen must be present in the aqueous phase when
  c— biodcgradaiion is considered.
     if(ktrl(3),and,casol(ipt(15>K2).It.0.dO)
    +   Call ErrMessage (79,0,ipt(29))
  c
  c— Nutrient information:
  c— Read a logical variable indicating if a nutrient
  c— is 10 be modeled.
     call commnt(l  1,21)
     rttad(ll,*)lctrl(9)
  c
  e— Error check; Ictrl(3) = true for nutrient to be considered.
     if (ktrl(9).and..noUctri(3)) Call ErrMessage (77,0,ipt(29))
  C
  c— If nutrient is modeled, then read the nutrient chemical properties.
  c— Error check: values must be nonegative except vapor pressure.
     istop  = ipt(15) + 3
     If(lctrl<9))Thcn
       islop = istop + 1
       if (istop .gt.  ncmp) Call ErrMessage (43,0,ipt(29))
       call commnt(l 1,21)
       read (11,*) ic,cnamc(istop),cmw(istop),cvp(istop),
     H-     cwis(istop),cden(istop),cmdif(2*istop-l).
  +     cmdif(2*istop),chen(istop),casol(istop)
    if (ic .ne. istop) Call ErrMessage (44,0,ipt(29))
    if (ic .ne. i) Call ErrMessage (44,0,ipt(29))
    if (cmW(ic).lt.zerO) Call ErrMessage (89,0,ipt(29))
    if (cvvis(ic).lt.zerO) Call ErrMessage (90,0,ipt(29))
    if (cden(ic).lt.zerO) Call ErrMessage (91,0,ipt(29))
    if (cmdif(2*ic-l).lt.zerO) Call EirMessage (92,0,ipt(29))
    if (cmdif(2*ic).lt.zer0) Call ErrMessage (92,0,ipt(29))
    if (chen(ic).It.zerO) Call ErrMessage (93,0,ipt(29))

  - Error check: casol(nutrient) must be positive if Ictrl(9) = true.
    if (casol(istop).lt.zerO) Call ErrMessage (78,0,ipt(29))
   Endlf
   ipt(65) = istop
   ipt(66) = istop *ipt(l)

  - Write component data.
   Write (21,510) ipt(15)
   Do 250 i = l,istop
    Write (21,511) cname(i),i,cmw(i),cvp(i),cvvis(i),
   +       cden(i),cmdif(2*i-1 ),cmdif(2*i),chen(i),casol(i)
250  continue

c— Adjust units.
;— Convert aqueous solubilities to mole ratios.
;— Convert all others to SI units.
   cmwaq = cmw(ipt(15)+l)
   do260i=l,istop
     if(cvp(i).gt.rone) then
       cvp(i) = chen(i) * casol(i)
     else
       cvp(i) = cvp(i) * patm ! vapor pressure = Pa
     end if
     casol(i) = casol(i)*cmwaq/(cmw(i)*cden(ipt(15)+l))
     cmw(i) = cmw(i) * l.Od-3   ! molecular weight = kg/mole
     cvvis(i) = cvvis© * 1 .Od-3 ! viscosity = Pa s
     cmdif(2*:-l) = cmdif(2*i-l) * l.Od-4 ! diffusivity = m"2/s
     cmdif(2*i) = cmdif(2*i) * l.Od-4
 260   chen(i) = chen(i) * patm ! henry's constant = Pa m"3/kg
c
c==== MASS EXCHANGE INFORMATION =====
c
   if(ipt(29).ne.O) write (ipt(29),*)
   +           'Reading Mass Transfer Information'
C
C— Read the mass exchange coefficients for the various components
C— betweeen contiguous phases. If the mass exchange coefficient
C— for a given component and phase pair is zero, that component
C— does not partition between that phase pair. Exchange coefficients
C— are ordered aqueous/gas, aqueous/NAPL, gas/NAPL, aqueous/biophase,
C— and aqueous/solid.
C— Error Check: Component number must be between 1 and istop.
C
    write (21,512)
    do270i=l,istop
      call commnt(l 1,21)
      read (11,*) ic,kex(5*(ic-l)+l),kex(5*(ic-l)+2)
   +    ,kex(5*(ic-l)+3),kex(5*(ic-l)+4),kex(5*(ic-l)+5)
      read (11,*) ic,kmax(5*(ic-l)+l),kmax(5*(ic-l)+2)
   +    ,kmax(5*(ic-l)+3),kmax(5*(ic-l)+4),kmax(5*(ic-l)+5)
      if (ic.lt.l .or. ic.gt.istop) Call ErrMessage (45,0,ipt(29))
 270   write (21,513) cname(ic),kex(5*(ic-l)+l),kex(5*(ic-l)+2)
   +    ,kex(5*(ic-l)+3),kex(5*(ic-l)+4),kex(5*(ic-l)+5)
    write (21,582)
    do 275 i=l,istop
      write (21,513) cname(i),kmax(5*(i-l)+l),kmax(5*(i-l)+2)
    +    ,kmax(5*(i-l)+3),kmax(5*(i-l)+4),kmax(5*(i-l)+5)
      do275ii = l,5
  275    if(kmax(5*(i-1 )+ii).lt.0.050d0.or.kmax(5*(i-1 )-)-ii).gt.rone)
    +      Call ErrMessage (134,0,ipt(29))
 C
 C— Create the pointer for  phase compositions. First consider
 C— the gas phase. Components are not included if their vapor
 C— pressures are negative. ipt(3) is the number of components in
 C— the gas phase and ipt(l 3) is the number of organic components in
 C— the gas phase.
     ipt(3)=0
     ipt(13)=0
                                                                           180

-------
     do280i=l,istop
       if(cvp(i).ge.zerO) then
        ipt(3)=ipt(3)+l
        icp(ipt(3))=i
       end if
       if(i.eq.ipt(15)) ipt(13)=ipt(3)
  280  continue
 c
 c— Error check: if present gas phase must contain nitrogen.
     if (ipt(3).gt.O .and. cvp(ipt(15)+3).lt.zerO)
    +   Call En-Message (69,0,ipt(29))
 C
 C— Next consider the aqueous phase. Components are not included if
 C— their aqueous solubilies are negative. ipt(4) is the number of
 C— components in the aqueous phase and ipt(14) is the number of
 C— organic components in the aqueous phase.
     ipt(4)=0
     ipt(14)=0
     do290i=l,istop
      if(casol(i).ge.zer0) then
        ipt(4)=ipt(4)+l
        icp(ipt(3)+ipt(4))=i
      end if
      if(i.eq.ipt(15))ipt(14)=ipt(4)
 290 continue
 c
 c— Error check: if present aqueous phase must contain water,
     if (ipt(4).gt.O .and. casol(ipt(15)+l).lt.zerO)
    +   Call En-Message (70,0,ipt(29))
 C
 C— Next consider the organic phase if lctrl(24) = true. AH organic
 C— components are included in the NAPL when present.
    ipt(5) = 0
    if(lctrl(24)) then
      ipt(5)=ipt(15)
      do300i=l,ipt(5)
        icp(ipt(3)+ipt(4)+i)=i
 300   continue
    Endlf
 C
 C—• Next consider the solid phase. Sorpa'on is considered for all
 C— organic component in the aqueous phase with nonzero aqueous/solid
 C— exchange coefficients. ipt(6) is the number of components in the
 C— solid phase. ipt(16) is  the number of organic components in  the
 C— solid phase.
    ipt(6)=0
    ipt{16)=0
    If(lctrl(25))Then
     do310i=l,ipt(15)
        if(kex(5*(i-l)+5).ne.zerO) then
         ipt(6)=ipt(6)+l
         icp(ipt(3)+ipt(4)+ipt(5)+i)=i
        end if
        if(i.eq.ipt(15)) ipt(16)=ipt(6)
 310   continue
    Endlf
 C
 C— Define pointers:
 C— ipt(8) - start of gas phase component section -1
 C— ipt(9) - start of aqueous phase component section -1
 C— ipt(10) - start of organic phase component section -1
 C—  ipt(l 1) - start of solid phase component section -1
 C—  ipt( 12) - start of bio-phase component section - 1
    ipt(8) =0
    ipt(9) =ipt(8) + ipt(3)*ipt(l)
    ipt(10) = ipt(9)-4-ipt(4)*ipt(l)
    ipt(l 1) = ipt(lO) + ipt(5)*ipt(l)
    ipt(12) = ipt(ll) + ipt(6)*ipt(l)
    ipt(58) = ipt(3)-t-ipt(4)
    ipt(59) = ipt(3) + ipt(4) + ipt(5)
    ipt(60) = ipt(3) + ipt(4) + jpt(5) -t-ipt(6)
 c
c==== MATERIAL PROPERTY BLOCK DATA =====
c
    if(ipt(29).ne.O) write (ipt(29),*)
   +          'Reading Material Property Block Data'
c
c— Read soil physical  properties:
 c—   porosity (-); horizontal and vertical permeability (m**2);
 c—   bulk density (gm/1);
 c—•   organic carbon fractional content(-)
 c— Error Check: block number=(0,ipt(26)); porosity=(0,l);
 c—       permeability>0; density>0; foc=(0,l);
     call commnt (11,21)
     Do340i = l,ipt(26)
      Read (11,*) ii,bphi(ii),bpermh(ii),bpermv(ii),bsden(ii),
    +         bfoc(ii)
      If (ii.lt. I .or. ii.gt.ipt(26)) Call ErrMessage (27,0,ipt(29))
      If (bphi(ii).lt.zerO .or. bphi(ii).gt.rone)
    +    Call ErrMessage (28,0,ipt(29))
      If (bpermh(ii).lt.zerO .or. bpermv(ii).lt.zerO)
    +    Call ErrMessage (29,0,ipt(29))
      If (bsden(ii).lt.zerO) Call ErrMessage (30,0,ipt(29))
      If (bfoc(ii).lt.zerO .or. bfoc(ii).gt.rone)
    +    Call ErrMessage (31,0,ipt(29))
 340 continue
 c
 c— Read the water retention parameters:
 c—    residual water saturation(-); van Genuchten n value;
 c—    van Genuchten alpha value
 c— Define the van Genuchten m value.
 c—Error Check: block number=(0,ipt(26)); residual saturation=(0,l);
 c—        n value>0; alpha value>0.
    call commnt (11,21)
    Do350i = l,ipt(26)
      Read (11,*) ii,bsrw(ii),bvgn(ii),bvga(ii)
      If (ii.lt. 1 .or. ii.gt.ipt(26)) Call ErrMessage (27,0,ipt(29))
      If (bsrw(ii).lt.zerO .or. bsrw(ii).gtrone)
    +   Call ErrMessage (33,0,ipt(29))
      If (bvgn(ii).lt.zerO) Call ErrMessage (34,0,ipt(29))
      If (bvga(ii).lt.zerO) Call ErrMessage (35,0,ipt(29))
      bvgm(ii) = rone - rone / bvgn(ii)
 350 continue
 c
 c— Read the dispersion parameters:
 c—    longitudinal and transverse dispersivity (m).
 c— Error Check: all parameters > 0.
    call commnt (11,21)
    Do 360 i = l,ipt(26)
      Read (11,*) ii,bdisl(ii),bdist(ii)
      If (ii.lt.l .or. ii.gt.ipt(26)) Call ErrMessage (27,0,ipt(29))
      If (bdisl(ii).lt.zerO .or. bdist(ii).lt.zerO)
   H-   Call ErrMessage (36,0,ipt(29))
 360  continue
 c
 c— Write the material, properties for each block.
    write (21,514)
    Do370i = l,ipt(26)
     Write (21,515) i,bphi(i),bpermh(i),bpermv(i),bsden(i),bfoc(i),
   +           bsrw(i),bvgn(i),bvga(i),
   +            bdisl(i),bdist(i)
 370 continue
 c
   ===== DISPERSION TENSOR	
   - If lctrl(21) is true the hydrodynamic dispersion tensor is
   - computed internally for all components.  If lctrl(21) is false
c— read hydrodynamic dispersion tensor information directly. The
   - hydrodynamic dispersion tensor is read for compound ic first
   - for the gas phase and then for the aqueous phase on separate
   - lines.  Hydrodynamic dispersion tensors must be entered for all
c— components present when lctrl(21) is false. Units (m**2/sec).
   if(ipt(29).ne.O) write (ipt(29),*)
   +           'Reading Dispersion Parameters'
   call commnt(l 1,21)
   read(ll,*)lctrl(21)
   write (21,580) lctrl(21)
   call commnt(l 1,21)
   if(.not.lctrl(21)) then
     write (21,581)
     do 380 i = 1, istop
       call commnt(l 1,21)
       read (11,*) ic, d(8*ic-7),d(8*ic-6),d(8*ic-5),d(8*ic-4)
       read (11,*) ic, d(8*ic-3),d(8*ic-2),d(8*ic-l),d(8*ic)
       write (21,585) cname(ic),'gas  ',d(8*ic-7),d(8*ic-6)
                                                                           181

-------
   +      ,d 0; slow/fast fraction = (0,1)
      If(ktr](19))Then
       call commnl(l 1,21)
       read (11,*) xbok, xbom, xkex, xden
       if (xbok .It, zcrO) Call ErrMessage (39,0,ipt(29))
       if (xbom ,lt. zerO) Call ErrMessage (40,0,ipt(29))
       if (xdcn.lt.rxrO .or. xden.gt.rone)
    +       Call ErrMessage (41,0,ipt(29))
                ipt(60)-H
        icp(ipt(3Hipt(4)+ipt(5)+ipt(6)) =
    +      icp(ipl(3)+ipt(4)+ipt(5)+l)
       Endlf
  c
  c — Read sorption parameters data:
  c — Read for each material property block enter:
  e —   (1 ) the kf parameter values for each organic component in
  c—     order from 1 to the number of components:
  c —     units (micro gm)/(gm solid) with aqueous concentration
  e—     inmg/1;
  c— •   (2) the n parameter values order in the same way.
  o — Error  Check: Kf and n=l/m>0
       call commntd 1,21)
       do400UO,ipt(26)-l
        read (1 1.*) ii,(bok((ii-l)*ipt(15)+j)o=l,ipt(15))
        read (1 1,*) ii,(bom«ii-l)*iPt(15)+j)j=l,ipt(15))
  400  continue
                0,ipt(26)-l
      do40Jj = J,ipt(15)
        if (bok.(i*ipt(15)+j) ,U..zerO)
           Call prrMessage (39,0,ipt(29))
401      if (bom(i*HM(I5)+j) .It. .zerO)
  -H        Call ErrMessage (40,0,ipt(29))

.— Write rate-limited .sorption parameters:
     write (21,51.6)     ! write sorpti.on.data
     Pp410j = 0,ipt(26)-l
      write (2J,517) j+J
      write (21,5,18) ,{cnameg),bpk(i*ipt.(15)+j),cname(j),
         bo.m.(i*jp.t(15)+j)j=J,ipt()5))
410   continue
     If (lctrl( 19)) Then   ! write two compartment data
      write (21,519) xbok, xbom, xden, xkex
     Endlf

    Conversions:
C— Convert .units for sorption parameters. This assumes the input
 ;— values for JCf or Koc .are rnjcrograms/grarn (with aqueous
 ;— concentration in mg/I) .and bom is 1/m (unitless).
 :— The converted Kf or Koc is in grams organic / gram solid.
     do420i=ftipt(26)-l
       do420j = l,ipt(15)
        jf(bok(i*ipt(15)+j).ge.zerO) then
          bok.(i*ipt(!5)+j) = bok(i*ipt(15)+j) * l.Od-6
          bom(i*ipt(15)+j) = rone / bom(i*ipt(15)+j)
        else if(bok(i*ipt(15)+j).!t.zerO) then
          bok(i*ipt(15)+j) = -bok(i*ipt(15)+j)*1.0d-6*bfoc(i+l)
          bom(i*ipt(15)+j) = rone
        end jf
 420    .contipue
C
C— Convert xbom to be consistent with bom.
     if(lctrl(19)) xbom = rone/xbom
C
C— Initial the retardation factors to one when a separate solid
C— phase is considered.
     do404i= l.istop
 404     krtd(i) = rone
c
c— Read equilibrium sorption parameters (retardation factors).
    Else
     lctrl(19) = .false.
C
C— Read retardation factors if desired. Retardation factors
C— can only be used when nonequilibrium sorption is not
C— being considered. Retardation factors are input as
C— component number as input above and then the retardation
 C— factor. Retardation pan be considered for oxygen or nutrient.
 C
     callcommnt(n,21)
     read(ll,*)lretrd
     call commnt( 11,21)
     if(.not.lretrd) then
        write(21,590)
        do4p5i = l,istop
 405      krtd(i) = rone
      else
        write(21,588)
        do406i = l.istop
         read(ll,*)ic,krtd(ic)
         write(21,574) cname(ic),krtd(ic)
         if(krtd(ic).lt.rone)
    +        Call ErrMessage (128,l,ipt(29))
  406    continue
      end if
     Endlf
 c
 c===== BIOLOGICAL PARAMETERS =====
 c
 c—This block read only if biotranformation eqs are solved.
     If(lctrl(3))Then
      if (ipt(29).ne.O)  write (ipt(29),*)
    +           'Reading Biological Parameters'
 c
 c— Read an integer indicating the number of organic components in
 c— the biophase.  The biophase always contains oxygen and nutrient
                                                                          182

-------
 c—if present.
 c— Error Check: Ictrl(3) must be true if ipt(17)>0.
      call commnt(l 1,21)
      read(ll,*)ipt(17)
      if (.not.lctrl(3) .and. ipt(17).gt.O)
   +    Call ErrMessage (81,0,ipt(29))
      if (ipt(17) .gt. ipt(15)) Call ErrMessage (130,l,ipt(29))
 C
 C— Biological parameters.
 C— ipt(7) is the number of components in the bio-phase. The bio-phase
 C— always includes oxygen and nutrient if present.
      if(ipt(17).gt.O) then
       if(lctrl(9))then
         ipt(7) = ipt(17) + 2
         icp(ipt(3)+ipt(4)+ipt(5)+ipt(6)+ipt(17)+2) = ipt(15) + 4
       else
         ipt(7) = ipt(17)-H
       end if
       icp(ipt(3)«pt(4)+ipt(5)+ipt(6)+ipt(17)-H) = ipt(15) -1- 2
 c
 c— Add the biomass as a component to the biophase.
 c— Initial cname with"biomass".
       ipt(7) = ipt(7)+l
       icp(ipt(3)-t-ipt(4)+ipt(5)+ipt(6)+ipt(7)) = istop+1
       cname(istop+l) =  ' biomass '
      else if(ipt(17).eq.O) then
       ipt(7) = ipt(17)
      end if
 c
 c— Generate pointer.
      ipt(61) = ipt(3) + ipt(4) + ipt(5) + ipt(6) + ipt(7)
 c
 c— Read 2 logical biodegradation'control switches:
 c—  lctrl(17) indicates if a steady state biomass is to used;
 c—  Ictrl( 16) indicates biodegradation equations are modeled as a
 c—  sink term in the aqueous transport equations; otherwise their
 c—   modeled as rate-limited exchange to a separate biophase.
      call commnt(l 1,21)
      read (11,*) lctrl(17),lctri(16)
 c
 c— Determine the type of kinetics.
 c—   1 - standard monod kinetics
 c—   2 - monod kinetics with substrate inhibition
 c—   3 - monod kinetics with lumped substrate inhibition
 c—   4 - monod kinetics with saturation dependency
 c—   5 - monod kinetics with saturation dependency  and
 c—     substrate inhibition
      if(lctrl(3)) then
       call commntC 11,21)
       read(ll,*)ipt(39)
c
c— Error Check:  Current version restriction.
       if (ipt(39).gt.2) call ErrMessage (68,l,ipt(29))
c
c— Read Monod  parameters for each component of the biophase:
c—   (1) component number
c—   (2) electron acceptor use coefficient gm O2/gm substrate)
c—   (3) nutrient use coefficient (gm n/gm substrate)
c—   (4) maximum substrate use rate (gm substrate/gm biomass*sec)
c—   (5) half saturation constant (gm substrate/1)
c—   (6) yield coefficient (gm biomass/gm substrate)
c—   (7) inhibition constant (unitless) expressed as a  fraction of
c—     the aqueous solubility.  For substrate and nutrient this
c—     turns off metabolism when the concentration  is above this
c—     threshold concentration and for electron acceptor this
c—     turns off metabolism when the concentration  is below this
c—     threshold concentration. In both cases hyperbolic
c—     functions are used.
c— Error Check: Component number must be defined; parameters values
c—•        must be nonnegative.
       ibpt = ipt(3)+ipt(4)+ipt(5)+ipt(6)
       do430i=l,ipt(7)-l
         call commnt(l 1,21)
         read(ll,*)ic,fuse(ic),
   +        fuse(ic+istop),umax(ic),
   +        khalf(ic),xyield(ic),
   +        kinhib(ic)
         icp(ibpt+i) = ic
         if (icp(ibpt-t-i).lt.O .or. icp(ibpt+i).gt.istop)
    +        Call ErrMessage (45,0,ipt(29))
         if(fuse(ic).lt.zerO)
    +        Call ErrMessage (94,0,ipt(29))
         if (fuse(ic+istop).lt.zerO)
    +        Call ErrMessage (95,0,ipt(29))
         if(umax(ic).It.zerO)
    +        Call ErrMessage (96,0,ipt(29))
         if(khalf(ic).lt.zerO)
    +        Call ErrMessage (97,0,ipt(29))
         if(xyield(ic).lt.zerO)
    +        Call ErrMessage (98,0,ipt(29))
         if(kinhib(ic).lt.zerO)
    +        Call ErrMessage (99,0,ipt(29))
 430    continue
 c
 c— Read five more bio parameters:
 c—  (1) decay coefficient (I/sec)
 c—  (2) minimum biomass (gm/1 media)
 c—  (3) maximum biomass (gm/1 media)
 o—  (4) initial uniform biomass (gm/1 media)
 c—  (5) delay period for initiation of bioreactions (sec)
 c— Error Check: parameters must be nonnegative, initial biomass must
 C—       be between minimum and maximum biomass.
       call commnt(l 1,21)
       read (11,*) kd,xbmin,xbmax,xinit,t(ll)
       if (kd.lt.zerO) Call ErrMessage (99,0,ipt(29))
       do 441 i = 1, ipt(17)
 441       if (9.990dO*kd.gt.umax(i)) Call ErrMessage (37,l,ipt(29))
       if (xbmin.lt.zerO) Call ErrMessage (100,0,ipt(29))
       if (xbmax.lt.zerO) Call ErrMessage (101,0,ipt(29))
       if (xinit.lt.zerO) Call ErrMessage (102,0,ipt(29))
       if (t(l l).lt.zerO) Call ErrMessage (103,0,ipt(29))
       if (xinit.ltxbmin .or. xinit.gt.xbmax)
   +      Call ErrMessage (104,0,ipt(29))
 c
 c— Write biological parameters.
       write (21,520) ipt(17),lctrl(17),Ictrl(16),ipt(39),xinit
   +      ,xbmin,xbmax,kd,t(ll)
       Do440i = l,ipt(7)-l
         write (21,521) cname(icp(ibpt+i)),fuse(icp(ibpt+i)),
   +•       fuse(icp(ibpt+i)+istop),umax(icp(ibpt+i)),
   -I-       khalf(icp(ibpt4-i)),xyield(icp(ibpt+i)),
   +       kinhib(icp(ibpt+i))
 440     continue
      Endlf
c
c—• Bio eqs are not solved. Set control switches.
    Else
      ipt(17) = 0
      ipt(7) = 0
      lctrl(16) = .false.
      ipt(61) = ipt(60)
   
-------
   wrire<21, 523) 'Solid1, !pt(6)
                 wrfte<21,524)
   write<21.523> 'MierobM',5pt<7)
   K(ipl<7).st.O) «fte<41,S24)
                                              ,i=l ,ipt(6))
    Convert Viscosity frOrn ePoise to Pa-s
   wvis = rone / (wvis * 1 ttcl-3)

   aaaaaaj. TEMPERATURE PARAMETERS
   ifCi|X(29),iw.O)  write Opt(29),*)
   +           'Reading Temperature Parameters'
c
c— Read a logical variable indicating if the temp dist is uniform.
   callcommnt(l!,2I)
   icad(n,*)tarl(10)
   write (21,525) 1*1(10)
C
C— Read and Write the Uniform tcrnperarure distribution in
C  ccmrigraJc.
   c»Hcornmnt(ll,21)
   tf(kttt(10)) theft
     tead(U,*)ctemp
     write (21,526) etcmp
     do450i=4,ipt, — five paranie'ters feeW for 'every cofriponeft. rl
     endif
     ip't(89) = 5*ipt(88)
     ii = 0
c
 c — Loop '6Ver fee number of component's.
     d6477ic = l,istop
       write(21,570) cname(ic)
 c
 c — Read component vapor pressure.
       call commnt(l 1,21)
       read(ll,*) (dtemp(i+ii),i=l,ipt(86))
       do 471 1 = ip'f(86),l,-l     ! read nodal vapor pressure
         if(igrid.eq.2) then
           dtemp(Wi) = dtemp(i+ii)*'patm - cvp(ic)
         else if (igrid.eq.l) 'then
          •dternp(2*i-l+ii) = •dtenip(i+ii)*pa'tih - 'cvp(ic)
         endif
 471     continue
       if(igrid.'eq.2) then
         ii=ipt(86)4li
       else if (igrid.eq. 1 ) then
         ii = 2*ip't(8'6)-l+ii
       endif
 c
 c — Read component vapor viscosity.
       call commnt(l 1,21)
       read(l 1,*) (dtemp(i+ii),i=l,ipt(86))
       do472i = ipt(86),l,-l
         if(igrid.eq.2) then
           dtemp(i+ii) = dtemp(i+ii)*1.0d-3 - cvvis(ic)
         else if (igrid.eq.l) then
           dtemp(2*i-l+ii) = dtemp(i+ii)*1.0d-3 - cvvis(ic)
           if(i.gt.l) dtemp(2*i-2+ii) = l.Od-3*
    +         (dtemp(i+ii)+dtemp(i-H-ii))/2.0dO - cvvis(ic)
         endif
  472    continue
       if(igrid.eq.2) then
         ii=ipt(86)+ii
       else if (igrid.eq.l) then
         ii = 2*ipt(86)-l+ii
       endif
 c
 c — Read component Henry's law coefficients.
       callcommnt(ll,21)
       read(l 1,*) (dtemp(i+ii),i=l,ipt(86))
       do473i = ipt(86),l,-l
         if(igrid.eq.2) then
           dtemp(i+ii) = patm*dtemp(i+ii) - chen(ic)
         else if (igrid.eq.l) then
                                                                          184

-------
           dtemp(2*i-l+ii) = patm*dtemp(i+ii) - chen(ic)
           if(i.gt.l) dtemp(2*i-2+ii) = patm*
   +          (dtemp(i+ii)+dtemp(i-l+ii))/2.0dO - chen(ic)
         end if
 473    continue
        if(igrid.eq.2) then
         ii=ipt(86)+ii
        else if (igrid.eq.l) then
         ii = 2*ipt(86)-l+ii
        endif
 c
 c— Read component aqueous solubilities.
        call commnt( 11,21)
        read( 11 ,*) (dtemp(i+ii),i=l ,ipt(86))
        cmwaq = cmw(ipt(15)+l)/(cmw(ic)*cden(ipt(15)+l))
        do474i = ipt(86),l,-l
         if(igrid.eq.2) then
          dtemp(i+ii) = cmwaq*dtemp(i+ii) - casol(ic)
         else if (igrid.eq.l) then
          dtemp(2*i-l+ii) = cmwaq*dtemp(i+ii) - casol(ic)
          if(i.gt.l) dtemp(2*i-2+ii) = cmwaq*
   +          (dtemp(i+ii)+dtemp(i-l+ii))/2.0dO- casol(ic)
         endif
 474    continue
        if(igrid.eq.2) then
         ii=ipt(86)+ii
        else if (igrid.eq.l) then
         ii = 2*ipt(86)-l+ii
        endif
 c
 c—  Read component maximum substrate utilization rate.
        call commnt(l 1,21)
        read(ll,*)(dtemp(i+ii),i=l,ipt(86))
        do 475 i = ipt(86),l,-l
         if(igrid.eq.2) then
          dtemp(i+ii) = dtemp(i+ii) - umax(ic)
         else if (igrid.eq.l) then
          dtemp(2*i-l+ii) = dtemp(i+ii) - umax(ic)
          if(i.gt.l) dternp(2*i-2+ii)
   +         = (dtemp(i+ii)+dtemp(i-1 +ii))/2.0dO - umax(ic)
         endif
 475     continue
        if(igrid.eq.2) then
         ii=ipt(86)+ii
       else if (igrid.eq. 1) then
         ii = 2*ipt(86)-l+ii
       endif
        do477ip=l,ipt(86)
         write(21,571) zdepth(ip)
   +        ,(dtemp(ip+ipp*ipt(88)+(ic-l)*ipt(89)),ipp=0,4)
 477   continue
c
c—  Read biomass decay rate.
     call commntU 1,21)
     write(21,572)
     read(l 1,*) (dtemp(i+ii),i=l,ipt(86))
     do 476 i = ipt(86), 1,-1
       if(igrid.eq.2) then
         dtemp(i+ii) = dtemp(i+ii) - kd
       else if (igrid.eq.l) then
         dtemp(2*i-l-t-ii) = dtemp(i+ii) - kd
         if(i.gt.l) dtemp(2*i-2+ii)
   +         =(dtemp(i+ii)+dtemp(i-l+ii))/2.0dO-kd
       endif
 476   continue
     write(21,573) (zdepth(ip),dtemp(ip+istop*ipt(89)),ip=l ,ipt(86))
   endif
c
c— Compute the gamma factor for computing mixture vapor viscosities.
c— Initialize gas phase viscosity if it is a constant.
   lctrl(13) = .false.
   if (ipt(3) .gt. l)then
     lctrl(13) = .true.
     do320node = l,ipt(l)
       do320i=l,ipt(3)
         ii = icp(i)
         if(lctrl(10)) then
          .cvvist = cvvis(ii)
         else
           cvvist = cvvis(ii)
   +          + dtemp(ipt(88)+(ii-l)*ipt(89)+idepth(node))
         endif
         i3 = (i-1) * ipt(3) + (node-l)*ipt(3)*ipt(3)
         do 320 j = l,ipt(3)
           jj = icp(j)
           if(lctrl(10)) then
            cvvist2 = cvvis(jj)
           else
            cvvist2 = cvvis(jj)
   +            + dtemp(ipt(88)+(jj-l)*ipt(89)+idepth(node))
           endif
           gamma(i3+j) = ((rone + dsqrt(cvvist/cvvist2) *
   +          (cmw(ij)/cmw(ii))**0.250dO) ** 2) /
   +          dsqrt(8.0dO * (rone + (cmw(jj)/cmw(ii))))
 320,   continue
   else ! vapor viscosity is a constant
     do330i = l,ipt(l)
       if(lctrl(10)) then
        cvvist = cvvis(icp(l))
       else
        cvvist = cvvis(icp(l))
   +        + dtemp((icp(l)-l)*ipt(88)+idepth(i))
       endif
       vis(i) = rone / cvvist
 330   continue
   endif
c

c
               = OUTPUT CONTROL PARAMETERS =====
        if(ipt(29).ne.O) write (ipt(29),*)
       +           'Reading Output Control Parameters'
    c
    c— Read a logical variable indicating if initial conditions
    c— should be printed.
        call commnt(l 1,21)
        read(ll,*)Iprnt(3)
    c
    c— Initial print counters.
        ipt(69) = 0
        ipt(70) = 0
        ipt(71) = 0
        ipt(72) = 0
        ipt(73) = 0
    c
    c—• Read and write print switches for specific variables:
        call commntO 1,21)
        iend = ipt(3) + ipt(4) + ipt(5) + ipt(6) + ipt(7)
        do 4801 = 1,7
    480   read(l 1 ,*) lprnt(i+7),lcon(i)
        read(ll,*) lprnt(15),lcon(8)
        if(lprnt(15).or.lcon(8))
       +   read(ll,*) ipt(69),(icp(iend+i),i=l,ipt(69))
        read(l 1,*) lprnt(16),lcon(9)
        if(lprnt(16).or.lcon(9))
       +   read(l 1,*) ipt(70),(icp(iend+ipt(69)+i),i=l,ipt(70))
        read(l 1,*) lprnt(17),lcon(10)
        if(lprnt(17).or.lcon(10))
       +   read(l 1,*) ipt(71),(icp(iend-t-ipt(69)+ipt(70)+i),i=l,ipt(71))
        read(l 1 ,*) Iprnt(l 8),lcon(l 1)
        if(Iprnt(18).or.lcon(ll))read(ll,*)ipt(72)
       +   ,(icp(iend+ipt(69)+ipt(70)+ipt(71 )+i),i=l ,ipt(72))
        read(l 1,*) lpmt(19),lcon(12)
        if(Iprnt(19).or.lcon(12)) read(ll,*) ipt(73)
       +   ,(icp(iend+ipt(69)+ipt(70)+ipt(71)+ipt(72)+i),i=l,ipt(73))
        read(l 1,*) lprnt(29),lcon(18)   ! element TPH cocnentration
        do 485 i = 13, 17
    485   read(l 1 ,*) lprnt(i+7),lcon(i)
    c
    c— Setup pointers.
       ipt(81) = 0
       ipt(82) = 0
       iend2 = ipt(69) + ipt(70) + ipt(71) + ipt(72) + ipt(73)
       ipt(74) = iend2
       call commnt(l 1,21)
       read(ll,*)lplt(l)
                       ,*) ipt(81),(icp(iend+2*iend2+i),i=l,2*ipt(81))
185

-------
   call commnKi 1,21)
   rcad(!I,*)lplt(2)
   if then
     do495i = l,2*ipt(82),2

c- Error check: node numbers for time series input must be within
c- domain.
       if(icp(iend+2*iehd2+2*ipt(8 1 )+i+l ).It.O
           .or.icp(iend+2*iend2+2*ipt(81)+i-t-l).gt.ipt(l))
           call ErrMessage (125,l,ipt(29»
 495     write(21,547) cname(icp(iend4-2*iend2+2*ipt(81)+i))
   +       ,icp(fend4-2*iend2+2*ipt(81)4-i+l)
    end if
    iadd=l
    iadd2 = 1
    if(ipt(69).gt.O) then
     ii = 0
     do 600  i = l,ipt(3)
       if((icp(i).eq.icp(iend+iadd)).and.(ii.le.ipt(69)))then
         ii = ii +  1
         icp(iend+iend2+iadd) = (i-l)*ipt(l)
         iadd = iadd + 1
       end if
 600   continue
    end if
    if(ipt(81).gt.O) then
     ii = 0
     do60ii=l,ipt(3)
        if((icp(i).eq.icp(iend+2*iend2+iadd2))
    +       .and.(ii.le.ipt(81)))thert
         ii = ii + 1
         icp(iend+2*iend2+iadd2+ 1 )
    +         = (i- 1 )*ipt(l )+icp(iend+2*iend2+iadd2+ 1 )
         iadd2 = iadd2 + 2
        end if
 601    continue
    end if
    if(ipt(70).gt.O) then
      ii = 0
      do 605 i = l+ipt(3),ipt(3)+ipt(4)
        if((icp(i).eq.icp(iend+iadd)).and.
    +      (ii-ipt(3).le.ipt(70))) then
         ii = ii -t- 1
         icp(iend+iend2+iadd) = (i-l)*ipt(l)
         iadd = iadd + 1
        end if
 605    continue
    end if
    if(ipt(82).gt.O) then
      ii = 0
      do 606 i =  l+ipt(3),ipt(3)+ipt(4)
        if((icp(i).eq.icp(iend+2*iend2+iadd2))
    +      .and.(ii-ipt(3).le.ipt(82))) then
         ii = ii + 1
         icpfiend+2*iend2+iadd2+l )
    +        = (i-l)*ipt(l)+icp(iend+2*iend2+iadd2+l)
         iadd2 = iadd2 + 2
        end if
  606   continue
    end if
    if(ipt(71).gt.0)then
       ii = 0
       do 610 i =  l+ipt(3)+ipt(4),ipt(3)+ipt(4)+ipt(5)
        if((icp(i).eq.icp(iend+iadd)).and.
    +       (ii-ipt(3)-ipt(4).le.ipt(7 1 ))) then
          icp(iend+iend2+iadd) = (i-
          iadd = iadd + 1
        end if
  610  continue
     end if
     if(ipt(72).gt.O) then
       ii = 0
       do 615 i =  l+ipt(3)+ipt(4)+ipt(5),ipt(3)+ipt(4)+ipt(5)+ipt(6)
        if((icp(i).eq.icp(iend+iadd)).and.
     +      (ii-ipt(3)-ipt(4)-ipt(5).le.ipt(72))) then
          ii = ii + l
          icp(iend+iend2+iadd) = (i-l)*ipt(l)
          iadd = iadd + 1
        end if
  615  continue

                                                                             186

-------
    end if
    if(ipt(73).gt.O) then
     ii=0
     do 620 i = l+ipt(3)+ipt(4)+ipt(5)+ipt(6),
   +     ipt(3)+ipt(4)+ipt(5)+ipt(6)+ipt(7)
       if((icp(i).eq.icp(iend+iadd)).and.
   +      (ii-ipt(3)-ipt(4)-ipt(5)-ipt(6).le.ipt(73))) then
         ii = ii -I-1
         icp(iend+iend2+iadd) = (i-l)*ipt(l)
         iadd = iadd + 1
       end if
 620   continue
    end if
c
c— Error check: contour file must be opened if any Icon is true.
    do 625 i= 1,17
 625   if (lcon(i).and..not.lctrl(23)) call ErrMessage (106,0,ipt(29))
c
c— Error check: time series file must be opened if any Iplt is true.
    do 630 i = 1,2
 630   if (lplt(i).and..not.lctrl(15)) call ErrMessage (123,0,ipt(29))
    return
c
c— formats
 500 format (76('*')/76('*')/
   +'              MISER7

   +'   Michigan Soil vapor Extraction Remediation model'

   +• '     Project directed by: L.M. Abriola'

   + '     Written by: J.R. Lang and K.M. Rathfelder'

   +'     Beta Version 1.0; May 1,1996'

   + 76('*')/76('*'))
 501 format ('INPUT AND OUTPUT FILES ',53('=')/
   + '  Main input file; control and field data: (unit Il) = ',a20/
   + '  Input file #2; ICs and BCs:        (unit 13) =',a20/
   +'  Error and warning message input data:   (unit 14) = ',a20/
   + '  Main output file:              (unit 21) =',a20/
   + '  Error messages:               (unit 22) = ',a20/
   + '  Performance Output:            (unit 23) = ',a20/
   + ' Contour plot data:             (unit 24) = ',a20/
   + ' Material balance information:        (unit 25) = ',a20/
   + ' Time series plot data:           (unit 26) = ',a20/
   + ' Restart data:                (unit27) = ',a20)
 502 format (/'GENERAL MODEL CONTROL OPTIONS ',46('=')/
   +' Domain configuration (0=xz,l=rz):     ipt(27)  = ',i5/
   -t-' Gravitational constant (m/s"2)-horizontal:t(21)   =',e!2.4/
   +•' Gravitational constant (m/s"2)-vertical: t(22)  = ',e!2.4/
   + ' Solve transient phase balance:       lctrl(l) =',15/
   + ' Skip ipt(85) time steps for phase blnce: ipt(85)  = ',i5/
   +' Solve transient component balance:     lctrl(2) = ',15/
   +' Solve NAPL equations:           lctrl(24) = ',15/
   + ' Solve solid phase equations:        lctrl(25) = ',15/
   + ' Solve biophase equations:         lctrl(3) = ',15/
   + ' Lump the phase balance mass matrix:    lctrl(7) = ',I5/
   + ' Lump the component balance mass matrix:   lctrl(8)  = ',I5/
   + ' Include phase mass exchange in flow eqs: lctrl(14) =',15/
   -1-' Calculate element dimensionless numbers:  lctrl(4)  =',I5)
 503 format ( /'TIME STEP/ITERATION CONTROL OPTIONS ',40('=')/
   + ' Initial simulation time (sec):      t(l)   =',e!2.4/
   + ' Final simulation time (sec):        t(2)    =',e!2.4/
   + ' Time weighting factor:           t(10)   =',e!2.4/
   + ' Maximum number of time steps:       ipt(30)  =',112 /
   + ' Convergence tolerance for pressure:    t(13)  =',e!2.4/
   H-' Convergence tolerance for concentration: t(14)  =',e!2.4/
   + ' Convergence tolerance for NAPL saturation:t(l5)  =',e!2.4/
   +•' Convergence tolerance for immobile phases:t(16)  = ',e!2.4/
   •)•' Initial time step:             t(3)   =',e!2.4/
   + ' Minimum time step:             t(4)   =',e!2.4/
   + ' Maximum time step:             t(5)  =',e!2.4/
   + ' Maximum phase balance iterations:     ipt(31)  =',i5 /
   + ' Maximum component balance iterations:   ipt(32)  =',i5  /
   + ' Maximum NAPL saturation iterations:   ipt(33) =',i5  /
   + ' Minimum phase balance iterations:     ipt(34)  =',i5  /
   + ' Minimum component balance iterations:    ipt(35)  =',i5 /  -
       + '  Time step multiplier for amplification:  t(6)   =',e!2.47
       + '  Time step multiplier for reduction:    t(7)   =',e!2.4)
     504 format(/'GRID INFORMATION ',59('=')7
       + '  Generate grid:                igrid   =',i5  /
       + '    0 = don"t generate the grid; 7
       + '    1 = generate a union jack grid;'/
       +'    2 = generate a herring bone grid.'/
       + '  Maximum dimension for number of elements: nelmx   =',i5  /
       + '  Actual number of elements:         ipt(0)   =',i5  /
       + '  Maximum dimension for number of nodes:   nnmx    =',i5  /
       + '  Actual number of nodes:          ipt(l)   =',i5  /
       + '  Maximum dimension for the number of'/
       +'    material property blocks:       nmblk   = ',i5  /
       + '  Number of material property blocks:     ipt(26)  =',i5 /
       H-'  Maximum dimension for the number of 7
       + '    nodal variables in stacked storg:  nnstk   = ',i5  /
       + '  Actual number of stacked nodal variables: ipt(2)  =',i5 /
       + '  Full bandwidth of transport matrix:    nbw(l)   =',i5  /
       + '  Full bandwidth of flow matrix:       nbw(2)  =',i5  )
     505 format(
       + '  Nodal Coordinates  in the cross-sectional (xz) domain:'/
       +'    Node Number    X-Location     Z-Location'     )
     506 format(
       + '  Nodal Coordinates  in the radial-vertical (rz) domain:'/
       + '    Node Number    R-Location     Z-Location'    )
     507 format(6x,i5,9x,el4.5,6x,el4.5)
     508 format(
       •f'  Element Information:'/
       + '  Element Number  Nodal Incidence List ',
       +'Material Block  Area(m"2)')
     509 format(6x,i5,12x,3i5,8x,i5,6x,el4.4)
     510 format(/'COMPONENT CHEMICAL PROPERTY DATA ',43('=')/
       + '  Number of organic  components:       ipt(15) =',i5  )
     511 format(
       +'  Component chemical property data for:        ',a/
       +'    Component number:                = ',i5/
       + '    Molecular weight (g/mole):            =',e!2.4/
       + '    Vapor pressure (arm):               =',e!2.4/
       + '    Vapor viscosity (cPoise):            =',e!2.4/
       +'    Liquid density (g/1):               = ',e!2.4/
       +'    Gas diffusivity (cm"2/s):            = ',e!2.4/
       +'    Aqueous diffusivity (cm"2/s):          = ',e!2.4/
       + '    Henry's Law constant (atml/g):         =',e!2.4/
       +'    Aqueous solubility (g/1):            = ',e!2.4)
     512 format(/'MASS EXCHANGE COEFFICIENTS ',49('=')/2x,
       + ' Component Aqueous/gas Aqueous/NAPL Gas/NAPL'
       + ,'  Bio/Aqueous Solid/Aqueous')
     513 format(2x,alO,5e!2.4)
     582 format(/'MINIMUM DEVIATION FROM EQUILIBRIUM ',41('=')/2x,
       +' Component Aqueous/gas Aqueous/NAPL Gas/NAPL'
       + ,'  Bio/Aqueous Solid/Aqueous')
     514 format(/'MATERIAL BLOCK PROPERTY DATA ',47('='))
     515 format(
       + '  Material Block Number:                ',i5/
       +'    Porosity:                     = ',e!2.4/
       +'    Horizontal permeability  (m"2):         = ',e!2.4/
       +•'    Vertical permeability (m"2):           = ',e!2.4/
       + '    Bulk soil density (gm/cm"3):          = ',e!2.4/
       +'    Organic carbon content:              = ',e!2.4/
       + '    Residual water saturation:            =',e!2.4/
       + '    van Genuchten n for air/water retention data: =',e!2.4/
       + '    van Genuchten alpha value (I/Pa):        =',e!2.4/
       +'    longitudinal dispersivity (m):         = ',e!2.4/
       + *    transverse dispersivity (m):           =',e!2.4)
      580    format(/'HYDRODYNAMIC  DISPERSION TENSOR  INFORMA-
    TION ',33('=')/
       + ' Compute hydrodynamic dispersion tensor:  lctrl(21) =',15)
     581  format(
       +' Input values of hydrodynamic dispersion:'/
       + ' component   phase',7x,'dir,9x,'dl2',9x,'d21',9x,'d22')
     585 format(al2,all,4el2.4)
     589 format(/'SORPTION PARAMETERS ',56('='))
     516 format(
       +' Isotherm parameters')
     517 format(
       + '  Material Block Number              ',15)
     518 format(
       + '    Kf (micrograms/gram-solid) for: ',aIO,'  =',e!2.4/
187

-------
  + '   m parameter (unitlcss) for: ',alO,'     =',e!2.4)
519  format(
  + * Two Compartment Model is in use'/
  + '   §Iow to fast compartment Kf multiplier:     =',e!2.4/
  •»•*   Slow to fast compartment m multiplier:     = ',el2.4/
  •»•'   Fast compartment fraction of solid phase:   = ',e!2.4/
  + *   Slow to fast compartment exchange multiplier: = ',e!2.4)
588  format{                  .  ,  •,.
  +' Retardation is considered for the following components')
590  formatC
  +' Socption is not considered for this simulation')
574  format(
  +  '   Retardation factor for:',a!0 ,'        =',e!2.4)
520  formalC/'BIOLOGlCAL PARAMETERS ',54('=')/
  +  ' Number of degradable organic components: ipt(17)  =',i5/
  +  ' Steady state biomass is assumed:     Ictrl(17) =',157
  +  * Biophasc mass transfer is at equilibrium: lctrl(16) = ',I5/
  +  ' Degradation kinetics:           ipt(39)  =',i5/
  +'   1 = standard Monod kinetics'/
  +  '   2 = Monod kinetics with substrate inhibition'/
  •*•'   3 * Monod kinetics with lumped substrate inhibition'/
  +  •   4s Monod kinetics with saturation dependency'/
  +•'   5s monod kinetics with saturation dependency and'/
  +'      substrate inhibition'/
  + ' Initial uniform biomass (g/1):      xinit   =',e!2.4/
  •f' Minimum biomass (g/1):            xbmin   =',e!2.4/
  + ' Maximum biomass (g/1):           xbmax   =',e!2.4/
  + ' Decay coefficient (I/sec):        kd    =',e!2.4/
  + ' Delay period for bioreaction (sec):    1(11)   =',e!2.4)
 521  formaK
  •(•' Component biological parameter data for:      ',ai
  + '   Oxygen Use coefficient (gmO2/gm substrate):    =',e!2.4/
  + '   Nutrient Use coefficient (gm n/gm substrate):   =',el2.4/
  + '   Maximum substrate use rate (gm/(gm cell sec)):   =',e!2.4/
  +'   Half saturation constant (gm substrate/1):     = ',e!2.4/
  •t-'   Yield coefficient (gm cell/gm substrate):     =',e!2.4/
   •t-*   Inhibition multiplier:               =',e!2.4)
 522 focmatf/PHASE PARAMETERS AND COMPOSITION ',43('=')/
   + ' Water phase viscosity (cPoise):      wvis    =',e!2.4/
   + ' Include Klinkenberg effect:         lctrl(20) =',15/
   +' Klinkenberg parameter (compute if b=<0)): b    = ',e!2.4)
 523 format(2x,a,' Phase has ',12,' components listed below:')
 524 rormat(6x,7»10) „  , ,
 525 formaK/'TEMPERATURE DISTRIBUTION ',51('=')/
   +•' Constant temperature distribution:     lctrl(lO) =',15)
 526 formatC
   + '  Uniform temperature (degreeC):      ctemp   =',e!2.4)
 527 format(
   +' Temperature distribution (node number; temperature)')
 528 format(4(i5,':',ell.5,lx))          	
 570 formatC/' Temperature dependent parameters for: ',alO/
   +'   dcpth',7x,'cvp',10x,'cvvis',8x,'chen',9x,'casor,8x,'umax')
 571 format(6(cl2.5,lx))
 572 fonnat(/
   +'  Temperature dependent decay coefficient (depth; kd)')
 573 farmat(3(cl2.5,':',eI2,5,lx))
 529 format (/'PRINTING INTERVAL VARIABLES ',48('=')/
   4- "The print interval h set by time steps:  ipt(25)  =',i5)
 530 formal (/-PRINTING INTERVAL VARIABLES ',48('=')/
   + 'Tlie print interval is set by time units:  t(12)   =',e!2.4)
 531 format ('PRINTING CONTROL VARIABLES ',49('=')/
   +' Generate output for the selected items'            /
   +•'  Output in molar form:           lprnt(8) =',15  /
   + '  Gas phase pressure:           lprnt(9) =',15 /
   +'  Aqueous phase pressure:         Iprnt(lO) = ',15 /
   + '  Gas/aqueous capillary pressure:     lprnt(l 1) =',15 /
   + '  Gas phase density:            lprnt(12) = ',15 /
   + '  Aqueous phase density:          lprnt(13) =',15 /
   + '  NAPL density:              lprnt(14) =',15 )
 532 format (
   + '  Gas phase components:           lprnt(15) = ',I5  )
533 formaU
  ,+ '   Aq'ueoiis phase components:         Iprnt(16) =',15  )
534 format {.,-..
  -(•',  NAPL components':             lphit(17) =',15 )
535 format (   .  ..     ..             	   ,.
    ',  Solid phase loadings:           lprnt(18) =',15  )
536 forrnaU .  _.    . t:   .,,,.,            _,._   r
  + '   Bio-phase components:           lpjcnt(19)' = ',15,/
  + '.  Total organic soif concentration     lprnt(29") =',15 )
537 format (             ,             ..      „   ,
  + '   Gas phase saturation:    ,       IprnfpO) =',15  /,
  + '   Aqueous phase saturation:      „  lprnt(2l) = ',15 /
  +•'   ti&PL saturation:              lprnt(22)'=',15 /
  +'   Gas phase D'aircy velocity:        Iprnt(23) = ',15 /
  + '   Aqueous phase Darcy velocity:      lprnt(24) =',15 )
538 format (' Generate contour files for the selected items'    /
  + '   Contour in molar form:          lcon(l)  =',15/
  + '   Gas phase pressure:            lcon(2) =',15/
  + '   Aqueous phase pressure:         Icori(3),  =', 15/
  +'  0as/acjueous capillary pressure:     jcpri(4) =', 15 /
  -i-'  tSs phase density:,            lcon(5 j. =', 15 /
  + '  ^quebus^hase clerisiiy:       ,  lcon(6)  =', 15 /
  + '  NAPL density:               lcbn(7) =',15)
539  format (.  ,,,,,..,
  + '  . Gas phase compbiierits:          lcori(8)  =',15)
540  format (
  + '  Aqueous phase components:        lcon(9)  =',15)
541  format (
  + '  NAPL components:              lcon(10)  =',15)
542 format (
  +'  Solid phase loadings:          lcon( 11) =', 15)
543  format (
  + '  Bio-phase components:          lcon(12) =', 15 /
  + '  Total organic soil concentration    lcon(18)  =',15 )
544 format (
   + '  Gas phase saturation:          lcon(13) =',15/
   + '  Aqueous phase saturation:         lcon(14) =', 15 /
   + '  NAPL saturation: .            lcon(15) =', 15 /
   + '  Gas phase Darcy velocity:         lcon(lfi) =', 15 /
   + '  Aqueous phase Darcy velocity:       Icon(17) =',15)
 545 format (5x,7alty          ...,..,,,, i.	
 546 forrnat(' tieiierate time series files  for the s.elected items '  /
   + ', ..Gas phase components:           lplt(l) = MS )
 547 fbnria't(
   + '    ',alO,'at node number',! 10                )
 548 formatC
   +'   Aqueous phase components:         lplt(2)  = ', 15)
 549 formate
   + 'Mass balance print interval in time steps: ipt(83)  =',i5)
 550 format (
   +'  Mass balance print interval is time units: t(27)   = ',e!2.4)
 551 formate
   -1-'  time series print interval in time  steps: ipte84) =',i5)
 552 formate                             .  .
   + '  Time series print interval in time  units: te28)   = ',e!2.4)
 553 format (
   + ' Material balance output in report form')
 554  format(
   + ' Material balance output in time series form')
 555 format e/'OUTPUT FILES FOR COMPONENT MASS BALANCE',37('='»
 556  formate
   + ' ',alO,'                  (unit',i2,') = ',a20)
  557  format(
   + ' Time series output in mole fractions')
  558 format(
   +' Time series output in concentrations')
  559 formate
   + ' Boundary nodes of the generated grid:')
  560 format(5x,a/50eiOx,10i6/))
    end
                                                                        188

-------
Subroutine - input2.f
c-
c
c
c
c
c
c
c-
 INPUT2.f - Subroutine which reads the initial and boundary
        conditions from device 13 and writes to device 21.
        This routine is written so that data2 can serve as
        a restart file generated by an option in datal.
C
C-
c

c
c-
c
 subroutine INPUT2
 include 'dimenjnc'
 character*20innle(4),outpre,outfile(8-l-ncmp)
 character* 10 cname(ncmp)                                         :
 common /cbl/ matel(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),      .;
+       matpt(nn6)
 common /cblc/ xnode(nnmx),znode(nnmx),rbar(nelmx),area(nelmx)
 common /cb2/ p(nn3)
 common /cb2c/ q(ne!4)
 common /cb2d/ pmwO(nnmx),denO(nnmx)
 common /cb3/ sat(nnstk3)
 common /cbSa/ bphi(nmblk),bpermh(nmblk),bpermv(nmblk)
 common /cbSb/ bvgn(nmblk),bvga(nmblk),bvgm(nmblk),bsrw(nmblk)
 common /cb6b/ por(nelmx),srw(nnstk)
 common /cb6c/ temp(nnmx)
 common /cb6d/ dtemp(nzmax6),idepth(nnmx)
 common /cb7b/ cmw(ncmp),cvp(ncmp),cden(ncmp),
+        chen(ncmp),casol(ncmp),cmdif(ncmp2)
 common /cbS/ vis(nnmx),pmw(nn3)
 common /cb9/ xmf(nmf)
 common /cblO/ den(nn6)
 common/cbl I/pex(nnslO),rxnp(nn2)
 common /cb30/ ibc(nnmx)
 common/cb31/source(nn2)
 common /cb64/ bok(nbcmp),bom(nbcmp),krtd(ncmp)
 common /cb84/ ibcxmf(nmbc),bcxmf(nmbc),dfxmf(nmbc)
 Common/cb86/strl(ncmpp5),str0(ncmpp5),cmf(ncmpp5),csink(ncmpp5)
+   ,cwsink(ncmpp5),csflux(ncmpp5),cmass 1 (ncmp5),cmassO(ncmp5)
+   ,cphex(ncmpp5),crsink(ncmpp5),tmass 1 .tmassO
 common /cb90/ infile,outpre,outfile
 common /cb91/ cname

  Dimension local arrays.

 dimension omfel(ncmp),soel(nelmx),iel(nelmx)

  Zero vectors and define local pointers.
   if(ipt(29).ne.O) write (ipt(29),*)
   +          'Reading from Input File',infile(2)
   lcsat=.false.
   lprnt(3)=.true.
   do 80 i= l,(ipt(3Hipt(4Hipt(5>Mpt(6)+ipt(7))*ipt(l)
 80   xmf(i)=zerO
   do 81 i= l,(ipt(3)+ipt(4))*ipt(l)
     ibcxmf(i)=0
     dfxmf(i)=zerO
 81   bcxmf(i)=zerO
   do85i = l,3*ipt(2)
     sat(i) = zerO
 85 continue
   ipt02=2*ipt(0)
   ipt03=3*ipt(0)
   ipt!2=2*ipt(l)
   ipt!3=3*ipt(l)
   ipt22=2*ipt(2)
          == RESTART INFORMATION ===
   if(ipt(29).ne.O) write (ipt(29),*)
   +           'Reading Restart Information'
c
c— Read two logical variables. Lctrl(26) indicates if this run
C— is a restart and lctrl(32) indicates whether the run is a
C— continuation of the previous run (lctrl(32)=t) or
C— is a new run using the previous run as initial conditions
C— (setting lctrl(32)=f resets the cumulative mass balance).
C
   lctrl(32) = .false.
   call commnt(13,21)
   read(13,*) lctrl(26), lctrl(32)
   if(lctr!(26))then
     callcommnt(13,21)
     read(13,*) infile(4)
     open(28,nle=infile(4),status='unknown')
   else
     infile(4) = 'none opened'
   endif
   write(21,550)lctri(26),innle(4),lctrl(32)
                                                                                      = INITIAL PRESSURE INFORMATION ===
   if(ipt(29).ne.O)  write (ipt(29),*)
   +          'Reading Initial Pressure Information'
c
c— Read an integer control variable (ipt(75)) indicating how the
c—• initial pressure distribution is to be input:
c     1 = Compute initial pressure distribution assuming Pg = 1 arm
c       and Pa is hydrostatic referenced to atmospheric pressure
c       at the water table. The water table is assumed to be flat;
c     2 = Input gas and aqueous pressures at all nodes;
c     3 = Assume gas and aqueous pressures are atmospheric and input
c       the Darcy velocity and saturations for both the aqueous
c       and gas phases. This option can only be used if the
c       phase mass balance equations are not solved.
c    Note: ipt(75)=3 is not a general option but is retained for
c       for column simulations.
c— Error Check: ipt(75)=(l-3);
c— Write header information.
   write (21,499)
   call commnt(13,21)
   read(13,*)ipt(75)
   if (ipt(75).lt.l  .or. ipt(75).gt.3) call ErrMessage (48,0,ipt(29))
   write (21,500) ipt(75)
c
o— If ipt(75) = 1, then read the depth to the water table (m).
c— Compute the initial pressure distribution.
c— All pressures are gauge pressures in Pascals.
c— Write to output  file.
   If(ipt(75).eq. l)Then
     if (ipt(29).ne.O) write (ipt(29),*)
   +            'Computing Initial Pressure Distribution'
     callcommnt(13,21)
     read(13,*)wtdpth
c
c— Estimate a gas phase density. Do not consider NAPL effects.
     Do86i = l,ipt(l)
      gmw = zerO
      vpn = rone
      do 87 ic = ipt(15)+l, ipt(15)+2
        if(cvp(ic).gt.zerO) then
         if(lctrl(10)) then
           cvpt =  cvp(ic)
         else
           cvpt =  cvp(ic) + dtemp((ic-l)*ipt(89)+idepth(i))
         endif
         gmw = gmw + cvpt*cmw(ic)/patm
         vpn = vpn - cvpt/patm
        end if
 87    continue
      gmw = gmw + vpn * cmw(ipt(15)+3)
      gmden = gmw * patm / r
      gden = gmden / temp(i)
C
C—• Use Hubbert's Potential to set initial gas phase pressure.
C
      pwtble = patm * (dexp(wtdpth*gden*t(22)/patm>rone)
      if(znode(i).ge.wtdpth) then
        p(ipt(l>i-i) = pwtble
   +       + cden(ipt(15)+l) * t(22) * (znode(i)-wtdpth)
                                                                      189

-------
86
       else if(znodc(i),lt.wtdplh) then
        p(i) = patm * (dexp(znode(i)*gden*t(22)/patm)-rone)
        p(ipt(l)+i) = cdcn(tpt(15>tl) * t(22) * (znode(i)-wtdpth)
            •j-pwlble
       end if
      continue
     write (21,501) wtdpth
   Endif
c— Otherwise if ipt{75) = 2, then read in initial water and gas phase
c— at all nodes,
c — One node per line, followed by water and air pressure.
c — Output all user input pressures (Pa gauge).
   If(ipt(75),cq,2)Then
     callcommnt(13,21)
     Read (13,*) nd
     Backspace 13
     If (nd .11.0) Then
       Read (1 3,*) nd, paq,pgas
       EndDo
     Else
       Doi«Upt(l)
         Read (13,*)nd,pOpt(l)+nd),p(nd)
       EndDo
     Endlf
     write (21, 502)
     write (21,503) (nd,p(ipt(lHnd),p(nd),nd=l,ipt(l))
    Endlf
c
c — Foript(75)=3, set pressures to atmospheric conditions
    lf{ipt(75),cq.3)Then
       p(i) s zcrO
      EndDo
    Endlf
c
c— Compute initial capillary pressures.
    EndDo
 c
 CKBMMOO.S INITIAL VELOCITY INFORMATION =	
 C
    if (ipt(29).nc.O) write (ipt(29),*)
    +          'Reading Darcy Velocity Computation Information'
 c
 c— Element or nodal Darcy velocities. Read a logical variable
 c— Indicating if velocities are discretized on an elemental or nodal
 c— basis,
    call commnt (13,21)
    rcad(13,*)lctrl(18)
    Write (21,504) ktrl(18)
 c
 c— Darcy velocity compulation approach:
 c— If kttl( 1) is true then Darey velocities are determined from
 c— transient pressure distributions. Write message.
    lf(lcltl(l))Then
      write (21,505)
    Endlf
 e— If lclrl(l) is false then the Darcy velocity distribution is
 c—constant. Read a logical variable indicating if steady state Darcy
 c—velocities are computed from the pressure field.
     Icssv = .false.
     lf(,not.lcirl(I))Then
      call commnt (13,21)
      read(13,*)Icssv
     Endlf
 e
 c— Compute the SS Darcy velocities from input pressures when
 c— letil(l )=F and kssv - true
     If («not,lctrl(l) .and. Icssv) Then
       write (21,506)
     call VEL
   Endif

_ - Read in SS Darcy velocities when lctrl(l)=F and lcssv=false.
c— First determine if Darcy velocity components are uniform.  If yes,
c— then read only the 4 components, otherwise read the 4 components
   • for all nodes or elements depending on the selected computation
   - method.
   lev =.false.
   If (.not.lctrl(l) .and. .not.lcssv) Then
     write (21,507)
     call .commnt (13,21)
     read (13,*) lev
     call commnt (13,21)
     If (lev) Then
       read (13,*) qgx,qgz,qax,qaz
       IfOctrl(18))Then
        Doi = i,ipt('l)
          q(i) = qgx
                                                                                      q(i*-iptl2) = qax
                                                                                      q(i+ipt!3) = qaz
                                                                                    EndDo
                                                                                   •Else
                                                                                    Doi-l,ipt(0)
                                                                                      q(i) = .qgx
                                                                                      q(i+ipt(0)) = qgz
                                                                                      q(i+ipt02) = qax
                                                                                      q(i+ipt03) = qaz
                                                                                    EndDo
                                                                                   Endif
                                                                                 Else
                                                                                   If(lctrl(18))Then
                                                                                    Doi = l,ipt(l)
                                                                                      read (13,*) i,q(i),q(i+ipt(l)),q(i-Hptl2),q(i+iptl3)
                                                                                    EndDo
                                                                                   Else
                                                                                    Doi = l,ipt(0)
                                                                                      read (13,*) i,q(i),q(i+ipt(0)),q(i+ipt02),q(i+ipt03)
                                                                                    EndDo
                                                                                   Endif
                                                                                 Endif
                                                                                Endlf
                                                                             c
                                                                             c — Write the steady state velocity components (m/sec).
                                                                                If(.not.lctrl(l))Then
                                                                                 If (lev) Then
                                                                                   write'(21,508) qgx,qgz,qax,qaz
                                                                                 Else
                                                                                   If(lctrl(18))Then
                                                                                     write<2.1,S09)
                                                                                     write (21,51 l).(i,qffl,q(i+ipt(l)),q(WptJ2),
                                                                                    Else
                                                                                     write (21,510)
                                                                                     write«(21,51 1) (i,q(i),q(Mpt(0)),q(i4:ipt02),
                                                                                +              q(i+ipt03),i=l,ipt(0))
                                                                                    Endif
                                                                                  Endlf
                                                                                Endif
                                                                             c
                                                                             c — Read mobile phase saturations if ipt(75)=3.
                                                                             c — Note: This is not a general option but is retained for column
                                                                             c — simulations. Saturations are never stacked for this case.
                                                                             c — Icsat indicates uniform mobile phase saturations (true).
                                                                                If (.not.Ictrl(l) .and. ipt(75).eq.3) Then
                                                                                  call commnt (13,21)
                                                                                  read(13,*) Icsat
                                                                                  call commnt (13,21)
                                                                                  If (Icsat) Then
                                                                                    read(13,*) sat(l),sat(l+ipt(l))
                                                                                    Doi = 2,ipt(l)
                                                                                     sat(i) = sat(l)
                                                                                     sat(i+ipt(l)) = sat(l+ipt(l))
                                                                                    EndDo
                                                                                  Else
                                                                                    Doi = l,ipt(l)
                                                                                     read(1 3,*) ii,s
                                                                          190

-------
        EndDo
      Endlf
    Endlf
 c
 c======= NAPL SATURATION AND COMPOSITION =====
 c
    if (ipt(29).ne.O) write (ipt(29),*)
    +   'Reading Initial NAPL Saturation and Composition Data'
 c
 c — Read the number of elements containing NAPL.
 c — A number less than zero indicates that a NAPL saturation is
 c — uniform and contained in all elements
 c — Error check: inoel<=ipt(0)
 c — Print header
    call commnt (13,21)
    read (13,*) inoel
    If (inoel .gt. ipt(0)) call ErrMessage (49,0,ipt(29))'
    write (21, 5 12)
 c
 c — If no NAPL present, print message.
    If (inoel .eq.O) write (21,513)
 c
 c — Error check: lctrl(24) must be true for inoel nonzero and vice
 c —        versa.
    if(.not.lctrl(24) .and .inoel.ne.0) call En-Message (82,0,ipt(29))
    if(lctrl(24) .and. inoel.eq.O) call ErrMessage (105,0,ipt(29))
 c
 c — If inoel<0 then read and distribute uniform NAPL sat and mole
 c — fractions at all nodes.
    If (inoel. It. 0) Then
      call commnt (13,21)
      read (13,*) soel(l),(omfel(j),j=l,ipt(15))
      If (soel(l).lt.zerO  .or. soel(l).gt.rone)
   +    call ErrMessage (51,0,ipt(29))
      sum = zerO
      Doii = l,ipt(15)
       sum = sum + omfel(ii)
      EndDo
      If (sum .ne. rone) call ErrMessage (52,0,ipt(29))
      write (21,514)
      write (21,515) soel(l),(omfel(j)j=l,ipt(15))
      Do 146 i = l,ipt(l)
       sat(ipt(2)*2+i) = soel(l)
       Dol46ii =
 146
         xmf(ipt(10)+iiml+i) = omfel(ii)
         continue
    Endlf
c
c — If the number of elements with NAPL is greater than zero,
c — then for each element provide the following information:
c —  ( 1 ) element number
c —  (2) NAPL saturation
c —  (3) mole fraction of each organic component.  There must be
c —    ipt(15) mole fractions specified for each element, and they
c — •    must sum to 1.
c — Error Checks: element number=(l,ipt(0)); So=(0-l); sum xi = 1.
c — Distribute the element saturation to each node in the element.
    If (inoel .gt.O) Then
     call commnt (13,21)
     write (21,516) inoel
     write (21,529) (cname(icp(i+ipt(3)+ipt(4))),i=l,ipt(5))
     Do 130 i = 1, inoel
      read (13,*) iel(i)
      If (iel(i).lt.l .or. iel(i).gt.ipt(0))
   +     call ErrMessage (50,0,ipt(29))
      backspace 13
      read (13,*) iel(i),soel(i),(omfel(j)j=l,ipt(15))
      If (soel(i).It.zerO .or. soel(i).gt.rone)
   +     call ErrMessage (5 1 ,0,ipt(29))
      sum = zerO
      Doii = l,ipt(15)
        sum = sum + omfel(ii)
      EndDo
      If (sum .ne. rone) call ErrMessage (52,0,ipt(29))
      write (21,517) iel(i),soel(i),(omfel(j)j=l,ipt(15))
      i3=iel(i)*3
      ilocl = ipt22 + nodept(nodel(i3-2)) + nelpt(i3-2)
        iloc2 = ipt22 + nodept(nodel(i3-l)) + nelpt(i3-l)
        iloc3 = ipt22 + nodept(nodel(i3))  + nelpt(i3)
        sat(ilocl) = lO.OdO + sat(ilocl) + soel(i)
        sat(iloc2) = 1 (XOdO + sat(iloc2) + soel(i)
        sat(iloc3) = lO.OdO + sat(iloc3) + soel(i)
        Do ii=l,ipt(15)
         ilocl = ipt(IO) + iiml + nodel(i3-2)
         iloc2 = ipt(IO) + iiml + nodel(i3-l)
         iloc3 = ipt(10) + iiml + nodel(i3)
         xmf(ilocl) = lO.OdO + xmf(ilocl) + omfel(ii)
         xmf(iloc2) = lO.OdO + xmf(iloc2) + omfel(ii)
         xmf(iloc3) = lO.OdO + xmf(iloc3) + omfel(ii)
        EndDo
  130   Continue
 C
 C— Now adjust for the multiple entries in sat and xmf for nodes where
 C— adjacent elements have nonzero organic saturations. Average
 C— organic saturations over a given material
 C— property block and mole fractions over the entire domain.
      Doi = l,ipt(2)
        ff(sat(2*ipt(2)+i).ge.lO.OdO)then
         sat(2*ipt(2)+i) = sat(2*ipt(2)+i)/10.0dO
         xx=dint(sat(2*ipt(2)+i))
         sat(2*ipt(2)+i) = 10.0dO*(sat(2*ipt(2)+i)-xx)/xx
        Endlf
      EndDo
      dol45i=l,ipt(l)
        do!45ii=l,ipt(15)

         if(xmf(ipt(10)-l-iiml-M).ge.lO.OdO)then
           xmf(ipt(10)+iiml+i)=xmf(ipt(10)+iiml+i)/10.0dO
           xx=dint(xmf(ipt(l 0)+iiml +i))
           xmf(ipt(10)+iiml+i)
   +         =10.0dO*(xmf(ipt(10)+iiml+i)-xx)/xx
         end if
 145  continue
    Endlf
 c
 c— Initialize porosity and residual saturation vectors.
    do!70i = l,ipt(2)
 170  srw(i) = bsrw(matpt(i))
    do 171 i = l,ipt(0)
 171   por(i) = bphi(matel(i))
 c
 c— Compute initial gas and aqueous phase saturations
    If(ipt(75).ne.3)Then
      call SATW
    Endif
    If(ipt(75).eq.3)Then
      do!47i=l,ipt(2)
       if(ipt(3).gt.O) then
         if(sat(i).gt.sat(i+2*ipt(2)))then
          sat© = sat(i)-sat(i+2*ipt(2))
         else
          write(21,*) 'Respecify gas phase saturation'
          stop
         end if
       else
         if(sat(i+ipt(2)).gt.sat(i+2*ipt(2)))then
          sat(i+ipt(2)) = sat(i+ipt(2))-sat(i+2*ipt(2))
         else         ',
          write(21,*) 'Respecify aqueous phase saturation'
          stop
         end if
       end if
 147   continue
    Endlf
c
c==  BLOCK  Q:  OXYGEN  AND  NUTRIENT INITIAL  CONDI-
TIONS =====
c
    if(ipt(29).ne.O) write (ipt(29),*)
   +     'Reading Gas, Aqueous, and Biophase Initial Conditions'
c
c— Read a logical variable indicating if the gas phase initial
c— conditions are uniform. Skip this input if oxygen is not
c— present in the gas phase.
                                                                         191

-------
   write (21318)
   call commnr 03,21)
   if(cvp(ipt(]5>l-2),ge.zciO) then-
     call commnt ( 1 3v2I)
     read (13,*) lunfx
c
0 — Read the gas phase initial conditions for oxygen and nutrient.
c— Iniial conditions arc read as partial pressures (i.e. mole
c — fractions). Nutrient can only be present if oxygen is present.
     rf(hinfx)Then
       call commit (I3i21-)
       ifl(cvp{ipt{15)+4),gc,zerO;and.Ictrl(9))then
        read (13,*) xog, xng
        write (21,519) xog
        write (21 ,543) xng
c
c— Error Check: mole frac=(0-l)
         If (xog,It.zerO .or. xog.gt.rone)
   +        callErrMessage(53,0,ipt(29))
         If (xng.ItzerQ .or. xng.gt.rone)
   +        call ErrMessage (73,0,ipt(29)>
       else
         read(13,*)xog
         write (21,519) xog
c
c— Error Check: mole frac=(0-l)
         If (xog.lf.zetO .or. xog.gt.rone)
   •f        call ErrMessage (53,0,ipt(29))
       end if
C
C — Assign gas phase initial conditions to the xmf vector.
       if (cvp(ipt(15)+4) ge,zetO;and.lctrl(9)) then
         ipto = ipt(3)-3
         iplgo2=ipt(8H'pto*ipt( 1 )
         if (cvp(ipt(15)+4) ,ge. zeiO) then
           iptn = ipt(3)-I
           iptgn2=ipt(8)+iptn*ipt(I )
           dolS5i=l,ipt(l)
 15S          xmfti+iptgn2)=xng
         end if
       else
         ipto = ipt(3)-2
         iptgo2=ipt(8)+i|>to*ipt(l )
       end if
       dolS6i=l,ipt(l)
 156       xmf(i+iplgo2)=xog
     else
c
e— Read a vector of nonuniform initial gas phase mole fractions.
       otllcommm(I3,21)
       if (cvp(ipt( I 5H4),gc,zer0.and.lctrl(9)) then
         iptgo - ipt(3)-3
         ip(go2=ipt(8)+ip!EO*'pt( 1 )
         if (cvp(ipt(15)+4) .ge. zerO) then
           iptn = ipt(3)-I
           ip(gn2=ipt(8)+iptn*ipt(l)
           write (21,547)
           dol57ii=l,ipt(l)
            rcad(13,*) i, xmf(i+iptgo2), xmf(i+iptgn2)
 c — Iirror Check: mole frac=(0-l )
             If (xmf(i+iptgo2).l(,zeiO .or. xmf(i+iptgo2)
   •»•           ,gt rone) call ErrMessage (53,0,ipt(29))
             If (xmf(i+iplgn2).ll,zerO .or. xmf(i+iptgn2)
   +           .gt.rone) call ErrMessage (73,0,ipt(29))
  1 57         continue
         else
           write (21 ,520)
           dol5Sii=l,ipt(l)
             read(I3,*) i. xmf(i«ptgo2)
 e
 c— Error Check: mole frac=(0-l)
             If (xmli(i+iptgo2),lt.zerO .or. xmf(i+iptgo2)
   +           .gt.rone) call ErrMessage (53,0,ipt(29))
  1 58        continue
         end if
        else
         iptgo = ipt(3)-2
        iptgo2=ipt(8)+iptgo*ipt(l)
        write (2K520)
        dol59ii=l,ipt(I)
          read(13,*) i, xmf(i-t-iptgo2)
c
c— Error Check: mole frac=(Qi 1)
          If (xrtif(Mptgo2).It.zerO .or. xmf(i+iptgo2).gt.rone)
   +         call EirMessage (53,0,ipt(29));
 159      continue
       ehd'if
     end if-
   end if
c
c— Read a logical variable indicating if the aqueous phase initial
c— conditions are uniform.  Skip this input if oxygen is not present
c— in the aqueous phase.
   call commnt (13,21)
   if (casol(ipt(15)+2).ge.O) then
     call commnt (13,21)
     read (13,*) lunfx
c
c— Read the'aqueous phase initial conditions for oxygen and nutrient.
c—Inital conditions are read* as concentrations (i.e. g/L). Nutrient
c— can' only be present if oxygen is present
     If (lunfx) Then
       call commnt (13,21-)
     ' if(lctri(9)) then
        read(13,*)-xoa, xna
c
c— Convert xna into a mole fraction.
        xna = xna*cmw(ipt(15)+10/(cmw(ipt(15)+4)*cden(ipt(15)+l))
        write (2T.543) xna
c
e— Error Check:  mole frac=(0-l)
        If (xna.lt.zerO .or. xna.gt.rone)
   +        call ErrMessage (74,0,ipt(29))
       else
        read(13,*)xoa
       end if
c
c— Convert xoa into a mole fraction.
       xoa'= xoa*cmw(ipt(15)+l )/(cmw(ipt(15)+2)*cden(ipt(l 5)+I))
       write (21,544) xoa
c
c— Error Check:  mole frac=(0-1)
       If (xoa.lt.zerO .or. xoa.gt.rone)
   +      call ErrMessage (54,0,ipt(29))
C
C-— Assign  aqueous phase initial conditions to the Xmf vector.
       iptao = ipt(14)+l
       iptao2=ipt(9)+iptao*ipt( I.)
       if(lctrl(9))then
         iptan = ipt(4)-l
         iptan2=ipt(9)+iptan*ipt(I)
          do!60i=l,ipt(l)
 160          xmf(i+iptan2)=xna
       end if
       do!61i=l,ipt(I)
C
C— Initialize biophase if present (Ictrl(3)=t). Oxygen is
C— always a component of the biophase. Nutrient is present
C— in the biophase if included (lctrl(9)=t).
C
         if(lctrl(3))
   +       xmf(ipt( 12)+ipt( 17)»ipt( I )+i)=xoa
         if(lctrl(9))
   +       xmf(ipt(I2)+(ipt(17)+l)*ipt(I)+i)=xna
 161      xmf(i+iptao2)=xoa
      else
 c
 c— Read a  vector of nonuniform initial aqueous component
 c— concentrations (gm/l).
       call  commnt (13,21)
       iptao = ipt(14)+l
       iptao2=ipt(9)+iptao*ipt( 1)
       if (casol(ipt(15)+4)  .ge. zerO .and. Ictrl(9)) then
         iptan =  ipt(4)-l
         iptan2=ipt(9)+iptan*ipt(l)
                                                                           192

-------
         write (21,548)
         do!62ii=l,ipt(l)
           read(13,*) i, xoa, xna
 c
 c— Convert xoa into a mole fraction.
           xoa = xoa*cmw(ipt(15)+l)/(cmw(ipt(15)+2)
   +           *cden(ipt(15)+l))
 c
 c— Error Check: mole frac=(0-1)
           If (xoa.lt.zerO .or. xoa.gt.rone)
   +•        .   call ErrMessage (54,0,ipt(29))
 c
 c— Convert xna into a mole fraction.
           xna = xna*cmw(ipt(15)+l)/(cmw(ipt(15)+4)
   +           *cden(ipt(15)+l))
 c
 c— Error Check: mole frac=(0-l)
           If (xna.lt.zerO .or. xna.gt.rone)
   4-           call ErrMessage (74,0,ipt(29))
C — Initialize biophase if present (lctrl(3)=t). Oxygen is
C — always a component of the biophase. Nutrient is present
C — in the biophase if included (lctrl(9)=t).
C
           if(lctrl(3))
   +          xmf(ipt(12)+ipt(17)*ipt(l)+i)=xoa
           if(lctrl(9))
   +          xmf(ipt(12)+(ipt(17)+l)*ipt(l)+i)=xna
           xmf(i+iptao2) = xoa
 162         xmf(i+iptan2) = xna
       else
         write (21,546)
         do 163 ii=l,ipt(l)
           read(13,*) i, xoa
c
c — Convert xoa into a mole fraction.
           xoa = xoa*cmw(ipt(15)+l)/(cmw(ipt(15)+2)
   +          *cden(ipt(15)+l))
c
c — Error Check: mole frac=(0-l)
           If (xoa.It.zerO .or. xoa.gt.rone)
   +          call ErrMessage (54,0,ipt(29))
C
C — Initialize biophase oxygen mole fraction if needed. Oxygen is
C — always a component of the biophase. If nutrient is present
C — (lctrl(9)=t) it must be included in the biophase.
C
           if(Ictrl(3))
   +          xmf(ipt(12)+ipt(17)*ipt(l)+i)=xoa
 163         xmf(i+iptao2) = xoa
       end if
     end if
   end if
C
C — Now assign gas phase nitrogen mole fractions for calculation
C — of initial gas phase density without organic content. This
C — neglects water vapor presence
C
   if (ipt(3).gt.O) then
     if(lctrl(9))then
       in = ipt(3) - 2
     else
       in = ipt(3)-l
     end if
     ix = in * ipt(l)
     do  165  i=l,ipt(l)
       xmf(ipt(8)+ix+i) = rone
       do!65ii=ipt(13),ipt(3)
         if(icp(ii).ne.icp(in+l)) then
           xmf(ipt(8)+ix+i) = xmf(ipt(8)+ix+i)
         end if
 165     continue
    end if
C— Now assign aqueous phase water mole fractions for calculation
 C —  of initial aqueous phase density without organic content
 C
    if(ipt(4).gt.O) then
      ix=ipt(14)*ipt(l)
      do 166 i=l,ipt(l)
        xmf(ipt(9)+ix+i) = rone
        do 166ii=ipt(14),ipt(4)
         if(icp(ipt(3)+ii).ne.icp(ipt(3)+ipt(14)+l))
   +         xmf(ipt(9)+ix+i) = xmf(ipt(9)+ix+i)
 166     continue
    end if
C
C — Calculate the gas phase initial phase molecular weight and the
C — aqueous phase initial density for velocity calculations.
C
    Ikeep = ictrl(22)
    lctrl(22) = .false.
    call MOLEWT
    lctrl(22) = Ikeep
    do!67i = l,ipt(l)
     pmwO(i) = pmw(i)
 1 67   denO(i) = den(4*ipt( 1 )+i)
C
C — Next calculate the equilibrium distribution of the organic
C — • components. This initial distribution occurs only in elements
C — containing NAPL. Organic components are partitioned into the gas,
C — aqueous, solid, and biophases.
    igas =0
    iaq = igas + ipt(3)
    inapl = iaq + ipt(4)
    isol = inapl + ipt(5)
    ibio = isol + ipt(6)
    do!64ii = l,ipt(15)
     inapl = inapl +• 1
     if((ipt(3).gt.0).and.(icp(igas+l).eq.ii))igas=igas+l
     if((ipt(4).gt.0).and.(icp(iaq+l).eq.ii)) iaq=iaq+l
     if((ipt(6).gt.O).and.(icp(isol-H).eq.ii))isol=isol+l
     if((ipt(7).gt.0).and.(icp(ibio+l).eq.ii)) ibio=ibio+l
     ngas = (igas- 1) *  ipt(l)
     naq = (iaq-l) * ipt(l)
     nnapl = (inapl-1)  * ipt(l)
     nsol = (isol-l)*ipt(l)
     nbio = (ibio-l)*ipt(l)
C
C — Compute organic  equilibrium mole fractions when organic phase
C — is present.
     Do!64i=l,ipt(l)
       if(xmf(nnapl+i).gt.zer0) then
C
C — Compute gas phase equilibrium organic mole fractions. Allow
C- — for the possibility that there are fewer organic components
C — in the gas phase than in the organic phase.
         if(ipt(3).gt.O)  then
          if(cvp(icp(igas)).gt.zerO) then
            if(lctrl(10)) then
              cvpt  = cvp(icp(igas))
              casolt = casol(icp(iaq))
            else
              cvpt  = cvp(icp(igas))
   +             + dtemp((icp(igas)- 1 )*ipt(89)+idepth(i))
              casolt = casol(icp(iaq)) + dtemp
   +             ((icp(iaq)-l )*ipt(89)+3*ipt(88)+idepth(i))
            end if
            if(icp(igas).eq.ii) xmf(ngas+i)
   +•           =xmf(nnapl+i)*cvpt/patm
          end if
         end if
C
C — Compute aqueous phase equilibrium organic mole fractions. Adjust
C — .for the possibility that there are fewer organic species in the
C — aqueous phase than in the organic phase
         if(ipt(4).gt.O)  then
          if(icp(iaq).eq.ii)  xmf(naq+i)
   +          =xmf(nnapl+i)*casolt
         end if
C
C — Set initial bio-phase organic component mole fractions equal to
                                                                           193

-------
C— ihc aqueous phase mole fractions if needed.
        if(lclrl(3))lhen
          if(lep    ,asinfc(i),csflux(i),cphex(i),i=I ,iendmb)
     call commnt(28,21)
      kndmb = iptC65)*5
      rcad(28,602)(cmassl(i),cmassO(i),i=l,iendmb)
      call commnl(28,21)
      rcad(28,*) tmassl.tmassO
 c
 c— Read the pressure vectors.
      if(ktrl
-------
 c— Gas phase component boundary conditions.
 c   (I) Read the number of nodes for which gas phase component boundary
 c     conditions are specified.
 c   (2) For each such node, read:
 c     (2a) the node number
 c     (2b) an integer variable indicating the boundary condition
 c       type for all gas phase components at the node.
 c        1 = constant mole fraction
 c       2 = constant diffusive flux
 c       3 = mixed type (contact with a known fluid).
 c     (2c) the boundary condition values for each component in the
 c       gas phase. The values are listed in sequential order
 c       corresponding to the component numbers. Only components
 c       that are present in the gas phase are listed. Component
 c       boundary conditions are not provided for components which
 c       are excluded from the gas phase (i.e. negative vapor
 c       pressure). Two values are needed for each boundary node.
 c       These  values are used as needed to specify the boundary
 c       condition.
 c       1 = specified gas phase mole fraction (partial pressure)
 c         in contacting fluid. The partial pressures must sum
 c         to one (used for first type boundary).
 c       2 = user supplied value of Dm/length (m/sec).
 c— Error check node numbers and BC type
 c— Impose first type BCs
    call commnt( 13,21)
    read(13,*)ipt(20)
    If(ipt(20).gt.O)Then
      lerror = .false.
      Doi = l,ipt(20)
       ii = ipt(18) + ipt(19)
       read (13,*) ibc(ii+i),ibcxmf(ibc(ii+i))
   +      ,(bcxmf(icbc*ipt(l)+ibc(ii+i))
   +      ,dfxmf(icbc*ipt( 1 )+ibc(ii+i)),icbc=0,ipt(3)-1)
       if (ibc(ii+i).lt.O .or. ibc(ii+i).gt.ipt(l))
   +       call ErrMessage (57,0,ipt(29))
       if (ibcxmf(ibc(ii+i)).lt.l .or. ibcxmf(ibc(ii+i)).gt.3)
   +       call ErrMessage (58,0,ipt(29))
       if(lctr!(9)) then
         ixmfnc = ipt(3)-l
       else
         ixmfnc = ipt(3)
       end if
       ixmfn = (ixmfnc-l)*ipt(l)+ibc(ii+i)
       sum = zerO
       doicbc = 0,ipt(3)-l
         ixmf = icbc*ipt(l)+ibc(ii+i)
 c
 c— Error check: xmf = (0,1).
         if( bcxmf(ixmf).lt.zerO .or. bcxmf(ixmf).gt.rone)
   +       call ErrMessage (83,0,ipt(29))
         if(ibcxmf(ibc(ii+i)).eq.l.and.lprnt(6)) lerror = .true.
         if(ibcxmf(ibc(ii+i)).eq.l) xmf(ixmf) = bcxmf(ixmf)
         if(icbc+l .nejxmfnc) sum = sum + bcxmf(ixmf)
       end do
c
c- Calculate master component boundary condition in mole fractions.
c
       bcxmf(ixmfn) = rone - sum
c
c— Error check: sum of specified boundary concentrations must
c—equal 1.
       if(sum+bcxmf(ixmfn).ne.rone) call ErrMessage (85,0,ipt(29))
     EndDo
     if(lerror) call ErrMessage (127,l,ipt(29))
     lerror = .false.
   Endlf
c
c— Aqueous phase component boundary conditions.
c  (1) Read the number of nodes for which aqueous phase component
c    boundary conditions are specified.
c  (2) For each such node, read:
c    (2a) the node number
c    (2b) an integer variable indicating the boundary condition
c        type for all aqueous phase components at the node.
c        1 = constant mole fraction
c        2 = constant diffusive flux
 c        3 = mixed type (contact with a known fluid).
 c     (2c) two boundary conditions values for each component in the
 c        aqueous phase. The values are listed in sequential order
 c        corresponding to the component numbers. Only components
 c        that are present in the aqueous phase are listed.
 c        Component boundary conditions are not provided for
 c        components which are excluded from the aqueous phase
 c        (i.e. negative solubility). Two values are needed for
 c        each boundary node component. These values are used as
 c        needed to specify the boundary condition.
 c        1 = specified aqueous phase concentration (g/1)
 c         in contacting fluid (used for first type boundary).
 c        2 = user supplied value of Dm/length (m/sec).
 c— Error check node numbers and BC  type
 c—- Impose first type BCs
    call commnt (13,21)
    read(13,*)ipt(21)
    If(ipt(21).gt.O)Then
      lerror = .false.
      ii = ipt(18) + ipt(19) + ipt(20)    •
      Doi = l,ipt(21)
       read (13,*) ibc(ii-t-i),ibcxmf(ipt(l)+ibc(ii-H))
    +      ,(bcxmf((ipt(3)+icbc)*ipt(l)+ibc(ii+i))
    +      ,dfxmf(icbc*ipt( 1 )+ibc(ii+i)),icbc=0,ipt(4)-1)
       if (ibc(ii+i).It.O .or. ibc(ii+i).gt.ipt(l))
    +      call ErrMessage (59,0,ipt(29))
       if (ibcxmf(ipt(l)+ibc(ii+i)).lt. 1 .or.
    +      ibcxmf(ipt(l)+ibc(ii+i)).gt.3)
    +      call ErrMessage (60,0,ipt(29))
       sum = zerO
       do icbc = 0, ipt(4) -1
         ixmf=(ipt(3)+icbc)*ipt(l)+ibc(ii+i)
 c
 c— Convert specified boundary concentrations into mole fractions.
         if(icbc+l.ne.ipt(14)+l) then
          bcxmf(ixmf) = bcxmf(ixmf)  * cmw(ipt(15)+l)
   +          / (cmw(icp(ipt(3)+icbc+l)) * cden(ipt(15)+l))
          sum = sum + bcxmf(ixmf)
 c
 c—Error check: xmf = (0,1).
          if( bcxmf(ixmf).lt.zerO .or. bcxmf(ixmf).gt.rone )
   +          call ErrMessage (84,0,ipt(29))
 c
 c— Error warning: no mass balance for first type nodes.
          if( ibcxmf(ipt(l)+ibc(ii+i)).eq.l.and.lprnt(6))
   +          lerror = .true.
 c
 c— Impose first type boundary condition.
          if (ibcxmf(ipt(l)+ibc(ii+i)) .eq. 1)
   +          xmf(ixmf) = bcxmf(ixmf)
        end if
       end do

 c- Calculate master component boundary condition in mole fractions.

       ixmfw = (ipt(3)fipt(14))*ipt(l)+ibc(ii+i)
       bcxmf(ixmfw) = rone - sum
       if (ibcxmf(ipt(l)+ibc(ii+i)) .eq. 1)
   +       xmf(ixmfw) = rone - sum
     EndDo
     if(lerror) call ErrMessage (127,l,ipt(29))
     lerror = .false.
    Endlf

c— Read nodes with a constant gas phase specific discharge.
c— Units of source are m**3/sec.
c— Error check node numbers
   call commnt (13,21)
   read (13,*) ipt(22)
   If (ipt(22) .gt. 0) Then
     iptbc = ipt(18) + ipt(19) + ipt(20) + ipt(21)
     Doi = l,ipt(22)
       read (13,*) ibc(iptbc+i),source(i)
       if (ibc(iptbc+i).lt.O .or. ibc(iptbc+i).gt.ipt(l))
  +       call ErrMessage (63,0,ipt(29))
     EndDo
   Endlf
                                                                         195

-------
 Read nodes with a constant aqueous phase specific discharge.
 Units of source are m**3/sec.
call commm( 13,21)
rcad(13,*)ipl(23)
lf(ipl(23),gt.O)Then
  iptbc = ipl(lS) + ipt(19) + ipt(20) + ipt(21) + ipt(22)
  Doi = l,ipt(23)
    read (13,*) ibc(iptbc+i),source(ipt(22)+i)
    if (ibe(iptbe+i),lt.O .or. ibe(iptbc+i).gt.ipt(l))
+        caUErrMessage(64,0,ipt(29))
  EndOo
 Endlf

 Write boundary condition information.
 write (21321)
 write (2 1 322) ipt(l 8)    ! constant gas phase pressures
 If(ipt(18),gt.O)Then
  write (21,523)
  write (21,524) (ibc(i),p(ibc(i)),i=l,ipt(18))
 Endlf
 write (21325) ipt(19)    ! constant aqueous phase pressures
 lf(ipl(19).g».0)Thcn
  write (21326)
    ii = ipt(18) + i
    write (21324) ibc(H),p(ipl(l)+ibc(U))
   EndDo
 Endlf
 write (21 327) ipt(20)     ! gas phase component BCs
 If (ipl(20) ,gt, 0)Then
   write (21,528)
   write (21329) (cnamc(icp(i)),i=l,ipt(3))
   Doi = l.ipt<20)
     ii = ipt(!8)-t-ipt(19)
     If(ipt<3).lc.2)Thcn
      write (21,531) ibc(il+i),ibcxrnf(ibc(ii+i)),
 •f        (bcxmf(ibc(ii+iHicbc*ipt(l))
 +        ,dfxmf(ibc(ii+i)+icbc*ipt(l)),icbc=0,ipt(3)-l)
     Else
      \vritc (21,531) ibc(!i+i),ibcxmf(ibc(ii+i)),
 +        (bcxmf(ibc(l!+i)+icbc*ipl(l))
 +        ,dfxmf(ibc(iiH4)+icbc*ipt(l)),icbc=0,l)
      Doj = l,(ipt(3)-lV2
         write (21, 532)
 +         (bcxmf(ibc(iW)+icbc*ipt(l»
 +         ,dfxmf(ibc(ii+i)+icbe*ipl(l)),icbc=j*2jj)
       EndDo
     Endlf
    EndDo
  Endlf
  write (21333) ipl(21)      1 aqueous phase component BCs
  If(ipt(21).gt.O)Then
    write (21,534)
    write (21,529) (cnamc(icp(H-ipt(3))),l=l,ipt(4))
    Ooi-l,ipt(21)
      !f(ipt(4),lc. 2)Then
       write (21,531) ibc(ii+i),ibcxmf(ipt(l)+ibc(ii+i)),
           (bcxmf(ibc(ii+i)+ipt(l )*(icbc+ipt(3)))
           ,dfxmf(ibc(ii+i)+ipt(l )«(icbc+ipt(3)))
           ,icbc=0,ipt(4)-l)
      Else
       write (21,531) ibe(ii+i),ibcxmf(ipt(l)+ibc(ii+i)),
           (bexmf(ibe(ii+i)+ipt(l)*(icbc+ipt(3)))
           ,dfxmf(ibc(ii+i)+ipt(l)*(icbc+ipt(3)))
           ,icbc=0,l)
          write (21, 532)
  +          (bcxmf(ibc(ii+i)+ipt(I )*(icbc+ipt(3)))
  +          ,dfxmf(ibc(ii+iHipl(l)*(icbc+ipt(3)))
  +          ,icbc=j*2jj)
        EndDo
      Endlf
     EndDo
   Endlf
   write (21336) ipt(22)     ! constant gas phase flux
   If(ipt(22).gt. 0>Then
     iptbc = ipt(18) -1- ipt(l 9) + ipt(20) -I- ipt(21)
     write (21,537)
     Doi=l,ipt(22)
      write (21,524) ibc(iptbc+i),source(i;)
     EndDo
   Endlf
   write (21 ,538) ipt(23)     ! constant aqueous phase flux
   If(ipt(23).gt.O)Then
     iptbc = ipt(18) + ipt(19) + ipt(20) + ipt(2l) + ipt(22)
     write (21,539)
     Doi==l,ipt(23)
      write (21,524) ibc(iptbc+i),source(ipt(22)+i)
     EndDo
   Endlf
c
c — If constant pressure nodes are present, then update saturations.
   if «ipt(18) .gt. 0 .or. ipt(19) .gt. O).and.lctrl(l)) then
     call SATW
   endif

c====== INITIALIZE VARIABLE3 =====
c
c —  Do not perform these initializations if the run is a restart.
   if(.not.lctrl(26)) then
C
C — Now assign aqueous phase water mole fractions.
C
     if(ipt(4).gt.O) then
       ix=ipt(14)*ipt(l)
       do460i=l,ipt(l)
         xmf(ipt(9)+ix-H) = rone
         do460ii=l,ipt(4)
           if(icp(ipt(3)+ii).ne.icp(ipt(3)+ipt(14)+l»
   +         xmf(ipt(9)+ix+i) = xmf(ipt(9)+ix+i)
 460      continue
 C
 C — Now assign gas phase water mole fractions. No gas phase water
 C — vapor equilibrations are permissible when the aqueous phase is
 C — absent.
 C
         if(ipt(3).gt.O) then
           do 470 i=l,ipt(l)
             ifflctrl(lO)) then
              cvpt = cvp(ipt(15)+l)
             else
              cvpt = cvp(ipt(15)+l)
    +             + dtemp(ipt( 1 5)*ipt(89)+idepth(i))
             endif
  470         if(cvp(ipt(15)+l).ge.zerO)
    +            xmf(ipt(13)*ipt(l>l-i)
    +            = xmf(ipt(9)+ix+i)*cvpt
    +            /(temp(i)*cden(ipt(15)+l)*r*patm)
          endif
        endif
 C
 C — Finally assign gas phase nitrogen mole fractions.
 C
        if(ipt(3).gt.0)then
          if(lctrl(9))then
            in = ipt(3) - 2
          else
            in = ipt(3) - 1
          endif
          ix = in*ipt(l)
          do475i=l,ipt(l)
            xmf(ipt(8)+ix+i) = rone
            do475ii=l,ipt(3)
              if(icp(ii).ne.icp(in+l)) then
               xmf(ipt(8)+ix+i) = xmf(ipt(8)+ix+i)
              endif
   475      continue
         endif
      endif
  C
  C — Compute the phase molecular weights and densities. Do not
                                                                         196

-------
 C— compute the phase density derivative terms on the first time
 C— step unless the run is a restart.
 c    if(.not.lctrl(26)) then
      Ikeep = lctrl(22)
      lctrl(22) = .false.
      call MOLEWT
      Ictrl(22) = Ikeep
 c    else
 c     call MOLEWT
 c    end if
 C
 C— Compute solid phase equilibrium organic mole fractions when the
 C— run is not a restart.
 C
    if(.not.lctrl(26)) then
      if(ipt(14).gt.0.and.ipt(16).gt.0)then                                 ;
       iaq = ipt(3)
       isol = ipt(3) + ipt(4) + ipt(5)
       do480ii = l,ipt(15)
         ngas = (igas-1) * ipt(l)
         inapl = inapl + 1
         if(icp(iaq+l).eq.ii) iaq=iaq+l
         if(icp(isol+l).eq.ii)isol=isol+l
         naq = (iaq-1) * ipt(l)
         nsol = (isol-1) * ipt(l)
         do480i = l,ipt(l)
           if(icp(isol).eq.ii) then
            if(xmf(naq+i).gt.0.dO) then
              xmf(nsol+i) = bok(l)*(xmf(naq+i)*cmw(icp(isol))
   +             * den(ipt(l)+i) * 1.0d3 ) ** (rone/bom(l))
            else
              xmf(nsol+i) = O.dO
            end if
            if(lctrl(19)) then
              if(xmf(naq+i).gt.0.dO) then
               xmf(nsol+i+ipt(l)) = xbok*bok(l)*(xmf(naq+i)
   +              *cmw(icp(isol))*den(ipt(l)+i)*1.0d3)
   +              **(rone/(xbom*bom(l)))
              else
               xmf(nsol+i+ipt(l)) = O.dO
              end if
            end if
          end if
 480     continue
      end if
   end if
c
c====== WELL CONDITIONS =======
c
   if(ipt(29).ne.O) write (ipt(29),*)
   +          ' Reading Extraction / Injection Well Conditions'
c
c— Read logical variable indicating if a well is included.
   call commnt (13,21)
   read (13,*) lctrl(12)  ! Is a well to be simulated?
   write (21,540) lctrl(12)
c
c— Read the volumetic flux (standard cubic feet per minute).
   If(lctrl(12))then
     call commnt (13,21)
     read (13,*) qwell
c
c— Read the well radius (m); and the minimum and maximum node numbers
c— along the well screen.
c— Error Check: rwell > 0; all nodes  along screen have same radius.
     call commnt (13,21)
     read (13,*) rwell,ii jj
     if (rwell .le. zerO) call ErrMessage (65,0,ipt(29))
     if (xnode(ii).ne.rwell .or. xnode(jj).ne.rwell)
   +•        call ErrMessage (66,0,ipt(29))
     iptbc = ipt(18)+ipt(19)+ipt(20>t-ipt(21)«pt(22)+ipt(23)
     ipt(24) =1          ! number of nodes along well screen.
     ibc(iptbc+ipt(24)) = ii  ! nodes  along well screen.
       If (xnode(i) .eq. rwell) Then
        ipt(24) = ipt(24) + l
        ibc(iptbc+ipt(24)) = i
        Endlf
      EndDo
      ipt(24) = ipt(24) + 1
      ibc(iptbc+ipt(24)) = jj ! bottom node along well screen
      zwell = zerO       ! determine length of well screen
      Do i = l,ipt(24)-l
        zwell = zwell + znode(ibc(iptbc+i+l)) - znode(ibc(iptbc+i))
      EndDo
      Do 350 i = 1 ,ipt(24)-1 [identify elements along the well screen
        ndl = ibc(iptbc+i)
        nd2 = ibc(iptbc+i+l)
        Do j = l,ipt(0)
         i3 = 3*(j-l)
         If ((ndl .eq. nodel(i3+l) .or. ndl .eq. nodel(i3+2) .or.
    +        ndl .eq. nodel(i3+3)) .and.
    +       (nd2 .eq. nodel(i3+l) .or. nd2 .eq. nodeI(i3+2) .or.
    +•        nd2 .eq. nodeI(i3+3))) Then
            ibc(iptbc+ipt(24)+i) = j
            goto 350
         Endlf
        EndDo
 350   Continue
 c
 c— Write  well conditions.
      write (21,541) qwell,rwell,zwell,ipt(24)
      Do i = l,ipt(24)-l
        write (21,542) ibc(iptbc+ipt(24)+i),ibc(iptbc+i),
    +            ibc(iptbc+i+l)
      EndDo
      qwell = qwell / 2118.60dO        ! convert cfm to m"3/s
    Endlf
 c
 c—• Generate boundary condition pointers.
    ipt(62) = ipt(18) + ipt(19) + ipt(20) +ipt(21)
    ipt(63) = ipt(62) + ipt(22)
    ipt(64) = ipt(63) + ipt(23)
 C
 C==== VELOCITY BOUNDARY CONDITIONS =====
 C
    if(ipt(29).ne.O)
   +   write (ipt(29),*) 'Reading Velocity Boundary Conditions'
 C
 C— Read a logical variable indicating if the bottom boundary is
 C— impervious.
 C
    if(lctrl(18)) then
     call commnt (13,21)
     read (13,*) lctrl(28)
 C
 C— Read  a logical variable indicating if the R.H.S. boundary is
 C— impervious.

     call commnt (13,21)
     read(13,*)lctrl(29)

   - Read a logical variable indicating if the L.H.S. boundary is
   - impervious.  Note that this boundary will be adjusted in the
   - presence of a well.

     call commnt (13,21)
     read(13,*)lctrl(30)

C— Read a logical  variable indicating if the top boundary is
C— impervious.
C
     call commnt (13,21)
     read(13,*)lctrl(31)
     write  (21,555) lctrl(28),lctrl(29),lctrl(30),lctrl(31)

  — If lctrl(31) is true read the length of the cap (m). The cap is
  — assumed to extend from the well to the input value.

     if(lctrl(31))then
      call commnt (13,21)
      read (13,*) caplen
      write(21,556) caplen
     end if
   end if
                                                                         197

-------
        «PRINT INITIAL CONDITIONS =
C
c«=
C
   If(lprnt<3»Then
     if(ipt<29).nc.0> write (ipl(29),*)
   •f            'Writing Initial Conditions'
     callprmeO)
   Endlf
c
c—Formats
 499 format e/riNPUT2',69e'=')/)
 SCO format emrriAL PRESSURE DISTRIBUTION ',46('=')/
   + * Pressures are defined as:         ipt(75) = ',i5/
   + "    1 * compute assuming: Pg=latm'           /
   + '                Pa = hydrostatic;'       /
   +'    2 * input Pg and Pa at all nodes;')
 501 format (
   + ' Depth (o water table (m):        wtdpth  = ',el2.4)
 HE forrrutC
   +' Input initial gauge pressure (Pa) at all nodes:'/
   + •   Node       Aqueous Phase     GasPnase')
 503 format (3x,i6,4x,el2,4,4x,el2.4)
 504 format f/DARCY VELOCITY COMPUTATION APPROACH ',40('=')/
   + ' Use nodal7 Darey velocities if true:     lctrl(I8) =',15)
 505 format (
   •f-' Time dependent Darcy velocity profiles.')
 506 formate
   +' Steady state Darcy velocity profile is generated from the'/
   + '    user defined initial pressure distribution:')
 507 format(
   +•' User defined steady state velocities:')
 508 formate
   +•' Constant steady state Darcy velocity components'/
   + '    gas phase velocity, x(orr) component: vgx  =',e!2.4/
   + '    gas phase velocity, z component:    vgz  =',e!2.4/
   •f'    aqueous phase velocity, x component  vax  =',e!2.4/
   + '    aqueous phase velocity, z component:  vaz  =',e!2.4)
 509 formate
   •(•'            Oas Phase        Aqueous Phase'/
   +"    Node   x-dir     z-dir   x-dir   z-dir')
 510 formate
   •f.'            Oas Phase        Aqueous Phase'/
   + '    Element x-dir    z-dir   x-dir   z-dir')
 511 format e3x,i5,5x,4el 2.4)
 512 format e/'lNITIAL NAPL SATURATION AND COMPOSITION ',36('='))
 513 formate
   + '  No NAPL is present')
 514 formate
   •f * Uniform NAPL saturation and mole fractions in all elements',/
   + *    NAPL sat   Component mole fractions')
 515 format (3x,6ecl2.5,lx))
 516 formate
   + * Number of elements with NAPL present:   inoel   =',i5,/
   + •   Element  NAPL sat  Component mole fractions (l-ipt(15))')
 517 format e2x,i6,2x,6(el2.5,lx))
 518  format e/'OAS, AQUEOUS, AND BIOPHASE PHASE INITIAL CONDI-
 TIONS '
   +   ,24('='))
 519 formate
   t' Uniform gas phase oxygen mole fraction:   xog  = ',e!2.4)
 543 formate
   + 'Uniform gas phase nutrient mole fraction:  xng  =',e!2.4)
 544 formate
   + ' Uniform aqueous phase oxygen mole fraction: xoa  =',e!2.4)
 545 format e
   + ' Uniform aqueous phase nutrient mole fractiomxna =',e!2.4)
 546 formate
  +'  Non-uniform aqueous phase oxygen mole fraction')
547 format(
  +'  Non-uniform gas phase oxygen and nutrient mole fraction')
548 format(
  +'  Non-uniform' aqueous phase oxygen and nutrient mole fraction')
520 format(
  + '  Non-uniform gas phase oxygen mole fraction')
521 format (/'BOUNDARY CONDITIONS ',56('='))
522 format(
  •f'  Number of nodes with constant gas pressure: ipt(IS) = ',i5)
523 format(
  -f'   Node   Constant gas phase pressure (Pa gauge)')
524 format (3x,i5,14x,e 12.4)
525 formate
  + '  Number of nodes w/constant aqueous press.: ipt(19) =',i5)
526 format (
  + '   Node   Constant aqueous phase pressure (Pa gauge)')
527 format (
  + '  Number of nodes W/gas phase component'            /
  +•'    boundary conditions:          ipt(20)  = ',15)
528 forrhatC   Gas phase BCs:'                   /
  +'   Nbde^ BC type   BC values for gas phase components'  /
  •H'             in pairs (concentratibn:Drri/!ength)')
529' format (2'0x,a!3,1 Jx.alS)
531 format (3x,i.'),6'x,il,4x,2(el2.4,':',el0.4,2x))
532 format(I:9x,2(el2.4,':',el0.4,2x))
533 format (
  + '  Number of nodes w/aqueous phase'               /
  + '   component boundary conditions:     ipt(21)  =',i5)
534 format ('   Aqueous phase BC:'                 /
  + '   Node BC typfe   BC values for aqueous phase components'/
  +'             frr pairs (concentrafion:Dm/Iength)')
536 formate
  + '  Number of nodes w/constant gas phase flux:ipt(22) =',i5)
537 format (
  +'   Node   Constant gas phase flux (scms)')
538 format (
  + '  Numberof nodes w/constant aq. phase flux:ipt(23) =',15)
539 format (
  +'   Node   Constant aqueous phase flux (cms)')
540 format (/'EXTRACTION / INJECTION WELL DATA ',43('=')/
  + '  Include an extraction/injection well:   lctrl(12) =',15)
541 format(
  + '  Volumetric fluid extraction rate (scfm): qwell   =',e!2.4/
  +'  Well radius (m):              rwell   = ',e!2.4/
  + '  Length of well screen (m):        zwell   =',e!2.4/
  + '  Number of nodes along well screen:    ipt(24)  =',i5  /
  + '  Element and node numbers along well screen:'/
  -1-'      Element      Element nodes along well screen')
542 format (9x,i6,I8x,2i8)
550 format (/'RESTART INFORMATION ',56('=')/
  + '  Run is a restart:             lctrl(26) =',15/
  + '  Restart data:               (unit 28) = ',a20/
  +'  Run is a continuation:           lctrl(32) = ',15)
555 format (/'VELOCITY BOUNDARY CONDITIONS',48('=')/
  + '  Bottom boundary is impervious:      lctrl(28) = ',15/
  + '  R.H.S. boundary is impervious:       lctrl(29) = ',15/
  + '  L.H.S. boundary is impervious:       lctrK30) = ",!5/
  +'   Note: L.H.S. is adjusted when a well is present'/
  + ' Top boundary is impervious:        lctrK31) =',15)
556 format(
  + ' Top boundary is covered from x = 0 to:  caplen  =',e!2.4)
601 format(3el5.8,ilO)
602 formate5el5.8)
   return
   end
Subroutine - mobil.f
                                                                     198

-------
 C	—	
 c
 C   mobil.f - This subroutine computes capacity coefficients, and
 C         aqueous and gas phase mobility terms in stacked
 C         storage.
 C
 c	:	:	
    subroutine mobil (iter)
    include 'dimen.inc'
    common /cbl/ matel(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
    •f       matpt(nn6)
    common /cb2/ p(nn3)
    common /cb2b/ pt(nn3)
    common /cb3/ sat(nnstk3)
    common /cb3b/ satt(nnstk3)
    common /cb4/ satk(nnstk2),cc(nnstk)
    common /cb5a/ bphi(nmblk),bpermh(nmb!k),bpermv(nmblk)
    common /cb5b/ bvgn(nmblk),bvga(nmblk),bvgm(nmblk),bsrw(nmblk)
    common /cbfi/ pmob(nnstk4)
    common /cb6b/por(nelmx),srw(nnstk)
    common /cb8/ vis(nnmx),pmw(nn3)
 C
 C— Dimension local arrays.
 C
    dimension c(3)
    data ccmin / 1 .Od-7 /
 c
 c— Branch computations for single and multiple material property
 c— blocks uniform material properties
    if (ipt(26) .eq. 1) then ! uniform material properties.
 c
 c— Update chord slope approx for capacity coeffs, no stacking.
     do!0i = l,ipt(l)
       if (iter .eq.  l)then
          cc(i) = -ccmin
       else
         x = p(2*ipt(l)+i) - pt(2*ipt(l)+i)
         if(x.ne. O.OdO)then
           cc(i) = (sat(ipt(2)+i) - satt(ipt(2)+i)) / x
           if (dabs(cc(i)) .It. ccmin) cc(i) = -ccmin
         else
           cc(i) = -ccmin
         endif
       endif
 c
 c—• Compute relative permeability.
       c(l) = 1 .OdO / (1 .Odd - srw(i))
 c         !  van Genuchten function
       c(2)=1.0dO/bvgm(l)
       sweff = (sat(ipt(2)+i) - srw(i)) * c(l)
       steff= (sat(ipt(2)+i)+sat(ipt(49)+i) - srw(i)) * c(l)
       pmob(2*ipt(2)+i) = dsqrt(sweff) * (l.OdO - (l.OdO -  !  kra
   +               sweff**c(2)) ** bvgm(l)) ** 2
       pmob(i) = dsqrt(l.OdO-steff) * (l.OdO ! krg
   +       - steff**c(2)) ** (2*bvgm(l))
 c
 c— Compute mobilities. Note 'bpermh' is an anisotropy factor.
       pmob(3*ipt(2)+i) = bpermv(l)           ! aq. z-dir
   +              * pmob(2*ipt(2)+i) *wvis
       pmob(2*ipt(2)+i) = bpermh(l) * pmob(3*ipt(2)+i)! aq. x-dir
       if (lctrl(20)) then    ! include Klinkenberg adjustment
         pmob(ipt(2)+i) =bpermv(l) * pmob(i) * vis(i) *
    +              (1 .OdO + b/(patm+p(i)))
        else
         pmob(ipt(2)+i) = bpermv(l) * pmob(i) * vis(i) ! gas z-dir
        endif
        pmob(i) = bpermh(l) * pmob(ipt(2)+i)       t gas x-dir
  10   continue
 c
 c— Multiple material property blocks.
    else
 c
 c— Update chord slope approx for capacity coeffs.
      do 20 i = l,ipt(l)
        do 20 j = 0,nodept(i+l)-nodept(i)-l
         jj = nodept© + j
         if (iter .eq. l)then
           cc(jj) = -ccmin
         else
           x = p(2*ipt(l)+i) - pt(2*ipt(l)-ri)
           if(x.ne. O.OdO)then
            cc(jj) = (sat(ipt(2)+jj) - satt(ipt(2)+Jj)) / x
            if(dabs(cc(jj)).lt. ccmin)  cc(jj) =-ccmin
           else
            cc(jj) = -ccmin
           endif
         endif
 c
 c— Compute relative permeability.
         mprop = matpt(jj)
         c(l) = 1.0dO/(1.0dO - srw(jj))
         c(2) = 1 .OdO / bvgm(mprop)
         sweff = (satOpt(2Mj) - srwOJ)) * c(l)
         steff = (sat(ipt(2)+jj)+sat(ipt(49)+jj) - srwQj)) * c(l)
         sweff = dminl (sweff, 1 .OdO)
      •   steff=dmin 1 (steff, 1 .OdO)
         steff= dmaxl(steff,xround)
         sweff = dmaxl(sweff,xround)
         pmob(2*ipt(2)+ii) = dsqrt(sweff)         ! kra
   +        * (1 .OdO - (1 .OdO -sweff**c(2)) ** bvgm(mprop)) ** 2
         pmobQj) = dsqrt(l.OdO-steff) ! krg
   +        * (1 .OdO - stefi**c(2)) ** (2*bvgm(mprop))
 c
 c— Compute mobilities.  Note 'bpermh' is an anisotropy factor.
         pmob(3*ipt(2)+jj) = bpermv(mprop)      ! aq. z-dir
   +        * pmob(2*ipt(2)+jj) * wvis
         pmob(2*ipt(2)+jj) = bpermh(mprop)      ! aq. x-dir
   +        * pmob(3*ipt(2)+jj)
         if (lctrl(20)) then   ! include Klinkenberg adjustment
          pmob(ipt(2)+ij) = bpermv(mprop) * pmobflj) * vis(i) *
   +                (1 .OdO + b/(patm+p(i)))
         else
          pmob(ipt(2)+jj) = bpermv(mprop) * prnobQj) *
   H-                vis(i)  ! gas z-dir
         endif
         pmob(jj) = bpermh(mprop) * pmob(ipt(2)+jj) ! gas x-dir
 20      continue
    endif
    return
    end
Subroutine - molewt.f
C	—	__
c
C   MOLEWT.f - Subroutine which computes the fluid phase molecular
C          weights, densities, and mass densities.
C
C   Required Control Flags:
C
C     lctrl(l) - logical variable controlling presence of flow
C          solution
C            lctrl(l) = .true. - compute flow solution
C            lctrl(l) = .false. - skip flow solution
C    lctrl(22) - logical variable controlling execution of
C          solution for dden
C            lctrl(22) = .true. - compute dden
C            lctrl(22) = .false. - skip dden
C
                                                                       199

-------
c
c-
c
   subroutine MOLEWT
   include Mimen inc'

     Declare »nd define common block variables.

   common/cb2/ p(nn3)
   common /cb6e/ temp(nnmx)
   common fcb7b/ cmw(ncmp),cvp(ncmp),cden(ncmp),
   +       chen(ncmp),casol(ncmp),cmdif(ncmp2)
   common /cb8/ vis
-------
 C—  Declare and define common block variables.
 C
    common /cbl/ matel(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +        matpt(nn6)
    common /cblc/ xnode(nnmx),znode(nnmx),rbar(nelmx),area(nelmx)
    common /cb2c/ q(ne!4)
    common/cb3/ sat(nnstkS)
    common /cb3b/ satt(nnstk3)
    common /cb6d/ dtemp(nzmax6),idepth(nnmx)
    common /cb7b/ cmw(ncmp),cvp(ncmp),cden(ncmp),
   +        chen(ncmp),casol(ncmp),cmdif(ncmp2)
    common/cb9/ xmf(nmf)
    common /cb9b/ xmft(nmf)
    common /cblO/ den(nn6)
    common /cbl I/ pex(nnslO),rxnp(nn2)
    common /cb62/ rxn(nmf),cex(nmfs)
    common /cb62b/ rhsex(nmfs)
    common /cb63/ kex(ncmp5),kmax(ncmp5)

    common /cb64/ bok(nbcmp),bom(nbcmp),krtd(ncmp)
 C
 C— Dimension local arrays.
 C
    dimension qaveg(nnmx),qavea(nnmx),xl(nnmx)
 C
 C— Klen is the dimension used to calculate the exchange coefficient
 C— bounds. Ordinarily this is not used and the exchange coefficients
 C—• are bounded using the element dimension.  However for column
 C— experiments, the column dimension may be appropriate and should
 C— be entered here in meters. Otherwise set klen to a negative
 C— number.
C
   data klen/-O.lOdO/
   data limag,  limao,  limgo,  limab,  limas /
   +   .true., .true., .true., .true., .false./
C
C— This statement sets upper limits on exchange coefficients.
C— Limits are expressed in the fraction of equilibrium it is
C— possible to approach over one element. Limits are is order:
C— gas/aqueous, aqueous/NAPL, gas/NAPL, aqueous/biophase,
C— and aqueous/solid.
C
   doli = l,ipt(l)
     xl(i) = zerO
     qaveg(i) = rone
     qavea(i) = rone
 1  continue
   do2i = l,ipt(0)
     i3=i*3
     n3=nodel(i3)
     n2=nodel(i3-l)
     nl=nodel(i3-2)
     darea = dsqrt( 2.0dO * area(i))
     if(klen.lt.zerO) then
       xl(nl) = dmaxl( xl(nl), darea)
       xl(n2) = dmaxl( xl(n2), darea )
       xl(n3) = dmaxl( xl(n3), darea)
     else
       xl(nl) = klen
       xl(n2) = klen
       xl(n3)=klen
     end if
     if(lctrl(18))then
       qelgl = dsqrt( q(nl)**2 -t- q(nl+ipt(l))**2) / darea
       qelg2 = dsqrt( q(n2)**2 +• q(n2+ipt(l))**2) / darea
       qelg3 = dsqrt( q(n3)**2 + q(n3+ipt(l))**2) / darea
       qelal = dsqrt( q(nl+ipt(40))**2 + q(nl+ipt(41))**2) / darea
       qela2 = dsqrt( q(n2+ipt(40))**2 + q(n2+ipt(41 ))**2) / darea
       qela3 = dsqrt( q(n3+ipt(40))**2 + q(n3+ipt(41))**2) / darea
       qaveg(nl) = dminl( qaveg(nl), qelgl)
       qavea(nl) = dminl( qavea(nl), qelal )
       qaveg(n2) = dminl( qaveg(n2), qelg2)
       qavea(n2) = dminl( qavea(n2), qela2)
       qaveg(n3) = dminl( qaveg(n3), qelgS )
       qavea(n3) = dminl( qavea(n3), qela3 )
    else
       qelg = dsqrt( q(i)**2 + q(i+ipt(0))**2 ) / darea
       qela = dsqrt( q(i+ipt(67))**2 + q(i+ipt(68))**2) / darea
       qaveg(nl) = dminl( qaveg(nl), qelg )
       qavea(nl) = dminl(qavea(nl), qela)
       qaveg(n2) = dminl( qaveg(n2), qelg)
       qavea(n2) = dminl ( qavea(n2), qela)
       qaveg(n3) = dminl (qaveg(n3), qelg)
       qavea(n3) = dminl( qavea(n3), qela )
     end if
 2  continue
 C
 C— Compute the phase mass exchange.  Initially iterate over just
 C— the mobile phases and then add NAPL, solid, and biophases.
 C— Aqueous/gas exchange is controlled by the aqueous phase
 C— mole fractions.  NAPL/gas and NAPL/aqueous exchange are controlled
 C— by the mole fractions in the respective mobile phases.
 C— Solid/aqueous mass exchange is governed by the solid phase
 C— loading. Aqueous/ biophase mass exchange is governed by the       ;
 C— biophase mole fractions. For now this routine is not stacked.         ;
 C— Stacking will arise when the exchange coeficients are correlated
 C—• with velocities or material properties.
 C
    ipt2x2 = ipt(49)
    ipt2x4 = ipt(51)
    ipt2x5 = ipt(52)
    ipt2x6 = ipt(53)
    ipt2x7 = ipt(54)
    ipt2x8 = ipt(55)
    ipt2x9 = ipt(56)
    ipt2 = ipt(2)
    iptl=ipt(l)
C
C— Zero the exchange vectors.
C
    do 90 i = 1,10*ipt2
 90   pex(i) = zerO
    do91i = l,ipt(61)*ipt2
     cex(i) = zerO
 91    rhsexffl = zerO
C
C— Begin iterations  over the various components. First  the organic
C— components.
C
    icg =  0
    ica = 0
    icn =  0
    ics = 0
    icb =  0
    do!00iexc=l,ipt(15)
     ic = icp(iexc)
     if(icp(icg+l).eq.ic) then
      icg = icg + 1                                      .
      igc = icp(icg)
     end if
     if(icp(ipt(3)+ica+l).eq.ic) then
      ica = ica + 1
      iac = icp(ipt(3)+ica)
     end if
     if(icp(ipt(3)+ipt(4)+icn+l).eq.ic)  then
      icn = icn + 1
     end if
     if(icp(ipt(3)+ipt(4)+ipt(5)4ics+1 ).eq.ic) then
      ics = ics + 1
      isc = icp(ipt(3)-Hpt(4)+ipt(5)+ics)
     end  if
     if(icp
-------
C— Iterate oxer the nodes, Iniiial temperature dependent parameters.
C
     JolOOi = l,ipt(l)
      if(lctrj(10))thcn
        cvpt s cvp(ic)
        casollFCasol(ie)
      else
        itcmp ~ (ic-l)*ipt(89)+idepth(i)
        cvpt ~ cvp(ic) 4> dtempCitcmp)
        itcmp s jtempf3*ipt(88)
        casolt = casol(ic) + dtemp(itemp)
      end if
      do 100 ii = 0,nodcpt(i+l)-nodept(i)-l
        islk = ii + nodepl(i)
C
C— Initialize saturations. Control NAPL exchange with NAPL
C—saturations from the previous time step.
C
        sgconl«sat(istk)
        snt = salt(ipt2x2+istk)
C
C— Calculate terms when NAPL is present.
C
        if((snt,gt.zerO).and.(xmft(i+in),gt,zerO))then
C
C— Calculate gas phase exchange when the gas phase is present.
C
          if(ipt(3),gt.0.and.igc.eq.ic)then
C
C—  PUT  USER  DEFINED  GAS/NAPL MASS  TRANSFER COEFFI-
CIENT FUNCTION HERE.
C— ASSIGN IT TO KGO TO UTILIZE BUILT-IN CONTROL.
C
            if(limgo) then
             kgo = kex(5*(ic-l)+3)
C
C— Gaj/NAPL control on mass transfer coefficient with the greater of
C— the gas phase advcclive velocity or diffusional velocity.
C
             kgo « dminU kgo, -{ dmaxl( qaveg(i),
    +            cmdif(2*ic-iyxl(i)**2) * d1og(
    +            kmax
-------
 C— exceed the amount of organic component available from the NAPL
 C
            xfluxl = pexao*t(8)
            xflux2 = den(ipt(40)+i)*snt*xmf(i+in)
            if(xfluxl.gt.xflux2) then
              xlimit = xflux2 / xfluxl
              pexao = xlimit * pexao
              cexao = xlimit * cexao
            end if
            pex(ipt2+istk) = pex(ipt2+istk) + pexao
 C
 C— Update aqueous/NAPL phase mass exchange.
 C
            pex(ipt2x6+istk) = pex(ipt2x6+istk)+pexao*cmw(ic)
 C
 C— Update NAPL/aqueous component mole exchange.
 C                                                                '
            cex(ins+istk) = cex(ins+istk) - pexao
 C
 C— Update NAPL/aqueous phase mole exchange.
 C
            pex(ipt2x2+istk) = pex(ipt2x2+istk) - pexao
 C
 C— Update NAPL/aqueous phase mass exchange.
 C
            pex(ipt2x7+istk) = pex(ipt2x7+istk)-pexao*cmw(ic)
 C
 C— Update right hand side terms.
 C
            rhsex(iasn-istk) = rhsex(ias-!-istk)
   +          + cexao * casolt * xmf(in+i)
          end if
         else
 C
 C— Calculate aqueous/gas exchange where NAPL is absent and both
 C— mobile phases are present.
 C
          if((ipt(3)+ipt(4)).ne.ipt(3).and.igc.eq.iac)then
 C
 C—  PUT USER DEFINED AQUEOUS/GAS MASS TRANSFER COEFFI-
 CIENT FUNCTION
 C— HERE. ASSIGN IT TO KAG TO UTILIZE BUILT-IN CONTROL
 C
            if(limag) then
             kag = kex(5*(ic-l)+l)
 C
 C— Gas/aqueous control on mass transfer coefficient with the greater
 C— of the gas or aqueous phase advective velocity or diffusional
 C— velocity.
 C
             kag = dminl( kag,-(dmaxl( qaveg©
   +            , qavea(i), cmdif(2*ic-l)/xl(i)**2
   +            , cmdif(2*ic)/xl(i)**2)
   +            * dlog(kmax(ic))))
 C
 C—  PUT USER DEFINED AQUEOUS/GAS MASS  TRANSFER COEFFI-
 CIENT FUNCTION
 C— HERE. ASSIGN IT TO KAG TO BYPASS BUILT-IN CONTROL
 C
           else
             kag = kex(5*(ic-l)+l)
           end if
 C
 C— Calculate constants.
 C
           sdgas = den(i)
           sdaq = den(iptl+i)
           keqag = patm*casolt/cvpt
C
C— Update left hand side terms for aqueous phase equations.
C
           cexag = sdaq * kag
           if(sgcont.lt.sgtest) cexag = zerO
           cex(ias+istk) = cex(ias+istk) + cexag
C
C— Update aqueous/gas phase mole exchange.
C
           pexag = cexag * (keqag*xmf(ig+i) - xmf(ia+i))
            pex(ipt2+istk) = pex(ipt2+istk) + pexag

 C— Update aqueous/gas phase mass exchange.
 C
            pex(ipt2x6+istk) = pex(ipt2x6+istk)+pexag*cmw(ic)

 C— Update gas/aqueous phase mole exchange.
 C
            pex(istk) = pex(istk) - pexag
 C
 C— Update gas/aqueous phase mass exchange.
 C
            pex(ipt2x5+istk) = pex(ipt2x5+istk)-pexag*cmw(ic)

 C— Update the right hand side terms for the component transport
 C— equations.
 C
            rhsex(igs+istk) = rhsex(igs+istk) - pexag
            rhsex(ias-Mstk)
   +          = rhsex(ias+istk) + cexag*keqag*xmf(ig+i)
          end if
         end if
 C
 C— Calculate the exchange terms when adsorption is considered.
 C— Use Freundlich isotherms for the equilibrium solid phase loading.
 C— Adsorption can only occur if the aqeous phase is present. Only
 C— include adsorption when NAPL is not present
 C
          if((ipt(6).gt.0).and.(ipt(4).gt.0).and.iac.eq.isc)
   +        then
 C
 C— Set the aqueous phase mole fraction for aqueous/solid exchange
 C— to zero if it is nonpositive.
 C
            if(xmf(ia+i).Ie.zerO) then
             xmfa = zerO
            else
             xmfa = xmf(ia+i)
            end if
 C
 C—  PUT USER DEFINED AQUEOUS/SOLID MASS TRANSFER COEFFI-
 CIENT FUNCTION
   - HERE. ASSIGN IT TO KSA TO UTILIZE BUILT-IN CONTROL
 C
            if(limas) then
             ksa = kex(5*(ic-l)+5)
 C
 C— Aqueous/solid control on mass transfer coefficient with the
 C— greater of the aqueous phase advective velocity or
 C— diffusional velocity.
 C
             ksa = dminl( ksa, -(dmaxl( qavea(i),
   +            cmdif(2*ic)/xl(i)**2)
   +            *dlog(kmax(ic+4*ipt(65)))))
 C
 C— PUT USER DEFINED AQUEOUS/SOLID MASS TRANSFER COEFFI-
 CIENT FUNCTION
C— HERE. ASSIGN IT TO KSA TO BYPASS BUILT-IN CONTROL
C
            else
             ksa=kex(5*(ic-l)+5)
            end if
C
 _  - Calculate constants.  This form puts the mass transfer resistance
C—• for solid/aqueous interactions into the aqueous phase
C
C
C— Set the aqueous phase equilibrium mole fraction to zero if the
C— solid phase mass fraction is nonpositive.
C
           if(xmf(is-H).le.zerO) then
            efrac = zerO
           else
            efrac = (( xmf(is+i) / bok(l)) **  bom(l))
   +            / ( cmw(ic) * den(iptl+i) * 1.0d3 )
           end if
           sdaq = den(iptl+i)
                                                                     203

-------
C— Update left hand side terms for aqueous phase equations.

           ccxas * sdaq * Icsa
           cex(ias+lstk) = cex(iastislk) + cexas
C
C— Update left hand side terms for solid phase equations.
C
           cex(lss+istk) * zerO
C
C— Update aqueous/solid phase mole exchange. Tnis ibrm puts the
C— mass transfer resistance for solid/aqueous interactions into
C— (he aqueous phase.
C
           pexas = cexas*(efrac-xmfa)
           pcx(ipt2+istk) = pex(ipt2+istk) + pexas
C
C— Update solid/aqueous phase mass exchange. This form puts the
C— mass transfer resistance for solid/aqueous interactions into
C— the aqueous phase.
C
           pcx(ip!2x8+istfc) = pex(ipt2x8+istfc)-pexas*cmw(ic)
C
C— Update aqueous/solid phase mass exchange. This form puts the
C— mass transfer resistance for solid/aqueous interactions into
C— the aqueous phase.
C
           pcx(ipl2x6+islk) = pex(ipt2x6+istk)+pexas*cmw(ic)
C
C— Update right hand side terms, first for the aqueous phase and
C— then the solid phase,
C
           rhscx(iss+istk) = rhsex(iss+istk) - pexas
           rhscx(ias+istk) = rhsex(iastistk) +• cexas * efrac
C
C— Calculate terms for two compartment sorption model. This can
C— only be used for one organic component. The slow compartment
C— terms have been caluclated above (ipt(6)=l), the fast compartment
C— terms are calculated below (ipt(6)=2).
C
            if«ipt(6).cq,2).and.letrl(19))then
C
C—  PUT USER DEFINED AQUEOUS/SOLID MASS TRANSFER COEFFI-
CIENT FUNCTION
C— HERE. ASSIGN  IT TO KS A TO UTILIZE BUILT-IN CONTROL.
C
              ifClimas) then
               ksa = xkex*kex(5*(ic-l)+5)
C
C— Aqueous/solid control on mass transfer coefficient with the
C— greater of the aqueous phase advective velocity or
C— diffusions! velocity.
C
                ksa = dininl( ksa, -( dmaxl(
    +              qavea(i), cmdif(2'ic)/xl(i)**2)
    •f              *  dlog(kmax(ic+4*ipt(65)))))
 C
 C— PUT USER DEFINED AQUEOUS/SOLID MASS TRANSFER COEFFI-
 CIENT FUNCTION
 C— HERE.  ASSIGN IT TO KSA TO BYPASS BUILT-IN CONTROL.
 C
              else
                ksa = xkex*kex(5*(ic-l)+5)
              end if
 C
 C— Set the aqueous phase equilibrium mole fraction to zero if the
 O— solid phase mass fraction is nonpositive.
 C
              iftxmfl(is-t-i+iptl).le,zer0) then
                efrac = zcrO
              else
                efrac = ((xmf(is+i+iptl )/(xbok*bok(l)))
    +.              **(xbom*bom(l)))
    +              / ( cmw(ic) * den(iptl+i) * 1 .Od3)
              end if
              ccxas = sdaq * ksa
              ccx(iastistk) = cex(ias+istk) + cexas
              ccx(iss+istk+ipt2) = zerO
              pexas s eexas*(efrac-xnifa)
             pex(ipt2+istk) = pex(ipt2-Msfk) + pexas
             pe*(fpt2x8+istfc)
                = p*ex(ipt2x8+istk) - pexas*cmw(ic)
             pex(ipt2x64-istk)=pex(ipt2x6+istk)+pexas*crhw(ic)
             rnsex(is^istk-Hpt2)
   +            = fhsex(i^s+iitk4-ip't2) - pexas
             rfisex(iaS+istk)=rh'sex(ias+istk) + cexa'S * efrac
           eridif
         Sndif

C— Calculate aquebusTbiophaSe rhble transfer only if NAPL is absent
C— and the biofea'ctioh terms are riot in'sefted directly  ihto the
C— aqueous phase equations.

         if(lctrl(3)) then

C—    PUT  USER  DEFINED   AQUEOUS/BlOPHASE  MASS  TRANS-
FER COEFFICIENT
c—   FUNCTION HERE.  ASSIGN  rr TO ftAfi TO  UTILIZE BUILT-
IN coNf R'OL.
c
           if(limabj then
             kab = kex(5*(ic-i)+4)
C
   - Aqueous/biophaSe control oil mass transfer coefficient with the
C— greater of the aq'ireous pha'se advecfive velocity or
C— aqueous phase diffusiohal velocity.
C
             kab = dminU kab, -(dmaxl( q'a'vea(i)',
   +             cmdif(2*ic)/xl(i)**2)
   +             *dlog(kmax(ic+3*ipt(65)))))
C
C—    PUT  USER  DEFINED  AQUEOUS/BIOPHASE  MASS  TRANS-
FER COEFFICIENT
C—   FUNCTION HERE.  ASSIGN IT TO  KAB TO  UTILIZE  BUILT-
IN CONTROL.
C
           else
             kab = kex(5*(ic-l)+4)
           end if
C
C— Calculate cbnsfahis".
C
           sdaq = deh(ipti+i)
C
C— This form  assumes that biophase exchange is controlled in the
C— aqueous phase.
C
           sdb = sdaq
C
C— Update left hand side terms for aqueous phase equations. The
C— bibmass term a'ccounts for the volume of the reactive phase
C— properly.
C
            cexab = kab * sdb
C
C— Update aqueoUs/biophase phase mole exchange.
 C
            if(.not.lctrl(16))then
 C
 C— Set the aqueous and bio phase mole fractions to zero if they
 C— are nonpositive.
 C
             if(xmf(ia+i).le.zerO) then
               xmfa = zerO
             else
               xmfa = xmf(ia+i)
              end if
              if(xmf(ib+i).le.zerO) then
               xmfb = zerO
              else
               xmfb = xmf(ib+i)
              end if
              pex(ipt2+istk) = pex(ipt2+istk)
    +             - cexab * (xmfa - xmfb)
 C
 C— Update aqueous/biophase phase mass exchange.
 C
                                                                       204

-------
             pex(ipt2x6+istk) = pex(ipt2x6+istk)
   +             - cmw(ic) * cexab * (xmfa - xmfb)
C
C— Update biophase/aqueous phase mole exchange.
C
             pex(ipt2x4+istk) = pex(ipt2x4+istk)
   +             + cexab * (xmfa - xmfb)
C
C— Update biophase/aqueous phase mass exchange.
C
             pex(ipt2x9+istk) = pex(ipt2x9+istk)
   +             + cmw(ic) * cexab * (xmfa - xmfb)
C
C— Update the right hand side terms for the component transport
C— equations.
C                                                                 I
             rhsex(ias+istk) = rhsex(ias+istk)
   +             + cexab * xmf(ib+i)
             rhsex(ibs+istk) = rhsex(ibs+istk)
   +             + cexab * (xmfa - xmfb)
C
C— Do not consider aqueous/biophase phase mole exchange, however
C— include the bioreaction loss.
C
           end if
          end if
 100 continue
C
C— Now calculate mass exchange for oxygen. Mass exchange
C— for oxygen is only considered for bioventing simulations. First
C— compute pointers.
C
   if(lctrl(3)) then
     ico = ipt(15) + 2
C
C— Consider moist gas phase.
C
     if(icp(ipt(13)+2).eq.ico) then
      igo = (ipt(13)-H)*ipt(l)
      igos = (ipt(13)+l)*ipt2
C
C— Consider dry gas phase.
C
     else
      igo = ipt(13)*ipt(l)
      igos = ipt(13)*ipt2
     end if
     iao = ipt(9) + (ipt(14)-H)*ipt(l)
     ibo = ipt(12) + ipt(17)*ipt(I)
     iaos = ipt(3)*ipt2 + (ipt(14}il)*ipt2
     ibos = (ipt(3)+ipt(4)+ipt(5)+ipt(6))*ipt2 + ipt(17)*ipt2
C
C— Iterate over the nodes.
C
     do200i = l,ipt(l)
      if(lctrl(10)) then
        cvpt = cvp(ico)
        casolt = casol(ico)
      else
        itemp = (ico-l)*ipt(89)+idepth(i)
        itemp2 = (ico-l)*ipt(89)+3*ipt(88)+idepth(i)
        cvpt = cvp(ico) + dtemp(itemp)
        casolt = casol(ico) + dtemp(itemp2)
      end if
C
C—   PUT  USER  DEFINED  AQUEOUS/BIOPHASE  MASS  TRANS-
FER COEFFICIENT
C—  FUNCTION HERE. ASSIGN IT TO  KABO TO UTILIZE  BUILT-
IN CONTROL.
C
      if(limab) then
        kabo = kex(5*(ic-l)+4)
C
C— Aqueous/biophase control on mass transfer coefficient with the
C— greater of the aqueous phase advective velocity or
C— aqueous phase diffusional velocity.
C
        kabo = dminl( kabo, -(dmaxl( qavea(i),
   +        cmdif(2*ic)/xl(i)**2 ) * dlog(kmax(ic+3*ipt(65)))))
 C
 C—    PUT  USER  DEFINED  AQUEOUS/BIOPHASE  MASS  TRANS-
 FER COEFFICIENT
 C—   FUNCTION HERE.  ASSIGN  IT TO KABO TO  BYPASS BUILT-
 IN CONTROL.
 C
       else
         kabo = kex(5*(ic-l)+4)
       end if
 C
 C— Turn off aqueous/biophase oxygen exchange if the aqueous phase
 C— oxygen mole fraction is negative.
 C
       if(xmf(iao+i).lt.zerO) kabo = zerO
 C
 C— PUT USER DEFINED AQUEOUS/GAS MASS TRANSFER COEFFICIENT
 C—   FUNCTION HERE. ASSIGN IT  TO  KAGO TO  UTILIZE BUILT-
 IN CONTROL.
 C
       if(Iimag) then
         kago = kex(5*(ic-l)+l)
 C
 C— Gas/aqueous control on mass transfer coefficient with the greater
 C— of the gas or aqueous phase advective velocity or diffusional
 C— velocity.
 C
         kago = dminl( kago, -(dmaxl( qaveg(i)
   +        , qavea(i), cmdif(2*ic-l)/xl(i)**2, cmdif(2*ic)
   +        /xl(i)**2) * dlog(kmax(ic))))
 C
 C— PUT USER DEFINED AQUEOUS/GAS MASS TRANSFER COEFFICIENT
 C—   FUNCTION HERE. ASSIGN IT  TO  KAGO TO  BYPASS  BUILT-
 IN CONTROL.
 C
       else
         kago = kex(5*(ic-l)+l)
       end if
 C
 C— Turn off gas/aqueous oxygen exchange if the gas phase
 C— oxygen mole fraction is negative.
 C
       if(xmf(igo+i).lt.zerO) kago = zerO
 C
 C— Calculate constants. Use aqueous phase properties for the biophase
 C
       keqag = patm*casolt/cvpt
       sdaq = den(iptl+i)
 C
 C— This form assumes that exchange is into a biophase, the size of
 C— which is determined by the maximum allowable biomass. Aqueous
 C— phase material properties are used to determine the volume of the
 C— biophase.
 C
       sdb = sdaq
 C
 C— Update left hand side term for the aqueous phase equations.
 C— First consider aqueous/gas oxygen mole exchange.
 C
       cexago = sdaq * kago
       do 200 ii = 0, nodept(i+l)-nodept(i)-l
        istk = ii + nodept(i)
        sgcont = sat(istk)
        if(sgcont.lt.sgtest) cexago = zerO
        cex(iaos+istk) = cex(iaos+istk) + cexago
 C
 C— Then consider aqueous/biophase oxygen mole exchange. The biomass
C— term accounts for the volume of the reactive phase properly.
C
        cexabo = kabo * sdb
 C
C— Update aqueous/gas phase mole exchange.
C
        pexago = cexago * (keqag*xmf(igo+i) - xmf(iao+i))
        pex(ipt2+istk) = pex(ipt2+istk) + pexago
C
C— Update aqueous/gas phase mass exchange.
C
                                                                     205

-------
        pex(ipt2xfrtistk) = pex(ipt2xfrfistk) H- pexago*cmw(ico)
C
C— Updntc aqucous/biophase phase mole exchange.
C
        if(,Bot.fcttI(16))thett
C
C — Scl the aqueous and bio phase mole fractions to zero if they
C— are nonpositive,
C
          lf(xmf(iaKrt0.k!,zetO) then.
          else
           xmfa=xmf(iao+i)
          end if
          i(l(xmf(ibo+i).lc,zerO) then.
          else
                  xmf(ibo+i)i
          end if
          pexabo - cexabo * (xmfa - xmJb)
          pexflpG+istk) » pex(ipt2+istk) - pexabo
C
C— Update aqucous/biophase phase mole exchange.
C
          pcx(ipt2x6+istk) = pex(ipt2x6+istk) - pexabo*cmw(ico)
C
C — Update biophase/aqueous phase mole exchange.
C
          pex(ipt2x4+istk) = pex(ipt2x4+istk) + pexabo
C
C~ Update biophase/aqueous phase mass exchange.
C
          pcx(ipt2x9+istk) * pex(ipt2x9+istk) +• pexabo
C
C — Do not consider aqueous/biophase phase mole exchange, however
C— include the biorcaction loss.
C
         end if
C
C — Update gas/aqueous phase mole exchange.
C
         pcx(istk) = pex(istk) - pexago
C
C — Update the right hand side terms for the component transport
C— equations,
C
         rhsex(igostistk) =rhsex(igos+istk) - pexago
         rhsex(iaos+istk)
    •<•       s rhscxflaos+istk) +• cexago * keqag * xmf(igo+i)
         if(.noUctrl(16)) tlien
          rhscx(iaos+is:k) = rhscx(iaos+istk)
    •(-         +• cexabo * xmfb
          rhscx(ibos+!stk) = rhsex(ibos+istk)
    +         + cexabo * ( xmfa - xmfb )
         end if
  200   continue
 C
 C — Now calculate mass exchange for the nutrient. Mass exchange for
 C— nutrient is only considered for bioventing simulations.  First
 C— compute pointers.
 C
      if(fcttl(9))tncn
        ign = ipt(9)-ipt(l)
        ian = ipt(10)-ipt(l)
        ibn « ipt(12) + ipt(l) * (ipt(7)-2)
        igns-(ipl(3)-l)*ipt2
        ians = (ipt(3)+iptW-l)*ipt2
        ibns = (ipt(3)+ip!(4)+ipt(5Hipt(6>ipt(7)-2)*ipt2
  C
  C — Iterate over the nodes.
  C
        do2IOi=l,ipt(l)
          if
-------
 C— biomass term accounts for the volume of the reactive phase
 C— properly.
 C
           cexabn = kabn * sdb
 C
 C— Update aqueous/gas phase mole exchange.
 C
           pexagn = cexagn * (keqag*xmf(ign+i) - xmf(ian+i))
           pex(ipt2+istk) = pex(ipt2+istk) + pexagn
 C
 C— Update aqueous/gas phase mass exchange.
 C
           pex(ipt2x6+istk) = pex(ipt2x6+istk)+pexago*cmw(icn)
 C
 C— Update aqueous/biophase phase mole exchange.
 C
           if(.not.lctrl(16))then
 C
 C— Set the aqueous and bio phase mole fractions to zero if they
 C— are nonpositive.
 C
            if(xmf(ian+i).Ie.zerO) then
              xmfa = zerO
            else
              xmfa = xmf(ian+i)
            end if
            if(xmf(ibn+i).Ie.zerO) then
              xmfb = zerO
            else
              xmfb = xmf(ibn+i)
            end if
            pexabn = cexabn * (xmfa - xmfb)
            pex(ipt2+istk) = pex(ipt2+istk) - pexabn
 C
 C— Update aqueous/biophase phase mole exchange.
 C
            pex(ipt2x6+istk)
   +          = pex(ipt2x6+istk) - pexabn * cmw(icn)
 C
 C— Update biophase/aqueous phase mole exchange.
 C
            pex(ipt2x4+istk) = pex(ipt2x4+istk) + pexabn
 C
 C—• Update biophase/aqueous phase mass exchange.
 C
            pex(ipt2x9+istk) = pex(ipt2x9+istk) + pexabn
          end if
 C
 C— Update gas/aqueous phase mole exchange.
 C
          pex(istk) = pex(istk) - pexagn
 C
 C— Update the right hand side terms for the component transport
 C— equations.
 C
          rhsex(igns+istk) = rhsex(igns+istk) - pexagn
          rhsex(ians+istk) = rhsex(ians+istk)
   +         + cexagn * keqag * xmf(ign+i)
          if(.not.lctrl(16)) then
            rhsex(ians+istk) = rhsex(ians+istk)
   +           + cexabn * xmfb
            rhsex(ibns+istk) = rhsex(ibns+istk)
   +•           -i- cexabn * (xmfa - xmfb)
          end if
 210    continue
     end if
   end if
C
C— Calculate water mass exchange between the aqueous and gas phases.
C— This is done only when both mobile phases are present and water is
C— present in the gas phase. The presence of NAPL has no effect
C— on this term. Gas phase mole  fractions controls water mole
C— exchange.
C
   icw = ipt(15) + 1
   icl = icp(ipt(13)+l)
   if((icl.eq.icw).and.(ipt(3)+ipt(4)).ne.ipt(3))then
     igw = ipt(13)*ipt(l)
      iaw = ipt(9) -t- ipt(14)*ipt(l)
      igws = ipt(13)*ipt2
      do300i = l,ipt(l)
        if(lctrl(10)) then
         cvpt = cvp(icw)
        else
         itemp = (icw-l)*ipt(89)+idepth(i)
         cvpt = cvp(icw) + dtemp(itemp)
        end if
        keqw = cvpt/patm
 C
 C— PUT USER DEFINED GAS/AQUEOUS MASS TRANSFER COEFFICIENT
 C—  FUNCTION  HERE.  ASSIGN IT TO  KGAW TO  UTILIZE BUILT-
 IN CONTROL.
 C
       if(Iimag) then
         kgaw = kex(5*(ic-l)+l)
 C
 C— Gas/aqueous control on mass transfer coefficient with the greater
 C— of the gas or aqueous phase advective velocity or diffusional
 C— velocity.
 C
         kgaw = dminl( kgaw, -< dmaxl( qaveg(i)
   +       ,  qavea(ij, cmdif(2*ic-l)/xl(i)**2, cmdif(2*ic)
   +       /xl(i)**2) * dlog(kmax(ic))))
 C
 C— PUT USER DEFINED GAS/AQUEOUS MASS TRANSFER COEFFICIENT
 C—  FUNCTION HERE.  ASSIGN IT TO  KGAW TO  BYPASS BUILT-
 IN CONTROL.
 C
       else
         kgaw = kex(5*(ic-l)+l)
       end if
 C
 C—• Update constants.
 C
       sdgas = den(i)
       sdaq =  den(iptl+i)
 C
 C— Update left hand side terms for gas phase equations
 C
       cexagw = sdgas * kgaw
       do 300  ii = 0,nodept(Hi)-nodept(i)-1
         istk = ii + nodept(i)
         sgcont = sat(istk)
         if(sgcont.lt.sgtest) cexagw =zerO
         cex(igws+istk) = cex(igws+istk) + cexagw
 C
 C— Update aqueous/gas phase mole exchange.
 C
         pexagw = cexagw * (keqw*xmf(iaw+i) - xmf(igw+i))
         pex(ipt2+istk) = pex(ipt2+istk) - pexagw
 C
   - Update aqueous/gas phase mass exchange.
 C
         pex(ipt2x6+istk) = pex(ipt2x6+istk) - pexagw*cmw(icw)
 C
 C— Update gas/aqueous phase mole exchange.
C
         pex(istk) = pex(istk) + pexagw
 C
   - Update gas/aqueous phase mass exchange.
C
        pex(ipt2x5+istk) = pex(ipt2x5+istk) + pexagw*cmw(icw)
C
   - Update the right hand side terms for the gas phase transport
C—• equations. The aqueous phase does not have a water transport
C— equation since the effect of water mass exchange is  accounted
C— for through the phase exchange terms.
C
        rhsex(igws+istk) = rhsex(igws+istk)
   +       +  cexagw * keqw * xmf(iaw+i)
 300  continue
   end if
   return
   end
                                                                      207

-------
               ijie *• napjs,f
c
c
c
c
C   Arguments: jconv - integer flag for global convergence
C
C   Required Control Hi(gs:
C
C
C
c
c
c
c
c-
    NAPLSJ - Subroutine which updates the NAPL
          saturations using the finite element method.
     1(16) - convergence criterion for immobile phases

    Control Flags computed internally in routine:

     ipt(38) - flag specifying time step modification
   subroutine NAPLS(konv)
   include 'dimcn.lnc'
C
C — Pccliira jind deli ne common block variables.
C
   common /cbl/ matel(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +       matpt(nn6)
   common fcblc/ abyl2(nelmx),aby30(nelmx)
   common /cb3/ sat(nnstk3)
   common /cb3b/ satt(nnstk3)
   common /cbfib/ porfnclmx),srw(nnstk)
   common /cblO/ den(nnS)
   common /cblOb/ dden(nn6),pmwt(nn3),dent(nn6)
   common /cbl l/pex(nnslO),rxnp(nn2)
   common /cWO/ a(icnl),rhs(nsolve),w(icnl)
C
C— Set pointers,
C
    fpt(38)=0
    mssjpt(49)
    insm = ipt(54)
C
C — Begin iterations.
C
    do400itnapl=l.ipt(33)
     dollOi = l,ipt<2)
       tlis(i) = zerO
  110    a(i) = zcrO
     do I20i=l,ipl(0)
 C
 C— Set the pointers to the local nodes II, 12, and 13. The
 C— postscript s is for stacked local nodes, and p is for phase
 C — Compute constants.
 C
       ie!3 = i*3
       icll  = ie!3-2
       icl2  = ic!3-I
       ilsnodcHiell)
       1 1 s = nodepl(i I } i- nc!pt(iel 1 )
       ilpsm = insm4 Us
       12-nodcl(iel2)
       i2s = nodep«i2>tnelpt(iel2)
       i2psm — insm + i2s
        i3s = nodepl(i3)+nclpt(iel3)
        i.lpsm = insm + i3s
        dl =ronc
        d2 s rone
        03 = rone
        term = por(i)'aby30(i)/l(8)
  C
  C— Compute the mass matrix.
  C
        a! I =Merm*( 3.0dO*dl +   d2+    d3)
        al2 = term*(    dl+    d2+   d3/2.0dO)
        al3sterm*(    dl+    d2/2.0dO + d3 )
        all=al2
        «22 m term*(    dl + 3.0dO*d2 +    A3 )
                                      43)
      a31,=al3

      s33i=term*,(    dH-    4213,OdO*d3)

             'mass* matrix.
      aU=aH+aJ24-al3
      a!2 = zerO
      aJ3 = zerO
      a22 = a
      a21 = zerO
      a23 = zerO
      a31=zerO
      a32 = zerO

C— Now compute the right hand side terms.
       ,..  . 2 = por(i)*abyl2(i)
       if(ipt(5).gt.l)then
        rhsl = pex(ilpsm)
        rhs2 = pex(i2psm)
        rhs3 = pex(i3psm)
       else
        rhsl =pex(ilpsm)
        rhs2 = pex(i2psm)
        rhs3 = pex(i3psm)
       end if
       fl = term!2 * ( 2.0dO*rhsl +    rhs2 +    rhs3)
       f2 = term!2*(    rhsl+2.0dO*rhs2+    rhs3)
       f3 = term!2*(    rhsl+    rhs2 + 2.0dO*rhs3)
^
C— Assemble global matrix and right hand side vector. Note that
C— the left hand side matrix is diagonal due to mass lumping and
C— the solution is therefore explicit.
C
                                                                           120
                                                                           C
                                                                           C—
                                                                           c—
                                                                           c
       a(i2s) = a(i2s) + a22
       a(i3s) = a(i3s) + a33
       rhs(ils) = rhs(ils) + fl
       rhs(i3s) = rhs(i3s) + f3
       continue

     Solve for saturations.  Skip any node where the NAPL saturation
     is zero. Determine the max norm of the updated solution.

      dsat = zerO
      satmax = smino
      do!50i=l,ipt(l)
       do!50ii = 0, nodept(i+l)-nodept(i)-l
         imat = nodept(i)+ii
         isat = imat + ins
         satold=sat(isat)
         if(sat(isat).gt.smino) then
           if(a(imat).ne.zerO) then
            sat(isat) = (dent(ipt(l)*5+i)*satt(isat)
    +           + rhs(imat)/a(imat))/den(ipt(l)*5+i)
            satmax = dmaxl(satmax,dabs(sat(isat)))
            dsat = dmaxl(dsat,dabs(sat(isat)-satold))
           end if
         else
  C
  C — Set NAPL saturation equal to zero when it falls below zero.
  C
  150
  C
           sat(isat) = zerO
          end if
        continue
      Return when NAPL has only one component.

      if(ipt(5).eq.l)then
        ipt(38) = 1
                                                                       208

-------
        return
      endif
 C
 C— Check convergence with the relative change in state variable for
 C— the multicomponent case.
 C
      if(dsat/satmax.le.t(15)) then
        if(ipt(28).gt.O) then
         write(ipt(28),*)' NAPL saturation iterations =', itnapl
        endif
        if(itnapl.le.ipt(34)) ipt(38) = 1
        return
      endif
  400 continue
    write(*,*) 'Maximum iterations exceeded in NAPLS; ', itnapl-1
    iconv = iconv + 1
    return
    end
 Subroutine - naplx.f
 C		
 C
 C    NAPLX.f - Subroutine which updates the NAPL phase
 C          mole fractions using the finite element method.
 C
 C    Arguments: iconv - integer flag for global convergence
 C
 C   Required Control Flags:
 C
 C     t( 16) - convergence criterion for immobile phases
 C     Ictrl(S) - logical variable controlling type of FEM
 C           solution for transport
 C             Ictrl{8)= .true. - use mass lumping
 C             lctrl(S) = .false. - full FEM solution
 C
 C		
    subroutine NAPLX(iconv)
    include 'dimen.inc'
    character*10 cname(ncmp)
 C
 C— Declare and define common block variables.
 C
    common /cbl/ matel(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +       matpt(nn6)
    common /cble/ abyl2(nelmx),aby30(nelmx)
    common/cb3/ sat(nnstk3)
    common /cb6b/ por(nelmx),srw(nnstk)
    common/cb9/ xmf(nmf)
    common/cb9b/ xmft(nmf)
    common /cblO/ den(nn6)
    common /cbl II pex(nnslO),rxnp(nn2)
    common /cb40/ a(icnl),rhs(nsolve),w(icnl)
    common /cb41/ irn(icnl),icn(icnl),iw(icnl,8),ikeep(icnl,5)
    common /cb41b/ nbw(0:2),ia
    common /cb62/ rxn(nmf),cex(nmfs)
    common /cb91/ cname
C
C— Set pointers.
C
    in = ipt(40)
    ins = ipt(49)
C
C— Now sequentially solve for the NAPL mole fractions.
C
    do 200 icnapl = l,ipt(5)
     iptc = ipt(58) + icnapl
     icpt = (iptc-l)*ipt(l)
     icpts = (iptc-l)*ipt(2)
C
C— Zero the finite element matrices.
C
     do210i =  l,ipt(2)
       rhs(i) = zerO
       nrow = (i-l)*nbw(l)
       do210j=l,nbw(l)
 210      a(nrow+j) = zerO
C
C— Compute the local finite element matrices.
C
      do 220 i = l,ipt(0)
 C
 C—  Set the pointers to the local nodes 11,12, and 13. The
 C—  postscript s is for stacked local nodes, p is for phase, and
 C—  c is for component. Compute constants.
 C
       ie!3=i*3
       iell =ieI3-2
       iel2 = ie!3-l
       il=nodel(iell)
       ils = nodept(il)+nelpt(iell)
       ilp = in + il
       ilps = ins + ils
       ilc = icpt + il
       ilcs = icpts + ils
       i2 = nodel(ie!2)
       i2s = nodept(i2)+nelpt
-------
      b31=b!3
      b32 = b23
      b33 = tenn30*(pexl
C
C~— Lump the "mass" matrix.
C
      if(lctrl(S)) then
        all sa
        a2l szcrO
                            + pex2    + 3.0dO*pex3)
      end if
C
C— Now compute the right hand side terms.
C
      lcrmI2 = porfi)*abyl2(i)
      rhsl =cex(ilcs)
       rhs3=ccx(i3cs)
       n « tcnnl2 * ( 2.0dO»rhsl +   rhs2 +    rhs3)
       R « tcrmlZ * (    rhsl + 2,OdO*rhs2 +    rhs3 )
                        rhsl +    rhs2 + 2.0dO*rhs3)
    • Assemble global matrix and right hand side vector in banded form.

       irowl=(il-l)*nbw(l)
       irow2 = (i2-l)*nbw{l)
       Irow3*(i3-l)*nbw(l)
       koll2*icom+(!2-il)
       icol2I=ico122 + (il-i2)
       Icol23 = icol22+(i3-i2)
       icol33
       tbl 1 sail + l(10)*bll
       ab21=«21+t(10)*b21
       ab3l=a3H-t(10)*b31
  220
 C
 C —
 C —
 C
       a(irowl -t-icolll) = a(irowl -t-icolllj + abll
       a(trowl +ico!12)=a(irowl -Hcoll2) + abl2
       n(irowl +icoll3) = a(irowl+icoll3) + abl3
       a(irow2 + ico!21 ) = a(irow2 + ico!21 ) + ab21
       a(irow2 + ico!22) - a(irow2 -f- ico!22) + ab22
       a(irow2 + ico!23) = a(lrow2 +• ico!23) + ab23
       a(irow3 + Icol31) = a(irow3 + ico!31) + ab31
       a(irow3 + ico!32) = a(irow3 + ico!32) + ab32
       a(irow3 4- ico!33) = a(iro%v3 + ico!33) + ab33
       riis(il) = rlis(il) + fl -bll *xmft(ilc)
           -bl2*xmft(i2c)-bl3*xnift(i3c)
       rhs(i2) * rhs(i2) + tl - b21 * xmft(ilc)
           -b22*xmft(i2c)-b23*xmft(i3c)
       rhs
-------
 Subroutine - prnt.f
 c—	
 c
 C   PRNT.f - outputs current values of selected variables
 C        defined in the logical array'Iprnt'.
 C
 C   Required Control Flags:
 C
 C    Ictrl(l) - logical variable controlling presence of flow
 C           solution
 C            lctrl(l) = .true, -computeflow solution
 C            lctrl(l) = .false. - skip flow solution
 C    lctrl(2) - logical variable controlling presence of transport
 C           solution
 C            lctrl(2) = .true. - compute transport solution
 C            lctrl(2) = .false. - skip transport solution
 C    Ictrl(3) - logical variable controlling inclusion of
 C           biodegradation
 C            lctrl(3) = .true. - include biodegradation
 C            lctrl(3) = .false. - neglect biodegration
 C    lctrl(lS) - logical variable denoting type of q calculation
 C            lctrl(18) = .true.-nodelFEMq
 C            lctrl(18) = .false. - element average q
 C    lctrl(19) - logical variable controlling type of sorption
 C            lctrl(19) = .true. - two compartment sorption
 C            lctrl(19) = .false. - single compartment
 C                         sorption
 C    lctrl(23) - logical variable controlling the printing of
 C           contour plot data
 C            lctrl(23) = .true. - print contour plot data
 C            lctrl(23) = .false. - do not print contour
 C                         plot data
 C
 C	
    subroutine PRNT (its)
    include 'dimen.inc'
    character*20infile(4),outpre,outfile(8+ncmp)
    character* 10 cname(ncmp)
    common /cbl/ matel(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
   +   matpt(nn6)
    common /cblc/ xnode(nnmx),znode(nnmx),rbar(nelmx),area(nelmx)
    common/cb2/ p(nn3)
    common /cb2c/ q(ne!4)
    common/cb3/ sat(nnstk3)
    common /cb6b/ por(nelmx),srw(nnstk)
    common /cb7b/ cmw(ncmp),cvp(ncmp),cden(ncmp),
   +   chen(ncmp),casol(ncmp),cmdif(ncmp2)
    common /cb9/ xmf(nmf)
    common /cblO/ den(nn6)
    common /cb 10b/ dden(nn6),pmwt(nn3),dent(nn6)
    common /cbl II pex(nns 10),rxnp(nn2)
    common /cb64/ bok(nbcmp),bom(nbcmp),krtd(ncmp)
    common /cb64b/ bsden(nmblk)
    common /cb86/ Strl(ncmpp5),str0(ncmpp5),cmf(ncmpp5),csink(ncmpp5)
   +   ,cwsink(ncmpp5),csflux(ncmpp5),cmassl(ncmp5),cmassO(ncmp5)
   +   ,cphex(ncmpp5),crsink(ncmpp5),tmassl,tmassO
    common /cb90/ infile,outpre,outfile
    common /cb91/ cname
C
C— Dimension local arrays, rcont, contr, and xm are dimensioned
C— with two less than maximum number of output columns divided by
C— 10.  Currently dimensioned to support 132 column output maximum.
C
    dimension tp(nnstk3),rcont(l l),xm(l 1)
    character contr(l 1)*10
C
C— Nout + 2 is the number of output columns desired in outpre.con
C— Currently set to 5 columns for 80 column output. Set nout to 6
C— for 132 column output.
C
    data nout/3/
C
C— Print header and time.
C
    write (21,500) its,t(9),t(9)/60.0dO,t(9)/3600.0dO,t(9)/.8640d5
 C— Print nodel gas phase pressure.
 C
    if(Iprnt(9))then
       Doi = l,ipt(l)
         tp(i) = (patm+p(i)) / patm
       EndDo
       callfprnt(21,tp(l),ipt(l),
   +          '@ Nodal gas phase pressure (atm)')
    endif
 C
 C— Print nodel aqueous phase pressure.
 C       ...
    if(lprnt(10))then
       Doi = l,ipt(l)
         tp(i) = (patnH-p(ipt(l)-t-i)) / patm
       EndDo
       caUfprnt(21,tp(l),ipt(l),
   +          ' @ Nodal aqueous phase pressure (atm)')
    endif
 C
 C— Print nodel capillary pressure.
 C
    if (lprnt(l 1)) call fprnt (21,p(2*ipt(l)+l),ipt(l),
   +          ' @ Nodal gas/aqueous capillary pressure (Pa)')
 C
 C— Print gas phase mass or molar density.
 C
    if(lprnt(12))then
     if(lprnt(8))then
       call fprnt (21,den(l),ipt(l),
   +       ' @ Gas phase molar density')
     else
       call fprnt (21,den(3*ipt(l)+l),ipt(l),
   +       ' @ Gas phase mass density')
     endif
    endif
 C
 C— Print aqueous phase mass or molar density.
 C
    if(lprnt(13))then
     if(lprnt(8))then
       call  fprnt (21,den(ipt(l)+l),ipt(l),
   +      '@ Aqueous phase molar density')
     else
       call  fprnt (21,den(4*ipt(l)+l),ipt(l),
   +      '@ Aqueous phase mass density')
     endif
   endif
C
C— Print NAPL phase mass or molar density.
C
   if(Iprnt(14))then
     if(lprnt(8))then
       call  fprnt (21,den(2*ipt(l)+l),ipt(l),
   +      ' @ NAPL phase molar density')
     else
       call fprnt (21,den(5*ipt(l)+l),ipt(l),
   +      '@ NAPL phase mass density')
     endif
   endif
C
C— Print gas phase component output.
C
   if(lprnt(15))then
     do!0i=l,ipt(3)
       ic=icp(i)
       iptc=(i-l)*ipt(l)
       if(lprnt(8))  then
        call rprnt(21,xmf(iptc+l),ipt(l),
   +     ' @ Nodal gas phase component mole fractions:'
   +       //cname(ic))
       else
        do!5ii = l,ipt(l)
                                                                       211

-------
 1 5        lp(ii) * xmf{iptc+ii) * den(ii) * cmw(ic)
        callfprnt(2|,lp(l)>ipt(l),
   +     ' @ Nodal gas phase component concentrations (g/j):
   t        //ename(ic))
       end if
 10   continue
   cnJif
C
C— Print aqueous phase component output.
C
   if(lpmtpt(4)+ipt(5)
       ic=icp(i)
       if(lpnit(8))tlicn
         call fprm(21,xmf(iptc+l),ipt(l),
   +     ' • Nodal NAPL phase component mole fractions: '
   +       //cnamc(ic))
       else
         do35ii=l,ipt(l)
 35         tp(ii) = xmf(iptc+ii) * den(ipt(40)+ii) * cmw(ic)
         callfpfnt<21,tp(l),ipt(l),
   +     '© Nodal NAPk phase component concentrations (g/L): '
   +       /fcnanxKlc))
       end if
 30    continue
    cndif
 C
 C — Print solid phase mass loadings,
 C
    if(lpml(18))lhen
      do 40 i=l+ipt(3)+ipt(4)+ipt(5),ipt(3)+ipt(4>l-ipt(5)H-ipt(6)
       Ie=iep(i)
       iptc=KM)*ipt{l)
       if fktrl(19)) then
         if(i-!pl(3)-ipt(4Hpt(5),eq.l)then
          call fprnt(21,xmf(iptc+l),ipt(l),
   +         ' ® Nodal slow solid phase component moss '
   •*•         //"loading gm/gm (slow compartment): '
   •f         //cnametic))
 45          lp(ii) * xmf(iptc+ii)*(rone-xden)
             call fprnl(21,tp(l),ipt(l),
    +           '@ Notlal slow solid phase component mass '
    +           //"loading gm/gm(bulk): '
    +           //cnamc(ic))
         else if (i.ipt(3).ipt(4).ipl(5).eq,2) then
           ieaicp(i-l)
           call fprnt(21,xmf(iptc+l),ipt(l),
    +          ' @ Nodal fast solid phase component mass '
    +          //"loading gm/gm(fast compartment): '
    +          //cnamc(ic))
           do50ii = l,ipt(l)
 50          tp{ii) m xmf(ipte+ii)*xden
             caHfprnt(2I,tp(l),ipt(I),
    •*•            '© Nodal fast solid phase component mass '
    +           If loading gm/gm(bulk): '
    +           //cnamc(ic))
          .do55ii = l,ipt(l)
55           jp(ii) = xmf(iptc+ii)*xden
  +           + xmf(iptc-ipt(l)+ii) * ( rone - jtden )
            callfprrit(21,tp(l),ipt(|),
  +           "@ Np.dal total solid phase component mass '
  t           //' loading gm/gm(bulk): '
  t           //cname(ic))
        end if
       else
        call fprnt(21,xrnf(iptctl),ipt(l),
  t        ' <§ Nodal splid phase cpmppnent mass '
  +        //'loading gm/gm(bu!kj: '
  +        //cnam.e(ic))
       end if
40    continue
   endif
C
  - Print biophase phase mole fractions.
C
   if(lprnt(19))then
     do 60 i=l+ipt(3)+ipt(4)+ipt(5)+ipt(6),
  +    ipt(3)tipt{4)t"Pt(5)tipt(6)4-ipl(7)-l
       ic=icp(i) "
       iptc=0-))*ipKD
       if(lprnt(8))then
        call fprnt(21,xmf(iptc+l),ipt(l),
  +     '@ ^odal bio-phase component mole fractions: '
  +        //cname(ic))
       else
        do65ii = l,ipt(l)
 65          tp(ii) = xmf(iptc+ii) * den(ipt(l)+ii) * cmw(ic)
        callfprnt(21,tp(l),ipt(l),
   +     '@ Nodal  bio-phase component concentrations (g/L):
   +        //cname(ic))
       endif
 60    continue
     call fprat(2 1 ,xmf(ipt(l )+iptc+ 1 ),ipt( 1 ),
   +     ' @ Nodal bio-phase biomass concentration')
    endif
c
c — Compute and print an element average total organic soil
c — • concentration.
c
    If (lprnt(29).or.lcon(!8)) then
     Do jel = 1 ,ipt(0)    Hoop over number of elements
       n3=(jel-l)*3
       xl = rbarfjel) * area(jel) * third
       x = xl * por(jel)
       iptlxS = ipt(41)
       il =  node!(n3+l)  ! element node numbers
       \2 =  npdel(n3+2)
       |3=nodel(n3+3)
       igl = il      ! nodel gas phase storage locations
       ial = ipt(l )+igl  ! nodel aqueous phase storage locations
       ia2 = ipt(l)+ig2
       ia3 = ipt(l)+ig3
       inl = ipt(l)+ial  ! nodel napl phase storage locations
       in2 = ipt(l)+ia2
       in3 =ipt(l)+ia3
       ndstkl = nodept(il) + nelpt(n3+l) ! node position in stack
       ndstk2 = nodept(i2) + nelpt(n3+2)
       ndstk3 = nodept(i3) + nelpt(n3+3)
       igls = ndstkl    ! gas phase stacked node numbers
       ig2s = ndstk2
       ig3s = ndstkS
       ials = ipt(2)+igls !  aqueous phase stacked node numbers
       ia2s = ipt(2)+ig2s
       ia3s = ipt(2)+ig3s
       inls = ipt(2)+ials !  napl phase stacked node numbers
       in2s = ipt(2)+ia2s
       in3s = ipt(2)+ia3s
       Wnapl = x * (    !  mass of napl
             den(iptlx3+inl)*sat(inls) +
             den(iptl x3+in2) * sat(in2s) +
             den(iptlx3+in3)*sat(in3s))
       Onapl = Wnapl     ! mass of organic in napl
                                                                          212

-------
        Waq = x * (     ! mass of aqueous phase
    +       den(iptlx3+ial)*sat(ials) +
    +       den(iptlx3+ia2) * sat(ia2s) +
    +       den(iptlx3+ia3) * sat(ia3s))
        Oaq = zerO      ! mass of organic in aqueous phase
        Doi = l,ipt(14)
         ipipt3 = i + ipt(3)
         ic = icp(ipiptS)
         iaqc = (ipipt3-l)*ipt(l)
         Oaq = Oaq + krtd(ic) * x * cmw(ic) * (
    +        den(ial) * sat(ials) * xmf(iaqc+il) +
    +        den(ia2) * sat(ia2s) * xmf(iaqc+i2) +,
    +        den(ia3) * sat(ia3s) * xmf(iaqc+i3))
        EndDo
        Wgas = x*(    ! mass of gas phase
    +        den(iptlx3-Higl)*sat(igls) +
    +       den(iptlx3+ig2) * sat(ig2s) +
    +       den(iptlx3+ig3) * sat(ig3s))                                 '
        Ogas = zerO     ! mass of organic in gas phase
        Doi = l,ipt(13)
         igasc = (i-l)*ipt(l)
         ic = icp(i)
         Ogas =  Ogas + x * cmw(ic) * (
    +        den(igl) * sat(igls) * xnrf(igasc+il) +
    +        den(ig2) * sat(ig2s) * xmf(igasc+i2) +
    +        den(ig3) * sat(ig3s) * xmf(igasc+i3))
        EndDo
        Wsld = bsden(matel(jel))*rbar(jel)*area(jel) ! mass of solid
        Osld = zerO         ! mass of organic in solid phase
        Doi = l,ipt(16)
         ipiptS = i + ipt(59)
         ic = icp(ipipt5)
         isc = (ipipt5-l)*ipt(l)
         If(xbok.gt.zerO)then
           If(i.eq.l)then
             solden = (rone-xden)*bsden(matel(i))
           Else If (i.eq.2) then
             isum = ipt(3)+ipt(4)+ipt(5)
             ic = icp(isum+i-l)
             solden = xden*bsden(matel(i))
           End If
           Osld = Osld + solden*
   +           ( xmf(isc+i 1) + xmf(isc+i2) + xmf(isc+i3) )
   +           *xl
         Else
           Osld = Osld + bsden(matel(jel)) *
   +           (xmf(isc+il) + xmf(isc+i2) + xmf(isc+i3))
   +           *xl
         Endlf
       EndDo
c       tp(jel) = 1 .d6*(Onapl+Oaq+Ogas+Osld)/CWnapl+Waq+Wgas+Wsld)
       tp(jel) = l.d6*(OnapI+Oaq+Ogas+Osld)/(Ws!d)
     EndDo
     If (lprnt(29)) call fprnt (21,tp(l),ipt(0),
   +   '@ Element average total organic soil  concentration (ppm)')
    Endlf
C
C— Print nodel gas phase saturation.
C
    if(Iprnt(20))then
     if(ipt(l).eq.ipt(2)) then
       call fprnt (21,sat(l),ipt(l),' @ Gas phase saturation')
     else
       call fprnt2 (21,sat(l),ipt(2),'@ Gas phase saturation'
   +      ,matpt,nodept,ipt(l))
     end if
    end if
C
C— Print nodel aqueous phase saturation.
C
    if(lprnt(21)) then
     if(ipt(l).eq.ipt(2)) then
       call fprnt (21,sat(ipt(l)+l),ipt(l),
   +      ' @ Aqueous phase saturation')
     else
       call fprnt2 (21,sat(ipt(2)+l),ipt(2),
   +•       '@ Aqueous phase saturation',matpt,nodept,ipt(I))
     end if
 C— Print nodel NAPL phase saturation
 C
    if(Iprnt(22)) then
      if(ipt(l).eq.ipt(2)) then
        call fprnt (21,sat(ipt(40)+l),ipt(l),
    +       '@ NAPL phase saturation')
      else
        call fprnt2 (21,sat(ipt(49)+l),ipt(2),
    +       '@ NAPL phase saturation',matpt,nodept,ipt(l))
      end if
    end if
 C
 C—  Print gas phase Darcy velocities.
 C
    if(lprnt(23))then       '•
 C
 C—  Print nodal Darcy velocities.
 C
      if(lctrl(18))then
        call fprnt (21,q(l),ipt(l),
    +       '@ Nodal gas phase x Darcy velocity (m/sec)')
        call fprnt (21,q(ipt(l)+l),ipt(l),
    +       ' @ Nodal gas phase z Darcy velocity (m/sec)')
 C
 C— Otherwise print element Darcy velocities.
 C
      else
       call fprnt (21,q(l),ipt(0),
    +       '@ Element gas phase x Darcy velocity (m/sec)')
       call fprnt (21 ,q(ipt(0)+l ),ipt(0),
    +       ' @ Element gas phase z Darcy velocity (m/sec)')
     end if
    end if
 C
 C— Print aqueous phase Darcy velocities.
 C
    if(lpmt(24))then
C
C— Print nodal Darcy velocities.
C
     if(lctrl(18))then
       call fprnt (21,q(ipt(40)+l),ipt(l),
   +       ' @ Nodal aqueous phase x Darcy velocity (m/sec)')
       call fprnt (21,q(ipt(41)+l),ipt(l),
   +       '@ Nodal aqueous phase z Darcy velocity (m/sec)')
     else
       call fprnt (21,q(ipt(67)+l),ipt(0),
   +       ' @ Element aqueous phase x Darcy velocity (m/sec)')
       call fprnt (21,q(ipt(68)-H),ipt(0),
   +       ' @ Element aqueous phase z Darcy velocity (m/sec)')
     end if
    end if
C— Write contour information.
C
   if(lctrl(23)) then
     ipcon = 0
     if(lcon(2)) then
       ipcon = ipcon + 1
       contr(ipcon) = * gas p   '
     end if
     if(Icon(3)) then
       ipcon = ipcon + 1
       contr(ipcon) =' aq p    '
     end if
     if(Icon(4)) then
       ipcon = ipcon + 1
       contr(ipcon) = ' cap p   '
     end if
     if(lcon(5)) then
       ipcon = ipcon +1
       contr(ipcon) = * gas den '
     end if
     if(lcon(6)) then
       ipcon = ipcon -f 1
                                                                          213

-------
     contrQpcon) =' aq dcij  *
   cndif  '
     ipcon s ipcon + J
     contr(ipcon) '-' nap! pt(71).and.
   +               i.gt.ipt(69)-fipt(70)) then
            contr(i-ifiisl+l) =' NAPL   '
          clseif(i.le.ipt(69)+ipl(70)+ipt(71)+ipt(72).and.
   +.               i.gt.ipt(69)+ipt(70)+ipt(71)) then
            comr(i-ifirst*l) =' solid   '
          else
            contr(i-ilirst+-I) =' biophase'
          end if
 S3       continue
         wrile(24,*)' elapsed time=',t(9)
         writc(24,*)'
   +        (conlr(i-ifirsn-l ),i=ifirst,ilast)
         wrilc(24,*)' x     z     ',
   •f        (cnamc(icp(ipt(61 )+i)),i=ifirst,ilast)
         if(Icon(l))then
           write(24,*) ' x& in m; composition in mole fractions'
                , ' solid phase loading in g/g; biomass in g/L'
          else
            write(24,*) ' x,z in ny, comppsifiqn in gni/]L'
                , ' solidphase loading In, g/g; bioniass in g/L'
          end if
          do90i = J
               ,
              ifQcon(l))then
                xm(iirifirst-H) = rone
              else

  C— Convert gas phase mole fractions into concentrations (g/L) if
  ""•   lcon(l) = false.

                if(ii.le.ipt(69)) then
                  xm(ii-ifirst+l) = den(i)*cmw(icp(ipt(61)+ii))

  C — Convert aqueous and biophase mole fractions into concentrations
  C — (g/L) if lcon(l) = false.  Biomass is always gm/L.
                ej§e,if((ii.le.ipt(69)+ipt(70).and.ii.gt.
                      ipt(69)).br.(ii.le.ipt(74)..aiid.ii
                      .gt.ipt(74)-ipt(73))) then
                  if(jcp(ipt(61)tii).eq.ipt(65)+J)then
                    xm(iHlr?.t-H) = rone
                  else''
                  " "jtm(ii-ifirsH-l) = den{ipt(l)+i)
                     " * cmw(icp(ipt(61Hii))
                  end if
   C— Convert NAPL mole fractions to concentrations (g/L).
   C
                else if (ii.Je.ipt(69)+ipt(70)tipt(71).and.
      +               ii.gt.ipt(69)+ipt(70)) then
                  xm(ii-ifirst+l) = den(ipt(40)+i)
      +               * cmw(icp(ipt(61)+ii))
   C
   C— Solid phase loadings are always g/g.
   C
                else
                  xm.(ii-ifirst+l) = rone
                end if
               end if
    95         cojjtjnue
    90         writs(2^,550) xno,de(i),znodleG),(xmfQ+icp(ipt(61)
      +          +ipt(74)+ii))*xm(ii-ifirst+l ),ii=ifirst,ilast)
            if(ipass.gt.l)then
             ifirst = iflrst + nout
             ilast = minO(ipt(74),ilast + nout)
            end if
    80      continue
        end if  "
        if(lcon(13).or.lcon(14).or.lcon(15))then
          write(24,*j' elapsed time=',t'(9)
          ipcon = 0
          if(lcon(13)) then
            ipcon = ipcon  + 1
            contr(ipcon) = ' gas sat  '
          end  if
          if(lcon(14)) then
            ipcon = ipcon  + 1
            contr(ipcon) = ' aq sat  '
          end if
          if(lcon(15» then
            ipcon = ipcon -f 1
            contr(ipcon) = ' napl sat'
          end if
          write(24,*)' x     z     ',(contr(i),i=l,ipcon)
          if(ipt(l).eq.ipt(2))then
             write(24,*)' x,z in m'
          else
             write(24,*)' x,z in m; sat stacked'
          end if
           do lOOi = l,ipt(l)
             do 100 istk =  0, nodept(i+l)-nodept(i)-l
               ipcon = 0
               if(lcon(13))then
                ipcon = ipcon + 1
214

-------
             rcont(ipcon) = sat(nodept(i)+istk)
           end if
           if(Icon(14))then
             ipcon = ipcon + 1
             rcont(ipcon) = sat(nodept(i)+istk+ipt(2))
           end if
           if(lcon(15))then
             ipcon = ipcon -1-1
             rcont(ipcon) = sat(nodept(i)+istk+ipt(49))
           end if
 100       write(24,550) xnode(i),znode(i),(rcont(ii),ii=l,ipcon)
     end if
     if(Icon(16).or.lcon(17)) then
       ipcon = 0
       if(lcon(16))then
         ipcon = ipcon +  1
         contr(ipcon) =' gas qx  '
         ipcon = ipcon +  1
         contr(ipcon) = ' gas qz  '
       end if
       if(lcon(17))then
         ipcon = ipcon 4- 1
         contr(ipcon) = ' aq qx   '
         ipcon = ipcon + 1
         contr(ipcon) =' aq qz   '
       end if
       write(24,*)' elapsed time=',t(9)
       write(24,*)' x     z     ',(contr(i),i=l,ipcon)
       if(Ictrl(18))then
         write(24,*) 'x,z in m; nodal q in m/s'
         dol!0i = l,ipt(l)
          ipcon = 0
          if(lcon(16)) then
            ipcon = ipcon + 1
            rcont(ipcon) = q(i)
            ipcon = ipcon + 1
            rcont(ipcon) = q(i+ipt( 1))
          end if
          if(lcon(17)) then
            ipcon = ipcon + 1
            rcont(ipcon) = q(i+ipt(40))
            ipcon = ipcon + 1
            rcont(ipcon) = q(i+ipt(41))
          end if
110        write(24,550) xnode(i),znode(i),(rcont(ii),ii=l ,ipcon)
      else
        write(24,*)
  +      'x,z in m (element centroids); element q in m/s'
        doll5i = l,ipt(0)
          ipcon = 0
          if(Icon(16))then
            ipcon = ipcon + 1
            rcont(ipcon) = q(i)
            ipcon = ipcon + 1
            rcont(ipcon) = q(i+ipt(0))
          end if
          if(lcon(17)) then
            ipcon = ipcon + 1
            rcont(ipcon) = q(i+ipt(67))
            ipcon = ipcon + 1
            rcont(ipcon) = q(i+ipt(68))
          end if
          ie!3 = i*3
          iell=ie!3-2
          iel2 = ie!3-l
          il = nodel(iell)
          i2 = nodel(ie!2)
          i3 = nodel(iel3)
          xel = third*(xnode(il)+xnode(i2)+xnode(i3))
          zel = third*(znode(il)+znode(i2)+znode(i3))
115        write(24,550) xel,zel,(rcont(ii),ii= 1 ,ipcon)
      end if
    end if
    If(lcon(18))then
      write(24,*)' elapsed time=',t(9)
      write(24,*)' x     z    Total organic soil cone'
      write(24,*) 'x,z in m (element centroids); cone (ppm)'
      Doi = l,ipt(0)
          ieI3 = i*3
          iell=iel3-2'
          iel2 = ie!3-I
          il=nodel(iell)
          i2 = nodel(ie!2)
          i3 = nodel(ie!3)
          xel = third*(xnode(il)+xnode(i2)+xnode(i3))
          zel = third*(znode(il)+znode(i2)+znode(i3))
          write(24,550) xel,zel,tp(i)
        EndDo
      Endlf
    end if
 C
 C— Generate a restart file if desired.
 C
    if(lctrl(5)) then
      rewind(27)
      write(27,556) '# ipt(i),i=0,7'
      write(27,549) (ipt(i),i=0,7)
      write(27,556) '#,t(8),t(2),t(9),its'
      write(27,551) t(8),t(2),t(9),its                   '
      write(27,556) '# strl(i),strO(i),cmf(i),csink(i),cwsink(i)'
      write(27,556) '# crsink(i),csflux(i),cphex(i),i=l,',ipt(65)+5
      write(27,555) (strl (i),strO(i),cmf(i),csink(i),cwsink(i)
   +   ,crsink(i),csflux(i),cphex(i),i=l ,ipt(65)+5)
      write(27,556) '#cmassl(i),cmassO(i),i=l,',ipt(65)*5
      write(27,555)(cmassl(i),cmassO(i),i=l,ipt(65)*5)
      write(27,556) '#tmassl,tmassO'
      write(27,555) tmassl.tmassO
      write(27,556)'#p'
      iendl = ipt(41)
      write(27,549) iendl
      write(27,555) (p(i),i=l,iendl)
      write(27,556)'#sat'
      iend2 = ipt(50)
      write(27,549) iend2
      write(27,555) (sat(i),i=l,iend2)
      write(27,556) '# xmf'
      iendS = ipt(61)*ipt(l)
      write(27,549) iend3
      write(27,555) (xmf(i),i=l,iend3)
      write(27,556)'#pex'
      iend4 = ipt(52)
      write(27,549) iend4
      write(27,555) (pex(ipt(52)+i),i=l ,iend4)
      close(27)
      open(27,fi!e=outfile(7),status='unknown')
   end if
 500  format (/72('*')/' Solution at:'/
   +     '  time step number   =',i5   /
   +     '  time in seconds   =',e!2.5 /
   +     '  time in minutes   =',e!2.5/
   +     '  time in hours     =',e!2.5 /
   +     '  time in days      =',e!2.5/72('*'))
 549  format(8i!0)
 550  format(8e!5.7)
 551   format(3el5.8,ilO)
 555   format(5e!5.8)
 556  format(a,ilO)
c
   return
   end
c	_	.	
   subroutine fprnt (nu,var,ilen,label)
   character label*(*)
   real*8 var(ilen)
   write (nu, 100) label
   write (nu,101) (i,var(i),i=l,ilen)
 100  format (/a)
 101  format (4(i5,':',ell.5,lx))
   return
   end
   subroutine fprnt2 (nu,var,ilen2,label,matpt,nodept,ilenl)
   character Iabel*(*)
   real*8 var(i!en2)
   integer matpt(ilen2),nodept(ilen2+l ),idum(5000)
   write (nu, 100) label
                                                                          215

-------
    iJum{noJcpl(i)) = i
    if(nQdcr»|(i-t-l).nodepl(i).gU) then
      do 60 li = 1, npd£ptfitl)-npdepl(iH
60       idum
-------
  c
  c
  c
  c
  c
  c
  c
  c
  c
  c-
   lctrl(8) - logical variable controlling type of FEM
         solution for transport
           lctrl(8)= .true. - use mass lumping
           lctrl(8) = .false. - full FEM solution
   !ctrl(19)- logical variable controlling type of sorption
           lctrl(19) = .true. - two compartment sorption
           lctrl(19) = .false. - single compartment
                       sorption
     subroutine SOLID(iconv)
     include 'dimen.inc'
     character* 10 cname(ncmp)
 C
 C— Declare and define common block variables.
 C
     common /cbl/ matel(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
    +       matpt(nn6)
     common /cble/ abyl2(nelmx),aby30(nelmx)
     common /cb6b/ por(nelmx),srw(nnstk)
     common /cb7b/ cmw(ncmp),cvp(ncmp),cden(ncmp),
    +        chen(ncmp),casol(ncmp),cmdif(ncmp2)
     common/cb9/ xmf(nmO
     common/cb9b/ xmft(nmf)
     common /cb40/ a(icnl),rhs(nsolve),w(icnl)
     common /cb41/ irn(icnl),icn(icnl),iw(icnl,8),ikeep(icnl,5)
     common /cb41b/ nbw(0:2),ia
     common/cb62b/rhsex(nmfs)
     common /cb64b/ bsden(nmblk)
     common /cb91/ cname
 C
 C— Set pointers and sequentially solve for the solid phase
 C— mass loadings.
 C
    iptl = ipt(l)
    ipt2 = ipt(2)
    do200ics = l,ipt(6)
      iptc = ipt(59) + ics
      icpt = (iptc-l)*iptl
      icpts = (iptc-l)*ipt2
      ic = icp(iptc)
 C
 C— If two compartment sorption is considered, do not advance the
 C— component identifier.
 C
      if((ics.eq.2).and.lctrl(19)) ic = icp(iptc-l)
 C
 C—Zero the finite element matrices..
 C
      do 210 i = I,ipt2
       rhs(i) = zerO
       nrow = (i-l)*nbw(l)
       do210j= l,nbw(l)
 210      a(nrow+j) = zerO
 C
 C— Compute the local finite element matrices.
 C
      do220i = l,ipt(0)
C
C—
C—
C—
C
C
C-
C—
C
If two compartment sorption is considered, reset the solid phase
mass density for the slow and fast compartments. Ipt(6)=l for the
slow compartment and ipt(6)=2 for the fast compartment.

  if«ics.eq.l).and.lctrl(19)) then
    solden = (rone-xden)*bsden(matel(i))
  else if((ics.eq.2).and.lctrl(19)) then
    solden = xden*bsden(matel(i))
  else
    solden = bsden(matel(i))
  end if

Set the pointers to the local nodes 11,12, and 13. The
postscript s is for stacked local nodes, p is for phase, and
c is for component. Compute constants.

  ieI3 = i*3
  iell=ie!3-2
        ie!2 = ie!3-l
        il=nodel(iell)
        ils = nodept(il)+nelpt(iell)
        ilcs = icpts + ils
        i2 = nodel(ie!2)
        i2s = nodept(i2)+nelpt(ieI2)
        i2cs = icpts + i2s
        i3=nodel(ie!3)
        i3s = nodept(i3)+nelpt(iel3)
        i3cs = icpts + i3s
        terml = aby30(i)/t(8)
 C
 C— Compute the lumped mass matrix.
 C
        if(Ictrl(8)) then
          amass = lO.OdO * terml
        else
          aon = terml*5.0dO
          aoff = terml *2.50dO
        end if
                                                                        C
                                                                        C—
                                                                        C—
                                                                        C
    - Compute the exchange terms. First consider phase mass transfer.
    - This term is updated after a complete pass through all the
    - components and phases.

        term2 = aby!2(i) * por(i) * cmw(ic) / solden
        rhsl =rhsex(ilcs)
        rhs2 = rhsex(i2cs)
        rhs3 = rhsex(iScs)
        fl = term2 * ( 2.0dO*rhsl +    rhs2 +    rhs3 )
        f2 = term2*(   rhsl + 2.0dO*rhs2 +    rhs3 )
        f3 = term2 * (   rhs 1 +    rhs2 + 2.0dO*rhs3)

      Assemble lumped global matrix Note that the left hand side matrix
      is diagonal due to mass lumping and the solution is explicit.

       if(lctrl(8)) then
         a(il) = a(il) +amass
         a(i2) = a(i2) + amass
         a(i3) = a(i3) + amass
       else

      Assemble global matrix in banded form.

         irowl = (il-l)*nbw(l)
         irow2 = (i2-l)*nbw(l)
         irow3 = (i3-l)*nbw(l)
         icolll = 1 + nbw(0)
         icol!2 = icoll 1 + (i2 - il)
         icoll3 = icollH-(i3-il)
         icoI22 = icolll
         ico!21 = ico!22 + (il -12)
         ico!23 = ico!22 + (i3 - i2)
         icoI33 = icolll
         icoI31=ico!33 + (il-i3)
         ico!32 = ico!33 + (i2 - i3)
         a(irowl + icoll 1) = a(irowl +  icoll 1) + aon
         a(irowl + icoll 2) = a(irowl +  icoll 2) + aoff
         a(irowl + icoll 3) = a(irowl +  icoll 3) + aoff
         a(irow2 + ico!21) = a(irow2 +  ico!21) + aoff
         a(irow2 + ico!22) = a(irow2 +  ico!22) + aon
         a(irow2 + ico!23) = a(irow2 +  ico!23) +• aoff
         a(irow3 + ico!31) = a(irow3 +  icol31) + aoff
         a(irow3 + ico!32) = a(irow3 +  ico!32) + aoff
         a(irow3 + ico!33) = a(irow3 +  ico!33) + aon
       end if
C—•  Assemble right hand side.

       rhs(il) = rhs(il) + fl
       rhs(i2) = rhs(i2) + f2
       rhs(i3) = rhs(i3)+f3
 220    continue

 :—  Solve for solid phase mass fractions. Determine the max norm of
 '•—  the updated solution.

     if(lctrl(8)) then
                                                                        217

-------
      dxmf » zcrO
      xmfmax = xround
      do230i=l,iptl
        xmfold=xmf(icpt+i)
        ill(a(i).nc,zerO) then
          xmf(icpH-i) - xmft(icpt+i) + rhs(i)/a(i)
          xmfmax = dmaxl(xmfmajc,dabs(xmf(icpH-i)))
          dxmf = dmaxl (dxmf,dabs(xmf(icpt+i)-xmfold))
        end if
250    continue
     else
C
C— Collapse full matrix into sparse form used by Harwell.  Also
C — scale array by dividing rows through by the diagonal value.
C
      in = 0
      (Io260irow= l.ipll
        nrow - (irow-l)*nbw(l)
        aii = rone / a(nrow+l+nbw(0))
        rhs(irow) = rhs(irow) * aii
          if (a(nrow+icol) ,ne. zerO) then
            a(ia) = a(nrawticol) * aii
            irn(is) 3 irow
            icn(i») = icol+irow-nbwCO)-l
          cndif
 260    continue
C
                                                                    C— Solve the linear system using Harwell routines.
                                                                    C
                                                                        callma28ad(ipt(l),ia,a,icnUrn,irnl,icn,u,ikeep,iw,w,iflag)
                                                                        if (iflag .It. Q) then
                                                                         write (ipt(28),'?) 'iflag return frpmharwell is ',iflag
                                                                         write (ipt(28),*) 'solid component is:  ', cname(ic)
                                                                        end if
                                                                        call ma28cd (ipt(l),a,icnl,icn,ikeep,rhs,w,mtype)
                                                                    C
                                                                    C— Update the solution and determine the max noim of the updated
                                                                    G— solution.
                                                                    C
                                                                           dxmf = zerO
                                                                           xmfmax = xround
                                                                           do 270 i = l+icpt,iptl+icpt
                                                                             xmfold = xmf(i)
                                                                             xmf(i) = xmft(i) + rhs(i-icpt)
                                                                             xmfmax = dmaxl(xmfmax,dabs(xmf(i)))
                                                                      270      dxmf = dmaxl(dxrnf,dabs(xmf(i)-xmfold))
                                                                          end if
                                                                     C
                                                                     C— Check convergence with the relative change in state variable.
                                                                     C
                                                                          if(dxiru7xmfrnax.gt.t(16)) SCOOT = iconv f 1
                                                                      200  continue
                                                                        return
                                                                        end
Subroutine - tlhs.f
c-
c
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
 C
TLHS.f - Subroutine which forms the left hand side of the
      finite clement equations for the two dimensional
      component mass balance equations.  Linear triangles
      arc used for the basis and weighting functions.

Arguments: iphasc - integer scalar denoting the phase
             gas phase:  iphasc = 1
             aqueous phase: iphase = 2
      komp - integer scalar denoting the component
             gas phase:  icomp = icp(l)-icp(ipt(3))
             aqueous phase: icomp = icp(ipt(3)+l) to
                          icp(ipt(4))
      ixc - integer pointer for principal component
         number
      nxc - integer pointer for principal component
         location in xmf

Required Control Flags:

  ipt(27) - integer variable indicating type of domain
         ipt(27) = 0 - xz domain
         ipt(27) = 1 - rz domain
  lcirl{4) - logical variable controlling printing of
        clement dimcnsionless numbers
           lctrl(4) = .true, - print element
                      dimensionless numbers
           lctrl(4) * .false. - skip element
                      dimcnsionless numbers
  klrl(S) - logical variable controlling type of FEM
         solution for transport
           lclrl(8)= ,irue. - use mass lumping
           ktrl(8) s .false. - full FEM solution
  IctrKIS)  - logical variable denoting type of q calculation
           lctrl(18) =  .true. - nodel FEM q
           lclrl(18) =  .false. - element average q
  lctrK2!)  - logical variable controlling calculation of
         the hydrodynamic dispersion tensor
           lctrl(21) = .true. - calculate tensor
           lctrl(21) = .false. - read tensor as input
 Control Flags computed internally in routine:

   t(2Ji - maximum gas phase cell Peclet number
   t(24) - maximum aqueous phase cell Peclet number
   t(25) - maximum gas phase cell Courant number
   t(26) - maximum aqueous phase cell Courant number

       Note: Component balance equations are not needed for
          nitrogen ia the gas phase and water in the
          aqueous phase
subroutine TLHS(iphase,icomp,ixc,nxc)
include 'dimen.inc'

  Declare and define common block variables.

common /cbl/ matel(nelmx),nodel(nel3),nodept(nnmx),nelpt(nel3),
+       matpt(nn6)
common /cblc/ xnode(nnmx),znode(nnmx),rbar(nelmx),area(nelmx)
common /cbld/gama(nel3),beta(ne!3)
common /cble/ abyl2(nelmx),aby30(nelmx)
common /cb2c/ q(ne!4)
common/cb3/ sat(nnstk3)
common /cb6b/ por(nelmx),srw(nnstk)
common /cb7b/ cmw(ncmp),cvp(ncmp),cden(ncmp),
+        chen(ncmp),casol(ncmp),cmdif(ncmp2)
common/cb9/ xmf(nmf)
common /cb9b/ xmft(nmf)
common /cblO/ den(nn6)
 common /cbl I/ pex(nnslO),rxnp(nn2)
 common /cb30/ ibc(nnmx)
 common /cb32/ bcf(nn2)
 common /cb40/ a(icnl),rhs(nsolve),w(icnl)
 common /cb41/ irn(icnl),icn(icnl),iw(icnl,8),ikeep(icnl,5)
 common/ cb41b/ nbw(0:2),ia
 common /cb62/ rxn(nmf),cex(nmfs)
 common /cb62b/ rhsex(nmfs)
 common /cb64/ bok(nbcmp),bom(nbcmp),krtd(ncmp)
 common /cb70/ d(nmd),tort(nelmx),bdist(nmblk),bdisl(nmblk)
                                                                       218

-------
     common /cb84/ ibcxmf(nmbc),bcxmf(nmbc),dfxmf(nmbc)
     common /cb85/ flux(ncmpp5),sflux(ncmpp5),first(ncmp)

  C— Compute terms which are not component dependent. These
  C— terms are only calculated once per iteration for each phase.
  C— Note that for mobile phases, saturation is stacked (i.e.
  C— discontinuous) while phase molar density not stacked (i.e.
  C— continuous).
  C
  C— Zero the global  matrix and right hand side vector.
  C
     do 110i= l,ipt(l)
      rhs(i) = zerO
      nrow = (i-l)*nbw(l)
      do 110j = l,nbw(l)
  110    a(nrow+j) = zerO
  C
  C— Set pointers, iptc points to the correct location in icp.
  C— icpt and icpts point to the correct location in xmf,
  C— and stacked xmf storage respectively, ippt and ippts point to
 C— the correct location in nonstacked and stacked phase storage.
 C— ic is the identity of the icomp component in the iphase phase.
 C— iptco points to the  organic phase components.
 C
    ipml = iphase-1
    iptc = ipml *ipt(3)+icomp
    icpt = (iptc-l)*ipt(l)
    icpts = (iptc-l)*ipt(2)
    ippt = ipml*ipt(l)
    ippts = ipml *ipt(2)
    ic = icp(iptc)
    iptl=ipt(l)
    iptO = ipt(0)
 C
 C— Compute the local  finite element matrices.
 C
    do!20i=l,ipt(0)
 C
 C— Set the pointers to the local nodes il,i2, and i3.  The
 C— postscript s is for stacked local nodes, p is for phase, and
 C— c is for component. Compute constants.
 C
      ieB = i*3
      ieIl=ie!3-2
      iel2 = ie!3-l
      il=nodel(iell)
      ils = nodept(il)+nelpt(iell)
      ilc = icpt + il
      ilcs = icpts + ils
     ilp = ippt + il
     ilps = ippts + ils
     i2 = nodel(ie!2)
     i2s = nodept(i2)+nelpt(ie!2)
     i2c = icpt-H2
     i2cs = icpts + i2s
     i2p = ippt + i2
     i2ps = ippts + i2s
     i3 = nodel(ie!3)
     i3s = nodept(i3)+nelpt(ie!3)
     i3c = icpt + i3
     i3cs = icpts + i3s
     i3p = ippt +13
     i3ps = ippts + i3s
     sdl=sat(ilps)*den(ilp)
     sd2 = sat(i2ps)*den(i2p)
     sd3 = sat(i3ps)*den(i3p)
     dl = den(ilp)
     d2 = den(i2p)
     d3 = den(i3p)
     term30 = por(i)*aby30(i)
     terml2 = por(i)*aby!2(i)
     term = term30/t(8)
C
C— If an element has gas saturations below sgtest skip
C— calculation of the local element matrix
C
     if((iphase.eq.l).and.((sat(ils).ltsgtest).or.
   +    (sat(i2s).lt.sgtest).or.(sat(i3s).lt.sgtest))) goto 120
 C
 C—
 C—
 C—
 C
  c
  C— Consider equilibrium sorption in the aqueous phase.

      if(iphase.eq.2) then
        term = term * krtd(ic)
      end if

      Compute the mass matrix. These terms are constant for a given
      phase and component unless the phase density or saturation
      is updated.

      all=term*(3.0dO*sdl    +    sd2    +   sd3    )
      a!2 = term*(    sdl    +    sd2    +    sd3/20dO)
      a!3 = term*(    sdl    +    sd2/2.0dO+    sd3   )
      a21=a!2                                  |
      a22 = term*(    sdl    + 3.0dO*sd2    +   sd3   )
      a23 = term*(    sdl/2.0dO+    sd2    +    sd3   )
      a31=a!3
      a32 = a23
      a33 = term*(    sdl    +    sd2   +3.0dO*sd3   )
 C
 C— Lump 'mass' matrix if lctrl(S) = true.
 C
      if(lctrl(8)) then
        all=all+aI2 + al3
        a!2 = zerO
        a!3 = zerO
        a22 = a21+a22 + a23
        a21 = zerO
        a23 = zerO
        a33 = a31+a32 + a33
        a31=zerO
        a32 = zerO
      endif
C
C—
C

c
c—
c
      Assign the Darcy velocities.

      if(lctrl(18))then

      Compute the stiffness matrix using nodal Darcy velocities.

       iptq = ipml*ipt(40)
       dqxl =q(iptq+il)*den(ilp)
       dqx2 = q(iptq+i2)*den(i2p)
       dqx3 = q(iptq+i3)*den(i3p)
       dqzl = q(iptq+iptl+il)*den(ilp)
       dqz2 = q(iptq+iptl+i2)*den(i2p)
       dqz3 = q(iptq+iptl+i3)*den(i3p)

       termq = rbar(i) / 24.0dO
       sumlx = termq * (2.0dO*dqxl +    dqx2+    dqx3)
       sum2x = termq * (   dqxl + 2.0dO*dqx2 +    dqx3)
       sum3x = termq *(   dqxl +    dqx2 + 2.0dO*dqx3)
       sumlz = termq * (2.0dO*dqzl +    dqz2+    dqz3)
       sum2z = termq *(   dqzl+ 2.0dO*dqz2 +    dqz3)
       sum3z = termq * (   dqzl +    dqz2 + 2.0dO*dqz3)

       bll = sumlx * beta(iell) + sumlz * gamaflell)
       b!2 = sumlx * beta(ie!2) + sumlz * gama(ieI2)
       b!3 = sumlx * beta(ie!3) + sumlz * gama(ie!3)
       b21 = sum2x * beta(iell) + sum2z * gama(iell)
       b22 = sum2x * beta(ie!2) + sum2z * gama(ie!2)
       b23 = sum2x * beta(ie!3) + sum2z * gama(ie!3)
       b31 = sum3x * beta(iell) + sum3z * gama(iell)
       b32 = sum3x * beta(ie!2) +• sum3z * gama(ie!2)
       b33 = sum3x * beta(ie!3) + sum3z * gama(ie!3)
     else

 -— Compute advective terms using element Darcy velocities.

       termq = rbar(i) / 24.0dO
       suml = termq * (2.0dO*den(ilp)+den(i2p)+den(i3p))
       sum2 = termq * (den(ilp)+2.0dO*den(i2p)+den(i3p))
       sum3 = termq * (den(ilp)+den(i2p)+2.0dO*den(i3p))

 ^— Assign the Darcy velocities.  Use q here since the saturations and
"    porosities are dropped from the preceding terms.
                                                                       219

-------
c
c—
c—
f*__jr
c
     iplq=i + ipml*ipt(67)
     qx = q(iptq)
     qzsq(iptq+iptQ)

    Compwt? Ihe stiffness matrix. First compute the advective terms.
    These terms are co.nstanj unless the phase density or Darcy
    velocity is updated.
     blgl
     b2g2
     b3g3
     bll-
     b!2 =
     b!3 =
      b32
      b33
    end if
            = beta(iell)*qx + gama(iell)*qz
            = bcta(ici2)*qx + gama(iel2)*qz
            = beta(+sat(i3ps))*por(i)
   H     *cmdif(2*(ic-l)+iphase)*lort(i)
      id = (iphas«-U*ip((68)
      dlt=d(td+3*i-2) + dm
             S*(ic-l)+(iphasc-l)*4
             d(idpt-t-l)
      d21=d!2
     else
      tdpt
      dll
      d21=d(idpt+3)

     end if
C
C—• Compute ibe maximum clement Peclet and Courant number if desired.
C
     if(ktil(4))then
      pclcn = dsqrt(2.0dO*area(i))
      pcsat = third*(sat(ilps>t-sat(i2ps)+sat(i3ps))
      pcpore = por(i)
      if(letrl{18))thcn
         qx - third*(q(iptq+il)+q(iptq-t-i2>Kl * su?n / (12.0dQ. * area(i))
    dlbgl=dH *b.etaflell) + d21 *gama(iell),
    d2bgl = d!2 * heta((iell) + d22 * gama(iell)
    dlbg2 = dl 1 * b,e,t.a(iei2). -t d?l * gama(ie!2)
    d2bg2 = d!2 * bet.a.(ie.l2) + d22 * gama(iel2)
    dlbg3 = dU * beta(ie,l3),,+ d21 * gama(iel3),
    d2bgj = d!2 * ^eta(iel3) + d22 * gama(iel3).
    bll = bll + sum,* (beta(iell) * dlbgl + garna(iell) * d2bgl)
    b!2 = b!2 + sum * (beta(iel2).* dlbgl- -fc gama(iel2) * d2bgl)
    b.;3 = b!3 + sum * (beta(ie,13) * dlbgl -I- gama(ieI3) * d2bgl)
    b,21 = b21+ sum * (beta(ieU) * dlbg2 + gama(iell) * d2bg2)
    b22 = b22 + s,um * (beta(ie!2) * dlbg2 +• gama(ie!2) * d2bg2)
    b23 = b?3 + s'um.* (beta(ie!3) * dlbg2 + gama(ieB) * d2bg2)
    b31 = b31 + sum * (beta(iell) "• dlbg3 + gama(iell) * d2bg3)
    b32 = b32 + sum * (beta(ie!2) * dlbgS + gama(ie!2) * d2bg3 )
    b33 = b33 + sum * (beta(ie!3) * dlbg3 + gama(iel3). * d2bg3)

C— Compute the exchange terms. First consider phase mass transfer.
C— This term is updated a,fter; a complete pass through all the
 ;— components and phases. Include the reaction, term in the aqueous
C— pha^e.

     if(iphase.eq.2.and.lctrl{3>.aji.d.lctrl(16)>th,en
       pex.1 = pexfilpa) -t  (rxnp(il) - rxn(ilc))/por(i).
       pex2 = pex.(i2ps) +  (rxnp(i2) - rxn(i2c))/por(i)
       pex3 = pex(i3ps) +  (rxnp(i3) - rxn(i3c))/por(i)
     else
       pexl = pex(ilps)
       pex2 = pex(i2ps)
       pex3 = pex(i3ps),
     end if
     pterml = term3.Q *( pexl    +pex2    +pex3/2.0dO)
     pterm2 = term30*(pexl    + pex2/2.0dO + pex3    )
     pterm3 = term30 * (pex l/2.0dO + pex2    + pex3    )
     bll=bll+term30*(3.0dO*pexl + pex2   +pex3    )
     b!2 = b!2 +pterml
     b!3=bl3 + pterm2
     b21 = b21 + pterml
     b22 = b22 + term30*(pexl    + 3.0dO*pe"2 + Pex3    )
     b23 = b23 + pterm3
     b31=b3l+pterm2
     b32- = b32 -b pterrnS.
     b3.3==b33 + term3Q*(pexl    +pex2    +3.0dQ*pex3)
 C
 C— Now include the lumped component exchange terms.
 C
     cexl = cex(ilcs)
     cex2 = cex(i2cs)
     cex3 = cex(i3cs)
     ctermi = termS.O *- (cexl    + cex2    + cex3/2.0dO)
     cterm2 = term30*(cexl    t cex2/2.0dO + cex3   )
     cterm3 = term3Q*(cex!/2.0d0 + cex2    +cex3    )
     bll=bll+term30*(3.0dO*cexl + cex2   +cex3    )
     b!2 = b!2 +ctermi
     bl3=b!3 + cterm2
      b21 =b21 +cterinl
      b22 = b22 + term30 * ( cex 1    + 3.0dO*cex2 + cex3    )
      b23 = b23 + ctermS
      b31 = b31 +cterm2
      b32 = b32 + ctermS
      b33 = b33 + term30*(cexl    +cex2    +3.0dO*cex3)

      Now compute the right hand side terms. These terms are constant
      unless the phase saturation or contacting phase composition is
 C— updated.
 C
      rhsexl = rhsex(ilcs)
      rhsex2= rhsex(i2cs)
      rhsex3= rhsex(iScs)
      fl = term!2 * (2.0dO*rhsexl +    rhsex2 +    rhsexS )
      f2 = terml2*(    rhsexl+2.0dO*rhsex2+    rhsex3)
       O = terml2*(    rhsexl +   rhsex2 + 2.0dO*rhsex3 )
 C
 C— Assemble global matrix and right hand side vector in banded form.
 C
            = (il-l)*nbw(l)
            = (i2-l)*nbw(l)
                                                                            C
                                                                            y"i

                                                                            C—
                                                                        220

-------
C
C —
 irow3 = (i3-l)*nbw(l)
 icolll = I + nbw(0)
 icoll2 = icolll + (i2-il)
 icol!3 = icolll +(i3-il)
 ico!22 = icolll
 icol21 =icoI22 + (il -i2)
 icol23 = icoI22 + (i3-i2)
 ico!33 = icoll I
 icolSl = ico!33 + (il - i3)
 ico!32 = ico!33 + (i2 - i3)
 abll =all + t(IO)*bll
 abl2 = aI2 + t(10)*bI2
 abl3 = aI3 + t(10)*b!3
 ab21 = a21 + t(10)*b21
 ab22 = a22 + t(10)*b22
 ab23 = a23 + t(10)*b23
 ab31=a3I +t(10)*b31
 ab32 = a32 + t(10)*b32
 ab33 = a33 + t(10)*b33
 a(irowl + icoll 1) = a(irowl + icoll 1) + abl 1
 a(irowl + icoI12) = a(irowl + icol!2) + ab!2
 a(irowl +icol!3) = a(irowl +icolI3) + ab!3
 a(irow2 +• ico!21) = a(irow2 + ico!21) + ab21
 a(irow2 + ico!22) = a(irow2 + ico!22) + ab22
 a(irow2 + icoI23) = a(irow2 + ico!23) + ab23
 a(irow3 + icoI31) = a(irow3 + icoDl) + ab31
 a(irow3 + ico!32) = a(irow3 + ico!32) + ab32
 a(irow3 + ico!33) = a(irow3 + ico!33) + ab33
 rhs(il) = rhs(il) + fl - bl 1 * xmft(ilc) - b!2 * xmft(i2c)
    -b!3*xmft(i3c)
 rhs(i2) = rhs(i2) + f2 - b2I * xmft(ilc) - b22 * xmft(i2c)
    - b23 * xmft(i3c)
 rhs(i3) = rhs(i3) + f3 - b31 * xmft(ilc) - b32 * xmft(i2c)
    - b33 * xmft(i3c)

Insert third type boundary condition here when the flow solution
is not included. First look at the three sides.

 ilbc = ilp
i2bc = i2p
 i3bc = i3p
if(ibcxmf(i 1 bc)+ibcxmf(i2bc)+ibcxmf(i3bc).ge.4) then
  if(((ibcxmf(ilbc)+ibcxmf(i2bc).eq.6).or.
      (ibcxmf(i 1 bc)+ibcxmf(i2bc).eq.4))
      .and.(xnode(il).eq.xnode(i2)
      .or.znode(il).eq.znode(i2))) then
    if(ipt(27).eq.l)then
     weight = xnode(i 1) + xnode(i2)
     weightl = xnode(il) / weight
     weight2 = xnode(i2) / weight
    else
     weightl = O.SOdO
     weight2 = O.SOdO
    end if
    dx = xnode(i2)-xnode(il)
    dz = znode(i2)-znode(il)
    rlen = dsqrt(dx**2+dz**2)
    if(ipt(27).eq.l)then
     rrad = pi*(xnode(il)+xnode(i2))
     rlen = rlen*rrad
    end if
    qnorm =  zerO
    if(lctrl(18)) then
     qx=q(iptq+il)*weightl+q(iptq+i2)*weight2
     qz=q(iptq+iptl+il)*weightl+q(iptq+iptl+i2)*weight2
    end if
    if(dx.gt.zerO) then
     qnorm=(dx*qz)/rlen
    else
     qnorm=(-dx*qz)/rlen
    end if
    if(dz.gt.zerO) then
     qnorm = qnorm + (dz*qx)/rlen
   else
     qnorm = qnorm + (-dz*qx)/rlen
   end if
   if(dabs(qnorm).lt.(den(ilp)*dfxmf(ilc)*weightl+
       den(i2p)*dfxmf(i2c)*weight2)) then
                                                                            C—
                                                                            C
          dfx 1 =den(i 1 p)*dfxmf(i 1 c)*rlen*weightl
          dfx2=den(i2p)*dfxmf(i2c)*rlen*weight2
         else
          dfx 1= zerO
          dfx2 = zerO
         end if
         abc31 = den(ilp)*qnorm*rlen*weightl
         abc32 = den(i2p)*qnorm*rlen*weight2
         if(ibcxmf(ilfac)+ibcxmf(i2bc).eq.4)then
          a(irowl + icoll 1) = a(irowl + icoll 1) + 1<10) * dfxl
          rhs(il) = rhs(il) + dfxl * (bcxmf(ilc)-xmft(ilc))
          a(irow2 + ico!22) = a(irow2 + ico!22) + 1(10) * dfx2
          rhs(i2) = rhs(i2) + dfx2 * (bcxmf(i2c)-xmft(i2c))

     Save the flux terms for the mass balance. Also compute the
     surface flux for output.

          if(.not.lctrl(l))then
          flxmf = xmf(ilc)
          f2xmf = xmf(i2c)
          fsave = abc31 * flxmf + abc32 * f2xmf
   +•          + dfx 1 * (bcxmf(i 1 c)-xmf(i 1 c))
   +          + dfx2 * (bcxmf(i2c)-xmf(i2c))
          flux(5+ic) = flux(5+ic) +• fsave
          if(znode(il).eq.zer0.and.znode(i2).eq.zerO)
   +          sflux(5+ic) = sflux<5+ic) +• fsave
C
C — Compute the flux for the master component.
C
          if(icomp.eq.l)then
           fsave = abc31 * xmf(nxc+il) + abc32 * xmf(nxc+i2)
           flux(5+ixc) = flux(5+ixc)  + fsave
           if(znode(i 1 ).eq.zer0.and.znode(i2).eq.zerO)
   +           sflux(5+ixc) = sflux(5+ixc) + fsave
          end if
          end if
        else if(.not.lctrl(l).and.
   +         ibcxmf(i 1 bc)+ibcxmf (i2bc).eq.6) then
          a(irowl + icoll 1) = a(irowl + icoll 1) + 1(10) * abc31
          rhs(il) = rhs(il) + abc31*(bcxmf(ilc)-xmft(ilc))
          a(irow2 + ico!22) = a(irow2 + ico!22) + 1(10) * abc32
          rhs(i2) = rhs(i2) + abc32*(bcxmf(i2c)-xmft(i2c))
                                                                            C
                                                                            C —
                                                                            C — •
                                                                            C
     Save the flux terms for the mass balance. Also compute the
     surface flux for output.

         fsave = abc31  * bcxmf(ilc) + abc32 * bcxmf(i2c)
         flux(5+ic)
             = flux(5+ic) + fsave
         if(znode(i 1 ).eq.zer0.and.znode(i2).eq.zerO)
             sflux(5+ic) = sflux(5+ic) + fsave
                                                                               +

                                                                               +
                                                                            C
                                                                            C — Compute the flux for the master component.
                                                                            C
                                                                                      if(icomp.eq.l) then
                                                                                       fsave = abc31*bcxmf(nxc+il) + abc32*bcxmf(nxc+i2)
                                                                                       flux(5+ixc) = flux(5+ixc) + fsave
                                                                                       if(znode(i 1 ).eq.zer0.and.znode(i2).eq.zerO)
                                                                               +           sflux(5+ixc) = sflux(5+ixc) + fsave
                                                                                      end if
                                                                                    end if
                                                                                  end if
                                                                                  if(((ibcxmf(i 1 bc)+ibcxmf(i3bc).eq.6).or.
                                                                               +      (ibcxmf(ilbc)+ibcxmf(i3bc).eq,4))
                                                                               +      .and.(xnode(il).eq.xnode(i3)
                                                                               +      .or.znode(il).eq.znode(i3))) then
                                                                                    if(ipt(27).eq.l)then
                                                                                      weight = xnode(il) + xnode(i3)
                                                                                      weightl = xnode(il) / weight
                                                                                      weights = xnode(iS) / weight
                                                                                    else
                                                                                      weightl = O.SOdO
                                                                                      weights = O.SOdO
                                                                                    end if
                                                                                    dx = xnode(i3)-xnode(il)
                                                                                    dz =  znode
-------
         rrad = pl*(xnoflc(il)+xnode(i3))
         rkn = rlen*rrad
       end if
       qnorm = zerO
       ifllctrKtS)} then
         qx=q(iptq+il)*weighU+q(iptq+i3)*weight3
         qz=q(iptq+ipt 1+i 1 )*weighl l+q{iptq+ipt 1 +i3)*weight3
       end if
       ifltdx.gt.zerO) then
         qnorm={dx*qz)/rleti
       else
         qnorm=(-dx*qzyrlen
       end if
       if(dz,gt,zcrO) then
         qnorm = qnorm +• (dz*qxyrlen
       else
         qnorm = qnorm + (-dz*qx)/rlen
       end if
       if(dabs(qnorm).lt.(den(ilp)*dfxmf(ilc)*weightl+
           f]cn{t3p)'dfxmf(i3c)*weight3)) then
         dfxl=dcn(ilp)*dfxmf(ilc)*rlcn*weightl
         dfx3=den{i3p)*dfxmf(i3c)»rlen*weight3
       else
         dfxlszetO
         df*3 = zerO
       end if
        abc31 = den(ilp)*qnorm*rlen*weightl
        abc33 = den{i3p)*qnorm*rlen*weight3
        if(ibcxmf(ilbc)+ibcxnif(i3bc),eq.4) then
         a(!rowl + icolU) = aprowl + icoll 1) + 1(10) * dfxl
         rhs(iI) = rhs(il)-)-dfxl*(bcxmf(ilc)-xraft(ilc))
         a(irow3 •»• ico!33) = a(iro\v3 + ico!33) + 1(10) * dfx3
         rhs(i3) = rhs(i3) + dfx3 * (bcxmf(i3c)-xmft(i3c))

     Save the (lux terms for the mass balance. Also compute the
     surface flux for output,

         if(.not,lctrl(l)) then
         flxmf=xmf
-------
c
c-
c
c
c-
c
 120
    else if(.not.Ictrl(l).and.
         ibcxmf(i2bc)+ibcxmf(i3bc).eq.6) then
     a(irow2 + icoI22) = a(irow2 + ico!22) +1(10) * abc32
     rhs(i2) = rhs(i2) + abc32*(bcxmf(i2c)-xmft(i2c))
     a(irow3 + icoI33) = a(irow3 + ico!33) +1(10) * abc33
     rhs(i3) = rhs(i3) + abc33*(bcxmf(i3c)-xraft(i3c))

Save the flux terms for the mass balance.

     fsave = abc32 * bcxmf(i2c) + abc33 * bcxmf(i3c)
     flux(5+ic) = flux(5+ic) + fsave
     if(znode(i2).eq.zer0.and.znode(i3).eq.zerO)
           sflux(5+ic) = sflux(5-ric) + fsave

Compute the flux for the master component.

     if(icomp.eq.l)then
       fsave = abc32*bcxmf(nxc+i2) + abc33*bcxmf(nxc+i3)
       flux(5+ixc) = flux(5+ixc) + fsave
       if(znode(i2).eq.zer0.and.znode(i3).eq.zerO)
           sflux(5+ixc) = sflux(5+ixc) + fsave
     end if
    end if
  end if
end if
continue

Calculations for first type boundary conditions.
   ibcn = ipt(18) + ipt(19) 4-ipt(20)*ipml
   do 26 i = 1, ipt(19+iphase)
     nbc = ibc(ibcn+i)
     inode = ibcxmf(ippt+nbc)
C
C— Skip specification of first type boundary condition if the node
C—  number is zero.
C
     if(inode.eq.l)then
C
C—  Compute flux at first type nodes for mass balance before the
C—  boundary condition is imposed. Computing the mass balance here
C—  lags the mole fractions one sweep.
C
       if(lprnt(6)) then
        fsave = O.dO
        do800irow=l,iptl
          if(irow.le.nbw(0)) then
           jstrt = nbw(O) + 1 - irow
           jend = nbw(l)
          else if(irow.ge.iptl-nbw(0)) then
           jstrt = 1
           jend = nbw(l) - nbw(O) + iptl - irow
          else
           jstrt = 1
           jend = nbw(l)
          endif
          sum = zerO
          do 805 j= jstrt jend
 805          sum = sum + a(nbw(l)*irow+j)
   +           * xmf(icpt+irow-nbw(0)+j)
 800         fsave = fsave + (sum-rhs(irow)) * t(8)
        if(.not.lctrl(l)) then
          flux(ic+5) = flux(ic+5) + fsave
          if(znode(nbc).eq.0.dO)
   +         sflux(ic+5) = sflux(ic+5) + fsave
        endif
        first(iptc) = first(iptc)+(sum-rhs(irow)) * t(8)
       endif
C
C—  Impose first type boundary conditions.
C
       rhs(ibc(ibcn+i)) = zerO
       nbwO = nbw(0)
       nbwl = nbw(l)
       do27j = l,nbw(l)
        a((nbc-l)*nbwl+j) = zerO
 27     continue
       a((nbc-l)*nbwl+l+nbwO) = rone
     end if
 26  continue
C
C— Use solution from flow section to impose boundary fluxes for third
C— type boundaries. First type pressure nodes.
C
    if(Ictrl(l))then
     do28i = l,ipt(18+ipml)
       nbc = ibc(i+ipml *ipt(18))
       nbcp = nbc + ippt
       irowbc = (nbc-l)*nbw(l)
       icolbc = 1 + nbw(0)
       nbcpc = icpt + nbc
       if(ibcxmf(nbcp).eq.3) then
         porsum = zerO
         do 32 ipor = 1, nodept(i+1 )-nodept(i)
 32        porsum = porsum + por(matpt(nodept(i)+ipor))
         porsum = porsum/dble{nodept(H-l)-nodept(i))
         a(irowbc + icolbc) = a(irowbc + icolbc) +1(10)
   +        * bcf(nbcp) * den(nbcp)
         rhs(nbc) = rhs(nbc) + bcf(nbcp) * den(nbcp)
   +        * (bcxmf(nbcpc) - xmft(nbcpc))
       end if
 28   continue
C
C— Third type nodes with constant volumetric flux.
C
     do 29 i = 1, ipt(22+ipml)
       nbc = ibc(i+ipml*ipt(22)+ipt(62))
       nbcp = nbc + ippt
       irowbc = (nbc-l)*nbw(l)
       icolbc = 1 + nbw(0)
       nbcpc = icpt + nbc
       if(ibcxmf(nbcp).eq.3) then
         porsum = zerO
         do 33 ipor = 1, nodept(i+l)-nodept(i)
 33        porsum = porsum+por(matpt(nodept(i)+ipor))
         porsum = porsum/dble(nodept(i+l)-nodept(i))
         a(irowbc + icolbc) = a(irowbc + icolbc) +1(10)
   +        * bcf(nbcp) * den(nbcp)
         rhs(nbc) = rhs(nbc) + bcf(nbcp) * den(nbcp)
   +        * ( bcxmf(nbcpc) - xmft(nbcpc) )
       endif
 29   continue
C
C— Well nodes.
C
     do31i = l,ipt(24)
       nbc = ibc(i+ipt(64))
       nbcp = nbc + ippt
       irowbc = (nbc-l)*nbw(l)
       icolbc = 1 + nbw(0)
       nbcpc = icpt + nbc
       if(ibcxmf(nbcp).eq.3)  then
         porsum = zerO
         do 34 ipor = 1, nodept(i+l)-nodept(i)
 34        porsum = porsum + por(matpt(nodept(i)+ipor))
         porsum = porsum/dble(nodept(i+l)-nodept(i))
         a(irowbc + icolbc) = a(irowbc + icolbc) +1(10)
   +        * bcf(nbcp) * den(nbcp)
         rhs(nbc) = rhs(nbc) + bcf(nbcp) * den(nbcp)
   +        *  (bcxmf(nbcpc) - xmft(nbcpc))
       endif
 31   continue
   endif
C
C— Collapse full matrix into sparse form used by Harwell. Also
C— scale array by dividing rows through by the diagonal value.
C
   ia = 0
   do 30 irow = l,ipt(l)
     nrow = (irow-l)*nbw(l)
     if(a(nrow+l+nbw(0)).eq.zerO) a(nrow+l+nbw(0)) = rone
     aii = rone / a(nrow+l+nbw(0))
     rhs(irow) = rhs(irow) * aii
     do30icol=l,nbw(l)
       if (a(nrow+icol) .ne. zerO) then
         ia = ia + 1
                                                                       223

-------
        a(la) = s(nrow+icol) * aii
        irn(ia) = irow
        icnfin) = icol+irow-nbw(0)-l
      endif
                                                                       30  continue
                                                                          return
                                                                          end
Subroutine  - trans.f
c-
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c-
 TRANS.f - Subroutine which solves the component molar balance
       equations. Solution is done sequentially starting
       with the most volatile component and moving to the

       least volatile.


 Arguments: its - integer time step number
       iconv - integer flag for global convergence


 Required Control Flags:


  t(14) - convergence criterion for mole fractions
  1(23) • maximum gas phase cell Peclet number
  1(24) - maximum aqueous phase cell Peclet number
  1(25) - maximum gas phase cell Courant number
  1(26) - maximum aqueous phase cell Courant number
  !pt{32) - maximum component balance iterations, also used as
        the criterion for decreasing dt in component balance

        routines
  ipt(35) - maximum number of iterations in component balance
        routines for increasing dt
  kttl(3) - logical variable controlling inclusion of
        biodcgradation
          ldrl(3) = .true. - include biodegradation
          lctrl(3) = .false. - neglect biodegration
  lctrl(4) - logical variable controlling printing of
        clement dimensionless numbers
           ktrl(4) = .true. - print element
                      dimensionless numbers
           lclrl(4) = .false. - skip element
                      dimensionless numbers
  letrl(9) - logical variable denoting presence of nutrient
          lctrl(9) ~ .true. - nutrient considered
          lctrl(9) = .false. - nutrient not considered
  IclrlllS) - logical variable controlling time series output
           !clrt(15) = .true. - output time series
           lctrl(15) - .false. - do not output time series
  lclrl(21) - logical variable controlling calculation of
         the hydrodynamic dispersion tensor
           Ictrl(2I) = .true. - calculate tensor
           lclrl(21) = .false, - read tensor as input


 Control Flags computed internally in routine:


   ipt(37) - (lag specifying time step modification
 C
 c-
 c
    subroutine TRANS(its,ibconv)

    include 'dimcn.inc'
    character* 10 cname(ncmp)
  Declare and define common block variables.


common/cb.V sat(nnstk3)
common /cb3b/ satt(nnstk3)
common /eb7W cmw(ncmp),cvp(ncmp),cden(ncmp),
t        chcn85/ flux(ncmpp5},sflux(ncmpp5),first(ncmp)
   common /cb91/ cname

   data Iplot / .false. /

C
C—  Initialize variables as needed.

C

   ipt(37)=0

   iptl=lpt(l)
   ipt2 = ipt(2)

   ipt3 = ipt(3)

C
C—  Determine which mobile phases are present.

C

   imobl=l

   imob2=2

   if(ipt(3).eq.O) imobl=2

   if(ipt(4).eq.O) imob2=l

C
C—  Update the biological reaction terms. These terms are lagged one

C—  time step.

C
   if(lctrl(3).and.Ictrl(16)) then

     iconv = 0

     if(ipt(28).gt.O) write(ipt(28),*)' BIO lagged'
     call BlO(iconv.ibconv)

   else
     if(Ictrl(3).and.ipt(28).gt.O)write(ipt(28),*)

   +     ' BIO separate phase included'

   end if

C
C— Begin iterations over the set of component balance equations.

C

   ipass = 0
   do200it=l,ipt(32)

     iconv = 0

C
C— Zero the component mass flux entry for the mass balance.

C
     do 130 i=3,ncmpp5

       sflux(i)=zerO

 130     flux(i)=zerO

C
C— Update the biological phase mole fractions every iteration when

C— considering a separate biophase.

C
     if(lctrl(3).and..not.lctrl(16)) call BlO(iconv.ibconv)

C
C— Update the phase molecular weights and densities every iteration.

C
     call MOLEWT

C
C— Update the phase mole exchange terms every iteration.

C
     call MPEX

     ipass = ipass + 1
     do 100iphase = imobl,imob2

       t(22+iphase) = zerO

       t(24+iphase) = zerO

 C
 C— iptp+1 is the first entry of phase vectors, iptps+l is the first

 C— entry of stacked phase vectors,

 C
       ipml = iphase-1

 C
 C— Use DISPER.f to compute the dispersivities if desired.

 C
                                                                       224

-------
        if (lctrl(21)) call DISPER(iphase)
        do 110 icomp = 1 ,ipt(2+iphase)
 C
 C— ic is the identity of the icomp component in the iphase phase,
 C— iptct-1 is the first entry of the icomp component in the iphase
 C— phase.
 C
          ic = icp(ipml*ipt3+icomp)
          iptc = ipt(7+iphase)+(icomp-l)*ipt(l)
 C
 C— Compute the pointers to the principal component of each phase.

          if(iphase.eq.l)then
           if(Ictrl(9))then
             ixc = icp(ipt3-l)
             nxc = (ipt3-2)*ipt(l)
           else
             ixc = icp(iptS)
             nxc = (ipt3-l)*ipt(l)
           end if
          else if(iphase.eq.2) then
           ipt314 = ipt3 + ipt(14)
           ixc = icp(ipt314+1)
           nxc = (ipt3+ipt(14))*ipt(l)
          end if
 C
 C— Skip the principal component of each mobile phase (i.e. nitrogen
 C— for the gas phase and water for the aqueous phase)
 C
          if(ic.eq.ixc)goto 110
 C
 C— Use TLHS.f to form and assemble the finite element matrices.
 C
          call TLHS(iphase,icomp,ixc,nxc)
 C
 C— Solve the linear system using Harwell routines.
 C
    call ma28ad(ipt( 1 ),ia,a,icnl,irn,irnl,icn,u,ikeep,iw,w,iflag)
    if (iflag.lt. 0)then
      write (ipt(28),*) 'iflag return from harweil is '.iflag
      write (ipt(28),*) 'trans phase/component are: '.iphase
   +     ,'  ',cname(ic)
    end if
    call ma28cd (ipt(l),a,icnl,icn,ikeep,rhs,w,mtype)
 C
 C— Update the solution and determine the max norm of the updated
 C—• solution.
 C
         dxmf = zerO
         xmfmax = xround
         do 210 i = l+iptc,ipt(l)+iptc
          xmfold=xmf(i)
          xmf(i) = xmft(i) + rhs(i-iptc)
          xmfmax = dmaxl(xmfmax,dabs(xmf(i)))
 210       dxmf = dmaxl(dxmf,dabs(xmf(i)-xmfold))
C
C— Check convergence with the relative change in state variable.
C— Update the solution.
C
         if(dxmf/xmfmax.gt.t(14)) iconv = iconv + 1
 110     continue
C
C— Update the mole fraction of the principal component of each
C— phase by the mole fraction constraint after all the components
C— of that phase have been updated.
C
       do300i=l,ipt(l)
         xmf(nxc+i) = rone
         do 300 ii=l,ipt(2+iphase)
          if(icp(ipt3*ipml+ii).ne.ixc) then
            ipt7p = ipt(7 + iphase)
            xmf(nxc+i) = xmf(nxc+i)
   +            -xmf(ipt7p+(ii-l)*iptl+i)
          end if
 300     continue
 100   continue
C
C— Update the NAPL mole fractions. This is only needed
 C— If there is more than 1 organic component.
 C
      if(ipt(5).gt.l)then
        call NAPLX(iconv)
      end if
 C
 C— Update the solid phase mass fractions.
 C
      if(ipt(6).gt.O) call SOLID(iconv)
 C
 C— Transport equation set is converged if each component equation
 C— has converged (i.e. iconv = 0).
 C
      if (iconv.eq.O) then
 C
 C— Use NAPLS.f to update the organic phase saturation
 C
        if(Ictrl(24)) call NAPLS(iconv)
 C
 C— Reset mobile phase saturation if the flow simulator is not
 C—• being used.
 C
        if(.not.lctrl(l)) then
          do!75i=l,ipt(2)
           ipt49 = ipt(49)
           if(ipt(3).gt,0) then
             if(sat(i).gt.zerO) then
               sat(i) = sat(i)+satt(ipt49+i)-sat(ipt49-H)
               if(sat(i).It. zerO)then
                sat(ipt2+i) = sat(ipt2+i) + sat(i)
                sat(i)'=zerO
               endif
             else
               sat(ipt2+i) = sat(ipt2+i) + satt(ipt49+i)
    +             - sat(ipt49+i)
             endif
           else
             sat(ipt2+i) = sat(ipt2+i) + satt(ipt49+i)
    +           - sat(ipt49+i)
           endif
 175      continue
       endif
 C
 C— Increase the time step if the number of iterations is less than
 C— orequaltoipt(35).
 C
       if(it.Ie.ipt(35))ipt(37)=l
 C
 C—• Write plotting data. This is restricted to 6 components from both
 C— mobile phases.
 C
       if(Ictrl(15)) then
         if(lprnt(26)) then
          if(mod(its,ipt(84)).eq.O) Iplot = .true.
         else if(.not.lprnt(26)) then
          if (int(t(9)/t(28)).gt.int((t(9)-t(8))/t(28)))
   +         Iplot = .true.
         endif
         ifflplot) then
          Iplot = .false.
          if(lprat(28)) then
            write(26,776) t(9)
   +           ,(xmf(icp(i)),i=ipt(61 )+2*ipt(74)+2
   +           ,ipt(6I)+2*ipt(74)+2*(ipt(81)+ipt(82)),2)
          else
            write(26,776) t(9)
   +           ,(xmf(icp(i)) * cmw(icp((icp(i)-1 )/ipt( 1 )+l))
   +•           * den(icp(i)-ipt(l)*((icp(i)-l)/ipt(l)))
   +           ,i=ipt(61)+2*ipt(74)+2
   +           ,ipt(61)+2*ipt(74)+2*ipt(81),2)
   +           ,(xmf(icp(i)) * cmw(icp((icp(i)-1 )/ipt(!)+!))
   +           *  den(icp(i)-ipt(l)*(((icp(i)-l)/ipt(l))-l))
   +           ,i=ipt(61)+2*ipt(74H2*ipt(81)+2
   +           ,ipt(61)+2*ipt(74)+2*(ipt(81)+ipt(82)),2)
          endif
        end if
       end if
C
                                                                          225

-------
C— Print diagnostic information.
C
      if(ipl(28),£t.0)then
        wriic (ipt(28),800) its,t(9),it,t(8)
 800     format ('Transport sol at time step =',i6,
   +        ' timc=',cl0.3/
   +•        ' iterations for convergences'44,2x,
   +        'withtimestep=',el0.3)
        if(lctrl(4))then
          if(imv*I,eq,l)then
            wriic (ipl(2S).S01) 'Gas',t<23),t(25)
 SOI         format(2x>a,' phase:'/
   +           4x,'Max cell peclet number: ',e!2.4/
   +           4x,'Max cell courant number:',el2.4/
   +           6x,'Notc - does not consider exchange')
          end if
          if(imob2,eq,2) then
            write (ipt(28),801)' Aqueous',t(24),t(26)
          end if
        end if
      end if
 C
 C— Return to MISER,f with a converged transport solution.
 C
       return
     end if
 200 continue
C
C— Reduce .(he time step if the maximum number of iterations was
C— reached without convergence. Reset the xmf and sat vectors.
C— Return to MIS.ER.f to begin time step again.
C
   ipt(37)=-l
     write(ipt(28),*)' Time step reduction  it>=',ipt(32)
     write(ipt(28),*)' .elapsed time:',t(9),' .time step:', t(8)
   end if
   do230i=l,ipt(l)*ipt(58)
 230  xmf(i)=xmft(i)
   do235i=l,ipt(41)
 235  sat(i)=satt(i)
C
C— Reset the molecular weights, molecular densities, mass densities,
C— ,mass exchange terms, and bio terms.
C
   callMOLEWT
   callMPEX
   if(lctrl(3)) call BIQ(iconv,ibconv)
 999 return
 776 format(7eU.4)
   end
 Subroutine -  vel.f
C
C
C
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c-
     VEL,f - Subroutine which computes the mobile phase specific
           discharge. This routine is not called when constant
           velocity simulations are being run. Specific discharges
           arc clement constants using averaged nodal properties.

           Storage is as follows: qx  gas phase
                       qz gas phase
                       qx aqueous phase
                       qz aqueous phase

     Required Control Flags:

       letrl( 1 8) - logical variable denoting velocity discretization
               lclrl(I8) = . true. -node!
               ktrl{ 18) = . false. -elemental
    subroutine vcl
    include Vlimen inc'
 C
 C — Declare and define common block variables.
 C
    common /cbl/ matel(nelmx),nodel(ncl3),nodept(nnmx),nelpt(nel3),
    +       matpt(nn6)
    common /cblc/ xnodc(nnmx),znode(nnmx),rbar(nelmx),area(nelmx)
    common /cbld/ gama(nel3),beta(nel3)
    common /eblc/ aby !2{nelmx),aby30(nelmx)
    common /cb2/ p(nn3)
    common /cb2c/ q(nc!4)
    common /cb2d/ pmwO{nnmx),denO(nnmx)
    common /cb3/ sat(nnsik3)
    common /cb57 pmob(nnstk4)
    common /cbfib/ por(nclmx),srw(nnstk)
    common /cb6c/ temp(nnmx)
    common /cblO/ dcn(nnfi)
    common /eb30/ ibc(nnmx)
    common /cb32/ bcf(nn2)
    common /cb40/ a(icnl),rhs(nsolve),w(icnl)
    common /cb41/ im(icnl),icn(icnl),iw(icnl,8),ikeep(icnl,5)
    common /cMlb/ nbw(0:2),ia
 C — Dimension local arrays.
 C
    dimension rhsx(nnmx),rhsz(nnmx),az(icnl),irnz(icnl),icnz(icnl)
   +  ,ikeepz(icnl,5),wz(icnl)
    if(lctrl(18)) goto 200
 C
 C — Initialize variables.as needed.
 C
    iptl=ipt(l)
    ipt2 = ipt(2)
    do 10 i=l,ipt(0)*4
      q(i)=zerO
  10  continue
 C
 C — Iterate over the mobile phases
 C
    iptOx2 = ipt(67)
    imobl=l
    imob2=2
    if(ipt(3).eq.O) imobl=2
    if(ipt(4).eq.O) imob2=l
    do 100 iphase = imobl,imob2
 C
 C— Set pointers, ip points to non-stacked phase properties, ipq
 C — points to q, ip2 points to den, ip2s points to pmob.
 C
      ipml = iphase-1
      ip = ipml *ipt(l)
      ipq = ipml  * iptOx2
      ip2 = ipml  * ipt(40)
      ip2s = ipml * ipt(49)
      ip3d = ipml *ipt(l) + ipt(41)
      Compute q element by element.  First set node numbers.

      do 100 i=l,ipt(0)
        ix = i + ipq
        iz = ix + ipt(O)
        ie!3 = i*3
        iell-iel3-2
        iel2 = ie!3-l
        il=nodel(iell)
                                                                        226

-------
C
C —
C—
C —
C
C
C —
C —
C
        i I s = nodept(i 1 )+nelpt(iel 1 )
        ilx = ip2s + ils
        ilz = ilx + ipt(2)
        12 = nodel(ie!2)
        i2s = nodept(i2)+nelpt(iel2)
        i2x = ip2s + i2s
        i2z = i2x + ipt(2)
        i3 = nodel(ieB)
        i3s = nodept(i3)-t-nelpt(ie!3)
        i3x = ip2s +• i3s
        i3z = i3x + ipt(2)

      Average mobilities and densities, obtaining centroid values
      for each element.  Mobilities are stacked. Mass densities
      are used for this expression.

        xmob = third * (pmob(ilx) + pmob(i2x) + pmob(i3x))
        zmob = third * (pmob(ilz) + pmob(i2z) + pmob(i3z))

      If an element has a gas saturation below sgtest, set the mobility
      of that element equal to zero.

        if(iphase.eq.l)then
         if((sat(ils).lt.sgtest).or.(sat(i2s).lt.sgtest)
            .or.(sat(i3s).It.sgtest)) then
           xmob = zerO
           zmob = zerO
        end if
       else
        if((sat(ils+ipt2).It.srw(ils)+srwmin)
             .or.(sat(i2s+ipt2).lt.srw(i2s)+srwmin)
             .or.(sat(i3s+ipt2).lt.srw(i3s)+srwrnin)) then
           xmob = zerO
           zmob = zerO
        end if
       end if
       dl = den(il+ip3d)
       d2 = den(i2+ip3d)
       d3 = den(i3+ip3d)
C — Calculate element average density in a manner consistent with
C — the calculation of the pressure gradient.
C
       davgx = (dl*dabs(beta(iell)) + d2*dabs(beta(ie!2))
   +       + d3*dabs(beta(iel3)))/(dabs(beta(iell))+
   +       dabs(beta(iel2))+dabs(beta(iel3)))
       davgz = (dl*dabs(gama(iell)) + d2*dabs(gama(iel2))
   +       + d3*dabs(gama(iel3)))/(dabs(gama(iell))+
   -1-       dabs(gama(ieI2))+dabs(gama(iel3)))
C
C — Calculate pressure heads.
C
       pi = p(il-t-ip)
       p2 = p(i2+ip)
       p3=p(i3+ip)
       hi = pi - dl*t(22)*znode(il)
       h2 = p2 - d2*t(22)*znode(i2)
       h3 = p3 - d3*t(22)*znode(i3)
C
C — Compute specific discharge.
C
       q(ix) = -xmob * davgx * (( hl*beta(iell) + h2*beta(ie!2)
   +       + h3*beta(ie!3))/(ZOdO*area(i)))
       q(iz) = -zmob * davgz * (( hl*gama(iell) + h2*gama(ie!2)
   +       +h3*gama(iel3))/(2.0dO*area(i)))
 100 continue
   return
C
C — Finite element q computation. First, initialize q with
C — zeros.
C
 200 do 210  i=l,ipt(42)
     q(i)=zerO
 210 continue
C
C — Now iterate over the mobile phases.
C
   imobl=l
    imob2=2
    if(ipt(3).eq.0)imobl=2
    if(ipt(4).eq.O) imob2=l
    do 220 iphase = imobl,imob2
 C
 C—  Zero the local finite element matrices.
 C
      do230i = l,ipt(l)
        rhsx(i) = zerO
        rhsz(i) = zerO
        nrow = (i-l)*nbw(l)
        do230j = l,nbw(l)
         az(nrow+j) = zerO
 230       a(nrow-l-j) = zerO
 C
 C—•  Set pointers, ip points to non-stacked phase properties, ipq
 C—  points to q, ip2 points to den, ip2s points to pmob.
 C
      iptl=ipt(l)
      ipt2 = ipt(2)
      ipml = iphase-1
      ip = ipml *ipt(l)
      ip2 = ipml * ipt(40)
      ip2s = ipml * ipt(49)
      ip3d = ipml * ipt(l) + ipt(41)
      do 240i=l,ipt(0)
 C
 C—  Set the pointers to the local nodes 11,12, and 13.  The
 C—  postscript s is for stacked local nodes, and p is for phase
 C—  Compute constants.
 C
       ie!3=i*3
       iell=ie!3-2
       ie!2 = ie!3-l  ,
       il =nodel(iell)
       ils = nodept(il)+nelpt(iell)
       ilx = ip2s + ils
       ilz = ilx + ipt2
       i2 = nodel(ieI2)
       i2s = nodept(i2)+nelpt(ieI2)
       i2x = ip2s + i2s
       i2z = i2x + ipt2
       i3 = nodel(ieB)
       i3s = nodept(i3)+nelpt(ie!3)
       i3x = ip2s + i3s
       i3z = i3x + ipt2
 C
 C— If an element has a gas saturation below sgtest or an aqueous
 C— saturation below srw+srwmin, skip calculation of the local
 C— element matrix.
 C
       ifftiphase.eq. 1 ).and.((sat(i 1 s).lt.sgtest)
   +      .or.(sat(i2s).lt.sgtest).or.(sat(i3s).It.sgtest)))
   +      goto 240
       if((iphase.eq.2)
   +      .and.((sat(ils+ipt2).lt.srw(ils)+srwmin)
   +      .or.(sat(i2s+ipt2).lt.srw(i2s)+srwmin)
   +      .or.(sat(i3s+ipt2).lt.srw(i3s)+snvmin)))
   +      goto 240
C
C— Compute the left hand side matrix.
C
                                                                             C
                                                                             C—
                                                                             C
       aoff=aby!2(i)
       aon = 2.0dO * aoff

     Calculate pressure heads.

       pi =p(il+ip)+patm
       p2 = p(i2+ip)+patm
       p3 = p(i3+ip)+patm
       dl =den(il+ip3d)
       d2 = den(i2+ip3d)
       d3 = den(i3+ip3d)
       if(iphase.eq.l) then
        dglO = pmwO(il)*patm/(r*temp(il))
        dg20 = pmwO(i2)*patm/(r*temp(i2))
        dg30 = pmwO(i3)*patm/(r*temp(i3))
                                                                          227

-------
c
c-
c
     bl =pl/(dglO'l(22))-znode(il)
     h2 - p2/(dg20*l<22)) - znode(i2)
     h3 * p3/(dg30*l{22» - znode(i3)
   else
     hi =pl -dl*t<22)* (znode(il)-wtdpth)
     h2 = p2 - d2»l(22) * Cznode(i2)-wtdpth)
     h3 =p3 - d3*t{22) * (znode(i3)-wtdptb)
   end if

• Calculate mobility terms for the right hand side.
   pmlx=:2.0d0*pmob(ilx) +
      pm3x
                                  pmob(i2x) +
                                  pmob(i2x) +
                                                 pmob(i3x)
                                                 pmob(i3x)
                 pmobfl 1 x) +   pmob(i2x) + 2.0dO*pmob(i3x)
            = 2.0dO*pmob(ilz) +    pmob(i2z) +   pmob(i3z)
      pm2z "    pmobfi 1 z) + 2.0dO*pmob(i2z) +   pmob(i3z)
      pm3z=    pmob(i 1 z) +   pmob(i2z) + 2.0dO*pmob(i3z)
C
C— Calculate pressure gradient terms for the right hand side.
C
      if(iphuc.eq,l)then
        term = -K22) » rbat (i) / 48.0dO
      eke
        term = -rbar(i)/48.0dO
      end if
      dpx * (hl*beta(iell)*dglO + h2*betaGel2)*dg20
   +      4- Ii3*bcta(iel3)*dg30) * term
      dpz = (hl*gama(iell)*dglO + h2*gama(ie!2)*dg20
   4-      4- ])3*gama(iel3)*dg30) * term
      flx = pmlx*dpx
      f2x = pm2x * dpx
      f3x * pm3x * dpx
      flz = pmlz*dpz
      f2zspm2z*dpz
      f3z s pm3z • dpz
C
C— Calculate mobility/gravity terms for the right hand side.
C
      iftiphase cq 1) then
        tcrm=:t<22) * aby!2(i)/2.0dO
        dmlz = pmob(ilz) * ((patm'dl /(pl*dglO))-rone)*dglO
        dm2z=pmob(i2z) * (( patm*d2 / ^p2*dg20)) - rone)*dg20
        dm3z = pmob(i3z) * ((patm*d3 / (p3*dg30)) - rone)*dg30
        flz » flz -t- term * ( 2.0dO*drnlz + dm2z+ dm3z)
        f2z = f2z + term * (dmlz + 2,OdO*dm2z + dm3z)
        fjz « f3z + term * (dmlz + dm2z + 2.0dO*dm3z)
       else
        term=abyl2(i)/2.0dO
        dmlz = pmob(ilz) * (dl - denO(il)) * t(22)
        dm2z = pmob(i2z) * (d2 - denO(i2)) * t(22)
        dm3z = pmob(i3z) * (d3 - denO(i3)) * t(22)
        fl z = f Iz + term * (2,OdO*dmlz+dm2z + dm3z)
        flz = f2z •»• term * (dmlz + 2.0dO*dm2z + dm3z)
        f3z = f3z + term * < dmlz + dm2z + 2.0dO*dm3z)
       end if
C
C— Now assemble the global matrix and right hand side vector in
C— banded form.
C
       rhsx(il)5trhsx(il) + flx
       ihs.Mi3) = rhsx(i3) + Ox
       irawl=(il-l)*nbw(l)
             = 02-l)*nbw(l)
               (i3-l)*nbw(l)
        icol22
        ico!21=icoi22 + (il-i
        icol31
               icol334-(il-i3)
               ico!33-Ki2-i3)
                                                                                a(iroiyl r)-icpll2)
                                                                                a(irow) +icoll3)
                                                                                a(irow2tipoJ21)
                                                                                a(irow2 + jco!22)
                                                                                a,(irow2-*-icp!23)
                                                                                a(irow3-i-!coJ31)
                                                                                a(irow3 4- icp)32)
                                                                                a(irow3 + ico!33)
                                                                                continue
                                                                                               = a(iro>v J + ippl!2) -h aoff
                                                                                               =a(irowj + icpjj 3) + aoff
                                                                                               = a(irow2 +• i,c,pl21) + aoff
                                                                                               = a(irpw2 + icol22) + aon
                                                                                               = a(itow2 * ico!23) + apff
                                                                                               =.a(irow3 + icp]31) + aoff
                                                                                               = a(irow3 + iso!32) + aoff
                                                                                               = a(irow3 + ico!33) + aon
240
C
C— $e.t up temporary mass matrix,
C
     do25i = l,ipt(l)*nbw(l)
25    az(i) = a(i)
C
C— Impose boundary conditions.
C
     nbwO = nbw(0)
     nbwl =nbw(l)
     dp26j=l,ipl(J)
       Ivelx = .false.
       )velz=.false.
C
C— No z-velocity normal to the bpt(om.
C
       if(lctrj<28).and.znode(i).eq.znods(ipt(l)))then
        rhsz(i) = zerO
        Ivelz = .true.
       end if
C
C— No x-velpcity nprmal tp the R.H.S. boundary.
C
       if(lctrl(29).and.xnode(i).eq.xnode(ipt(l)))then
        rhsx(i) = zerO
        Ivelx = .true.
       end if
                                                                          C—
                                                                          C
                                                                          C
                                                                           No x-velocity normal tp the L.H.S. bpundary. Npte that this
                                                                           bpundary will be adjusted in the presence of a well.
                                                                                if(lctrl,(30).and.xnpde(i).eq.xnode(l))then
                                                                                  rhsx(i) = zerO
                                                                                  Ivelx = .true.
                                                                          C
                                                                          C— Adjust velpcity boundary condition in the presense of a well.
                                                                          C
                                                                                  if(!ctr!a2)) then
                                                                                    do28iwell=l,ipt(24)
                                                                                     inw = ibc(ipt(64)+iwell)
                                                                                     if(inw.eq.i) then
                                                                                       if(iphase,eq.l)then
                                                                                        rhsxO) = bcf(inw)
                                                                                       else if(iphase.eq.2.and.qwell.lt.zerO) then
                                                                                        rhsx(i) = bcf(inw+ipt(l))
                                                                           28
                                                                          C
                                                                          C—
                                                                           27
                                                                                    end if
                                                                                  end if
                                                                                 continue
                                                                               end if
                                                                             end if

                                                                            No z-velocity normal to the top. This boundary extends from the
                                                                            well to caplen.

                                                                             if(lctrl{31 ).and.znpde(i).eq.znode(l)
                                                                                 .and.xnode(i).le.caplen) then
                                                                               rhsz(i) = zerO
                                                                               Ivelz = .true.
                                                                             end if
                                                                             if(lvelx.or.lvelz) then
                                                                               do27j = l,nbw(l)
                                                                                 if(lvelx) a((i-l)*nbwl+j) = zerO
                                                                                 if(lvelz) az((i-l)*nbwl+j) = zerO
                                                                                cpntinue
                                                                               if(lvelx) a((i-l)*nbwl+l+nbwO) = rpne
                                                                               if(lvelz) az((i-l)*nbwl+l+nbwO) = rone
                                                                             end if
                                                                             Ivelx = .false.
                                                                       228

-------
       Ivelz = .false.
 26   continue
C
C— Collapse full matrix into sparse form used by Harwell.  Also
C— scale array by dividing rows through by the diagonal value.
C
     ia = 0
     iaz = 0
     do260irow = l,ipt(l)
       nrow = (irow-l)*nbw(l)
       if(a(nrow+l+nbw(0)).eq.zerO) then
         a(nrow+l+nbw(0)) = rone
         rhsx(irow) = zerO
       end if
       if(az(nrow+l+nbw(0)).eq.zerO)then
         az(nrow+l+nbw(0)) = rone
         rhsz(irow) = zerO
       end if
       aii = rone / a(nrow+l+nbw(0))
       aiiz = rone / az(nrow+l+nbw(0))
       rhsx(irow) = rhsx(irow) * aii
       rhsz(irow) = rhsz(irow) * aiiz
       do270icol=l,nbw(l)
         if (a(nrow+icol) .ne. zerO) then
          ia = ia + 1
          a(ia) = a(nrow+icol) * aii
          icn(ia) = icol+irow-nbw(0)-l
          irn(ia) = irow
         endif
         if (az(nrow+icol) .ne. zerO) then
          iaz = iaz + 1
          az(iaz) = az(nrow+icol) * aiiz
          icnz(iaz) = icol+irow-nbw(0)-1
          irnz(iaz) = irow
        endif
 270    continue
 260   continue
C
C— Solve the linear system using Harwell routines.
C
    callma28ad
-------
                                     REFERENCES


Abriola, L.M., Multiphase Migration of Organic Compounds in a Porous Medium. A Mathematical Model, in
     Lecture Notes in Engineering, (C.A. Brebbia and S.A. Orszag eds.), 8, Springer-Verlag, Berlin, 1984.

Abriola, L.M. and G.F. Finder, A multiphase approach to the modeling of porous media contamination by organic
     compounds:  2. Numerical simulation, Water Resour. Res., 21(1), 19-26, 1985.
Abriola, L.M., Multiphase Flow and Transport Models for Organic Chemicals: A Review and Assessment, EPRI
     EA-5976, Electric Power Research Institute, Palo Alto, 1988.
Abriola, L.M., Modeling multiphase migration of organic chemicals in groundwater systems - A review and
     assessment, Environ. Health Perspect, 83,117-143,1989.
Abriola, L.M., K. Rathfelder, M. Maiza and S. Yadav, VALOR Code Version 1.0: A PC Code for Simulating
     Immiscible Contaminant Transport in Subsurface Systems, EPRI TR-101018, Electric Power Research
     Institute, Palo Alto, 1992.
Abriola, L.M. and K. Rathfelder, Mass balance errors in modeling two-phase immiscible flows: Causes and
     remedies, Advances in Water Resources, 16, 223-239, 1993.
Abu-El-Sha'r, W.Y., Experimental Assessment of Multicomponent Gas Transport Flux Mechanisms in Subsurface
     Systems, Ph.D. Dissertation, University of Michigan, Ann Arbor, MI, 1993.
Adcnekan, A.E., T.W. Patzek and K. Pruess, Modeling of multiphase transport of multicomponent organic
     contaminants and heat in the subsurface: Numerical model formulation, Water Resour. Res., 29(11),
     3727-3740, 1993.
Agrclot, J.C., J.J. Malot, and MJ. Visser, Vacuum: Defense System for Groundwater VOC Contamination, in Proc.
     Fifth National Symposium and Exposition on Aquifer Restoration and Ground Water Monitoring, Columbus,
     Ohio, 485-494, National Water Well Association, 1985.
Armstrong, I.E., J. Croise and V. Kaleris, Simulation of rate-limiting processes controlling the vapour extraction of
     tricholorethylene in sandy soils, Proc. Con. The Environment and Geotechnics, April 6-8, Paris, 1993.

Armstrong, J.E., E.O. Frindand R.D. McClellan, Nonequilibrium mass transfer between the vapor, aqueous, and
     solid phases in unsaturated soils during vapor extraction, Water Resour. Res,, 30(2), 355-368,1994.
Atlas, R.M. and R. Bartha, Microbial Ecology, 2nd.  Ed., Menlo Park, California, The Benjamin/Cummings
     Publishing Company, 1987.
Aziz, K. and A. Settari, Petroleum Reservoir Simulation, Applied Science Publishers, London,  1979.

Bachr, A.L., Immiscible Contaminant Transport in Soils with an Emphasis on Gasoline Hydrocarbons, Ph.D.
     Dissertation, Department of Civil Engineering, University of Delaware, 1984.
Baehr, A.L., G.E. Hoag and M.C. Marley, Removing volatile contaminants from the unsaturated zone by inducing
     advective air-phase transport, /. Contain. Hydrol,  4,1-26, 1989.
Baehr, A.L. and M.F. Hult, Evaluation of unsaturated zone air permeability through pneumatic tests, Water Resour.
     Res., 27(10), 2605-2617, 1991.
 Baehr, A.L., J.M. Fischer, M.A. Lahvis, RJ. Baker and N.P. Smith, Method for estimating rates of microbial
      degradation of hydrocarbons based on gas transport in the unsaturated zone at a gasoline-spill site in Galloway
      Township, New Jersey, Proceedings of the Technical Meeting of the U.S. Geological Survey Toxic Substances
      Hydrology Program, Monterey, CA, March 11-15, Water Resources Investigations Report 91-4034, 250-55,
      1991.
 Bachr, A.L., Joss, C.J., and M.F. Hult, An  updated model of induced  air flow in the unsaturated zone, Water Resour.
      Res,, 2(31), 417-421, 1995.
 Baker, R.S., J.  Ghaemghami, S. Simkins and L.M. Mallory, A vadose column treatability test for bioventing
      applications, in Hydrocarbon Bioremediation, 32-39, Lewis Pub., Boca Raton, 1994.
 Barbcc, G.C., Fate of chlorinated aliphatic hydrocarbons in  the vadose zone and ground water, Ground Water Man.
      Rev., 129-140, Winter 1994.
                                                  230

-------
Baveye, P. and A. Valocchi, An evaluation of mathematical models of the transport of biologically reacting solutes
     in saturated soils and aquifers, Water Resour. Res., 25(6), 1413-21, 1989.
Bear, J., Dynamics of Fluids in Porous Media, Elsevier Publishing Co., New York, 1972.
Beckett, G.D. and D. Huntley, Characterization of flow parameters controlling soil vapor extraction, Ground Water,
     32(2), 239-247, 1994.
Benson, D.A., P. Huntley and P.C. Johnson, Modeling vapor extraction and general transport in the presence of
     NAPL mixtures and nonideal conditions, Ground Water, 31(3), 437-445, 1993.
Berndtson, MJ. and A.L. Bunge, A mechanistic study of forced aeration for in-place remediation of vadose zone
     soils, Proc. Petroleum Hydrocarbons and Organic Chemicals in Ground Water, 249-263, National Water Well
     Assoc., 1991.
Bloes, M.B., K.M. Rathfelder, and D.M. Mackay, Laboratory studies of vapor extraction for remediation of
     contaminated soil, in Subsurface Contamination by Immiscible Fluids, 255-262, A.A. Balkema, Rotterdam,
     1992.
Borden, R.C. and P.B. Bedient, Transport of dissolved hydrocarbons influenced by oxygen-limited biodegradation,
     1. Theoretical development, Water Resour. Res., 22, 1973-82, 1986.
Breedveld, G.D., G. Olstad, et aL, Nutrient demand in bioventing of fuel oil pollution, in In Situ Aeration: Air
     Sparging, Bioventing, and Related Remediation Processes (R.E. Hinchee et al.  eds.), 391-399, Battelle Press,
     Columbus, 1995.
Brock, T.D., D.W. Smith and M.T.  Madigan, Biology of Microorganisms, 4th ed., Prentice-Hall, Englewood Cliffs,
     NJ, 1984.
Brusseau, M.L. and P.S.C. Rao, Sorption nonideality during organic contaminant transport in porous media, CRC
     Critical Reviews in Environmental Control, 19(1), 33-99, 1989.
Brusseau, M.L., Transport of organic chemicals by gas advection in structured or heterogeneous porous media:
     Development of a model and application to column experiments, Water Resour. Res., 27(12), 3189-3199,  1991.
Brusseau, M.L., Rate-limited mass transfer and transport of organic solutes in porous media that contain  immobile
     immiscible organic liquid, Water Resour. Res., 28(1), 33-46, 1992.
Celia, M.A., E.T. Boulouton and R.L. Zarba, A general mass-conservation numerical solution for the unsaturated
     flow equation,  Water Resour. Res., 26(7), 1483-1496, 1990.
Chen, Y-M., L.M. Abriola, P.J.J. Alvarez, P.J. Anid and T.M. Vogel, Modeling transport and biodegradation of
     benzene and toluene in sandy aquifer material: Comparisons with experimental measurements, Water Resour.
     Res., 28(7), 1833-47, 1992.
Chen, Y-M., Mathematical Modeling ofln-Situ Bioremediation of Volatile Organics in Variably Saturated Aquifers,
     Ph.D. Dissertation, University of Michigan, Ann Arbor, MI, 1996.
Chiang, C.Y., J.P. Salanitro, E.Y. Chai, J.D. Colthart and C.L. Klein, Aerobic biodegradation of benzene, toluene,
     and xylene in a sandy aquifer - Data analysis and computer modeling, Ground Water, 27(6), 823-34, 1989.
Cho, H J. and PR. Jaffe, The volatilization of organic compounds in unsaturated porous media during infiltration, /.
     Contam. Hydrol., 6, 387-410, 1990.
Cho, J.S. and D.C. DiGiulio, Pneumatic pumping test for soil vacuum extraction, Environmental Progress, 11(3),
     228-233, 1992.
Clarke, A.N., M.M. Megehee and D.J. Wilson, Soil clean up by in situ aeration. XII. Effect of departures from
     Darcy's Law on soil vapor extraction, Separation Sci. and Tech., 28(9), 1671-1690, 1993.
Cleary, R.W. and MJ. Ungs, Groundwater pollution and hydrology, Mathematical models and computer programs,
     Research Report No. 78-WR-15, Water Resources Program, Princeton University, Princeton, New Jersey,  1978.
Corey, A.T., Mechanics of Immiscible Fluids in Porous Media, Water Resources Publications, Fort Collins, 1986.
Croise, J. and V. Kaleris, Field measurements and numerical simulation of pressure drop during air stripping in the
     vadose zone, in Subsurface Contamination by Immiscible Fluids, (K.U. Weyer  ed.), 239-246, A.A. Balkema,
     Rotterdam, 1992.
                                                 231

-------
Crow, W.L., E.R, Anderson and E. Minugh, Subsurface Venting of Hydrocarbon Vapors from an Underground
     Aquifer, American Petroleum Institute, Washington, D.C., 1985.
Crow, W.L., E.R. Anderson and E. Minugh, Subsurface venting of hydrocarbon emanating from hydrocarbon
     product on groundwater, Ground Water Man. Rev., 51-57, Winter, 1987.
Dean, J.A. (Ed.), Lange's Handbook of Chemistry, 13th Ed., McGraw-Hill, New York, 1985.
Dcmond, A.H. and P.V. Roberts, Effect of interfacial forces on two-phase capillary pressure relationships, Water
     Resoitr. Res., 27(3), 423-437, 1991.
DiGiulio, D.C., Ground Water Issue - Evaluation of Soil Venting, U.S. Environmental Protection Agency,
     EPA/54Q/S-92/004,1992.
Downey, D.C. and M.G. Elliott, Performance of selected in-situ soil decontamination technologies: An Air Force
     perspective, Environ.  Progress, 9(3), 169-73,1990.
Duff, I.S., MA28 - A Set of Fortran Subroutines for Sparse Unsymrnetric Linear Equations. Report No.
     AERE-R.8730, AERE, Harwell, 88  pp, 1979.
Dupont, R.R., W.J. Doucette and R.E. Hinchee, Assessment of in-sifii bioremediatioh potential and the application
     of bioventing at a fuel-contaminated site, in In situ Biorectamation, (R.E. Hinchee and R.F. O'fenbuttel, eds.),
     Bultefworth-Heinemann, Boston, 262-282,1991.
Dupont, R.R., Fundamentals of bioventing applied to fuel contaminated sites, Environ. Progress, 12(1), 45-53, 1993.
Edwards, K.B. and L.C. Jones, Air permeability from pneumatic tests in oxidized till, /. Environ. Eng., 120(2),
     329-347, 1994.
English, C.W. and R.C. Loehr, Degradation of organic vapors in unsaturated soils, J. ofHaz. Materials, 28, 55-63,
     1991.
Falta, R.W., I. Javandel, K. Pruess and P.A. Witherspoon, Density-driven flow of gas in the unsaturated zone due to
     evaporation of volatile organic compounds, Water Resour. Res., 25(10), 2159-70, 1989.
Falta, R.W., K. Pruess, I. Javandel, and PA. Witherspoon, Numerical modeling of steam injection for the removal of
     nonaqueous phase liquids from the subsurface 2. Code validation arid application, Water Resour. Res., 28(2),
     451-465,1992.
Fan, S. and K.M. Scow, Biodegradation of trichloroethylene and toluene by indigenous microbial populations in
     soil, Applied and Environmental Microbiology, 59(6), 1911-1918, 1993.
Fen, C.S., Mathematical Modeling and Analysis of Flux Mechanisms Controlling Multicomponent Vapor Transport
     in the Subsurface, Ph.D. Dissertation,  University of Michigan, Ann Arbor, MI, 1993.
Fine, P. and B. Yaron, Outdoor experiments on enhanced volatilization by venting of kerosene component from soil,
     J. Contam. Hydroi, 12, 355-374, 1993.
Freeze, R.A. and J.A. Cherry, Groundwater, Prentice-Hall, Englewood Cliffs, N.J., 1979.
Frind, E.G., W.H.M. Duynisveld, O. Strebel and J. Boettcher, Modeling of multicomponent transport with microbial
     transformation in groundwater: The Fuhrberg case, Water Resour. Res., 26(8), 1707-19, 1990.
Fuller, M.E., D.Y. Mu, and K.M. Scow, Biodegradation of trichloroethylene and toluene by indigenous microbial
     populations in vadose sediments, Microb. EcoL, 29, 311-325, 1995.
Gannon, K. and D.J. Wilson, Soil clean up by in-situ aeration, II. Effects of impermeable caps, soil permeability, and
     evaporative cooling, Separation Sci. and Tech., 24(11), 831-862, 1989.
Gerbasi, P.J., and M.A. Memoli, The value  of vapor extraction, Water Envr. &  Tech., 6(3), 40-6, 1994.
Gibson, T.L., A.S.  Abdul etal,  Vapor extraction of volatile organic compounds from clay soil: A long term field
     pilot study, Ground Water, 31(4), 616-626, 1993.
Gierke, J.S., N.J. Hutzler, and J.C. Crittenden, Modeling the movement of volatile organic chemicals in columns of
     unsaturated soil, Water Resour. Res., 26(7), 1529-47, 1990.
Gierke, J.S., NJ. Hutzler and D.B. McKenzie, Vapor transport in unsaturated soil columns: Implications for vapor
     extraction, Water Resour. Res., 28(2),  323-335,  1992.
                                                  232

-------
Gomez-Lahoz, C., J.M. Rodriguez-Maroto and D.J. Wilson, Soil clean up by in-situ aeration: VI. effects of variable
     permeabilities, Separation Sci. and Tech., 26(2), 133-163, 1991.

Goss, K-U., Effects of temperature and relative humidity on the sorption of organic vapors on quartz sand Environ
     Sci. Technol., 26(11), 2287-2293, 1992.

Haley, J.L., B. Hanson, C. Enfield and J. Glass, Evaluating the effectiveness of groundwater extraction systems,
     Ground-water Monitoring Rev., 11(1), 119-24, 1991.

Hayden, N.J., T.C. Voice, M.D. Annable and R.B. Wallace, Change in gasoline constituent mass transfer during soil
     venting, /. of Environ. Engr., 120(6), 1598-1614, 1994.

Heid, J.G., J.J. McMahon, R.F. Nielsen and S.T. Yuster, Study of the permeability of rocks to homogeneous fluids,
     230-246, American Petroleum Institute, New York, 1950.

Hinchee, R.E. and M. Arthur, Bench scale studies of the soil aeration process for bioremediation of petroleum
     hydrocarbons, /. Appl. Biochem. & Biotech., 28/29, 901-906, 1991.

Hinchee, R.E., D.C. Downey, R.R. Dupont, P. Aggarwal and P. Miller, Enhancing biodegradation of petroleum
     hydrocarbons through soil venting, J. of Hazardous Materials, 27, 315-325, 1991.

Hinchee, R.E., Bioventing of Petroleum Hydrocarbons, in Handbook of Bioremediation, 39-59, Lewis Pub., Boca
     Raton, 1994.

Ho, C.K. and K.S. Udell, An experimental investigation of air venting of volatile liquid hydrocarbon mixtures from
     homogeneous and heterogeneous porous media, / Contam. Hydrol., 11, 291-216, 1992.

Ho, C.K., S-W. Liu and K.S. Udell, Propagation of evaporation and condensation fronts during multicomponent soil
     vapor extraction, /.  Contam. Hydrol., 16, 381-401,1994.

Hoag, G.E., C.J. Bruell, and M.C. Marley, A Study of the Mechanisms Controlling Gasoline Hydrocarbon
     Partitioning and Transport in Groundwater Systems, NTIS publication No. PB85-242907, October 1984.

Hoag, G.E. and M.C. Marley, Gasoline residual saturation in unsaturated uniform aquifer materials, /. of Environ
     Engr., 112(3), 586-604, 1986.

Hoffman, G.D., L.M. Abriola and K.D. Pennell, An investigation of interphase mass transfer NAPL dissolution
     processes, EOS, Trans. American Geophysical Union, 73(43), 127, 1993.

Holman, H-Y. and Y.W. Tsang, Effects of soil moisture on biodegradation of petroleum hydrocarbons, in In Situ
     Aeration: Air Sparging, Bioventing, and Related Remediation Processes (R.E. Hinchee et al. eds.), 323-332,
     Battelle Press, Columbus, 1995.

Huesemann, M.H. and K.O. Moore, The effects of soil type, crude oil type and loading, oxygen, and commercial
     bacteria on crude oil bioremediation kinetics as measured by  soil respirometry, in Hydrocarbon
     Bioremediation, 58-71, Lewis Pub., Boca Raton, 1994.

Hutzler, N.F., B.E. Murphy and J.S. Gierke, State of Technology Review of Soil Vapor Extraction Systems,
     Cooperative  Agreement CR-814319-01-1, Hazardous Waste Engineering Research Laboratory, Environmental
     Protection Agency, Cincinnati, 1989.

Huyakorn, P.S. and G.F. Pinder, Computational Methods in Subsurface Flow, Academic, San Diego, 1983.

Johnson, P.C., M.W. Kemblowski and J.D. Colthart, Quantitative analysis for the cleanup of
     hydrocarbon-contaminated soils by in-situ soil venting, Ground Water, 28(3), 403-412, 1990.

Johnson, PC., A.L. Baehr, R.A. Brown, R.E. Hinchee, and G.E. Hoag, Innovative Site Remediation Technology: Vol.
     8 - Vacuum Vapor Extraction, American Academy of Environmental Engineers, Annapolis, 1995.

Joss, C.J., A three-dimensional, Multispecies vapor transport model for the design of vapor extraction and
     bioventing systems, Proc. Petroleum Hydrocarbons and Organic Chemicals in Ground Water, 493-507,
     National Water Well Assoc., 1993.

Kaluarachchi, J.J.  and J.C. Parker, Multiphase flow with a simplified model for oil entrapment, Trans, in Porous
     Media, 7,1-14, 1992.

Kampbell, D.H. and J.T. Wilson, Bioventing to treat fuel spills from underground storage tanks, J. Haz. Materials,
     28, 75-80,  1991.
                                                 233

-------
Kayano, S. and D.J. Wilson Soil clean up by in situ aeration. X. Vapor stripping of mixtures of volatile organics
     obeying Raoult's Law, Separation Sci. and Tech., 27(12), 1525-1554,1992.
Kearl, P.M., N.E. Korte, T.A. Gleason and J.S. Beale, Vapor extraction experiments with laboratory soil columns:
     Implications for field programs, Waste Management, 11,231-239,1991.

Kellems, B.L., A. Leeson, and R.E. Hinchee, Review of bioremediation experience in Alaska, in Hydrocarbon
     Bioremediation, 438-443, Lewis Pub., Boca Raton, 1994.
Kinzelbach, W., W. Schafer and J. Herzer, Numerical modeling of nitrate and enhanced denitrification processes in
     aquifers, Water Resour. Res., 27(6), 1123-1135, 1991.
Klinkenberg, L.J., The Permeability of Porous Media to Liquids and Gases in Drilling and Production Practice,
     American Petroleum Institute, New York, 1941.
Lapidus, L. and G.F. Finder, Numerical Solution of Partial Differential Equations in Science and Engineering, John
     Wiley and Sons, New York, 1982.
Leeson, A., P. Kumar, et al., Statistical analyses of the U.S. Air Force bioventing initiative results, in In Situ
     Aeration: Air Sparging, Bioventing, and Related Remediation Processes (R.E. Hinchee et al. eds.), 223-235,
     Battelle Press, Columbus, 1995.
Lingineni, S. and Dhir, V.K., Modeling of soil venting processes to remediate unsaturated soils, J. of Environmental
     Engineering, 118(1), 135-152,1992.
Litchfield, C.D., In situ bioremediation: Basis and practices, in Biotreatment of Industrial and Hazardous Waste,
     167-195, McGraw-Hill, New York, 1993.
Lyman, W.J., W.F. Rheel and D.H. Rosenblatt (Eds.), Handbook of Chemical Property Estimation Methods:
     Environmental Behavior of Organic Compounds, McGraw-Hill Book Co.,  New York, 1982.

Mackay, D.M. and J.A. Cherry, Groundwater contamination: Pump-and-treat remediation, Environ. Sci. TechnoL,
     23(6), 632-36, 1989.
Marley, M.C. and G.E. Hoag, Induced soil venting for recovery/restoration of gasoline hydrocarbons in the vadose
     zone, in Proc., Petroleum Hydrocarbons and Organic Chemicals in Ground Water - Prevention, Detection and
     Restoration, Houston, Texas, 473-503, National Water Well Association, 1984.
Massmann, J.W., Applying groundwater flow models in vapor extraction system design, /. Environ. Eng., 115(1),
     129-149, 1989.
Massmann, J.W. and D.F. Farrier, Effects of atmospheric pressures on gas transport in the vadose zone, Water
     Resour. Res., 28(3), 777-791,1992.
Massmann, J.W. and M. Madden, Estimating air conductivity and porosity from vadose-zone pumping tests, J.
     Environ. Eng., 120(2), 313-328, 1994.
McBride, J.F., C.S. Simmons and J.W. Gary, Interfacial spreading effects on one-dimensional organic liquid
     imbibition in water-wetted porous media, /. of Contaminant Hydrol., 11,1-25, 1992.
McCann, M., P. Boersma, J. Dankp, and M. Guerriero, Remediation  of a VOC contaminated Superfund site using
     soil vapor extraction, groundwater extraction, and treatment: A case study, Environ. Progress, 13(3), 208-213,
     1994.
McClellan, R.D. and R.W. Gilham, Vapour extraction of trichloroethylene under controlled conditions at the Borden
     site, in Subsurface Contamination by Immiscible Fluids, 89-96, A.A. Balkema, Rotterdam, 1992.  •
McWhorter, D.B., Unsteady radial flow of gas in the vadose zone, J.  Contam. Hydrol., 5, 297-314, 1990.

Mendoza, C.A. and E.O. Frind, Advective-dispersive transport of dense organic vapors in the unsaturated one 1.
     Model development, Water Resour.  Res., 26(3), 379-387,1990.

Mercer, J.W. and R.M. Cohen, A review of immiscible fluids in the subsurface:  properties, models, characterization
     and remediation, J. of Contaminant Hydrology, 6, 107-163, 1990.

Metcalf, D.E. and G.J. Farquhar, Modeling gas migration through unsaturated soil from waste disposal sites, Water
     Air & Soil Pollution, 32, 247-259, 1987.
                                                  234

-------
Miller, R.N., A Field Scale Investigation of Enhanced Petroleum Hydrocarbon Biodegradation in the Vadose Zone
     Combining Soil Venting as an Oxygen Source with Moisture and Nutrient Addition, Ph.D. Dissertation, Utah
     State Univ., Logan, UT, 1990.

Miller, R.N., D.C. Downey, V.A. Carmen, R.E. Hinchee, and A. Leeson, A summary of bioventing performance at
     multiple air force sites, in Hydrocarbon Bioremediation (R.E. Hinchee etal. eds.), 397-411, Lewis Pub., Boca
     Raton, 1994.

Millington, RJ. and J.P. Quirk, Permeability of porous solids, Trans, of the Faraday Society, 57, 1200-1207, 1961.

Milly, P.C.D., A mass-conservative procedure for time-stepping in models of unsaturated flow, Adv. Water
     Resources, 8, 32-36, 1985.

Molz, F.J., M.A. Widdowson and L.D. Benfield, Simulation of microbial growth dynamics coupled to nutrient and
     oxygen transport in porous media, Water Resour. Res., 22,1207-1216,  1986.

Mohr, D.H. and P.H. Merz, Application of a 2D air flow model to soil vapor extraction and bioventing case studies,
     Ground Water, 33(3), 433-444,  1995.

Moore, B.J., I.E. Armstrong, et al., The influence of temperature on bioventing, in In Situ Aeration: Air Sparging,
     Bioventing, and Related Remediation Processes (R.E. Hinchee et al.  eds.), 333-340, Battelle Press, Columbus,
     1995.

Mu, D.Y. and K.M. Scow, Effect of trichloroethylene (TCE) and toluene concentrations on TCE and Toluene
     biodegradation and the population density of TCE and toluene degraders in soil, Applied and Environmental
     Microbiology, 60(7), 2661-2665,1994.

Mualem, Y., A new model for predicting the hydraulic conductivity of unsaturated porous media, Water Resour.
     Res., 12(3), 513-522, 1976.

Mueller, J.G., PJ. Chapman andE.H. Pritchard, Creosote-contaminated sites, Environ. Sci. Technol, 23, 1197-1201,
     1989.

Munz, C. and P.V. Roberts, The ratio of gas-phase to liquid-phase mass transfer coefficients in gas-liquid contacting
     processes, in Gas Transfer at Water Surfaces (W. Brutsaert and G.H. Kirka eds.), D. Reidel, Dordrecht, 35-45,
     1984.

Mutch Jr., R.D. and DJ. Wilson, Soil clean up by in-situ aeration.  IV. Anisotropic permeabilities, Separation Sci.
     and Tech., 25(1 & 2), 1-29, 1990.

National Research  Council, Alternatives for Ground Water Cleanup, National Academy Press, Washington, D.C.,
     1994.

Nelson, C.H., R J. Hicks and S.D. Andrews, In situ bioremediation: An integrated system approach, in Hydrocarbon
     Bioremediation, 125-133, Lewis Pub., Boca Raton, 1994.

Norris, R.D., K. Dowd and C. Maudlin, The use of multiple oxygen sources and nutrient delivery systems to effect
     in situ bioremediation of saturation and unsaturated soils, in Hydrocarbon Bioremediation, 405-410, Lewis
     Pub., Boca Raton, 1994.

Novak, J.T., R.G. Young and S. Forsling, Bioavailability of contaminants sorbed to soil organic matter,  Proc.
     Petroleum Hydrocarbons and Organic Chemicals in Ground Water, 335-349, National Ground Water
     Association, 1993.

Ogata, A. and R.B. Banks, A solution of the differential equation of longitudinal dispersion in porous media,
     Geological Survey Professional Paper 411-A, Washington, D.C.: United States Government Printing Office,
     1961.

Ong, S.K., R.E. Hinchee, R. Hoeppel and R. Schultz, In situ respirometry  for determining aerobic degradation rates,
     In situ Bioremediation,  (R.E. Hinchee and R.F. O'fenbuttel, eds.), Butterworth-Heinemann, Boston, 541-45,
     1991.

Ong, S.K., A. Leeson, R.E. Hinchee, etal, Cold climate applications of bioventing, in Hydrocarbon
     Bioremediation, 444-453, Lewis Pub., Boca Raton, 1994.

Osejo, R.E. and D.J. Wilson, Soil clean up by in situ aeration. IX. Diffusion constants of volatile organics and
     removal of underlying liquid, Separation Sci. and Tech., 26(12), 1433-1466, 1991.
                                                  235

-------
Parker, J.C., R.J. Lenhard and T. Kuppusamy, A parametric model for constitutive properties governing multiphase
     flow in porous media, Water Resour. Res., 23, 618-624, 1987.
Pedersen, T.A. and J.t. Curtis, Soil Vapor Extraction Technology - Reference Handbook* U.S. EPA,
     EPA/540/2-91/003,1991.
Pennell, K.D., R.D. Rhue, RS.C. Rao and C.T. Johnson, Vapor-phase sorptiori of p-xylehe and water on soils and
     clay minerals, Environ. Sci. Technol, 26(4), 756-762,1992.
Perry, R.H. and C.H. Chilton, Chemical Engineers' Handbook, McG-raw-Hill, New York* 1971
Philip, J.R., Theory of infiltration, Advances in Hydroscience, (ed. V.T. Chow), 5, Academic Press, New York, 1969.
Pignatello,  J.J. and B. Xing, Mechanisms of slow sorption of organic chemicals to natural particles, Environ. Sci.
     Technol, 30(1), 1-11,1996.
Powers, S.E., C.O. Loureiro, L.M. Abriola and W.J. Weber, Jr., Theoretical study of the non-equilibrium dissolution
     of NAPL in subsurface systems, Water Resour. Res., 27(4), 463-77, i991.
Powers, S.E., L.M. Abriola and W.J. Weber, Jr., An experimental  investigation of NAPL dissolution in saturated
     subsurface systems: Steady-state mass transfer rates, Water Resour. Res., 28(10), 2691-2705, 1992.

Powers, S.E., L.M. Abriola and W.J. Weber, Jr., An experimental investigation of NAPL dissolution in saturated
     subsurface systems: Transient mass transfer rates, Water Resour. Res., 30(2), 321-332, 1994.

Rainwater, K., M.R. Zaman, B.J. Claborn and H.W. Parker, Experimental and modeling studies of in situ
     volatilization: vapor-liquid equilibrium or diffusion-controlled process?, Proc. Petroleum Hydrocarbons and
     Organic Chemicals in Ground Water, 357-371, National Water Well Assoc., 1989.
Rathfelder, K. W.W-G. Yeh and D. Mackay, Mathematical simulation of soil vapor extraction systems: model
     development and numerical examples, J. Contain. Hydrol, 8, 263-297, 1991.
Rathfelder, K.M. and L.M. Abriola, Mass conservative numerical solutions of the head-based Richards equation,
     Water Resour. Res., 30(9), 2579-2586, 1994.
Rathfelder, K.M., J.R. Lang, and L.M.  Abriola, Soil vapor extraction and bioventing: Applications, limitations, and
     future research directions, Reviews of Geophysics IUGG Quadrennial Report, American Geophysical Union,
     1067-1082,1995.
Reeves, H.W. and L.M. Abriola, A decoupled approach to the simulation of flow and transport of non-aqueous
     organic phase contaminants through porous media, Modeling Surface and Sub-surface Flows, Developments in
     Water Science, Proceedings of the VII International Conference on Computational Methods in Water
     Resources, Vol. 1, 35,147-52, Elsevier, 1988.
Reeves, H.W., Volatilization and Vapor Phase Transport of Organic Contaminants in the Subsurface, Ph.D.
     Dissertation, University of Michigan, Ann Arbor, MI, 1993.
Reeves, H.W. and L.M. Abriola, An iterative-compositional model for subsurface multiphase flow, submitted to
     Journal of Contaminant Hydrology, 15,249-276,1994.
Reid, R.C., J.M. Prausnitz and T.K. Sherwood, The Properties of Gases and Liquids, McGraw-Hill, New York, 1977.
Reisinger,  H.J., E.F. Johnstone, and P. Hubbard, Jr., Cost effectiveness and feasibility comparison of bioventing vs.
     conventional soil venting, in Hydrocarbon Bioremediation, 40-57, Lewis Pub., Boca Raton, 1994.
Riddick, J.A., W.B. Bundger, and T.K. Sakano, Organic  Solvents: Physical Properties and Methods of Purification,
     John Wiley, New York,  1986.
 Rijnaarts, H.H.M., A. Bachmann, J.C. Jumelet and AJ. Zehnder, Effect of desorption and intraparticle mass transfer
      on the aerobic biomineralization of a-hexachlorocyclohexane in a contaminated  calcareous soil, Environ. Sci.
      Technol., 24, 1349-1354, 1990.
 Roberts, L.A. and D.J. Wilson, Soil clean up by in-situ aeration:  XI. Cleanup time distributions for statistically
      equivalent variable permeabilities, Separation Sci.  and Tech., 28(8), 1539-1559,  1993.
 Roberts, P.V., G.D. Hopkins, C. Munz and A.H. Riojas, Evaluating two-resistance models for air stripping of volatile
      organic organic contaminants in a countercurrent packed column,  Environ. Sci. Technol., 19(2), 164-173,  1985.
                                                  236

-------
                                                                                         Bffects


               &91 Griffin> ^ 3naIytiCal m°del f°r in SkU 6XtraCtion °f OTSanic vaP°rs' '• rfft*. «*"**; 26,

 Sayles , G.D  RE. Hinchee  C.M. Vogel, R.C. Brenner and R.N. Miller, An evaluation of concurrent bioventing of
      jet fuel and several soil warming methods: A field study at Eielson Air Force Base Alask ^AbsS S5, L
      TnTT^'Tf diat£n °f HaZ3rdOUS WaSteS: *esearch' Development, arS $£&$£££ DaHaS
      TX, May 4-6, United States Environmental Protection Agency, EPA/600R-93/054, 27-337l993

 Sayles G.D., A Leeson, et al  Cold climate bioventing with soil warming in Alaska, in In Situ Aeration- Air
      CoSb'u's f Sg   S>        atCd Remediation Processes (R'E- HiDchce et al. 'eds.), 297-306,1 attelfe ^Press,
 Schw^zenbach, R.P., P.M. Gschwend and D.M. Imboden, Environmental Organic Chemistry, John Wiley, New






                                                                            Experimental results with


 Scow, K.M and J. Hutson, Effect of diffusion and sorption the kinetics of biodegradation- Theoretical
      considerations, Soil Set. Soc. Am. J., 56, 119-127, 1992.                         meorencai

 Scow, K.M., Effect of sorption-desorption and diffusion processes on the kinetics of biodegradation of organic
Simunek, J., T. Vogel and M. Th. van Genuchten, The SWMS J>D Code for Simulating Water Flow and Solute




                                 C?frfner' Use °f thermal-enhanced soil vapor extraction to accelerate




                                                              * ^^ "^^ media' Water Resour'

Sleep B.E _ and J F. Sykes, Biodegradation of volatile organic compounds in porous media with natural and forced
     gas-phase advection, In situ Bioremediation, (R.E. Hinchee and R.F. O'fenbuttel  eds )
     Butterworth-Heinemann, Boston, 245-61, 1991.                            '


                                        °f UnSatUrated S°ils contami^d with chlorinated solvents, / HaZ.


     pH'"          Se5anSP°rt °f gasoline vaP°rs ^ an advective-diffusion unsaturated zone model
     Proceedings Petroleum Hydrocarbons and Organic Chemicals in Groundwater: Prevention Detect and
     Restoration, National Water Well Association, Houston, TX, 591-61 1, 1988.     revemi°n' Uetectlon and
                                      ***** Element Meth°d> Prentice-Hall Inc., Englewood Cliffs, New
SykesbiFw
                                                                migration ^ attenuation in
                                                                                                waters
                                                                            from Contaminated Soil,
                                                237

-------
Thomas, J.M. and C.H. Ward, Subsurface microbial ecology and bioieiilediation, J. ofHaz. Materials, 32, 179-194,
     1992.

Thornton J.S. and W.L. Wootan, Venting for the removal of hydrocarbon vapors frotti gasoline contaminated soil, J.
     Environ. Sci. Health, A17(l), 31-44,1982.

Thorstenson, D.C. and D.W. Pollock, Gas transport in unsaturated porous media: The adequacy of Pick's Law,
     Reviews of Geophysics, 27(1), 61-78, 1989.

Travis, C.C. and J.M. Macinnis, Vapof extraction of organics from subsurface soils — Is it effective?, Environ. Sci.
     Technol, 26(10), 1885-1887,1992.

U.S. Environmental Protection Agency, Innovative Treatment Technologies - Overview and Guide to Information
     Sources, EPA/540/9-91/002, 1991.

van Eyk, J., Venting and bioventing for the in situ removal of petroleum from soil, in Hydrocarbon Bioremediation,
     243-251, Lewis Pub., Boca Raton, 1994.

van Genuchten, M.T., A comparison of numerical solutions of the one-dimensional unsaturated-saturated flow and
     mass transport equations, Adv. in Water Resources, 5,47-55, 1980.

Voss, C.I., SUTRA, A finite element simulation model for saturated-unsaturated, fluid-density-dependent
     groUndwater flow with energy transport or chemically-reactive single-species solute transport, U.S. Geological
     Survey, Reston, VA, 1984.

Weber, W.J., Jr. and C.T. Miller, Modeling the sorption of hydrophobic contaminants by aquifer materials I. Rates
     and equilibria, Water Res., 22(4), 457-464, 1988.

Weber, W.J., Jr., P.M. McGinley and L.M. Katz, Sorption phenomena in subsurface systems: Concepts, models and
     effects on contaminant fate and transport, Water Res., 25(5), 499-528,1991.

Weber, W.J., Jr., P.M. McGinley and L.M. Katz, A distributed reactivity model for sorption by soils and sediments 1.
     Conceptual basis and equilibrium assessments, Environ. Sci. Technol, 26,  1955-1962, 1992.

Weber, W.J., Jr. and F. DiGiano, Process Dynamics in Environmental Systems, John Wiley, New York, 1996.

Welly, C, C.J. Joss, A.L. Baehr, and J.A. Dillow, Use of a three-dimetisiottal air-flow model coupled with an
     optimization algorithm to aid in the design of soil venting systems, Prtic. Petroleum Hydrocarbons and Organic
     Chemicals in Ground Water, 221-231, National Water Well Association, 1991.

Welly, J.R., C.E. Wicks and R.W. Wilson, Fundamentals of Momentum, Heat and Mass Transfer, John Wiley, New
     York, 1984.

Widdowson, M.A., F.J. Molz and L.D. Benfield, A numerical transport model for oxygen- and nitrate-based
     respiration linked to substrate and nutrient availability in porous media, Water ResoUr. Res., 24, 1553-65, 1988.

Wilkins, M.D., L.M. Abriola, and K.D. Pennell, An experimental investigation of rate limited nonaqueous phase
     liquid volatilization in unsaturated porous media: Steady state mass transfer, Water Resour. Res., 31(9),
     2159-2172, 1995.

Williamson, K.J. and P.L. McCarty, A model of substrate utilization by bacterial films, /. Water Pollut. Control Fed.,
     48(1), 9-24,1976.

Wilson, D.J., Soil clean up by in situ aeration: V.  Vapor stripping from fractured bedrock, Separation Sci. and Tech.,
     25(3), 243-262, 1990.

Wilson, D.J. and A.N. Clarke, Removal of semivolatiles from soils by steam stripping 1. A local equilibrium model,
     Separation Sci. and Tech., 27(11), 1337-1359,1992.

Wilson, J.L. and S.H. Conrad, E. Hagan, W.R. Mason, and W. Peplinski, The pore level spatial distribution and
     saturation of organic liquids in porous media, Proc. of NWWA Conference on Petroleum Hydrocarbons and
     Organic Chemicals in Groundwater, National Water Well Association, Dublin, OH, 107-132, 1988.

Wilson, J.L., S.H. Conrad, W.R. Mason, W. Peplinski and E. Hagan, Laboratory Investigation of Residual Liquid
     Organics from Spills Leaks and the Disposal of Hazardous Wastes in Groundwater, Robert S. Kerr
     Environmental Research Laboratory, EPA/600/6-90/004, April 1990.
                                                  238

-------
Wilson, J.L., Pore scale behavior of spreading and non-spreading liquids in the vadose zone, in Subsurface
     Contamination by Immiscible Fluids, (K.U. Weyer ed.), 107-114, A.A. Balkema, Rotterdam, 1992.

Wilson, J.L., Bioventing of chlorinated solvents for ground-water cleanup through bioremediation, in Handbook of
     Bioremediation,  117-129, Lewis Pub., Boca Raton, 1994.

Yeh, G-T., On the computation of Darcian velocity and mass balance in the finite element modeling of groundwater
     flow, Water Resour. Res., 17(5), 1529-1534, 1981.

Zaidel, J. and D. Russo, Analytical models of steady state organic species transport in the vadose zone with
     kinetically controlled volatilization and dissolution, Water Resour. Res., 29(10), 3343-3356, 1993.

Zienkiewicz, O.C. and R.L. Taylor, The Finite Element Method, McGraw-Hill, London, 1991.

Zwick, T.C., A. Leeson, et al, Soil moisture effects during bioventing in fuel contaminated arid soils, in In Situ
     Aeration:  Air Sparging, Bioventing, and Related Remediation Processes (R.E. Hinchee et al eds ) 333-340
     Battelle Press, Columbus, 1995.
                                                 239
                                                        •&U.S. GOVERNMENT PRINTING OFFICE: 1997 - 650-001/80159

-------

-------