4.3.2.2. Extended MODFLOW 6 Types

The type extensions involve little new code. Mostly this functionality is implemented by making copies of existing MODFLOW 6 modules and renaming the modules, types, and subroutines to avoid issues with having the same names for types and subroutines that use different types.

Documentation and comments are only provided for the modified portions of these four modules.


4.3.2.2.1. cphSimulationCreateModule in cp_SimulationCreate.f90

Copy of MODFLOW 6, v.6.1.1 SimulationCreateModule that has been slightly extended to provde for coupled mode simulation with HSPF. There are really only three modifications or extensions to this module.

  1. simulation_cr() replaced cphsimulation_cr() so that this module provides

    a unique name for simulation object creation

  2. simulation_da() replaced by cphsimulation_da() so that this module

    provides a unique name for simulation object deallocation

  3. cphgwf_cr() from cphGwfModule is used in models_create() so that extended

    type GWF models are created and used for coupled simulation.

Module cphSimulationCreateModule

subroutine  cphSimulationCreateModule/cphsimulation_cr()

Reads the simulation name file and initializes the models and exchanges. Only the name has changed and no functionality altered.

Called from

f2pwrap/cphsetup()

Call to

subroutine  cphSimulationCreateModule/cphsimulation_da()

Deallocates simulation variables. Only the name is changed and no functionality altered.

Called from

f2pwrap/cphdeallocall()

subroutine  cphSimulationCreateModule/models_create()

Create model objects for the simulation. Only modification is to use cphgwf_cr from cphGwfModule for groundwater flow model (GWF) creation.

Called from

read_simulation_namefile in cphSimlationCreateModule

Call to

cphGwfModule/cphgwf_cr()


4.3.2.2.2. cphGwfModule in cp_gwf3.f90

Copy of MODFLOW 6, v.6.1.1 GwfModule that has been slightly extended to provde for coupled mode simulation with HSPF. There are really only five modifications or extensions.

  1. GwfModelType replaced cphGwfModelType so that the types can

    coexist in pyMF6

  2. gwf_cr() replaced by cphgwf_cr() to ensure that this version of

    create is only called for coupled

  3. package_create() subroutine has been extended to create

    cphUzfModule/cphUzfType UZF packages and cphDrnModule/cphDrnType DRN packages.

  1. Added gwf_chprp() for groundwater model read and prepare. The

    original gwf_rp is maintained. gwf_chprp provides for passing in of the array of UZF infiltration to the model from an external process. It also calls the modified UZF type that is customized to deal with receiving this array each simulation day.

  2. Added cphsurfdis() to extract simulated groundwater discharges to

    the surface for the just simulated time step. This includes DRN package discharge, UZF seepage to surface, and UZF rejected infiltration.

Module cphGwfModule

type  cphGwfModule/cphGwfModelType

GWF model type that extended to provide for receiving an array of infiltration at the start of each simulation day and returning an array of groundwater discharge to the surface at the end of each simulation day.

subroutine  cphGwfModule/cphgwf_cr(filename, id, modelname, smr)

Create a new groundwater flow model object and add it to the internal list of models. Also assign the values for this model object. This routine is unchanged, just renamed.

Parameters
  • filename (*) [character,in] :: name file

  • id [integer,in] :: model identifier

  • modelname (*) [character,in] :: model name string

  • smr [logical,in] :: is a single model run?

Call to

package_create()

Called from

cphSimulationCreateModule/models_create()

subroutine  cphGwfModule/package_create(this, filtyp, ipakid, ipaknum, pakname, inunit, iout)

Create boundary condition packages for the GWF model. Uses the same parameters and is unchanged except for creation of cphUzfModule/cphUzfType and cphDrnModule/cphDrnType packages.

Call to

Called from

cphgwf_cr()

subroutine  cphGwfModule/gwf_chprp(this, cpinalen, cpinarr)

Modified GroundWater Flow Model (GWF) read and prepare which calls package read and prepare routines. Main modification is to receive an array from HSPF and a length for this array and then pass the array to the modified UZF package.

Parameters
  • this [cphGwfModelType,in] :: self

  • cpinalen [integer,optional, in] :: length of the cpinarr array, NUZFCELLS

  • cpinarr (cpinalen) [float,optional, in] :: array of fixed infiltration rates

Call to

cphUzfModule/cphuzf_rp()

Called from

f2pwrap/cphinnertimeloop()

subroutine  cphGwfModule/cphsurfdis(this, surfd, numnodes2d)

Extract all simulated discharges to the ground surface and compile these to an array representing a layer surface. This array is returned to the calling program for passing to an external process. The array is calculated from DRN discharge, UZF seepage, and UZF rejected infiltration.

Parameters
  • this [cphGwfModelType,in] :: self

  • surf2d (2, numnodes2d) [float,inout] ::

    array of cell discharge values

    1. UZF groundwater discharge and DRN discharge

    2. UZF rejected infiltration

  • numnodes2d [integer,in] :: number of cells in a layer, NCPL

Call to

Called from

f2pwrap/cphinnertimeloop()


4.3.2.2.3. cphUzfModule in cp_gwf3uzf8.f90

Copy of MODFLOW 6, v.6.1.1 UzfModule that has been slightly extended to provde for coupled mode simulation with HSPF. There are really only four modifications or extensions.

  1. UzfType replaced cphUzfType so that the types can coexist in pyMF6

  2. uzf_create() replaced by cphuzf_create() to ensure that this version

    of create is only called for coupled

  3. Added cphuzf_rp for package read and prepare. The original uzf_rp is

    maintained. cphuzf_rp provides for passing in of the array of UZF infiltration to the model from an external process. These infiltration values are then written into the time series inputs for the current day.

  4. Added cphuzf_exsdis() to extract simulated groundwater discharges to

    the surface for the just simulated time step. This includes UZF seepage to surface and UZF rejected infiltration.

Module cphUzfModule

type  cphUzfModule/cphUzfType

UZF package type that extended to provide for receiving an array of infiltration at the start of each simulation day and returning an array of groundwater discharge to the surface at the end of each simulation day.

subroutine  cphUzfModule/cphuzf_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)

Create a new UZF boundary forcing package for the GWF model at the start of the simulation. The subroutine is unchanged, including parameters, but is extended to use the coupled model UZF type.

Called from

cphGwfModule/package_create()

subroutine  cphUzfModule/cphuzf_rp(this, cpinalen, cpinarr)

New subroutine based on uzf_rp that puts the infiltration from HSPF into the sinf values location so that will be incorporated into the time step solution for the current day. Does this every simulation day.

Parameters
  • this [cphUzfType,in] :: self

  • cpinalen [integer,optional, in] :: length of the cpinarr array, NUZFCELLS

  • cpinarr (cpinalen) [float,optional, in] :: array of fixed infiltration rates

Called from

cphGwfModule/gwf_chprp()

subroutine  cphUzfModule/cphuzf_exsdis(this, surfd, numnodes2d)

New subroutine for coupling to HSPF. It provides an extension to extract surface discharges. Both groundwater seepage discharge and rejected infiltration are collated from the UZF solution for the current time step.

Parameters
  • this [cphUzfType,in] :: self

  • surf2d (2, numnodes2d) [float,inout] ::

    array of cell discharge values

    1. UZF groundwater discharge and DRN discharge

    2. UZF rejected infiltration

  • numnodes2d [integer,in] :: number of cells in a layer, NCPL

Called from

cphGwfModule/cphsurfdis()


4.3.2.2.4. cphDrnModule in cp_gwf3drn8.f90

Copy of MODFLOW 6, v.6.1.1 DRN Module that has been slightly extended to provide for coupled mode simulation with HSPF. There are really only three modifications or extensions.

  1. DrnType replaced cphDrnType so that the types can coexist in pyMF6

  2. drn_create() replaced by cphdrn_create() to ensure that this version

    of create is only called for coupled

  3. Added cphdrn_exsdis() to extract simulated groundwater discharges to

    the surface for the just simulated time step.

Module cphDrnModule

type  cphDrnModule/cphDrnType

DRN package type that extended to provide for returning an array of groundwater discharge to the surface at the end of each simulation day.

subroutine  cphDrnModule/cphdrn_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)

Create a new DRN boundary forcing package for the GWF model at the start of the simulation. The subroutine is unchanged, including parameters, but is extended to use the coupled model DRN type.

Called from

cphGwfModule/package_create()

subroutine  cphDrnModule/cphdrn_exsdis(this, surfd, numnodes2d)

New subroutine for coupling to HSPF. It provides an extension to extract surface discharges. DRN package discharge is added to the array that returned to the external process.

Parameters
  • this [cphDrnType,in] :: self

  • surf2d (2, numnodes2d) [float,inout] ::

    array of cell discharge values

    1. UZF groundwater discharge and DRN discharge

    2. UZF rejected infiltration

  • numnodes2d [integer,in] :: number of cells in a layer, NCPL

Called from

cphGwfModule/cphsurfdis()