gwflow_module.f90 Source File


Files dependent on this one

sourcefile~~gwflow_module.f90~~AfferentGraph sourcefile~gwflow_module.f90 gwflow_module.f90 sourcefile~basin_read_objs.f90 basin_read_objs.f90 sourcefile~basin_read_objs.f90->sourcefile~gwflow_module.f90 sourcefile~cal_parm_select.f90 cal_parm_select.f90 sourcefile~cal_parm_select.f90->sourcefile~gwflow_module.f90 sourcefile~cal_parmchg_read.f90 cal_parmchg_read.f90 sourcefile~cal_parmchg_read.f90->sourcefile~gwflow_module.f90 sourcefile~command.f90 command.f90 sourcefile~command.f90->sourcefile~gwflow_module.f90 sourcefile~cs_balance.f90 cs_balance.f90 sourcefile~cs_balance.f90->sourcefile~gwflow_module.f90 sourcefile~cs_lch.f90 cs_lch.f90 sourcefile~cs_lch.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_canal.f90 gwflow_canal.f90 sourcefile~gwflow_canal.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_canal_div.f90 gwflow_canal_div.f90 sourcefile~gwflow_canal_div.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_canal_ext.f90 gwflow_canal_ext.f90 sourcefile~gwflow_canal_ext.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_chan_read.f90 gwflow_chan_read.f90 sourcefile~gwflow_chan_read.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_channel_exch.f90 gwflow_channel_exch.f90 sourcefile~gwflow_channel_exch.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_chem.f90 gwflow_chem.f90 sourcefile~gwflow_chem.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_floodplain.f90 gwflow_floodplain.f90 sourcefile~gwflow_floodplain.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_gwet.f90 gwflow_gwet.f90 sourcefile~gwflow_gwet.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_heat.f90 gwflow_heat.f90 sourcefile~gwflow_heat.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_lateral.f90 gwflow_lateral.f90 sourcefile~gwflow_lateral.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_output.f90 gwflow_output.f90 sourcefile~gwflow_output.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_phreatophyte.f90 gwflow_phreatophyte.f90 sourcefile~gwflow_phreatophyte.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_pond.f90 gwflow_pond.f90 sourcefile~gwflow_pond.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_pump_allo.f90 gwflow_pump_allo.f90 sourcefile~gwflow_pump_allo.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_pump_ext.f90 gwflow_pump_ext.f90 sourcefile~gwflow_pump_ext.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_read.f90 gwflow_read.f90 sourcefile~gwflow_read.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_rech.f90 gwflow_rech.f90 sourcefile~gwflow_rech.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_reservoir.f90 gwflow_reservoir.f90 sourcefile~gwflow_reservoir.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_satexcess.f90 gwflow_satexcess.f90 sourcefile~gwflow_satexcess.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_simulate.f90 gwflow_simulate.f90 sourcefile~gwflow_simulate.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_soil.f90 gwflow_soil.f90 sourcefile~gwflow_soil.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_solute.f90 gwflow_solute.f90 sourcefile~gwflow_solute.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_tile.f90 gwflow_tile.f90 sourcefile~gwflow_tile.f90->sourcefile~gwflow_module.f90 sourcefile~gwflow_wetland.f90 gwflow_wetland.f90 sourcefile~gwflow_wetland.f90->sourcefile~gwflow_module.f90 sourcefile~hru_control.f90 hru_control.f90 sourcefile~hru_control.f90->sourcefile~gwflow_module.f90 sourcefile~nut_nlch.f90 nut_nlch.f90 sourcefile~nut_nlch.f90->sourcefile~gwflow_module.f90 sourcefile~nut_solp.f90 nut_solp.f90 sourcefile~nut_solp.f90->sourcefile~gwflow_module.f90 sourcefile~recall_cs.f90 recall_cs.f90 sourcefile~recall_cs.f90->sourcefile~gwflow_module.f90 sourcefile~recall_salt.f90 recall_salt.f90 sourcefile~recall_salt.f90->sourcefile~gwflow_module.f90 sourcefile~salt_balance.f90 salt_balance.f90 sourcefile~salt_balance.f90->sourcefile~gwflow_module.f90 sourcefile~salt_lch.f90 salt_lch.f90 sourcefile~salt_lch.f90->sourcefile~gwflow_module.f90 sourcefile~sd_channel_control3.f90 sd_channel_control3.f90 sourcefile~sd_channel_control3.f90->sourcefile~gwflow_module.f90 sourcefile~sd_channel_sediment3.f90 sd_channel_sediment3.f90 sourcefile~sd_channel_sediment3.f90->sourcefile~gwflow_module.f90 sourcefile~swr_satexcess.f90 swr_satexcess.f90 sourcefile~swr_satexcess.f90->sourcefile~gwflow_module.f90 sourcefile~wallo_canal.f90 wallo_canal.f90 sourcefile~wallo_canal.f90->sourcefile~gwflow_module.f90 sourcefile~wet_read_hyd.f90 wet_read_hyd.f90 sourcefile~wet_read_hyd.f90->sourcefile~gwflow_module.f90 sourcefile~wetland_control.f90 wetland_control.f90 sourcefile~wetland_control.f90->sourcefile~gwflow_module.f90

Source Code

      module gwflow_module
     
      implicit none

      !general variables ----------------------------------------------------------------------------------------------
      integer :: ncell = 0          !               !number of gwflow cells
      integer :: num_active = 0     !               !number of active cells
      real    :: gw_time_step = 0.  !days           !flow solution time step
      integer :: gwflag_day = 0     !               !flag for writing daily mass balance file
      integer :: gwflag_mon = 0     !               !flag for writing monthly mass balance file
      integer :: gwflag_yr = 0      !               !flag for writing yearly mass balance file
      integer :: gwflag_aa = 0      !               !flag for writing average annual mass balance file
      integer :: gwflag_obs = 1     !               !flag for writing observation well output (default on)
      integer :: gwflag_pump = 1    !               !flag for writing HRU pumping output (default on)
      integer :: gwflag_heat = 1    !               !flag for writing heat balance output (default on if heat active)
      integer :: gwflag_solute = 1  !               !flag for writing solute balance output (default on if solute active)
      integer :: gwflag_flux = 1    !               !flag for writing specialty diagnostic output (default on)
      integer :: bc_type = 0        !               !boundary conditions (1=constant head; 2=no-flow)
      integer :: conn_type = 0      !               !recharge/ET connections (1=HRU; 2=LSU)
      integer :: gw_daycount = 0    !               !simulation day counter (for pumping time series)
      real*8  :: gwflow_area = 0.d0 !m2             !area of the watershed occupied by active gwflow cells
      real, dimension (:), allocatable :: bc_type_array !generic array for reading in values for structured grid
      
      !grid type ------------------------------------------------------------------------------------------------------
      character*15 :: grid_type                               !"structured" or "unstructured" (usg)
      integer :: grid_nrow = 0                                !number of rows in structured grid
      integer :: grid_ncol = 0                                !number of columns in structured grid
      integer, dimension (:,:), allocatable :: cell_id_usg    !usg cell number, for cell in structured grid (array)
      integer, dimension (:), allocatable :: cell_id_list     !usg cell number, for cell in structured grid (list)
      integer, dimension (:,:), allocatable :: grid_status    !cell status for structured grid
      integer, dimension (:,:), allocatable :: grid_int       !generic array for reading in values for structured grid
      real, dimension (:,:), allocatable :: grid_val          !generic array for reading in values for structured grid
      integer, dimension (:), allocatable :: cell_row          !structured grid row for each cell (for cell definition output)
      integer, dimension (:), allocatable :: cell_col          !structured grid column for each cell (for cell definition output)
      integer, dimension (:), allocatable :: cell_gis_id       !authoritative gis_id per cell (gwflowcells.shp id), from gwflow.cells col 22
      character(len=16), dimension (:), allocatable :: cell_name  !authoritative cell name (cellNNNN), from gwflow.cells col 2
      integer :: out_gw_celldef = 1416                         !file unit for cell definition output

      !groundwater state variables for each cell ----------------------------------------------------------------------
      type groundwater_state
        real :: elev = 0.           !m            |ground surface elevation
        real :: thck = 0.           !m            |aquifer thickness
        real :: botm = 0.           !m            |bottom (bedrock) elevation
        real :: xcrd = 0.           !m            |x coordinate of cell centroid
        real :: ycrd = 0.           !m            |y coordinate of cell centroid
        real :: area = 0.           !m2           |surface area
        real :: init = 0.           !m            |initial groundwater head (beginning of simulation)
        real :: head = 0.           !m            |current simulated groundwater head
        real :: hydc = 0.           !m/day        |aquifer hydraulic conductivity
        real :: spyd = 0.           !m3/m3        |aquifer specific yield
        real :: exdp = 0.           !m            |groundwater ET extinction depth
        integer :: stat = 0         !             |status (0=inactive; 1=active; 2=boundary)
        integer :: zone = 0         !             |aquifer zone
        integer :: ncon = 0         !             |number of connected cells
        integer :: tile = 0         !             |tile drainage flag (0=no tile; 1=tile is present)
        real :: hnew = 0.           !m            |new groundwater head (at end of day)
        real :: hold = 0.           !m            |old groundwater head (at beginning of day)
        real :: stor = 0.           !m3           |currently available groundwater storage
        real :: vbef = 0.           !m3           |groundwater volume at beginning of day
        real :: vaft = 0.           !m3           |groundwater volume at end of day
        real :: hdmo = 0.           !m            |monthly average groundwater head
        real :: hdyr = 0.           !m            |annual average groundwater head
        real :: delx = 0.           !m            |change in groundwater position (x direction) for current time step
        real :: dely = 0.           !m            |change in groundwater position (y direction) for current time step
      end type groundwater_state
      type (groundwater_state), dimension (:), allocatable :: gw_state
      
      
      !groundwater transit time variables for each cell ---------------------------------------------------------------
      integer :: gw_ttime = 0
      integer :: gw_transit_num = 0
      integer, dimension (:), allocatable :: gw_transit_cells
      integer, dimension (:), allocatable :: gw_cell_chan_flag
      real, dimension (:), allocatable :: gw_cell_chan_time
      real, dimension (:), allocatable :: gw_cell_tile_time
      type groundwater_transit
        real*8 :: x = 0.             !m            |x coordinate
        real*8 :: y = 0.             !m            |y coordinate
        integer :: cell = 0          !             |current cell where groundwater is located
        real :: t = 0.               !d            |cumulative groundwater travel time from recharge area
        real :: t_chan = 0.          !d            |time for groundwater to reach a channel
        real :: t_tile = 0.          !d            |time for groundwater to reach a tile drain
        real :: t_well = 0.          !d            |time for groundwater to reach pumping well
      end type groundwater_transit
      type (groundwater_transit), dimension (:), allocatable :: gw_transit

      !variables for HRU (and LSU) linkage to grid cells --------------------------------------------------------------
      !variables for linking HRUs to grid cells
      integer :: hru_cells_link = 0                                          !        |
      integer, dimension (:), allocatable :: hru_num_cells                   !        |
      integer, dimension (:,:), allocatable :: hru_cells                     !        |
      real, dimension (:,:), allocatable :: hru_cells_fract                  !        |
      real, dimension (:,:), allocatable :: cells_fract                      !        |
      integer, dimension (:), allocatable :: hrus_connected                  !        |flag: which HRUs are connected to cells
      !variables for linking LSUs (landscape units) to grid cells
      integer :: lsu_cells_link = 0                                          !        |
      integer :: in_lsu_cell = 0                                             !        |
      integer, dimension (:), allocatable :: lsu_num_cells                   !        |
      integer, dimension (:,:), allocatable :: lsu_cells                     !        |
      real, dimension (:,:), allocatable :: lsu_cells_fract                  !        |
      integer, dimension (:), allocatable :: lsus_connected                  !        |
      
      
      !variables for groundwater sources and sinks --------------------------------------------------------------------

      !unified source/sink type -- used for water fluxes, heat fluxes, and grid summaries
      !fields not applicable to a given variable are left at 0.0 and unused
      type groundwater_ss
        real :: chng = 0.           !              |change in storage (grid summaries only)
        real :: rech = 0.           !              |recharge
        real :: gwet = 0.           !              |groundwater ET
        real :: gwsw = 0.           !              |groundwater discharge to channels
        real :: swgw = 0.           !              |channel seepage to groundwater
        real :: satx = 0.           !              |saturation excess flow
        real :: soil = 0.           !              |groundwater added to soil profile
        real :: latl = 0.           !              |lateral flow between cells
        real :: disp = 0.           !              |dispersion (heat/solute transport)
        real :: bndr = 0.           !              |boundary exchange
        real :: ppag = 0.           !              |allocation-driven pumping (irrigation)
        real :: ppdf = 0.           !              |pumping deficit (unmet demand)
        real :: ppex = 0.           !              |external pumping
        real :: tile = 0.           !              |tile drainage outflow
        real :: resv = 0.           !              |reservoir exchange
        real :: wetl = 0.           !              |wetland exchange
        real :: fpln = 0.           !              |floodplain exchange
        real :: canl = 0.           !              |canal exchange
        real :: pond = 0.           !              |recharge pond seepage
        real :: phyt = 0.           !              |phreatophyte transpiration
        real :: totl = 0.           !              |sum of inputs and outputs
      end type groundwater_ss

      !--- hydrology (water) fluxes: per-cell arrays (m3) ---
      type (groundwater_ss), dimension (:), allocatable :: gw_hyd_ss         !daily
      type (groundwater_ss), dimension (:), allocatable :: gw_hyd_ss_mo      !monthly sums
      type (groundwater_ss), dimension (:), allocatable :: gw_hyd_ss_yr      !yearly sums
      type (groundwater_ss), dimension (:), allocatable :: gw_hyd_ss_aa      !average annual sums
      real, dimension (:), allocatable :: gw_head_sum_aa                     !head sum across all years for AA avg

      !--- hydrology (water) fluxes: grid-wide totals (mm) ---
      type (groundwater_ss) :: gw_hyd_grid_mo                                !monthly grid total
      type (groundwater_ss) :: gw_hyd_grid_yr                                !yearly grid total
      type (groundwater_ss) :: gw_hyd_grid_aa                                !accumulates simulation total; divided by nbyr at end

      !--- shared grid totals for end-of-day / end-of-sim (computed in output_day, used in output_aa) ---
      real*8 :: vbef_grid = 0.d0                                              !m3 total GW volume at start of day
      real*8 :: vaft_grid = 0.d0                                              !m3 total GW volume at end of day
      real*8 :: heat_hbef_grid = 0.d0                                         !J total heat at start of day
      real*8 :: heat_haft_grid = 0.d0                                         !J total heat at end of day
      real :: sol_grid_mbef = 0.                                              !kg total solute mass at start of day
      real :: sol_grid_maft = 0.                                              !kg total solute mass at end of day
      integer :: sim_month = 0                                                !month counter for simulation

      !--- heat fluxes: per-cell arrays (Joule / MJ) ---
      type (groundwater_ss), dimension (:), allocatable :: gw_heat_ss        !daily
      type (groundwater_ss), dimension (:), allocatable :: gw_heat_ss_mo     !monthly sums
      type (groundwater_ss), dimension (:), allocatable :: gw_heat_ss_yr     !yearly sums

      !--- heat fluxes: grid-wide totals (MJ) ---
      type (groundwater_ss) :: gw_heat_grid_mo                               !monthly grid total
      type (groundwater_ss) :: gw_heat_grid_yr                               !yearly grid total
      type (groundwater_ss) :: gw_heat_grid_aa                               !accumulates simulation total; divided by nbyr at end
      
      !rech: variables for groundwater recharge ---------------------------------------------------
      integer, dimension (:), allocatable :: gw_bound_near  !           |nearest active cell to each boundary cell
      real, dimension (:), allocatable :: gw_bound_dist     !m          |distance of nearest active cell to each boundary cell
      real, dimension (:), allocatable :: gwflow_perc       !     |      
      real, dimension (:), allocatable :: gw_delay          !           |
      real, dimension (:), allocatable :: gw_rech           !           |
      real, dimension (:), allocatable :: delay             !           |
            
      !gwet: variables for groundwater evapotranspiration -----------------------------------------
      integer :: gw_et_flag = 0                             !           |
      real, dimension (:), allocatable :: etremain          !           |
      
      !gwsw: variables for groundwater-channel exchange -------------------------------------------
      integer :: num_chancells = 0                          !           |
      integer, dimension (:), allocatable :: gw_chan_id     !           |
      integer, dimension (:), allocatable :: gw_chan_cell   !           |
      integer, dimension (:), allocatable :: gw_chan_chan   !           |
      integer, dimension (:), allocatable :: gw_chan_zone   !           |
      integer, dimension (:), allocatable :: gw_chan_ncell  !           |number of cells connected to each channel
      real, dimension (:), allocatable :: gw_chan_len       !           |
      real, dimension (:), allocatable :: gw_chan_elev      !           |
      real, dimension (:), allocatable :: gw_chan_K         !           |
      real, dimension (:), allocatable :: gw_chan_thick     !           |
      real :: gw_bed_change = 0.                            !           |
      integer, dimension (:), allocatable :: gw_chan_dpzn   !           |depth zone per channel-cell connection
      integer, dimension (:), allocatable :: gw_chan_obs    !           |obs flag (0/1) per channel-cell connection (from chancell.gw)
      integer :: gw_chan_dep_flag = 0                        !           |flag for channel depth zones
      integer :: gw_chan_ndpzn = 0                           !           |number of channel depth zones
      real, dimension (:), allocatable :: gw_chan_dep        !m          |specified daily channel depths
      !channel-cell connection
      type cell_channel_info
        integer :: ncon = 0                                 !           |number of cells connected to the channel
        integer, allocatable :: cells(:)                    !           |cells connected to the channel
        real, allocatable :: leng(:)                        !m          |length of channel in the cell
        real, allocatable :: elev(:)                        !m          |elevation of channel bed in the cell
        real, allocatable :: hydc(:)                        !m          |hydraulic conductivity of channel bed in the cell
        real, allocatable :: thck(:)                        !m          |thickness of channel bed in the cell
        integer, allocatable :: dpzn(:)                     !           |channel depth zone (optional)
      endtype cell_channel_info
      type (cell_channel_info), dimension(:), allocatable :: gw_chan_info

      !groundwater-channel cell groups ---------------------------------------------------------
      integer :: gw_gwsw_group_flag = 0                     !           |flag for channel cell grouping
      integer :: gw_gwsw_ngroup = 0                         !           |number of groups
      integer :: gw_gwsw_max = 0                            !           |max cells per group
      integer, dimension (:), allocatable :: gw_gwsw_ncell  !           |number of cells per group
      integer, dimension (:,:), allocatable :: gw_gwsw_group !          |cell IDs in each group

      !channel observation cells ---------------------------------------------------------------
      integer :: gw_chan_obs_flag = 0                        !           |flag for observation cells
      integer :: gw_chan_nobs = 0                            !           |number of observation cells
      integer, dimension (:), allocatable :: gw_chan_obs_cell !          |cell IDs for observations
      
      !satx: variables for saturated excess flow --------------------------------------------------
      integer :: gw_satx_flag = 0                           !           |
      integer :: satx_count = 0                             !           |for each day: number of cells that are saturated
      type satx_channel_info
        integer :: ncon = 0                                 !           |number of cells connected to the channel
        integer, allocatable :: cells (:)                   !           |cells connected to the channel
      endtype satx_channel_info
      type (satx_channel_info), dimension(:), allocatable :: gw_satx_info
      
      !soil: variables for gw-->soil exchange -----------------------------------------------------
      integer :: gw_soil_flag = 0                           !           |
      real, dimension (:,:,:), allocatable :: hru_soil      !           |
      
      !latl: variables for groundwater lateral flow -----------------------------------------------
      type cell_connections
        integer, allocatable :: cell_id(:)                  !           |cells connected to the cell
        real, allocatable :: latl(:)                        !m3         |groundwater flow to/from connected cell
        real, allocatable :: sat(:)                         !m          |saturated thickness of connected cell
      endtype cell_connections
      type (cell_connections), dimension(:), allocatable :: cell_con
      
      !ppag: variables for irrigation pumping -----------------------------------------------------
      real, dimension (:), allocatable :: hru_pump          !m3/day     |daily pumping per HRU
      real, dimension (:), allocatable :: hru_pump_mo       !m3         |monthly accumulator
      real, dimension (:), allocatable :: hru_pump_yr       !m3         |yearly accumulator
      real, dimension (:), allocatable :: hru_pump_aa       !m3         |average annual accumulator (sum of yearly totals)
      !logical :: hru_pump_flag !           |
      integer :: hru_pump_flag = 0
      integer :: in_hru_pump_obs = 0                        !           |
      integer :: num_hru_pump_obs = 0                       !           |
      integer, dimension (:), allocatable :: hru_pump_ids   !           |
      real, dimension (:), allocatable :: hru_pump_obs      !           |
      
      !ppex: variables for specified groundwater pumping ------------------------------------------
      integer :: gw_pumpex_flag = 0                                !           |
      integer :: gw_npumpex = 0                                    !           |
      integer, dimension (:), allocatable :: gw_pumpex_cell        !           |
      integer, dimension (:), allocatable :: gw_pumpex_nperiods    !           |
      integer, dimension (:,:,:), allocatable :: gw_pumpex_dates   !           |
      real, dimension (:,:), allocatable :: gw_pumpex_rates        !           |
      
      !tile: variables for tile drainage outflow --------------------------------------------------
      integer :: gw_tile_flag = 0                                  !           |
      integer :: gw_tile_group_flag = 0                            !           |
      integer :: gw_tile_num_group = 0                             !           |
      integer :: num_tile_cells(50) = 0                            !           |
      real, dimension (:), allocatable :: gw_tile_depth            !m          |tile drain depth per cell
      real, dimension (:), allocatable :: gw_tile_drain_area       !m2         |drainage area per cell
      real, dimension (:), allocatable :: gw_tile_K                !m/day      |tile hydraulic conductivity per cell
      integer, dimension (:,:), allocatable :: gw_cell_tile        !           |
      integer, dimension (:), allocatable :: gw_tilecell_chancell  !           |
      integer, dimension (:,:), allocatable :: gw_tile_groups      !           |
      !channel-tile connection
      type tile_channel_info
        integer :: ncon = 0                                        !     |number of cells connected to the channel
        integer, allocatable :: cells(:)                           !     |cells connected to the channel
      endtype tile_channel_info
      type (tile_channel_info), dimension(:), allocatable :: gw_tile_info
      
      !resv: variables for groundwater-reservoir exchange -----------------------------------------
      integer :: gw_res_flag = 0            !     |
      real    :: res_thick = 0.             !     |
      real    :: res_K = 0.                 !     |
      integer :: num_res_cells = 0          !     |
      !cell-reservoir connection
      type cell_reservoir_info
        integer :: ncon = 0                 !     |number of cells connected to the channel
        integer, allocatable :: cells(:)    !     |cells connected to the channel
        real, allocatable :: elev(:)        !m    |elevation of channel bed in the cell
        real, allocatable :: hydc(:)        !m    |hydraulic conductivity of channel bed in the cell
        real, allocatable :: thck(:)        !m    |thickness of channel bed in the cell
      endtype cell_reservoir_info
      type (cell_reservoir_info), dimension(:), allocatable :: gw_resv_info
      
      !wetl: variables for groundwater-wetland exchange -------------------------------------------
      integer :: gw_wet_flag = 0                         !     |
      real, dimension (:), allocatable :: wet_thick      !     |
      
      !fpln: variables for groundwater-floodplain exchange ----------------------------------------
      integer :: gw_fp_flag = 0                                             !     |
      integer :: in_fp_cell = 0                                             !     |
      integer :: gw_fp_ncells = 0                                           !     |
      integer, dimension (:), allocatable :: gw_fp_cellid                   !     |
      integer, dimension (:), allocatable :: gw_fp_chanid                   !     |
      real, dimension (:), allocatable :: gw_fp_K                           !     |
      real, dimension (:), allocatable :: gw_fp_area                        !     |
      integer, dimension (:), allocatable :: flood_freq                     !     |
      !channel-cell connection
      type cell_floodplain_info
        integer :: ncon = 0                              !     |number of cells connected to the channel
        integer, allocatable :: cells(:)                 !     |cells connected to the channel
        real, allocatable :: hydc(:)                     !m    |hydraulic conductivity of floodplain bottom in the cell
        real, allocatable :: area(:)                     !m    |floodplain area in connection with cell
        integer, allocatable :: mtch(:)                  !     |matching channel cell
      endtype cell_floodplain_info
      type (cell_floodplain_info), dimension(:), allocatable :: gw_fpln_info
      
      !canl: variables for groundwater-canal exchange ---------------------------------------------
      integer :: gw_canal_flag = 0                       !     |
      integer :: gw_ncanal = 0                           !     |
      integer :: gw_canal_ncells = 0                     !     |
      integer :: num_canalK_zones = 0                    !     |
      real, dimension (:), allocatable :: canalK_zones   !     |
      !canal-channel connection
      type canal_chan_info
        integer :: ncanal = 0                            !     |number of canals connected to the channel
        integer, allocatable :: canals(:)                !     |canals connected to the channel
        real, allocatable :: wdth(:)                     !m    |canal width
        real, allocatable :: dpth(:)                     !m    |canal depth
        real, allocatable :: thck(:)                     !m    |canal thickness
        real, allocatable :: hydc(:)                     !m/d  |hydraulic conductivity of canal bed sediments
        integer, allocatable :: dayb(:)                  !     |beginning day of active canal
        integer, allocatable :: daye(:)                  !     |ending day of active canal
      endtype canal_chan_info
      type (canal_chan_info), dimension(:), allocatable :: gw_chan_canl_info
      !canal-cell connection
      type cell_canal_info
        integer :: ncon = 0                              !     |number of cells connected to the canal
        integer, allocatable :: cells(:)                 !     |cells connected to the canal
        real, allocatable :: leng(:)                     !m    |length of canal in the cell
        real, allocatable :: elev(:)                     !m    |stage of canal in the cell
        real, allocatable :: hydc(:)                     !m    |hydraulic conductivity of canal bed in the cell
      endtype cell_canal_info
      type (cell_canal_info), dimension(:), allocatable :: gw_canl_info 
      !canal-cell connection for canals that receive water outside of the model domain
      type cell_canal_out_info
        integer :: cell_id = 0
        real :: wdth = 0.
        real :: dpth = 0.
        real :: thck = 0.
        real :: leng = 0.
        real :: elev = 0.
        real :: hydc = 0.
        integer :: dayb = 0
        integer :: daye = 0
      end type cell_canal_out_info
      type (cell_canal_out_info), dimension (:), allocatable :: gw_canl_out_info
      integer :: gw_canal_ncells_out = 0                 !     |number of cells connected to canals that receive outside water
      real, allocatable :: canal_out_info(:,:)           !     |characteristics for canals that receive outside water
      real, allocatable :: canal_out_conc(:)             !     |solute concentration in canals that receive outside water
      !temporary: diversion water quality arrays (to be replaced by wallo transfer hydrograph in Phase 7)
      real, allocatable :: div_conc_salt(:,:)            !g/m3 |salt ion concentration in diverted water
      real, allocatable :: div_conc_cs(:,:)              !g/m3 |constituent concentration in diverted water
      !canal-cell connection for canals that receive water from a point source diversion
      type cell_canal_div_info
        integer :: cell_id = 0
        integer :: canal_id = 0
        real :: leng = 0.
        real :: elev = 0.
      end type cell_canal_div_info
      type (cell_canal_div_info), dimension (:), allocatable :: gw_canl_div_cell
      integer :: gw_canal_ncells_div = 0                 !     |number of cells connected to canals that receive from diversions
      !canal diversion characteristics
      type canal_info
        integer :: canal_id = 0
        integer :: divr = 0                              !     |recall diversion ID (0 = no recall)
        real :: width = 0.                               !m    |canal width
        real :: depth = 0.                               !m    |canal water depth
        real :: thick = 0.                               !m    |canal bed thickness
        real :: bed_K = 0.                               !m/day|canal bed hydraulic conductivity
        real :: div = 0.                                 !m3   |volume of water diverted from channel source
        real :: stor = 0.                                !m3   |current volume of canal water
        real :: out_seep = 0.                            !m3   |volume of canal water seeped to aquifer
        real :: out_pond = 0.                            !m3   |volume of canal water routed to recharge pond
      end type canal_info
      type (canal_info), dimension (:), allocatable :: gw_canl_div_info

      !pond: variables for recharge pond seepage --------------------------------------------------
      integer :: gw_pond_flag = 0                        !     |flag = 0 (off) or 1 (on)
      integer :: gw_pond_div_flag = 0                    !     |flag: daily pond diversion series present (pond_div.gw)
      integer :: gw_npond = 0                            !     |number of recharge ponds in the model domain
      integer :: in_ponds = 1219                         !     |input file unit for ponds
      !pond features
      type cell_pond_info
        integer :: id = 0                                !     |recharge pond id
        integer :: chan = 0                               !     |channel which provides water to the recharge pond
        integer :: canal = 0                              !     |canal which provides water to the recharge pond
        integer :: unl = 0                                !     |flag for outside source (1 = outside source)
        integer :: ncell = 0                              !     |number of cells connected to the recharge pond
        integer :: wsta = 0                               !     |weather station id
        real :: area = 0.                                !m2   |recharge pond surface area
        real :: bed_k = 0.                               !m/d  |hydraulic conductivity of the pond bed sediments
        real :: evap_co = 0.6                            !     |pond evaporation coefficient
        real :: stor = 0.                                !m3   |current daily volume of the recharge pond
        real :: seep = 0.                                !m3   |current daily seepage from the pond to the aquifer
        real :: div = 0.                                 !m3   |current daily specified diversion volume
        real :: div_uns = 0.                             !m3   |unsatisfied diversion volume
        real :: evap = 0.                                !m3   |current daily volume of evaporation from the recharge pond
        integer :: dy_start = 0                          !     |year when recharge pond begins operation
        integer, allocatable :: cells(:)                 !     |cells connected to the recharge pond
        real, allocatable :: conn_area(:)                !m2   |connection area between recharge pond and cell
        real, allocatable :: sol_mass(:)                 !kg   |solute mass in the pond water
        real, allocatable :: sol_conc(:)                 !g/m3 |solute concentration in the pond water
        real, allocatable :: unl_conc(:)                 !g/m3 |solute concentrations for an outside water source
      end type cell_pond_info
      type (cell_pond_info), dimension (:), allocatable :: gw_pond_info

      !phyt: variables for phreatophyte transpiration ----------------------------------------------
      integer :: gw_phyt_flag = 0                        !     |flag = 0 (off) or 1 (on)
      integer :: gw_phyt_ncells = 0                      !     |number of cells with phreatophytes
      integer :: gw_phyt_npts = 0                        !     |number of depth-rate points
      integer, allocatable :: gw_phyt_ids(:)             !     |ids of cells with phreatophytes
      real, allocatable :: gw_phyt_area(:)               !m2   |area of each cell that contains phreatophytes
      real, allocatable :: gw_phyt_dep(:)                !m    |depth below ground surface for ET-rate relationship
      real, allocatable :: gw_phyt_rate(:)               !m/day|rate of transpiration at corresponding depth

      !tvh: variables for time-varying boundary conditions -----------------------------------------
      integer :: gw_tvh_flag = 0                         !     |flag = 0 (off) or 1 (on)
      integer :: gw_ntvh = 0                             !     |number of time-varying boundary cells
      integer, allocatable :: gw_tvh_ids(:)              !     |boundary cell IDs
      real, allocatable :: gw_tvh_vals(:,:)              !     |boundary cell head values for each year

      !variables for writing out groundwater balance for selected groups of cells
      integer :: gw_group_flag = 0                       !     |flag to make active
      integer :: gw_wb_grp_num = 0                       !     |number of water balance groups
      integer, allocatable :: gw_wb_grp_ncell(:)         !     |number of cells in each group
      integer, allocatable :: gw_wb_grp_cells(:,:)       !     |cell IDs in each water balance group

      !general: nearest channel for each grid cell
      real, allocatable :: cell_channel(:)               !     |nearest channel for each grid cell 
      

      !variables for writing head and concentration values ------------------------------------------------------------
      integer :: gw_num_output = 0                              !     |
      integer :: gw_output_index = 0                            !     |
      integer, dimension (:), allocatable :: gw_output_yr       !     |
      integer, dimension (:), allocatable :: gw_output_day      !     |
      
      
      !variables for observation wells --------------------------------------------------------------------------------
      integer :: gw_num_obs_wells = 0                           !     |
      integer, dimension (:), allocatable :: gw_obs_cells       !     |
      real, dimension (:), allocatable :: gw_obs_head           !     |
      integer :: gw_cell_obs_ss = 0                             !     |
      real, dimension (:), allocatable :: gw_cell_obs_ss_vals   !     |
      

      !variables for hydrograph separation ----------------------------------------------------------------------------
      real, dimension (:,:), allocatable :: chan_hyd_sep
      integer, dimension (:), allocatable :: hydsep_flag


      !variables for groundwater heat transport -----------------------------------------------------------------------
      integer :: gw_heat_flag = 0         !             |flag (0 or 1) 1 = heat transport is simulated
      real :: gw_rho = 1000.              !kg/m3        |density of groundwater
      real :: gw_cp = 4182.               !J/(kg C)     |specific heat of groundwater
      real, dimension (:), allocatable :: gw_rechheat   !J            |heat in daily recharge (reaching water table)
      real, dimension (:), allocatable :: gw_obs_temp   !deg C        |temperature in observation cells
      real, dimension (:), allocatable :: gw_obs_temp_aa !deg C       |AA temperature accumulator for obs wells
      real, dimension (:,:), allocatable :: gw_obs_sol_aa  !mg/L      |AA solute conc accumulator for obs wells
      real, dimension (:), allocatable :: heat_cell     !J            |heat storage for current day (before heat change loop)
      type groundwater_heat_state
        real :: stor = 0.           !Joule        |current heat stored in groundwater
        real :: thmc = 0.           !J/(d m K)    |thermal conductivity
        real :: temp = 0.           !C            |current groundwater temperature
        real :: tnew = 0.           !C            |new groundwater temperature (at end of day)
        real :: told = 0.           !C            |old groundwater temperature (at beginning of day)
        real :: hbef = 0.           !Joule        |groundwater heat at beginning of day
        real :: haft = 0.           !Joule        |groundwater heat at end of day
        real :: tpmo = 0.           !C            |monthly average groundwater temperature
        real :: tpyr = 0.           !C            |annual average groundwater temperature
      end type groundwater_heat_state
      type (groundwater_heat_state), dimension (:), allocatable :: gwheat_state

      !note: gw_heat_ss, gw_heat_ss_mo, gw_heat_ss_yr, gw_heat_grid_* use the unified
      !      groundwater_ss type declared above in the sources/sinks section


      !variables for groundwater solute transport ---------------------------------------------------------------------
      
      !general solute variables
      integer :: gw_solute_flag = 0                           !    |main flag
      integer :: gw_nsolute = 0                               !    |number of solutes
      integer :: num_ts_transport = 0                         !    |number of transport time steps per day
      real :: gw_long_disp = 0.                               !m   |aquifer longitudinal dispersivity
      integer :: gwsol_salt = 0                               !    |flag for simulating salt ion groundwater transport (so4,ca,mg,na,k,cl,co3,hco3)
      integer :: gwsol_cons = 0              !    |flag for simulating constituent groundwater transport (seo4,seo3,boron)
      integer :: gwsol_minl = 0                               !    |flag for simulating salt mineral precipitation-dissolution
      integer :: gw_nminl = 0                                 !    |number of salt minerals (set to 5)
       
      !main attributes of solutes (allocated in gwflow_read to gw_nsolute)
      character (len=16), allocatable :: gwsol_nm(:)
      real, allocatable :: gwsol_rctn(:)
      real, allocatable :: gwsol_sorb(:)
      
      !solute cell state variables
      type solute_state
        real :: mass = 0.           !g            |solute mass in groundwater
        real :: init = 0.           !g/m3         |solute concentration in groundwater at beginning of simulation
        real :: conc = 0.           !g/m3         |solute concentration in groundwater      
        real :: cnew = 0.           !g/m3         |new concentrations at end of time step
        real :: mbef = 0.           !g            |solute mass at beginning of time step
        real :: maft = 0.           !g            |solute mass at end of time step
        real :: cnmo = 0.           !g/m3         |monthly average concentration
        real :: cnyr = 0.           !g/m3         |annual average concentration
      end type solute_state
      type object_solute_state
        type (solute_state), dimension (:), allocatable :: solute
      end type object_solute_state
      type (object_solute_state), dimension (:), allocatable :: gwsol_state

      !salt mineral cell state variables (allocated in gwflow_read to gw_nsolute)
      real, allocatable :: mass_min(:)                   !g       |solute mass added/removed from cell via precipitation-dissolution
      type minl_state
        real, dimension (:), allocatable :: fract        !        |fraction of cell that is the salt mineral
      end type minl_state
      type (minl_state), dimension (:), allocatable :: gwsol_minl_state
      
      !solute cell chemical reaction variables
      integer, dimension (:), allocatable :: cell_int
      real, allocatable :: mass_rct(:)    !g            |solute mass added/removed from cell via chemical reaction (allocated in gwflow_read)
      type solute_chem
        real :: ino3 = 0.           !             |selenium reduction inhibition factor
        real :: oxyg = 0.           !g/m3         |oxygen concentration in groundwater
        real :: kd_seo4 = 0.        !             |seo4 sorption partitioning coefficient
        real :: kd_seo3 = 0.        !             |seo3 sorption partitioning coefficient
        real :: kd_boron = 0.       !             |boron sorption partitioning coefficient
        real :: kseo4 = 0.          !1/day        |seo4 microbial reduction rate
        real :: kseo3 = 0.          !1/day        |seo3 microbial reduction rate
        integer :: nshale = 0                               !        |number of shale formations
        integer, dimension (:), allocatable :: shale        !        |presence of shale in cell
        real, dimension (:), allocatable :: shale_sseratio  !        |sulfur:se ratio in shale
        real, dimension (:), allocatable :: shale_o2a       !1/day   |o2 oxidation rate in presence of shale
        real, dimension (:), allocatable :: shale_no3a      !1/day   |no3 oxidation rate in presence of shale
        integer :: bed_flag = 0     !             |flag (0,1) for presence of shale in bedrock
        real :: bed_sse = 0.        !             |sulfur:se ratio in bedrock shale
        real :: bed_o2a = 0.        !1/day        |o2 oxidation rate in presence of bedrock shale
        real :: bed_no3a = 0.       !1/day        |no3 oxidation rate in presence of bedrock shale
        integer :: ripar = 0        !             |flag: 1=cell in riparian area; 0=not
      end type solute_chem
      type (solute_chem), dimension (:), allocatable :: gwsol_chem
      
      !solute cell mass sources and sinks (inputs and outputs)
      type solute_ss
        real :: rech = 0.           !g            |solute mass entering cell via recharge water
        real :: gwsw = 0.           !g            |solute mass leaving cell via groundwater discharging to channels
        real :: swgw = 0.           !g            |solute mass entering cell via channel water seeping to groundwater
        real :: soil = 0.           !g            |solute mass leaving cell via gw-->soil transfer
        real :: satx = 0.           !g            |solute mass leaving cell via saturation excess flow
        real :: ppag = 0.           !g            |solute mass leaving cell via pumping (for agriculture)
        real :: ppex = 0.           !g            |solute mass leaving cell via pumping (external demand)
        real :: tile = 0.           !g            |solute mass leaving cell via tile drainage outflow
        real :: resv = 0.           !g            |solute mass exchanged with reservoir
        real :: wetl = 0.           !g            |solute mass exchanged with wetland
        real :: fpln = 0.           !g            |solute mass exchanged with channel in floodplain
        real :: canl = 0.           !g            |solute mass exchanged with irrigation canal
        real :: pond = 0.           !g            |solute mass in recharge pond seepage water
        real :: advn = 0.           !g            |solute mass advected to/from cell
        real :: disp = 0.           !g            |solute mass dispersed to/from cell
        real :: rcti = 0.           !g            |solute mass of chemical reaction (input)
        real :: rcto = 0.           !g            |solute mass of chemical reaction (output)
        real :: minl = 0.           !g            |solute mass added (dissolution) or removed (precipitation) via salt mineral interactions
        real :: sorb = 0.           !g            |solute mass of sorption
        real :: totl = 0.           !g            |sum of mass inputs and outputs
      end type solute_ss
      type object_solute_ss
        type (solute_ss), dimension (:), allocatable :: solute
      end type object_solute_ss
      type (object_solute_ss), dimension (:), allocatable :: gwsol_ss
      
      !summed values for solutes
      type solute_ss_sum
        real :: rech = 0.           !g            |solute mass entering cell via recharge water
        real :: gwsw = 0.           !g            |solute mass leaving cell via groundwater discharging to channels
        real :: swgw = 0.           !g            |solute mass entering cell via channel water seeping to groundwater
        real :: soil = 0.           !g            |solute mass leaving cell via gw-->soil transfer
        real :: satx = 0.           !g            |solute mass leaving cell via saturation excess flow
        real :: ppag = 0.           !g            |solute mass leaving cell via pumping (for agriculture)
        real :: ppex = 0.           !g            |solute mass leaving cell via pumping (external demand)
        real :: tile = 0.           !g            |solute mass leaving cell via tile drainage outflow
        real :: resv = 0.           !g            |solute mass exchanged with reservoir
        real :: wetl = 0.           !g            |solute mass exchanged with wetland
        real :: fpln = 0.           !g            |solute mass exchanged with channel in floodplain
        real :: canl = 0.           !g            |solute mass exchanged with irrigation canal
        real :: pond = 0.           !g            |solute mass in recharge pond seepage water
        real :: advn = 0.           !g            |solute mass advected to/from cell
        real :: disp = 0.           !g            |solute mass dispersed to/from cell
        real :: rcti = 0.           !g            |solute mass produced by chemical reaction
        real :: rcto = 0.           !g            |solute mass consumed by chemical reaction
        real :: minl = 0.           !g            |solute mass produced by salt mineral dissolution
        real :: sorb = 0.           !g            |solute mass of sorption
      end type solute_ss_sum
      type object_solute_ss_sum
        type (solute_ss_sum), dimension (:), allocatable :: solute
      end type object_solute_ss_sum
      type (object_solute_ss_sum), dimension (:), allocatable :: gwsol_ss_sum
      type (object_solute_ss_sum), dimension (:), allocatable :: gwsol_ss_sum_mo
      
      !percolation and recharge arrays
      real, dimension (:,:), allocatable :: gwflow_percsol         !kg/ha    |solute mass leaving the soil profile
      real, dimension (:,:), allocatable :: gw_rechsol             !kg/ha    |solute mass in daily recharge (reaching water table)
      
      !grid mass for month, year, and total (kg)
      real, dimension (:), allocatable :: sol_grid_chng_mo,sol_grid_rech_mo,sol_grid_gwsw_mo,sol_grid_swgw_mo, &
                                          sol_grid_satx_mo,sol_grid_advn_mo,sol_grid_disp_mo, &
                                          sol_grid_rcti_mo,sol_grid_rcto_mo,sol_grid_minl_mo, &
                                          sol_grid_sorb_mo,sol_grid_ppag_mo,sol_grid_ppex_mo,sol_grid_tile_mo, &
                                          sol_grid_soil_mo,sol_grid_resv_mo,sol_grid_wetl_mo,sol_grid_canl_mo, &
                                          sol_grid_fpln_mo,sol_grid_pond_mo
      real, dimension (:), allocatable :: sol_grid_chng_yr
      real, dimension (:), allocatable :: sol_grid_rech_yr
      real, dimension (:), allocatable :: sol_grid_gwsw_yr
      real, dimension (:), allocatable :: sol_grid_swgw_yr
      real, dimension (:), allocatable :: sol_grid_satx_yr
      real, dimension (:), allocatable :: sol_grid_advn_yr
      real, dimension (:), allocatable :: sol_grid_disp_yr
      real, dimension (:), allocatable :: sol_grid_rcti_yr
      real, dimension (:), allocatable :: sol_grid_rcto_yr
      real, dimension (:), allocatable :: sol_grid_minl_yr
      real, dimension (:), allocatable :: sol_grid_sorb_yr
      real, dimension (:), allocatable :: sol_grid_ppag_yr
      real, dimension (:), allocatable :: sol_grid_ppex_yr
      real, dimension (:), allocatable :: sol_grid_tile_yr
      real, dimension (:), allocatable :: sol_grid_soil_yr
      real, dimension (:), allocatable :: sol_grid_resv_yr
      real, dimension (:), allocatable :: sol_grid_wetl_yr
      real, dimension (:), allocatable :: sol_grid_canl_yr
      real, dimension (:), allocatable :: sol_grid_fpln_yr
      real, dimension (:), allocatable :: sol_grid_pond_yr
      real, dimension (:), allocatable :: sol_grid_chng_tt
      real, dimension (:), allocatable :: sol_grid_rech_tt
      real, dimension (:), allocatable :: sol_grid_gwsw_tt
      real, dimension (:), allocatable :: sol_grid_swgw_tt
      real, dimension (:), allocatable :: sol_grid_satx_tt
      real, dimension (:), allocatable :: sol_grid_advn_tt
      real, dimension (:), allocatable :: sol_grid_disp_tt
      real, dimension (:), allocatable :: sol_grid_rcti_tt
      real, dimension (:), allocatable :: sol_grid_rcto_tt
      real, dimension (:), allocatable :: sol_grid_minl_tt
      real, dimension (:), allocatable :: sol_grid_sorb_tt
      real, dimension (:), allocatable :: sol_grid_ppag_tt
      real, dimension (:), allocatable :: sol_grid_ppex_tt
      real, dimension (:), allocatable :: sol_grid_tile_tt
      real, dimension (:), allocatable :: sol_grid_soil_tt
      real, dimension (:), allocatable :: sol_grid_resv_tt
      real, dimension (:), allocatable :: sol_grid_wetl_tt
      real, dimension (:), allocatable :: sol_grid_canl_tt
      real, dimension (:), allocatable :: sol_grid_fpln_tt
      real, dimension (:), allocatable :: sol_grid_pond_tt
      
      !solute concentrations at observation cells
      real, dimension (:,:), allocatable :: gw_obs_solute          !         |                                 
                                          
      
      !reading and writing --------------------------------------------------------------------------------------------
      integer :: out_gw = 1228
      integer :: in_wet_cell = 1239
      integer :: out_gwobs = 1457       !merged obs well long-format file (day)
      integer :: out_gwobs_mon = 1458
      integer :: out_gwobs_yr = 1459
      integer :: out_gwobs_aa = 1460
      integer :: out_gwconnect = 1241
      integer :: out_gwheads = 1242
      integer :: out_gwbal = 1243
      integer :: out_gwsw_chan = 1245
      integer :: out_gw_chan = 1246
      integer :: out_gw_rech = 1247
      integer :: out_gw_et = 1248
      integer :: out_gw_grid = 1249
      integer :: out_gw_satex = 1251
      integer :: out_gwsw = 1252
      integer :: out_lateral = 1253
      integer :: out_gw_etact = 1254
      integer :: out_gw_tile = 1317
      integer :: out_gwbal_mon = 1255
      integer :: out_gwbal_yr = 1256
      integer :: out_gwbal_aa = 1257
      integer :: out_gwbal_grp = 1601
      integer :: out_hyd_sep = 1258
      integer :: out_tile_cells = 1259
      integer :: out_gwconc = 1260
      integer :: out_gwtile_hru = 1267
      integer :: out_gwobs_ss = 1268
      integer :: out_gw_soil = 1270
      integer :: out_gw_res = 1271
      integer :: out_gw_wet = 1310
      integer :: out_gw_pumpag = 1272
      integer :: out_gw_pumpex = 1273
      integer :: out_gw_pumpdef = 1277
      integer :: out_gw_canal = 1278
      integer :: out_gw_fp = 1283
      integer :: out_gw_chem = 1284
      !yearly water flux component output
      integer :: out_gw_gwet = 1311
      integer :: out_gw_gwsw = 1312
      integer :: out_gw_satx = 1314
      integer :: out_gw_ppag = 1315
      integer :: out_gw_ppex = 1316
      integer :: out_gw_resv = 1318
      integer :: out_gw_wetl = 1319
      integer :: out_gw_fpln = 1320
      integer :: out_gw_canl = 1321
      integer :: out_gw_pond = 1322
      integer :: out_gw_phyt = 1325
      !canal and pond balance output
      integer :: out_canal_bal = 1328
      integer :: out_canal_sol = 1329
      integer :: out_pond_bal = 1323
      integer :: out_pond_sol = 1324
      integer :: out_pond_mass = 1326
      integer :: out_pond_conc = 1327
      !temperature output
      integer :: out_gwtemps = 1370
      !transit time output
      integer :: out_gw_transit = 1410
      integer :: out_gw_transit_chan = 1411
      integer :: out_gw_transit_tile = 1412
      !channel cell groups and observation output
      integer :: out_gwsw_groups = 1413
      integer :: out_gwsw_chanobs_flow = 1414
      integer :: out_gwsw_chanobs_no3 = 1415
      integer :: out_hru_pump_day = 1285
      integer :: out_hru_pump_mo = 1454
      integer :: out_hru_pump_yr = 1455
      integer :: out_hru_pump_aa = 1456
      integer :: out_hru_pump_obs = 1287
      integer :: out_head_mo = 1288
      integer :: out_head_yr = 1289
      integer :: out_conc_mo = 1290
      integer :: out_conc_yr = 1291
      !solute fluxes (yearly)
      integer :: out_sol_rech = 1292
      integer :: out_sol_gwsw = 1293
      integer :: out_sol_soil = 1294
      integer :: out_sol_satx = 1295
      integer :: out_sol_ppag = 1296
      integer :: out_sol_ppex = 1297
      integer :: out_sol_tile = 1298
      integer :: out_sol_resv = 1299
      integer :: out_sol_fpln = 1300
      integer :: out_sol_canl = 1301
      integer :: out_sol_wetl = 1302
      integer :: out_sol_rcti = 1303
      integer :: out_sol_rcto = 1304
      integer :: out_sol_minl = 1305
      integer :: out_sol_sorb = 1306
      integer :: out_sol_pond = 1307
      !solute fluxes (monthly)
      integer :: out_sol_rech_mo = 1430
      integer :: out_sol_gwsw_mo = 1431
      integer :: out_sol_soil_mo = 1432
      integer :: out_sol_satx_mo = 1433
      integer :: out_sol_ppag_mo = 1434
      integer :: out_sol_ppex_mo = 1435
      integer :: out_sol_tile_mo = 1436
      integer :: out_sol_resv_mo = 1437
      integer :: out_sol_fpln_mo = 1438
      integer :: out_sol_canl_mo = 1439
      integer :: out_sol_wetl_mo = 1440
      integer :: out_sol_rcti_mo = 1441
      integer :: out_sol_rcto_mo = 1442
      integer :: out_sol_minl_mo = 1443
      integer :: out_sol_sorb_mo = 1444
      integer :: out_sol_pond_mo = 1445
      !solute mass balance (daily, monthly, yearly, average annual)
      integer :: out_solbal_dy = 7100
      integer :: out_solbal_mo = 7150
      integer :: out_solbal_yr = 7200
      integer :: out_solbal_aa = 7300
      !solute observation cell concentrations
      integer :: out_gwobs_sol = 1308
      !water flux component output (monthly grids)
      integer :: out_gw_rech_mo = 1330
      integer :: out_gw_gwet_mo = 1331
      integer :: out_gw_gwsw_mo = 1332
      integer :: out_gw_soil_mo = 1333
      integer :: out_gw_satx_mo = 1334
      integer :: out_gw_ppag_mo = 1335
      integer :: out_gw_ppex_mo = 1336
      integer :: out_gw_tile_mo = 1337
      integer :: out_gw_resv_mo = 1338
      integer :: out_gw_wetl_mo = 1339
      integer :: out_gw_fpln_mo = 1340
      integer :: out_gw_canl_mo = 1341
      integer :: out_gw_pond_mo = 1342
      integer :: out_gw_phyt_mo = 1343
      !heat transport output
      integer :: out_heatbal_dy = 1360
      integer :: out_heatbal_yr = 1361
      integer :: out_heatbal_aa = 1362
      integer :: out_temp_mo = 1371
      integer :: out_temp_yr = 1372
      integer :: out_gwobs_temp = 1373
      !heat flux component output (yearly grids)
      integer :: out_heat_rech = 1380
      integer :: out_heat_gwet = 1381
      integer :: out_heat_gwsw = 1382
      integer :: out_heat_satx = 1383
      integer :: out_heat_soil = 1384
      integer :: out_heat_tile = 1385
      integer :: out_heat_ppag = 1386
      integer :: out_heat_ppex = 1387
      integer :: out_heat_resv = 1388
      integer :: out_heat_wetl = 1389
      integer :: out_heat_fpln = 1390
      integer :: out_heat_canl = 1391
      integer :: out_heat_pond = 1392

      !cell-level long-format output file units
      integer :: out_gwcell_day = 1450
      integer :: out_gwcell_mon = 1451
      integer :: out_gwcell_yr  = 1452
      integer :: out_gwcell_aa  = 1453

      end module gwflow_module