MODFLOW 6  version 6.9.0.dev0
USGS Modular Hydrologic Model
gwfnpfmodule Module Reference

Data Types

type  gwfnpftype
 

Functions/Subroutines

subroutine, public npf_cr (npfobj, name_model, input_mempath, inunit, iout)
 Create a new NPF object. Pass a inunit value of 0 if npf data will initialized from memory. More...
 
subroutine npf_df (this, dis, xt3d, ingnc, invsc, npf_options)
 Define the NPF package instance. More...
 
subroutine npf_ac (this, moffset, sparse)
 Add connections for extended neighbors to the sparse matrix. More...
 
subroutine npf_mc (this, moffset, matrix_sln)
 Map connections and construct iax, jax, and idxglox. More...
 
subroutine npf_ar (this, ic, vsc, ibound, hnew)
 Allocate and read this NPF instance. More...
 
subroutine npf_rp (this)
 Read and prepare method for package. More...
 
subroutine npf_ad (this, nodes, hold, hnew, irestore)
 Advance. More...
 
subroutine npf_cf (this, kiter, nodes, hnew)
 Routines associated fill coefficients. More...
 
subroutine npf_fc (this, kiter, matrix_sln, idxglo, rhs, hnew)
 Formulate coefficients. More...
 
subroutine highest_cell_saturation (this, n, m, hn, hm, satn, satm)
 Calculate dry cell saturation. More...
 
subroutine npf_fn (this, kiter, matrix_sln, idxglo, rhs, hnew)
 Fill newton terms. More...
 
subroutine npf_nur (this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
 Under-relaxation. More...
 
subroutine npf_cq (this, hnew, flowja)
 Calculate flowja. More...
 
subroutine sgwf_npf_thksat (this, n, hn, thksat)
 Fractional cell saturation. More...
 
subroutine sgwf_npf_qcalc (this, n, m, hn, hm, icon, qnm)
 Flow between two cells. More...
 
subroutine npf_save_model_flows (this, flowja, icbcfl, icbcun)
 Record flowja and calculate specific discharge if requested. More...
 
subroutine npf_print_model_flows (this, ibudfl, flowja)
 Print budget. More...
 
subroutine npf_da (this)
 Deallocate variables. More...
 
subroutine allocate_scalars (this)
 @ brief Allocate scalars More...
 
subroutine store_original_k_arrays (this, ncells, njas)
 @ brief Store backup copy of hydraulic conductivity when the VSC package is activate More...
 
subroutine allocate_arrays (this, ncells, njas)
 Allocate npf arrays. More...
 
subroutine log_options (this, found)
 Log npf options sourced from the input mempath. More...
 
subroutine source_options (this)
 Update simulation options from input mempath. More...
 
subroutine set_options (this, options)
 Set options in the NPF object. More...
 
subroutine check_options (this)
 Check for conflicting NPF options. More...
 
subroutine log_griddata (this, found)
 Write dimensions to list file. More...
 
subroutine source_griddata (this)
 Update simulation griddata from input mempath. More...
 
subroutine prepcheck (this)
 Initialize and check NPF data. More...
 
subroutine preprocess_input (this)
 preprocess the NPF input data More...
 
subroutine calc_condsat (this, node, upperOnly)
 Calculate CONDSAT array entries for the given node. More...
 
real(dp) function calc_initial_sat (this, n)
 Calculate initial saturation for the given node. More...
 
subroutine sgwf_npf_wetdry (this, kiter, hnew)
 Perform wetting and drying. More...
 
subroutine rewet_check (this, kiter, node, hm, ibdm, ihc, hnew, irewet)
 Determine if a cell should rewet. More...
 
subroutine sgwf_npf_wdmsg (this, icode, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
 Print wet/dry message. More...
 
real(dp) function hy_eff (this, n, m, ihc, ipos, vg)
 Calculate the effective hydraulic conductivity for the n-m connection. More...
 
subroutine calc_spdis (this, flowja)
 Calculate the 3 components of specific discharge at the cell center. More...
 
subroutine sav_spdis (this, ibinun)
 Save specific discharge in binary format to ibinun. More...
 
subroutine sav_sat (this, ibinun)
 Save saturation in binary format to ibinun. More...
 
subroutine increase_edge_count (this, nedges)
 Reserve space for nedges cells that have an edge on them. More...
 
integer(i4b) function calc_max_conns (this)
 Calculate the maximum number of connections for any cell. More...
 
subroutine set_edge_properties (this, nodedge, ihcedge, q, area, nx, ny, distance)
 Provide the npf package with edge properties. More...
 
subroutine prepare_edge_lookup (this)
 
real(dp) function calcsatthickness (this, n, m, ihc)
 Calculate saturated thickness between cell n and m. More...
 

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine gwfnpfmodule::allocate_arrays ( class(gwfnpftype)  this,
integer(i4b), intent(in)  ncells,
integer(i4b), intent(in)  njas 
)

Definition at line 1239 of file gwf-npf.f90.

1240  ! -- dummy
1241  class(GwfNpftype) :: this
1242  integer(I4B), intent(in) :: ncells
1243  integer(I4B), intent(in) :: njas
1244  ! -- local
1245  integer(I4B) :: n
1246  !
1247  call mem_allocate(this%ithickstartflag, ncells, 'ITHICKSTARTFLAG', &
1248  this%memoryPath)
1249  call mem_allocate(this%icelltype, ncells, 'ICELLTYPE', this%memoryPath)
1250  call mem_allocate(this%k11, ncells, 'K11', this%memoryPath)
1251  call mem_allocate(this%sat, ncells, 'SAT', this%memoryPath)
1252  call mem_allocate(this%condsat, njas, 'CONDSAT', this%memoryPath)
1253  !
1254  ! -- Optional arrays dimensioned to full size initially
1255  call mem_allocate(this%k22, ncells, 'K22', this%memoryPath)
1256  call mem_allocate(this%k33, ncells, 'K33', this%memoryPath)
1257  call mem_allocate(this%wetdry, ncells, 'WETDRY', this%memoryPath)
1258  call mem_allocate(this%angle1, ncells, 'ANGLE1', this%memoryPath)
1259  call mem_allocate(this%angle2, ncells, 'ANGLE2', this%memoryPath)
1260  call mem_allocate(this%angle3, ncells, 'ANGLE3', this%memoryPath)
1261  !
1262  ! -- Optional arrays
1263  call mem_allocate(this%ibotnode, 0, 'IBOTNODE', this%memoryPath)
1264  call mem_allocate(this%nodedge, 0, 'NODEDGE', this%memoryPath)
1265  call mem_allocate(this%ihcedge, 0, 'IHCEDGE', this%memoryPath)
1266  call mem_allocate(this%propsedge, 0, 0, 'PROPSEDGE', this%memoryPath)
1267  call mem_allocate(this%iedge_ptr, 0, 'NREDGESNODE', this%memoryPath)
1268  call mem_allocate(this%edge_idxs, 0, 'EDGEIDXS', this%memoryPath)
1269  !
1270  ! -- Optional arrays only needed when vsc package is active
1271  call mem_allocate(this%k11input, 0, 'K11INPUT', this%memoryPath)
1272  call mem_allocate(this%k22input, 0, 'K22INPUT', this%memoryPath)
1273  call mem_allocate(this%k33input, 0, 'K33INPUT', this%memoryPath)
1274  !
1275  ! -- Specific discharge is (re-)allocated when nedges is known
1276  call mem_allocate(this%spdis, 3, 0, 'SPDIS', this%memoryPath)
1277  !
1278  ! -- Time-varying property flag arrays
1279  call mem_allocate(this%nodekchange, ncells, 'NODEKCHANGE', this%memoryPath)
1280  !
1281  ! -- initialize iangle1, iangle2, iangle3, and wetdry
1282  do n = 1, ncells
1283  this%angle1(n) = dzero
1284  this%angle2(n) = dzero
1285  this%angle3(n) = dzero
1286  this%wetdry(n) = dzero
1287  this%nodekchange(n) = dzero
1288  end do
1289  !
1290  ! -- allocate variable names
1291  allocate (this%aname(this%iname))
1292  this%aname = [' ICELLTYPE', ' K', &
1293  ' K33', ' K22', &
1294  ' WETDRY', ' ANGLE1', &
1295  ' ANGLE2', ' ANGLE3']

◆ allocate_scalars()

subroutine gwfnpfmodule::allocate_scalars ( class(gwfnpftype)  this)

Allocate and initialize scalars for the VSC package. The base model allocate scalars method is also called.

Definition at line 1120 of file gwf-npf.f90.

1121  ! -- modules
1123  ! -- dummy
1124  class(GwfNpftype) :: this
1125  !
1126  ! -- allocate scalars in NumericalPackageType
1127  call this%NumericalPackageType%allocate_scalars()
1128  !
1129  ! -- Allocate scalars
1130  call mem_allocate(this%iname, 'INAME', this%memoryPath)
1131  call mem_allocate(this%ixt3d, 'IXT3D', this%memoryPath)
1132  call mem_allocate(this%ixt3drhs, 'IXT3DRHS', this%memoryPath)
1133  call mem_allocate(this%satomega, 'SATOMEGA', this%memoryPath)
1134  call mem_allocate(this%hnoflo, 'HNOFLO', this%memoryPath)
1135  call mem_allocate(this%hdry, 'HDRY', this%memoryPath)
1136  call mem_allocate(this%icellavg, 'ICELLAVG', this%memoryPath)
1137  call mem_allocate(this%iavgkeff, 'IAVGKEFF', this%memoryPath)
1138  call mem_allocate(this%ik22, 'IK22', this%memoryPath)
1139  call mem_allocate(this%ik33, 'IK33', this%memoryPath)
1140  call mem_allocate(this%ik22overk, 'IK22OVERK', this%memoryPath)
1141  call mem_allocate(this%ik33overk, 'IK33OVERK', this%memoryPath)
1142  call mem_allocate(this%iperched, 'IPERCHED', this%memoryPath)
1143  call mem_allocate(this%ivarcv, 'IVARCV', this%memoryPath)
1144  call mem_allocate(this%idewatcv, 'IDEWATCV', this%memoryPath)
1145  call mem_allocate(this%ithickstrt, 'ITHICKSTRT', this%memoryPath)
1146  call mem_allocate(this%ihighcellsat, 'IHIGHCELLSAT', this%memoryPath)
1147  call mem_allocate(this%icalcspdis, 'ICALCSPDIS', this%memoryPath)
1148  call mem_allocate(this%isavspdis, 'ISAVSPDIS', this%memoryPath)
1149  call mem_allocate(this%isavsat, 'ISAVSAT', this%memoryPath)
1150  call mem_allocate(this%irewet, 'IREWET', this%memoryPath)
1151  call mem_allocate(this%wetfct, 'WETFCT', this%memoryPath)
1152  call mem_allocate(this%iwetit, 'IWETIT', this%memoryPath)
1153  call mem_allocate(this%ihdwet, 'IHDWET', this%memoryPath)
1154  call mem_allocate(this%iangle1, 'IANGLE1', this%memoryPath)
1155  call mem_allocate(this%iangle2, 'IANGLE2', this%memoryPath)
1156  call mem_allocate(this%iangle3, 'IANGLE3', this%memoryPath)
1157  call mem_allocate(this%iwetdry, 'IWETDRY', this%memoryPath)
1158  call mem_allocate(this%nedges, 'NEDGES', this%memoryPath)
1159  call mem_allocate(this%lastedge, 'LASTEDGE', this%memoryPath)
1160  call mem_allocate(this%intvk, 'INTVK', this%memoryPath)
1161  call mem_allocate(this%invsc, 'INVSC', this%memoryPath)
1162  call mem_allocate(this%kchangeper, 'KCHANGEPER', this%memoryPath)
1163  call mem_allocate(this%kchangestp, 'KCHANGESTP', this%memoryPath)
1164  !
1165  ! -- set pointer to inewtonur
1166  call mem_setptr(this%igwfnewtonur, 'INEWTONUR', &
1167  create_mem_path(this%name_model))
1168  !
1169  ! -- Initialize value
1170  this%iname = 8
1171  this%ixt3d = 0
1172  this%ixt3drhs = 0
1173  this%satomega = dzero
1174  this%hnoflo = dhnoflo !1.d30
1175  this%hdry = dhdry !-1.d30
1176  this%icellavg = ccond_hmean
1177  this%iavgkeff = 0
1178  this%ik22 = 0
1179  this%ik33 = 0
1180  this%ik22overk = 0
1181  this%ik33overk = 0
1182  this%iperched = 0
1183  this%ivarcv = 0
1184  this%idewatcv = 0
1185  this%ithickstrt = 0
1186  this%ihighcellsat = 0
1187  this%icalcspdis = 0
1188  this%isavspdis = 0
1189  this%isavsat = 0
1190  this%irewet = 0
1191  this%wetfct = done
1192  this%iwetit = 1
1193  this%ihdwet = 0
1194  this%iangle1 = 0
1195  this%iangle2 = 0
1196  this%iangle3 = 0
1197  this%iwetdry = 0
1198  this%nedges = 0
1199  this%lastedge = 0
1200  this%intvk = 0
1201  this%invsc = 0
1202  this%kchangeper = 0
1203  this%kchangestp = 0
1204  !
1205  ! -- If newton is on, then NPF creates asymmetric matrix
1206  this%iasym = this%inewton
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
Here is the call graph for this function:

◆ calc_condsat()

subroutine gwfnpfmodule::calc_condsat ( class(gwfnpftype)  this,
integer(i4b), intent(in)  node,
logical, intent(in)  upperOnly 
)

Calculate saturated conductances for all connections of the given node, or optionally for the upper portion of the matrix only.

Definition at line 2062 of file gwf-npf.f90.

2063  ! -- dummy variables
2064  class(GwfNpfType) :: this
2065  integer(I4B), intent(in) :: node
2066  logical, intent(in) :: upperOnly
2067  ! -- local variables
2068  integer(I4B) :: ii, m, n, ihc, jj
2069  real(DP) :: topm, topn, topnode, botm, botn, botnode, satm, satn, satnode
2070  real(DP) :: hyn, hym, hn, hm, fawidth, csat
2071  !
2072  satnode = this%calc_initial_sat(node)
2073  !
2074  topnode = this%dis%top(node)
2075  botnode = this%dis%bot(node)
2076  !
2077  ! -- Go through the connecting cells
2078  do ii = this%dis%con%ia(node) + 1, this%dis%con%ia(node + 1) - 1
2079  !
2080  ! -- Set the m cell number and cycle if lower triangle connection and
2081  ! -- we're not updating both upper and lower matrix parts for this node
2082  m = this%dis%con%ja(ii)
2083  jj = this%dis%con%jas(ii)
2084  if (m < node) then
2085  if (upperonly) cycle
2086  ! m => node, n => neighbour
2087  n = m
2088  m = node
2089  topm = topnode
2090  botm = botnode
2091  satm = satnode
2092  topn = this%dis%top(n)
2093  botn = this%dis%bot(n)
2094  satn = this%calc_initial_sat(n)
2095  else
2096  ! n => node, m => neighbour
2097  n = node
2098  topn = topnode
2099  botn = botnode
2100  satn = satnode
2101  topm = this%dis%top(m)
2102  botm = this%dis%bot(m)
2103  satm = this%calc_initial_sat(m)
2104  end if
2105  !
2106  ihc = this%dis%con%ihc(jj)
2107  hyn = this%hy_eff(n, m, ihc, ipos=ii)
2108  hym = this%hy_eff(m, n, ihc, ipos=ii)
2109  if (this%ithickstartflag(n) == 0) then
2110  hn = topn
2111  else
2112  hn = this%ic%strt(n)
2113  end if
2114  if (this%ithickstartflag(m) == 0) then
2115  hm = topm
2116  else
2117  hm = this%ic%strt(m)
2118  end if
2119  !
2120  ! -- Calculate conductance depending on whether connection is
2121  ! vertical (0), horizontal (1), or staggered horizontal (2)
2122  if (ihc == c3d_vertical) then
2123  !
2124  ! -- Vertical conductance for fully saturated conditions
2125  csat = vcond(1, 1, 1, 1, 0, 1, 1, done, &
2126  botn, botm, &
2127  hyn, hym, &
2128  satn, satm, &
2129  topn, topm, &
2130  botn, botm, &
2131  this%dis%con%hwva(jj))
2132  else
2133  !
2134  ! -- Horizontal conductance for fully saturated conditions
2135  fawidth = this%dis%con%hwva(jj)
2136  csat = hcond(1, 1, 1, 1, 0, &
2137  ihc, &
2138  this%icellavg, &
2139  done, &
2140  hn, hm, satn, satm, hyn, hym, &
2141  topn, topm, &
2142  botn, botm, &
2143  this%dis%con%cl1(jj), &
2144  this%dis%con%cl2(jj), &
2145  fawidth)
2146  end if
2147  this%condsat(jj) = csat
2148  end do
Here is the call graph for this function:

◆ calc_initial_sat()

real(dp) function gwfnpfmodule::calc_initial_sat ( class(gwfnpftype)  this,
integer(i4b), intent(in)  n 
)
private

Calculate saturation as a fraction of thickness for the given node, used for saturated conductance calculations: full thickness by default (1.0) or saturation based on initial conditions if the THICKSTRT option is used.

Definition at line 2158 of file gwf-npf.f90.

2159  ! -- dummy variables
2160  class(GwfNpfType) :: this
2161  integer(I4B), intent(in) :: n
2162  ! -- Return
2163  real(DP) :: satn
2164  !
2165  satn = done
2166  if (this%ibound(n) /= 0 .and. this%ithickstartflag(n) /= 0) then
2167  call this%thksat(n, this%ic%strt(n), satn)
2168  end if

◆ calc_max_conns()

integer(i4b) function gwfnpfmodule::calc_max_conns ( class(gwfnpftype)  this)
private

Definition at line 2792 of file gwf-npf.f90.

2793  class(GwfNpfType) :: this
2794  integer(I4B) :: max_conns
2795  ! local
2796  integer(I4B) :: n, m, ic
2797 
2798  max_conns = 0
2799  do n = 1, this%dis%nodes
2800 
2801  ! Count internal model connections
2802  ic = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
2803 
2804  ! Add edge connections
2805  do m = 1, this%nedges
2806  if (this%nodedge(m) == n) then
2807  ic = ic + 1
2808  end if
2809  end do
2810 
2811  ! Set max number of connections for any cell
2812  if (ic > max_conns) max_conns = ic
2813  end do
2814 

◆ calc_spdis()

subroutine gwfnpfmodule::calc_spdis ( class(gwfnpftype)  this,
real(dp), dimension(:), intent(in)  flowja 
)
private

Definition at line 2471 of file gwf-npf.f90.

2472  ! -- modules
2473  use simmodule, only: store_error
2474  ! -- dummy
2475  class(GwfNpfType) :: this
2476  real(DP), intent(in), dimension(:) :: flowja
2477  ! -- local
2478  integer(I4B) :: n
2479  integer(I4B) :: m
2480  integer(I4B) :: ipos
2481  integer(I4B) :: iedge
2482  integer(I4B) :: isympos
2483  integer(I4B) :: ihc
2484  integer(I4B) :: ic
2485  integer(I4B) :: iz
2486  integer(I4B) :: nc
2487  integer(I4B) :: ncz
2488  real(DP) :: qz
2489  real(DP) :: vx
2490  real(DP) :: vy
2491  real(DP) :: vz
2492  real(DP) :: xn
2493  real(DP) :: yn
2494  real(DP) :: zn
2495  real(DP) :: xc
2496  real(DP) :: yc
2497  real(DP) :: zc
2498  real(DP) :: cl1
2499  real(DP) :: cl2
2500  real(DP) :: dltot
2501  real(DP) :: ooclsum
2502  real(DP) :: dsumx
2503  real(DP) :: dsumy
2504  real(DP) :: dsumz
2505  real(DP) :: denom
2506  real(DP) :: area
2507  real(DP) :: dz
2508  real(DP) :: axy
2509  real(DP) :: ayx
2510  logical :: nozee = .true.
2511  type(SpdisWorkArrayType), pointer :: swa => null() !< pointer to spdis work arrays structure
2512  !
2513  ! -- Ensure dis has necessary information
2514  if (this%icalcspdis /= 0 .and. this%dis%con%ianglex == 0) then
2515  call store_error('Error. ANGLDEGX not provided in '// &
2516  'discretization file. ANGLDEGX required for '// &
2517  'calculation of specific discharge.', terminate=.true.)
2518  end if
2519 
2520  swa => this%spdis_wa
2521  if (.not. swa%is_created()) then
2522  ! prepare work arrays
2523  call this%spdis_wa%create(this%calc_max_conns())
2524 
2525  ! prepare lookup table
2526  if (this%nedges > 0) call this%prepare_edge_lookup()
2527  end if
2528  !
2529  ! -- Go through each cell and calculate specific discharge
2530  do n = 1, this%dis%nodes
2531  !
2532  ! -- first calculate geometric properties for x and y directions and
2533  ! the specific discharge at a face (vi)
2534  ic = 0
2535  iz = 0
2536 
2537  ! reset work arrays
2538  call swa%reset()
2539 
2540  do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
2541  m = this%dis%con%ja(ipos)
2542  isympos = this%dis%con%jas(ipos)
2543  ihc = this%dis%con%ihc(isympos)
2544  area = this%dis%con%hwva(isympos)
2545  if (ihc == c3d_vertical) then
2546  !
2547  ! -- vertical connection
2548  iz = iz + 1
2549  !call this%dis%connection_normal(n, m, ihc, xn, yn, zn, ipos)
2550  call this%dis%connection_vector(n, m, nozee, this%sat(n), this%sat(m), &
2551  ihc, xc, yc, zc, dltot)
2552  cl1 = this%dis%con%cl1(isympos)
2553  cl2 = this%dis%con%cl2(isympos)
2554  if (m < n) then
2555  cl1 = this%dis%con%cl2(isympos)
2556  cl2 = this%dis%con%cl1(isympos)
2557  end if
2558  ooclsum = done / (cl1 + cl2)
2559  swa%diz(iz) = dltot * cl1 * ooclsum
2560  qz = flowja(ipos)
2561  if (n > m) qz = -qz
2562  swa%viz(iz) = qz / area
2563  else
2564  !
2565  ! -- horizontal connection
2566  ic = ic + 1
2567  dz = thksatnm(this%ibound(n), this%ibound(m), &
2568  this%icelltype(n), this%icelltype(m), &
2569  this%inewton, ihc, &
2570  this%hnew(n), this%hnew(m), this%sat(n), this%sat(m), &
2571  this%dis%top(n), this%dis%top(m), this%dis%bot(n), &
2572  this%dis%bot(m))
2573  area = area * dz
2574  call this%dis%connection_normal(n, m, ihc, xn, yn, zn, ipos)
2575  call this%dis%connection_vector(n, m, nozee, this%sat(n), this%sat(m), &
2576  ihc, xc, yc, zc, dltot)
2577  cl1 = this%dis%con%cl1(isympos)
2578  cl2 = this%dis%con%cl2(isympos)
2579  if (m < n) then
2580  cl1 = this%dis%con%cl2(isympos)
2581  cl2 = this%dis%con%cl1(isympos)
2582  end if
2583  ooclsum = done / (cl1 + cl2)
2584  swa%nix(ic) = -xn
2585  swa%niy(ic) = -yn
2586  swa%di(ic) = dltot * cl1 * ooclsum
2587  if (area > dzero) then
2588  swa%vi(ic) = flowja(ipos) / area
2589  else
2590  swa%vi(ic) = dzero
2591  end if
2592  end if
2593  end do
2594 
2595  ! add contribution from edge flows (i.e. from exchanges)
2596  if (this%nedges > 0) then
2597  do ipos = this%iedge_ptr(n), this%iedge_ptr(n + 1) - 1
2598  iedge = this%edge_idxs(ipos)
2599 
2600  ! propsedge: (Q, area, nx, ny, distance)
2601  ihc = this%ihcedge(iedge)
2602  area = this%propsedge(2, iedge)
2603  if (ihc == c3d_vertical) then
2604  iz = iz + 1
2605  swa%viz(iz) = this%propsedge(1, iedge) / area
2606  swa%diz(iz) = this%propsedge(5, iedge)
2607  else
2608  ic = ic + 1
2609  swa%nix(ic) = -this%propsedge(3, iedge)
2610  swa%niy(ic) = -this%propsedge(4, iedge)
2611  swa%di(ic) = this%propsedge(5, iedge)
2612  if (area > dzero) then
2613  swa%vi(ic) = this%propsedge(1, iedge) / area
2614  else
2615  swa%vi(ic) = dzero
2616  end if
2617  end if
2618  end do
2619  end if
2620  !
2621  ! -- Assign number of vertical and horizontal connections
2622  ncz = iz
2623  nc = ic
2624  !
2625  ! -- calculate z weight (wiz) and z velocity
2626  if (ncz == 1) then
2627  swa%wiz(1) = done
2628  else
2629  dsumz = dzero
2630  do iz = 1, ncz
2631  dsumz = dsumz + swa%diz(iz)
2632  end do
2633  denom = (ncz - done)
2634  if (denom < dzero) denom = dzero
2635  dsumz = dsumz + dem10 * dsumz
2636  do iz = 1, ncz
2637  if (dsumz > dzero) swa%wiz(iz) = done - swa%diz(iz) / dsumz
2638  if (denom > 0) then
2639  swa%wiz(iz) = swa%wiz(iz) / denom
2640  else
2641  swa%wiz(iz) = dzero
2642  end if
2643  end do
2644  end if
2645  vz = dzero
2646  do iz = 1, ncz
2647  vz = vz + swa%wiz(iz) * swa%viz(iz)
2648  end do
2649  !
2650  ! -- distance-based weighting
2651  nc = ic
2652  dsumx = dzero
2653  dsumy = dzero
2654  dsumz = dzero
2655  do ic = 1, nc
2656  swa%wix(ic) = swa%di(ic) * abs(swa%nix(ic))
2657  swa%wiy(ic) = swa%di(ic) * abs(swa%niy(ic))
2658  dsumx = dsumx + swa%wix(ic)
2659  dsumy = dsumy + swa%wiy(ic)
2660  end do
2661  !
2662  ! -- Finish computing omega weights. Add a tiny bit
2663  ! to dsum so that the normalized omega weight later
2664  ! evaluates to (essentially) 1 in the case of a single
2665  ! relevant connection, avoiding 0/0.
2666  dsumx = dsumx + dem10 * dsumx
2667  dsumy = dsumy + dem10 * dsumy
2668  do ic = 1, nc
2669  swa%wix(ic) = (dsumx - swa%wix(ic)) * abs(swa%nix(ic))
2670  swa%wiy(ic) = (dsumy - swa%wiy(ic)) * abs(swa%niy(ic))
2671  end do
2672  !
2673  ! -- compute B weights
2674  dsumx = dzero
2675  dsumy = dzero
2676  do ic = 1, nc
2677  swa%bix(ic) = swa%wix(ic) * sign(done, swa%nix(ic))
2678  swa%biy(ic) = swa%wiy(ic) * sign(done, swa%niy(ic))
2679  dsumx = dsumx + swa%wix(ic) * abs(swa%nix(ic))
2680  dsumy = dsumy + swa%wiy(ic) * abs(swa%niy(ic))
2681  end do
2682  if (dsumx > dzero) dsumx = done / dsumx
2683  if (dsumy > dzero) dsumy = done / dsumy
2684  axy = dzero
2685  ayx = dzero
2686  do ic = 1, nc
2687  swa%bix(ic) = swa%bix(ic) * dsumx
2688  swa%biy(ic) = swa%biy(ic) * dsumy
2689  axy = axy + swa%bix(ic) * swa%niy(ic)
2690  ayx = ayx + swa%biy(ic) * swa%nix(ic)
2691  end do
2692  !
2693  ! -- Calculate specific discharge. The divide by zero checking below
2694  ! is problematic for cells with only one flow, such as can happen
2695  ! with triangular cells in corners. In this case, the resulting
2696  ! cell velocity will be calculated as zero. The method should be
2697  ! improved so that edge flows of zero are included in these
2698  ! calculations. But this needs to be done with consideration for LGR
2699  ! cases in which flows are submitted from an exchange.
2700  vx = dzero
2701  vy = dzero
2702  do ic = 1, nc
2703  vx = vx + (swa%bix(ic) - axy * swa%biy(ic)) * swa%vi(ic)
2704  vy = vy + (swa%biy(ic) - ayx * swa%bix(ic)) * swa%vi(ic)
2705  end do
2706  denom = done - axy * ayx
2707  if (denom /= dzero) then
2708  vx = vx / denom
2709  vy = vy / denom
2710  end if
2711  !
2712  this%spdis(1, n) = vx
2713  this%spdis(2, n) = vy
2714  this%spdis(3, n) = vz
2715  !
2716  end do
2717 
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
Here is the call graph for this function:

◆ calcsatthickness()

real(dp) function gwfnpfmodule::calcsatthickness ( class(gwfnpftype)  this,
integer(i4b)  n,
integer(i4b)  m,
integer(i4b)  ihc 
)
private
Parameters
thisthis NPF instance
nnode n
mnode m
ihc1 = horizontal connection, 0 for vertical
Returns
saturated thickness

Definition at line 2893 of file gwf-npf.f90.

2894  ! -- dummy
2895  class(GwfNpfType) :: this !< this NPF instance
2896  integer(I4B) :: n !< node n
2897  integer(I4B) :: m !< node m
2898  integer(I4B) :: ihc !< 1 = horizontal connection, 0 for vertical
2899  ! -- return
2900  real(DP) :: satThickness !< saturated thickness
2901  !
2902  satthickness = thksatnm(this%ibound(n), &
2903  this%ibound(m), &
2904  this%icelltype(n), &
2905  this%icelltype(m), &
2906  this%inewton, &
2907  ihc, &
2908  this%hnew(n), &
2909  this%hnew(m), &
2910  this%sat(n), &
2911  this%sat(m), &
2912  this%dis%top(n), &
2913  this%dis%top(m), &
2914  this%dis%bot(n), &
2915  this%dis%bot(m))

◆ check_options()

subroutine gwfnpfmodule::check_options ( class(gwfnpftype)  this)
private

Definition at line 1483 of file gwf-npf.f90.

1484  ! -- modules
1485  use simmodule, only: store_error, store_warning, &
1487  use constantsmodule, only: linelength
1488  ! -- dummy
1489  class(GwfNpftype) :: this
1490  !
1491  ! -- set omega value used for saturation calculations
1492  if (this%inewton > 0) then
1493  this%satomega = dem6
1494  end if
1495  !
1496  if (this%inewton > 0) then
1497  if (this%iperched > 0) then
1498  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1499  'BE USED WITH PERCHED OPTION.'
1500  call store_error(errmsg)
1501  end if
1502  if (this%ivarcv > 0) then
1503  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1504  'BE USED WITH VARIABLECV OPTION.'
1505  call store_error(errmsg)
1506  end if
1507  if (this%irewet > 0) then
1508  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1509  'BE USED WITH REWET OPTION.'
1510  call store_error(errmsg)
1511  end if
1512  else
1513  if (this%ihighcellsat /= 0) then
1514  write (warnmsg, '(a)') 'HIGHEST_CELL_SATURATION '// &
1515  'option cannot be used when NEWTON option in not specified. '// &
1516  'Resetting HIGHEST_CELL_SATURATION option to off.'
1517  this%ihighcellsat = 0
1518  call store_warning(warnmsg)
1519  end if
1520  end if
1521  !
1522  if (this%ixt3d /= 0) then
1523  if (this%icellavg > 0) then
1524  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. '// &
1525  'ALTERNATIVE_CELL_AVERAGING OPTION '// &
1526  'CANNOT BE USED WITH XT3D OPTION.'
1527  call store_error(errmsg)
1528  end if
1529  if (this%ithickstrt > 0) then
1530  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. THICKSTRT OPTION '// &
1531  'CANNOT BE USED WITH XT3D OPTION.'
1532  call store_error(errmsg)
1533  end if
1534  if (this%iperched > 0) then
1535  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. PERCHED OPTION '// &
1536  'CANNOT BE USED WITH XT3D OPTION.'
1537  call store_error(errmsg)
1538  end if
1539  if (this%ivarcv > 0) then
1540  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. VARIABLECV OPTION '// &
1541  'CANNOT BE USED WITH XT3D OPTION.'
1542  call store_error(errmsg)
1543  end if
1544  end if
1545  !
1546  ! -- Terminate if errors
1547  if (count_errors() > 0) then
1548  call store_error_filename(this%input_fname)
1549  end if
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
subroutine, public store_warning(msg, substring)
Store warning message.
Definition: Sim.f90:237
integer(i4b) function, public count_errors()
Return number of errors.
Definition: Sim.f90:59
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition: Sim.f90:204
Here is the call graph for this function:

◆ highest_cell_saturation()

subroutine gwfnpfmodule::highest_cell_saturation ( class(gwfnpftype)  this,
integer(i4b), intent(in)  n,
integer(i4b), intent(in)  m,
real(dp), intent(in)  hn,
real(dp), intent(in)  hm,
real(dp), intent(inout)  satn,
real(dp), intent(inout)  satm 
)

Calculate the saturation based on the maximum cell bottom for two connected cells

Definition at line 611 of file gwf-npf.f90.

612  ! dummy
613  class(GwfNpfType) :: this
614  integer(I4B), intent(in) :: n, m
615  real(DP), intent(in) :: hn, hm
616  real(DP), intent(inout) :: satn, satm
617  ! local
618  integer(I4B) :: ihdbot
619  real(DP) :: botn, botm
620  real(DP) :: top, bot
621 
622  botn = this%dis%bot(n)
623  botm = this%dis%bot(m)
624 
625  ihdbot = n
626  if (botm > botn) ihdbot = m
627 
628  ! recalculate saturation if the difference in elevation between
629  ! two cells exceed a threshold value
630  if (abs(botm - botn) >= dem2) then
631  top = this%dis%top(ihdbot)
632  bot = this%dis%bot(ihdbot)
633  satn = squadraticsaturation(top, bot, hn, this%satomega)
634  satm = squadraticsaturation(top, bot, hm, this%satomega)
635  end if
Here is the call graph for this function:

◆ hy_eff()

real(dp) function gwfnpfmodule::hy_eff ( class(gwfnpftype)  this,
integer(i4b), intent(in)  n,
integer(i4b), intent(in)  m,
integer(i4b), intent(in)  ihc,
integer(i4b), intent(in), optional  ipos,
real(dp), dimension(3), intent(in), optional  vg 
)

n is primary node node number m is connected node (not used if vg is provided) ihc is horizontal indicator (0 vertical, 1 horizontal, 2 vertically staggered) ipos_opt is position of connection in ja array vg is the global unit vector that expresses the direction from which to calculate an effective hydraulic conductivity.

Definition at line 2392 of file gwf-npf.f90.

2393  ! -- return
2394  real(DP) :: hy
2395  ! -- dummy
2396  class(GwfNpfType) :: this
2397  integer(I4B), intent(in) :: n
2398  integer(I4B), intent(in) :: m
2399  integer(I4B), intent(in) :: ihc
2400  integer(I4B), intent(in), optional :: ipos
2401  real(DP), dimension(3), intent(in), optional :: vg
2402  ! -- local
2403  integer(I4B) :: iipos
2404  real(DP) :: hy11, hy22, hy33
2405  real(DP) :: ang1, ang2, ang3
2406  real(DP) :: vg1, vg2, vg3
2407  !
2408  ! -- Initialize
2409  iipos = 0
2410  if (present(ipos)) iipos = ipos
2411  hy11 = this%k11(n)
2412  hy22 = this%k11(n)
2413  hy33 = this%k11(n)
2414  hy22 = this%k22(n)
2415  hy33 = this%k33(n)
2416  !
2417  ! -- Calculate effective K based on whether connection is vertical
2418  ! or horizontal
2419  if (ihc == c3d_vertical) then
2420  !
2421  ! -- Handle rotated anisotropy case that would affect the effective
2422  ! vertical hydraulic conductivity
2423  hy = hy33
2424  if (this%iangle2 > 0) then
2425  if (present(vg)) then
2426  vg1 = vg(1)
2427  vg2 = vg(2)
2428  vg3 = vg(3)
2429  else
2430  call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, iipos)
2431  end if
2432  ang1 = this%angle1(n)
2433  ang2 = this%angle2(n)
2434  ang3 = dzero
2435  if (this%iangle3 > 0) ang3 = this%angle3(n)
2436  hy = hyeff(hy11, hy22, hy33, ang1, ang2, ang3, vg1, vg2, vg3, &
2437  this%iavgkeff)
2438  end if
2439  !
2440  else
2441  !
2442  ! -- Handle horizontal case
2443  hy = hy11
2444  if (this%ik22 > 0) then
2445  if (present(vg)) then
2446  vg1 = vg(1)
2447  vg2 = vg(2)
2448  vg3 = vg(3)
2449  else
2450  call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, iipos)
2451  end if
2452  ang1 = dzero
2453  ang2 = dzero
2454  ang3 = dzero
2455  if (this%iangle1 > 0) then
2456  ang1 = this%angle1(n)
2457  if (this%iangle2 > 0) then
2458  ang2 = this%angle2(n)
2459  if (this%iangle3 > 0) ang3 = this%angle3(n)
2460  end if
2461  end if
2462  hy = hyeff(hy11, hy22, hy33, ang1, ang2, ang3, vg1, vg2, vg3, &
2463  this%iavgkeff)
2464  end if
2465  !
2466  end if
Here is the call graph for this function:

◆ increase_edge_count()

subroutine gwfnpfmodule::increase_edge_count ( class(gwfnpftype)  this,
integer(i4b), intent(in)  nedges 
)
private

This must be called before the npfallocate_arrays routine, which is called from npfar.

Definition at line 2782 of file gwf-npf.f90.

2783  ! -- dummy
2784  class(GwfNpfType) :: this
2785  integer(I4B), intent(in) :: nedges
2786  !
2787  this%nedges = this%nedges + nedges

◆ log_griddata()

subroutine gwfnpfmodule::log_griddata ( class(gwfnpftype)  this,
type(gwfnpfparamfoundtype), intent(in)  found 
)

Definition at line 1554 of file gwf-npf.f90.

1555  ! -- modules
1557  ! -- dummy
1558  class(GwfNpfType) :: this
1559  type(GwfNpfParamFoundType), intent(in) :: found
1560  !
1561  write (this%iout, '(1x,a)') 'Setting NPF Griddata'
1562  !
1563  if (found%icelltype) then
1564  write (this%iout, '(4x,a)') 'ICELLTYPE set from input file'
1565  end if
1566  !
1567  if (found%k) then
1568  write (this%iout, '(4x,a)') 'K set from input file'
1569  end if
1570  !
1571  if (found%k33) then
1572  write (this%iout, '(4x,a)') 'K33 set from input file'
1573  else
1574  write (this%iout, '(4x,a)') 'K33 not provided. Setting K33 = K.'
1575  end if
1576  !
1577  if (found%k22) then
1578  write (this%iout, '(4x,a)') 'K22 set from input file'
1579  else
1580  write (this%iout, '(4x,a)') 'K22 not provided. Setting K22 = K.'
1581  end if
1582  !
1583  if (found%wetdry) then
1584  write (this%iout, '(4x,a)') 'WETDRY set from input file'
1585  end if
1586  !
1587  if (found%angle1) then
1588  write (this%iout, '(4x,a)') 'ANGLE1 set from input file'
1589  end if
1590  !
1591  if (found%angle2) then
1592  write (this%iout, '(4x,a)') 'ANGLE2 set from input file'
1593  end if
1594  !
1595  if (found%angle3) then
1596  write (this%iout, '(4x,a)') 'ANGLE3 set from input file'
1597  end if
1598  !
1599  write (this%iout, '(1x,a,/)') 'End Setting NPF Griddata'

◆ log_options()

subroutine gwfnpfmodule::log_options ( class(gwfnpftype)  this,
type(gwfnpfparamfoundtype), intent(in)  found 
)
private

Definition at line 1300 of file gwf-npf.f90.

1301  ! -- modules
1302  use kindmodule, only: lgp
1304  ! -- dummy
1305  class(GwfNpftype) :: this
1306  ! -- locals
1307  type(GwfNpfParamFoundType), intent(in) :: found
1308  !
1309  write (this%iout, '(1x,a)') 'Setting NPF Options'
1310  if (found%iprflow) &
1311  write (this%iout, '(4x,a)') 'Cell-by-cell flow information will be printed &
1312  &to listing file whenever ICBCFL is not zero.'
1313  if (found%ipakcb) &
1314  write (this%iout, '(4x,a)') 'Cell-by-cell flow information will be saved &
1315  &to binary file whenever ICBCFL is not zero.'
1316  if (found%cellavg) &
1317  write (this%iout, '(4x,a,i0)') 'Alternative cell averaging [1=logarithmic, &
1318  &2=AMT-LMK, 3=AMT-HMK] set to: ', &
1319  this%icellavg
1320  if (found%ithickstrt) &
1321  write (this%iout, '(4x,a)') 'THICKSTRT option has been activated.'
1322  if (found%ihighcellsat) &
1323  write (this%iout, '(4x,a)') 'HIGHEST_CELL_SATURATION option &
1324  &has been activated.'
1325  if (found%iperched) &
1326  write (this%iout, '(4x,a)') 'Vertical flow will be adjusted for perched &
1327  &conditions.'
1328  if (found%ivarcv) &
1329  write (this%iout, '(4x,a)') 'Vertical conductance varies with water table.'
1330  if (found%idewatcv) &
1331  write (this%iout, '(4x,a)') 'Vertical conductance is calculated using &
1332  &only the saturated thickness and properties &
1333  &of the overlying cell if the head in the &
1334  &underlying cell is below its top.'
1335  if (found%ixt3d) write (this%iout, '(4x,a)') 'XT3D formulation is selected.'
1336  if (found%ixt3drhs) &
1337  write (this%iout, '(4x,a)') 'XT3D RHS formulation is selected.'
1338  if (found%isavspdis) &
1339  write (this%iout, '(4x,a)') 'Specific discharge will be calculated at cell &
1340  &centers and written to DATA-SPDIS in budget &
1341  &file when requested.'
1342  if (found%isavsat) &
1343  write (this%iout, '(4x,a)') 'Saturation will be written to DATA-SAT in &
1344  &budget file when requested.'
1345  if (found%ik22overk) &
1346  write (this%iout, '(4x,a)') 'Values specified for K22 are anisotropy &
1347  &ratios and will be multiplied by K before &
1348  &being used in calculations.'
1349  if (found%ik33overk) &
1350  write (this%iout, '(4x,a)') 'Values specified for K33 are anisotropy &
1351  &ratios and will be multiplied by K before &
1352  &being used in calculations.'
1353  if (found%inewton) &
1354  write (this%iout, '(4x,a)') 'NEWTON-RAPHSON method disabled for unconfined &
1355  &cells'
1356  if (found%satomega) &
1357  write (this%iout, '(4x,a,1pg15.6)') 'Saturation omega: ', this%satomega
1358  if (found%irewet) &
1359  write (this%iout, '(4x,a)') 'Rewetting is active.'
1360  if (found%wetfct) &
1361  write (this%iout, '(4x,a,1pg15.6)') &
1362  'Wetting factor (WETFCT) has been set to: ', this%wetfct
1363  if (found%iwetit) &
1364  write (this%iout, '(4x,a,i5)') &
1365  'Wetting iteration interval (IWETIT) has been set to: ', this%iwetit
1366  if (found%ihdwet) &
1367  write (this%iout, '(4x,a,i5)') &
1368  'Head rewet equation (IHDWET) has been set to: ', this%ihdwet
1369  write (this%iout, '(1x,a,/)') 'End Setting NPF Options'
This module defines variable data types.
Definition: kind.f90:8

◆ npf_ac()

subroutine gwfnpfmodule::npf_ac ( class(gwfnpftype)  this,
integer(i4b), intent(in)  moffset,
type(sparsematrix), intent(inout)  sparse 
)

Definition at line 259 of file gwf-npf.f90.

260  ! -- modules
261  use sparsemodule, only: sparsematrix
262  ! -- dummy
263  class(GwfNpftype) :: this
264  integer(I4B), intent(in) :: moffset
265  type(sparsematrix), intent(inout) :: sparse
266  !
267  ! -- Add extended neighbors (neighbors of neighbors)
268  if (this%ixt3d /= 0) call this%xt3d%xt3d_ac(moffset, sparse)

◆ npf_ad()

subroutine gwfnpfmodule::npf_ad ( class(gwfnpftype)  this,
integer(i4b), intent(in)  nodes,
real(dp), dimension(nodes), intent(inout)  hold,
real(dp), dimension(nodes), intent(inout)  hnew,
integer(i4b), intent(in)  irestore 
)
private

Sets hold (head old) to bot whenever a wettable cell is dry

Definition at line 401 of file gwf-npf.f90.

402  ! -- modules
403  use tdismodule, only: kper, kstp
404  !
405  implicit none
406  ! -- dummy
407  class(GwfNpfType) :: this
408  integer(I4B), intent(in) :: nodes
409  real(DP), dimension(nodes), intent(inout) :: hold
410  real(DP), dimension(nodes), intent(inout) :: hnew
411  integer(I4B), intent(in) :: irestore
412  ! -- local
413  integer(I4B) :: n
414  !
415  ! -- loop through all cells and set hold=bot if wettable cell is dry
416  if (this%irewet > 0) then
417  do n = 1, this%dis%nodes
418  if (this%wetdry(n) == dzero) cycle
419  if (this%ibound(n) /= 0) cycle
420  hold(n) = this%dis%bot(n)
421  end do
422  !
423  ! -- if restore state, then set hnew to DRY if it is a dry wettable cell
424  do n = 1, this%dis%nodes
425  if (this%wetdry(n) == dzero) cycle
426  if (this%ibound(n) /= 0) cycle
427  hnew(n) = dhdry
428  end do
429  end if
430  !
431  ! -- TVK
432  if (this%intvk /= 0) then
433  call this%tvk%ad()
434  end if
435  !
436  ! -- VSC
437  ! -- Hit the TVK-updated K's with VSC correction before calling/updating condsat
438  if (this%invsc /= 0) then
439  call this%vsc%update_k_with_vsc()
440  end if
441  !
442  ! -- If any K values have changed, we need to update CONDSAT or XT3D arrays
443  if (this%kchangeper == kper .and. this%kchangestp == kstp) then
444  if (this%ixt3d == 0) then
445  !
446  ! -- Update the saturated conductance for all connections
447  ! -- of the affected nodes
448  do n = 1, this%dis%nodes
449  if (this%nodekchange(n) == 1) then
450  call this%calc_condsat(n, .false.)
451  end if
452  end do
453  else
454  !
455  ! -- Recompute XT3D coefficients for permanently confined connections
456  if (this%xt3d%lamatsaved .and. .not. this%xt3d%ldispersion) then
457  call this%xt3d%xt3d_fcpc(this%dis%nodes, .true.)
458  end if
459  end if
460  end if
integer(i4b), pointer, public kstp
current time step number
Definition: tdis.f90:27
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:26

◆ npf_ar()

subroutine gwfnpfmodule::npf_ar ( class(gwfnpftype)  this,
type(gwfictype), intent(in), pointer  ic,
type(gwfvsctype), intent(in), pointer  vsc,
integer(i4b), dimension(:), intent(inout), pointer, contiguous  ibound,
real(dp), dimension(:), intent(inout), pointer, contiguous  hnew 
)
private

Allocate remaining package arrays, preprocess the input data and call *_ar on xt3d, when active.

Parameters
thisinstance of the NPF package
[in]icinitial conditions
[in]vscviscosity package
[in,out]iboundmodel ibound array
[in,out]hnewpointer to model head array

Definition at line 287 of file gwf-npf.f90.

288  ! -- modules
291  ! -- dummy
292  class(GwfNpftype) :: this !< instance of the NPF package
293  type(GwfIcType), pointer, intent(in) :: ic !< initial conditions
294  type(GwfVscType), pointer, intent(in) :: vsc !< viscosity package
295  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: ibound !< model ibound array
296  real(DP), dimension(:), pointer, contiguous, intent(inout) :: hnew !< pointer to model head array
297  ! -- local
298  integer(I4B) :: n
299  !
300  ! -- Store pointers to arguments that were passed in
301  this%ic => ic
302  this%ibound => ibound
303  this%hnew => hnew
304  !
305  if (this%icalcspdis == 1) then
306  call mem_reallocate(this%spdis, 3, this%dis%nodes, 'SPDIS', this%memoryPath)
307  call mem_reallocate(this%nodedge, this%nedges, 'NODEDGE', this%memoryPath)
308  call mem_reallocate(this%ihcedge, this%nedges, 'IHCEDGE', this%memoryPath)
309  call mem_reallocate(this%propsedge, 5, this%nedges, 'PROPSEDGE', &
310  this%memoryPath)
311  call mem_reallocate(this%iedge_ptr, this%dis%nodes + 1, &
312  'NREDGESNODE', this%memoryPath)
313  call mem_reallocate(this%edge_idxs, this%nedges, &
314  'EDGEIDXS', this%memoryPath)
315 
316  do n = 1, this%nedges
317  this%edge_idxs(n) = 0
318  end do
319  do n = 1, this%dis%nodes
320  this%iedge_ptr(n) = 0
321  this%spdis(:, n) = dzero
322  end do
323  end if
324  !
325  ! -- Store pointer to VSC if active
326  if (this%invsc /= 0) then
327  this%vsc => vsc
328  end if
329  !
330  ! -- allocate arrays to store original user input in case TVK/VSC modify them
331  if (this%invsc > 0) then
332  !
333  ! -- Reallocate arrays that store user-input values.
334  call mem_reallocate(this%k11input, this%dis%nodes, 'K11INPUT', &
335  this%memoryPath)
336  call mem_reallocate(this%k22input, this%dis%nodes, 'K22INPUT', &
337  this%memoryPath)
338  call mem_reallocate(this%k33input, this%dis%nodes, 'K33INPUT', &
339  this%memoryPath)
340  ! Allocate arrays that will store the original K values. When VSC active,
341  ! the current Kxx arrays carry the viscosity-adjusted K values.
342  ! This approach leverages existing functionality that makes use of K.
343  call this%store_original_k_arrays(this%dis%nodes, this%dis%njas)
344  end if
345  !
346  ! -- preprocess data
347  call this%preprocess_input()
348  !
349  ! -- xt3d
350  ! -- Terminate if the DISU ANGLDEGX values are inconsistent and this
351  ! package requires ANGLDEGX (it has no effect otherwise)
352  if (this%ixt3d /= 0 .or. this%ik22 /= 0 .or. this%icalcspdis /= 0) then
353  select type (dis => this%dis)
354  type is (disutype)
355  if (dis%nangldegxerr > 0) then
356  write (errmsg, '(a,1x,i0,1x,a)') &
357  'ANGLDEGX values in the DISU Package are inconsistent for', &
358  dis%nangldegxerr, 'cell faces (see the warnings written after &
359  &the DISU Package input in the model listing file). ANGLDEGX &
360  &must be correct because it is required input for the NPF &
361  &Package when XT3D, K22, or SAVE_SPECIFIC_DISCHARGE is specified.'
362  call store_error(errmsg)
363  call store_error_filename(dis%input_fname)
364  end if
365  end select
366  end if
367  !
368  if (this%ixt3d /= 0) then
369  call this%xt3d%xt3d_ar(ibound, this%k11, this%ik33, this%k33, &
370  this%sat, this%ik22, this%k22, &
371  this%iangle1, this%iangle2, this%iangle3, &
372  this%angle1, this%angle2, this%angle3, &
373  this%inewton, this%icelltype)
374  end if
375  !
376  ! -- TVK
377  if (this%intvk /= 0) then
378  call this%tvk%ar(this%dis)
379  end if
Here is the call graph for this function:

◆ npf_cf()

subroutine gwfnpfmodule::npf_cf ( class(gwfnpftype)  this,
integer(i4b)  kiter,
integer(i4b), intent(in)  nodes,
real(dp), dimension(nodes), intent(inout)  hnew 
)

Definition at line 465 of file gwf-npf.f90.

466  ! -- dummy
467  class(GwfNpfType) :: this
468  integer(I4B) :: kiter
469  integer(I4B), intent(in) :: nodes
470  real(DP), intent(inout), dimension(nodes) :: hnew
471  ! -- local
472  integer(I4B) :: n
473  real(DP) :: satn
474  !
475  ! -- Perform wetting and drying
476  if (this%inewton /= 1) then
477  call this%wd(kiter, hnew)
478  end if
479  !
480  ! -- Calculate saturation for convertible cells
481  do n = 1, this%dis%nodes
482  if (this%icelltype(n) /= 0) then
483  if (this%ibound(n) == 0) then
484  satn = dzero
485  else
486  call this%thksat(n, hnew(n), satn)
487  end if
488  this%sat(n) = satn
489  end if
490  end do

◆ npf_cq()

subroutine gwfnpfmodule::npf_cq ( class(gwfnpftype)  this,
real(dp), dimension(:), intent(inout)  hnew,
real(dp), dimension(:), intent(inout)  flowja 
)
private

Definition at line 811 of file gwf-npf.f90.

812  ! -- dummy
813  class(GwfNpfType) :: this
814  real(DP), intent(inout), dimension(:) :: hnew
815  real(DP), intent(inout), dimension(:) :: flowja
816  ! -- local
817  integer(I4B) :: n, ipos, m
818  real(DP) :: qnm
819  !
820  ! -- Calculate the flow across each cell face and store in flowja
821  !
822  if (this%ixt3d /= 0) then
823  call this%xt3d%xt3d_flowja(hnew, flowja)
824  else
825  !
826  do n = 1, this%dis%nodes
827  do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
828  m = this%dis%con%ja(ipos)
829  if (m < n) cycle
830  call this%qcalc(n, m, hnew(n), hnew(m), ipos, qnm)
831  flowja(ipos) = qnm
832  flowja(this%dis%con%isym(ipos)) = -qnm
833  end do
834  end do
835  !
836  end if

◆ npf_cr()

subroutine, public gwfnpfmodule::npf_cr ( type(gwfnpftype), pointer  npfobj,
character(len=*), intent(in)  name_model,
character(len=*), intent(in)  input_mempath,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout 
)

Definition at line 159 of file gwf-npf.f90.

160  ! -- modules
161  use kindmodule, only: lgp
163  ! -- dummy
164  type(GwfNpfType), pointer :: npfobj
165  character(len=*), intent(in) :: name_model
166  character(len=*), intent(in) :: input_mempath
167  integer(I4B), intent(in) :: inunit
168  integer(I4B), intent(in) :: iout
169  ! -- formats
170  character(len=*), parameter :: fmtheader = &
171  "(1x, /1x, 'NPF -- NODE PROPERTY FLOW PACKAGE, VERSION 1, 3/30/2015', &
172  &' INPUT READ FROM MEMPATH: ', A, /)"
173  !
174  ! -- Create the object
175  allocate (npfobj)
176  !
177  ! -- create name and memory path
178  call npfobj%set_names(1, name_model, 'NPF', 'NPF', input_mempath)
179  !
180  ! -- Allocate scalars
181  call npfobj%allocate_scalars()
182  !
183  ! -- Set variables
184  npfobj%inunit = inunit
185  npfobj%iout = iout
186  !
187  ! -- check if npf is enabled
188  if (inunit > 0) then
189  !
190  ! -- Print a message identifying the node property flow package.
191  write (iout, fmtheader) input_mempath
192  end if
193 
194  ! allocate spdis structure
195  allocate (npfobj%spdis_wa)
196 
Here is the caller graph for this function:

◆ npf_da()

subroutine gwfnpfmodule::npf_da ( class(gwfnpftype)  this)

Definition at line 1018 of file gwf-npf.f90.

1019  ! -- modules
1021  use simvariablesmodule, only: idm_context
1022  ! -- dummy
1023  class(GwfNpftype) :: this
1024 
1025  ! free spdis work structure
1026  if (this%icalcspdis == 1 .and. this%spdis_wa%is_created()) &
1027  call this%spdis_wa%destroy()
1028  deallocate (this%spdis_wa)
1029  !
1030  ! -- Deallocate input memory
1031  call memorystore_remove(this%name_model, 'NPF', idm_context)
1032  !
1033  ! -- TVK
1034  if (this%intvk /= 0) then
1035  call this%tvk%da()
1036  deallocate (this%tvk)
1037  end if
1038  !
1039  ! -- VSC
1040  if (this%invsc /= 0) then
1041  nullify (this%vsc)
1042  end if
1043  !
1044  ! -- Strings
1045  !
1046  ! -- Scalars
1047  call mem_deallocate(this%iname)
1048  call mem_deallocate(this%ixt3d)
1049  call mem_deallocate(this%ixt3drhs)
1050  call mem_deallocate(this%satomega)
1051  call mem_deallocate(this%hnoflo)
1052  call mem_deallocate(this%hdry)
1053  call mem_deallocate(this%icellavg)
1054  call mem_deallocate(this%iavgkeff)
1055  call mem_deallocate(this%ik22)
1056  call mem_deallocate(this%ik33)
1057  call mem_deallocate(this%iperched)
1058  call mem_deallocate(this%ivarcv)
1059  call mem_deallocate(this%idewatcv)
1060  call mem_deallocate(this%ithickstrt)
1061  call mem_deallocate(this%ihighcellsat)
1062  call mem_deallocate(this%isavspdis)
1063  call mem_deallocate(this%isavsat)
1064  call mem_deallocate(this%icalcspdis)
1065  call mem_deallocate(this%irewet)
1066  call mem_deallocate(this%wetfct)
1067  call mem_deallocate(this%iwetit)
1068  call mem_deallocate(this%ihdwet)
1069  call mem_deallocate(this%ibotnode)
1070  call mem_deallocate(this%iwetdry)
1071  call mem_deallocate(this%iangle1)
1072  call mem_deallocate(this%iangle2)
1073  call mem_deallocate(this%iangle3)
1074  call mem_deallocate(this%nedges)
1075  call mem_deallocate(this%lastedge)
1076  call mem_deallocate(this%ik22overk)
1077  call mem_deallocate(this%ik33overk)
1078  call mem_deallocate(this%intvk)
1079  call mem_deallocate(this%invsc)
1080  call mem_deallocate(this%kchangeper)
1081  call mem_deallocate(this%kchangestp)
1082  !
1083  ! -- Deallocate arrays
1084  deallocate (this%aname)
1085  call mem_deallocate(this%ithickstartflag)
1086  call mem_deallocate(this%icelltype)
1087  call mem_deallocate(this%k11)
1088  call mem_deallocate(this%k22)
1089  call mem_deallocate(this%k33)
1090  call mem_deallocate(this%k11input)
1091  call mem_deallocate(this%k22input)
1092  call mem_deallocate(this%k33input)
1093  call mem_deallocate(this%sat, 'SAT', this%memoryPath)
1094  call mem_deallocate(this%condsat)
1095  call mem_deallocate(this%wetdry)
1096  call mem_deallocate(this%angle1)
1097  call mem_deallocate(this%angle2)
1098  call mem_deallocate(this%angle3)
1099  call mem_deallocate(this%nodedge)
1100  call mem_deallocate(this%ihcedge)
1101  call mem_deallocate(this%propsedge)
1102  call mem_deallocate(this%iedge_ptr)
1103  call mem_deallocate(this%edge_idxs)
1104  call mem_deallocate(this%spdis, 'SPDIS', this%memoryPath)
1105  call mem_deallocate(this%nodekchange)
1106  !
1107  ! -- deallocate parent
1108  call this%NumericalPackageType%da()
1109 
1110  ! pointers
1111  this%hnew => null()
1112 
subroutine, public memorystore_remove(component, subcomponent, context)
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=linelength) idm_context
Here is the call graph for this function:

◆ npf_df()

subroutine gwfnpfmodule::npf_df ( class(gwfnpftype)  this,
class(disbasetype), intent(inout), pointer  dis,
type(xt3dtype), pointer  xt3d,
integer(i4b), intent(in)  ingnc,
integer(i4b), intent(in)  invsc,
type(gwfnpfoptionstype), intent(in), optional  npf_options 
)

This is a hybrid routine: it either reads the options for this package from the input file, or the optional argument

Parameters
npf_optionsshould be passed. A consistency check is performed, and finally xt3d_df is called, when enabled.
thisinstance of the NPF package
[in,out]disthe pointer to the discretization
xt3dthe pointer to the XT3D 'package'
[in]ingncghostnodes enabled? (>0 means yes)
[in]invscviscosity enabled? (>0 means yes)
[in]npf_optionsthe optional options, for when not constructing from file

Definition at line 206 of file gwf-npf.f90.

207  ! -- modules
208  use simmodule, only: store_error
209  use xt3dmodule, only: xt3d_cr
210  ! -- dummy
211  class(GwfNpftype) :: this !< instance of the NPF package
212  class(DisBaseType), pointer, intent(inout) :: dis !< the pointer to the discretization
213  type(Xt3dType), pointer :: xt3d !< the pointer to the XT3D 'package'
214  integer(I4B), intent(in) :: ingnc !< ghostnodes enabled? (>0 means yes)
215  integer(I4B), intent(in) :: invsc !< viscosity enabled? (>0 means yes)
216  type(GwfNpfOptionsType), optional, intent(in) :: npf_options !< the optional options, for when not constructing from file
217  !
218  ! -- Set a pointer to dis
219  this%dis => dis
220  !
221  ! -- Set flag signifying whether vsc is active
222  if (invsc > 0) this%invsc = invsc
223  !
224  if (.not. present(npf_options)) then
225  !
226  ! -- source options
227  call this%source_options()
228  !
229  ! -- allocate arrays
230  call this%allocate_arrays(this%dis%nodes, this%dis%njas)
231  !
232  ! -- source griddata, set, and convert/check the input
233  call this%source_griddata()
234  call this%prepcheck()
235  else
236  call this%set_options(npf_options)
237  !
238  ! -- allocate arrays
239  call this%allocate_arrays(this%dis%nodes, this%dis%njas)
240  end if
241  !
242  call this%check_options()
243  !
244  ! -- Save pointer to xt3d object
245  this%xt3d => xt3d
246  if (this%ixt3d /= 0) xt3d%ixt3d = this%ixt3d
247  call this%xt3d%xt3d_df(dis)
248  !
249  ! -- Ensure GNC and XT3D are not both on at the same time
250  if (this%ixt3d /= 0 .and. ingnc > 0) then
251  call store_error('Error in model '//trim(this%name_model)// &
252  '. The XT3D option cannot be used with the GNC &
253  &Package.', terminate=.true.)
254  end if
subroutine, public xt3d_cr(xt3dobj, name_model, inunit, iout, ldispopt)
Create a new xt3d object.
Here is the call graph for this function:

◆ npf_fc()

subroutine gwfnpfmodule::npf_fc ( class(gwfnpftype)  this,
integer(i4b)  kiter,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(:), intent(in)  idxglo,
real(dp), dimension(:), intent(inout)  rhs,
real(dp), dimension(:), intent(inout)  hnew 
)
private

Definition at line 495 of file gwf-npf.f90.

496  ! -- modules
497  use constantsmodule, only: done
498  ! -- dummy
499  class(GwfNpfType) :: this
500  integer(I4B) :: kiter
501  class(MatrixBaseType), pointer :: matrix_sln
502  integer(I4B), intent(in), dimension(:) :: idxglo
503  real(DP), intent(inout), dimension(:) :: rhs
504  real(DP), intent(inout), dimension(:) :: hnew
505  ! -- local
506  integer(I4B) :: n, m, ii, idiag, ihc
507  integer(I4B) :: isymcon, idiagm
508  real(DP) :: hyn, hym
509  real(DP) :: cond
510  real(DP) :: satn
511  real(DP) :: satm
512  !
513  ! -- Calculate conductance and put into amat
514  !
515  if (this%ixt3d /= 0) then
516  call this%xt3d%xt3d_fc(kiter, matrix_sln, idxglo, rhs, hnew)
517  else
518  do n = 1, this%dis%nodes
519  do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
520  if (this%dis%con%mask(ii) == 0) cycle
521 
522  m = this%dis%con%ja(ii)
523  !
524  ! -- Calculate conductance only for upper triangle but insert into
525  ! upper and lower parts of amat.
526  if (m < n) cycle
527  ihc = this%dis%con%ihc(this%dis%con%jas(ii))
528  hyn = this%hy_eff(n, m, ihc, ipos=ii)
529  hym = this%hy_eff(m, n, ihc, ipos=ii)
530  !
531  ! -- Vertical connection
532  if (ihc == c3d_vertical) then
533  !
534  ! -- Calculate vertical conductance
535  cond = vcond(this%ibound(n), this%ibound(m), &
536  this%icelltype(n), this%icelltype(m), this%inewton, &
537  this%ivarcv, this%idewatcv, &
538  this%condsat(this%dis%con%jas(ii)), hnew(n), hnew(m), &
539  hyn, hym, &
540  this%sat(n), this%sat(m), &
541  this%dis%top(n), this%dis%top(m), &
542  this%dis%bot(n), this%dis%bot(m), &
543  this%dis%con%hwva(this%dis%con%jas(ii)))
544  !
545  ! -- Vertical flow for perched conditions
546  if (this%iperched /= 0) then
547  if (this%icelltype(m) /= 0) then
548  if (hnew(m) < this%dis%top(m)) then
549  !
550  ! -- Fill row n
551  idiag = this%dis%con%ia(n)
552  rhs(n) = rhs(n) - cond * this%dis%bot(n)
553  call matrix_sln%add_value_pos(idxglo(idiag), -cond)
554  !
555  ! -- Fill row m
556  isymcon = this%dis%con%isym(ii)
557  call matrix_sln%add_value_pos(idxglo(isymcon), cond)
558  rhs(m) = rhs(m) + cond * this%dis%bot(n)
559  !
560  ! -- cycle the connection loop
561  cycle
562  end if
563  end if
564  end if
565  !
566  else
567  satn = this%sat(n)
568  satm = this%sat(m)
569  if (this%ihighcellsat /= 0) then
570  call this%highest_cell_saturation(n, m, &
571  hnew(n), hnew(m), &
572  satn, satm)
573  end if
574  !
575  ! -- Horizontal conductance
576  cond = hcond(this%ibound(n), this%ibound(m), &
577  this%icelltype(n), this%icelltype(m), &
578  this%inewton, &
579  this%dis%con%ihc(this%dis%con%jas(ii)), &
580  this%icellavg, &
581  this%condsat(this%dis%con%jas(ii)), &
582  hnew(n), hnew(m), satn, satm, hyn, hym, &
583  this%dis%top(n), this%dis%top(m), &
584  this%dis%bot(n), this%dis%bot(m), &
585  this%dis%con%cl1(this%dis%con%jas(ii)), &
586  this%dis%con%cl2(this%dis%con%jas(ii)), &
587  this%dis%con%hwva(this%dis%con%jas(ii)))
588  end if
589  !
590  ! -- Fill row n
591  idiag = this%dis%con%ia(n)
592  call matrix_sln%add_value_pos(idxglo(ii), cond)
593  call matrix_sln%add_value_pos(idxglo(idiag), -cond)
594  !
595  ! -- Fill row m
596  isymcon = this%dis%con%isym(ii)
597  idiagm = this%dis%con%ia(m)
598  call matrix_sln%add_value_pos(idxglo(isymcon), cond)
599  call matrix_sln%add_value_pos(idxglo(idiagm), -cond)
600  end do
601  end do
602  !
603  end if
real(dp), parameter done
real constant 1
Definition: Constants.f90:76
Here is the call graph for this function:

◆ npf_fn()

subroutine gwfnpfmodule::npf_fn ( class(gwfnpftype)  this,
integer(i4b)  kiter,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(:), intent(in)  idxglo,
real(dp), dimension(:), intent(inout)  rhs,
real(dp), dimension(:), intent(inout)  hnew 
)
private

Definition at line 640 of file gwf-npf.f90.

641  ! -- dummy
642  class(GwfNpfType) :: this
643  integer(I4B) :: kiter
644  class(MatrixBaseType), pointer :: matrix_sln
645  integer(I4B), intent(in), dimension(:) :: idxglo
646  real(DP), intent(inout), dimension(:) :: rhs
647  real(DP), intent(inout), dimension(:) :: hnew
648  ! -- local
649  integer(I4B) :: nodes, nja
650  integer(I4B) :: n, m, ii, idiag
651  integer(I4B) :: isymcon, idiagm
652  integer(I4B) :: iups
653  integer(I4B) :: idn
654  real(DP) :: cond
655  real(DP) :: consterm
656  real(DP) :: filledterm
657  real(DP) :: derv
658  real(DP) :: hds
659  real(DP) :: term
660  real(DP) :: topup
661  real(DP) :: botup
662  !
663  ! -- add newton terms to solution matrix
664  nodes = this%dis%nodes
665  nja = this%dis%con%nja
666  if (this%ixt3d /= 0) then
667  call this%xt3d%xt3d_fn(kiter, nodes, nja, matrix_sln, idxglo, rhs, hnew)
668  else
669  !
670  do n = 1, nodes
671  idiag = this%dis%con%ia(n)
672  do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
673  if (this%dis%con%mask(ii) == 0) cycle
674 
675  m = this%dis%con%ja(ii)
676  isymcon = this%dis%con%isym(ii)
677  ! work on upper triangle
678  if (m < n) cycle
679  if (this%dis%con%ihc(this%dis%con%jas(ii)) == 0 .and. &
680  this%ivarcv == 0) then
681  !call this%vcond(n,m,hnew(n),hnew(m),ii,cond)
682  ! do nothing
683  else
684  ! determine upstream node
685  iups = m
686  if (hnew(m) < hnew(n)) iups = n
687  idn = n
688  if (iups == n) idn = m
689  !
690  ! -- no newton terms if upstream cell is confined
691  if (this%icelltype(iups) == 0) cycle
692  !
693  ! -- Set the upstream top and bot, and then recalculate for a
694  ! vertically staggered horizontal connection
695  topup = this%dis%top(iups)
696  botup = this%dis%bot(iups)
697  if (this%dis%con%ihc(this%dis%con%jas(ii)) == 2) then
698  topup = min(this%dis%top(n), this%dis%top(m))
699  botup = max(this%dis%bot(n), this%dis%bot(m))
700  end if
701  !
702  ! get saturated conductivity for derivative
703  cond = this%condsat(this%dis%con%jas(ii))
704  !
705  ! compute additional term
706  consterm = -cond * (hnew(iups) - hnew(idn)) !needs to use hwadi instead of hnew(idn)
707  !filledterm = cond
708  filledterm = matrix_sln%get_value_pos(idxglo(ii))
709  derv = squadraticsaturationderivative(topup, botup, hnew(iups), &
710  this%satomega)
711  idiagm = this%dis%con%ia(m)
712  ! fill jacobian for n being the upstream node
713  if (iups == n) then
714  hds = hnew(m)
715  !isymcon = this%dis%con%isym(ii)
716  term = consterm * derv
717  rhs(n) = rhs(n) + term * hnew(n) !+ amat(idxglo(isymcon)) * (dwadi * hds - hds) !need to add dwadi
718  rhs(m) = rhs(m) - term * hnew(n) !- amat(idxglo(isymcon)) * (dwadi * hds - hds) !need to add dwadi
719  ! fill in row of n
720  call matrix_sln%add_value_pos(idxglo(idiag), term)
721  ! fill newton term in off diagonal if active cell
722  if (this%ibound(n) > 0) then
723  filledterm = matrix_sln%get_value_pos(idxglo(ii))
724  call matrix_sln%set_value_pos(idxglo(ii), filledterm) !* dwadi !need to add dwadi
725  end if
726  !fill row of m
727  filledterm = matrix_sln%get_value_pos(idxglo(idiagm))
728  call matrix_sln%set_value_pos(idxglo(idiagm), filledterm) !- filledterm * (dwadi - DONE) !need to add dwadi
729  ! fill newton term in off diagonal if active cell
730  if (this%ibound(m) > 0) then
731  call matrix_sln%add_value_pos(idxglo(isymcon), -term)
732  end if
733  ! fill jacobian for m being the upstream node
734  else
735  hds = hnew(n)
736  term = -consterm * derv
737  rhs(n) = rhs(n) + term * hnew(m) !+ amat(idxglo(ii)) * (dwadi * hds - hds) !need to add dwadi
738  rhs(m) = rhs(m) - term * hnew(m) !- amat(idxglo(ii)) * (dwadi * hds - hds) !need to add dwadi
739  ! fill in row of n
740  filledterm = matrix_sln%get_value_pos(idxglo(idiag))
741  call matrix_sln%set_value_pos(idxglo(idiag), filledterm) !- filledterm * (dwadi - DONE) !need to add dwadi
742  ! fill newton term in off diagonal if active cell
743  if (this%ibound(n) > 0) then
744  call matrix_sln%add_value_pos(idxglo(ii), term)
745  end if
746  !fill row of m
747  call matrix_sln%add_value_pos(idxglo(idiagm), -term)
748  ! fill newton term in off diagonal if active cell
749  if (this%ibound(m) > 0) then
750  filledterm = matrix_sln%get_value_pos(idxglo(isymcon))
751  call matrix_sln%set_value_pos(idxglo(isymcon), filledterm) !* dwadi !need to add dwadi
752  end if
753  end if
754  end if
755 
756  end do
757  end do
758  !
759  end if
Here is the call graph for this function:

◆ npf_mc()

subroutine gwfnpfmodule::npf_mc ( class(gwfnpftype)  this,
integer(i4b), intent(in)  moffset,
class(matrixbasetype), pointer  matrix_sln 
)

Definition at line 273 of file gwf-npf.f90.

274  ! -- dummy
275  class(GwfNpftype) :: this
276  integer(I4B), intent(in) :: moffset
277  class(MatrixBaseType), pointer :: matrix_sln
278  !
279  if (this%ixt3d /= 0) call this%xt3d%xt3d_mc(moffset, matrix_sln)

◆ npf_nur()

subroutine gwfnpfmodule::npf_nur ( class(gwfnpftype)  this,
integer(i4b), intent(in)  neqmod,
real(dp), dimension(neqmod), intent(inout)  x,
real(dp), dimension(neqmod), intent(in)  xtemp,
real(dp), dimension(neqmod), intent(inout)  dx,
integer(i4b), intent(inout)  inewtonur,
real(dp), intent(inout)  dxmax,
integer(i4b), intent(inout)  locmax 
)
private

Under-relaxation of Groundwater Flow Model Heads for current outer iteration using the cell bottoms at the bottom of the model

Definition at line 767 of file gwf-npf.f90.

768  ! -- dummy
769  class(GwfNpfType) :: this
770  integer(I4B), intent(in) :: neqmod
771  real(DP), dimension(neqmod), intent(inout) :: x
772  real(DP), dimension(neqmod), intent(in) :: xtemp
773  real(DP), dimension(neqmod), intent(inout) :: dx
774  integer(I4B), intent(inout) :: inewtonur
775  real(DP), intent(inout) :: dxmax
776  integer(I4B), intent(inout) :: locmax
777  ! -- local
778  integer(I4B) :: n
779  integer(I4B) :: ibot
780  real(DP) :: botm
781  real(DP) :: xx
782  real(DP) :: dxx
783  !
784  ! -- Newton-Raphson under-relaxation
785  do n = 1, this%dis%nodes
786  if (this%ibound(n) < 1) cycle
787  ibot = this%ibotnode(n)
788  ! Newton-Raphson under-relaxation is only applied to convertible cells where
789  ! the bottom cell in a stack is convertible
790  if (this%icelltype(n) > 0 .and. this%icelltype(ibot) > 0) then
791  botm = this%dis%bot(ibot)
792  ! Newton-Raphson under-relaxation applied when solution head is
793  ! below the bottom of the model
794  if (x(n) < botm) then
795  inewtonur = 1
796  xx = xtemp(n) * (done - dp9) + botm * dp9
797  dxx = xx - xtemp(n)
798  if (abs(dxx) > abs(dxmax)) then
799  locmax = n
800  dxmax = dxx
801  end if
802  x(n) = xx
803  dx(n) = xtemp(n) - x(n)
804  end if
805  end if
806  end do

◆ npf_print_model_flows()

subroutine gwfnpfmodule::npf_print_model_flows ( class(gwfnpftype)  this,
integer(i4b), intent(in)  ibudfl,
real(dp), dimension(:), intent(inout)  flowja 
)
private

Definition at line 979 of file gwf-npf.f90.

980  ! -- modules
981  use tdismodule, only: kper, kstp
982  use constantsmodule, only: lenbigline
983  ! -- dummy
984  class(GwfNpfType) :: this
985  integer(I4B), intent(in) :: ibudfl
986  real(DP), intent(inout), dimension(:) :: flowja
987  ! -- local
988  character(len=LENBIGLINE) :: line
989  character(len=30) :: tempstr
990  integer(I4B) :: n, ipos, m
991  real(DP) :: qnm
992  ! -- formats
993  character(len=*), parameter :: fmtiprflow = &
994  &"(/,4x,'CALCULATED INTERCELL FLOW FOR PERIOD ', i0, ' STEP ', i0)"
995  !
996  ! -- Write flowja to list file if requested
997  if (ibudfl /= 0 .and. this%iprflow > 0) then
998  write (this%iout, fmtiprflow) kper, kstp
999  do n = 1, this%dis%nodes
1000  line = ''
1001  call this%dis%noder_to_string(n, tempstr)
1002  line = trim(tempstr)//':'
1003  do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
1004  m = this%dis%con%ja(ipos)
1005  call this%dis%noder_to_string(m, tempstr)
1006  line = trim(line)//' '//trim(tempstr)
1007  qnm = flowja(ipos)
1008  write (tempstr, '(1pg15.6)') qnm
1009  line = trim(line)//' '//trim(adjustl(tempstr))
1010  end do
1011  write (this%iout, '(a)') trim(line)
1012  end do
1013  end if
integer(i4b), parameter lenbigline
maximum length of a big line
Definition: Constants.f90:15

◆ npf_rp()

subroutine gwfnpfmodule::npf_rp ( class(gwfnpftype)  this)

Read and prepare NPF stress period data.

Definition at line 386 of file gwf-npf.f90.

387  implicit none
388  ! -- dummy
389  class(GwfNpfType) :: this
390  !
391  ! -- TVK
392  if (this%intvk /= 0) then
393  call this%tvk%rp()
394  end if

◆ npf_save_model_flows()

subroutine gwfnpfmodule::npf_save_model_flows ( class(gwfnpftype)  this,
real(dp), dimension(:), intent(in)  flowja,
integer(i4b), intent(in)  icbcfl,
integer(i4b), intent(in)  icbcun 
)
private

Definition at line 942 of file gwf-npf.f90.

943  ! -- dummy
944  class(GwfNpfType) :: this
945  real(DP), dimension(:), intent(in) :: flowja
946  integer(I4B), intent(in) :: icbcfl
947  integer(I4B), intent(in) :: icbcun
948  ! -- local
949  integer(I4B) :: ibinun
950  !
951  ! -- Set unit number for binary output
952  if (this%ipakcb < 0) then
953  ibinun = icbcun
954  elseif (this%ipakcb == 0) then
955  ibinun = 0
956  else
957  ibinun = this%ipakcb
958  end if
959  if (icbcfl == 0) ibinun = 0
960  !
961  ! -- Write the face flows if requested
962  if (ibinun /= 0) then
963  call this%dis%record_connection_array(flowja, ibinun, this%iout)
964  end if
965  !
966  ! -- Calculate specific discharge at cell centers and write, if requested
967  if (this%isavspdis /= 0) then
968  if (ibinun /= 0) call this%sav_spdis(ibinun)
969  end if
970  !
971  ! -- Save saturation, if requested
972  if (this%isavsat /= 0) then
973  if (ibinun /= 0) call this%sav_sat(ibinun)
974  end if

◆ prepare_edge_lookup()

subroutine gwfnpfmodule::prepare_edge_lookup ( class(gwfnpftype)  this)
private

Definition at line 2848 of file gwf-npf.f90.

2849  class(GwfNpfType) :: this
2850  ! local
2851  integer(I4B) :: i, inode, iedge
2852  integer(I4B) :: n, start, end
2853  integer(I4B) :: prev_cnt, strt_idx, ipos
2854 
2855  do i = 1, size(this%iedge_ptr)
2856  this%iedge_ptr(i) = 0
2857  end do
2858  do i = 1, size(this%edge_idxs)
2859  this%edge_idxs(i) = 0
2860  end do
2861 
2862  ! count
2863  do iedge = 1, this%nedges
2864  n = this%nodedge(iedge)
2865  this%iedge_ptr(n) = this%iedge_ptr(n) + 1
2866  end do
2867 
2868  ! determine start indexes
2869  prev_cnt = this%iedge_ptr(1)
2870  this%iedge_ptr(1) = 1
2871  do inode = 2, this%dis%nodes + 1
2872  strt_idx = this%iedge_ptr(inode - 1) + prev_cnt
2873  prev_cnt = this%iedge_ptr(inode)
2874  this%iedge_ptr(inode) = strt_idx
2875  end do
2876 
2877  ! loop over edges to fill lookup table
2878  do iedge = 1, this%nedges
2879  n = this%nodedge(iedge)
2880  start = this%iedge_ptr(n)
2881  end = this%iedge_ptr(n + 1) - 1
2882  do ipos = start, end
2883  if (this%edge_idxs(ipos) > 0) cycle ! go to next
2884  this%edge_idxs(ipos) = iedge
2885  exit
2886  end do
2887  end do
2888 

◆ prepcheck()

subroutine gwfnpfmodule::prepcheck ( class(gwfnpftype)  this)

Definition at line 1699 of file gwf-npf.f90.

1700  ! -- modules
1701  use constantsmodule, only: linelength, dpio180
1703  ! -- dummy
1704  class(GwfNpfType) :: this
1705  ! -- local
1706  character(len=24), dimension(:), pointer :: aname
1707  character(len=LINELENGTH) :: cellstr, errmsg
1708  integer(I4B) :: nerr, n
1709  ! -- format
1710  character(len=*), parameter :: fmtkerr = &
1711  &"(1x, 'Hydraulic property ',a,' is <= 0 for cell ',a, ' ', 1pg15.6)"
1712  character(len=*), parameter :: fmtkerr2 = &
1713  &"(1x, '... ', i0,' additional errors not shown for ',a)"
1714  !
1715  ! -- initialize
1716  aname => this%aname
1717  !
1718  ! -- check k11
1719  nerr = 0
1720  do n = 1, size(this%k11)
1721  if (this%k11(n) <= dzero) then
1722  nerr = nerr + 1
1723  if (nerr <= 20) then
1724  call this%dis%noder_to_string(n, cellstr)
1725  write (errmsg, fmtkerr) trim(adjustl(aname(2))), trim(cellstr), &
1726  this%k11(n)
1727  call store_error(errmsg)
1728  end if
1729  end if
1730  end do
1731  if (nerr > 20) then
1732  write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(2)))
1733  call store_error(errmsg)
1734  end if
1735  !
1736  ! -- check k33 because it was read
1737  if (this%ik33 /= 0) then
1738  !
1739  ! -- Check to make sure values are greater than or equal to zero
1740  nerr = 0
1741  do n = 1, size(this%k33)
1742  if (this%ik33overk /= 0) this%k33(n) = this%k33(n) * this%k11(n)
1743  if (this%k33(n) <= dzero) then
1744  nerr = nerr + 1
1745  if (nerr <= 20) then
1746  call this%dis%noder_to_string(n, cellstr)
1747  write (errmsg, fmtkerr) trim(adjustl(aname(3))), trim(cellstr), &
1748  this%k33(n)
1749  call store_error(errmsg)
1750  end if
1751  end if
1752  end do
1753  if (nerr > 20) then
1754  write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(3)))
1755  call store_error(errmsg)
1756  end if
1757  end if
1758  !
1759  ! -- check k22 because it was read
1760  if (this%ik22 /= 0) then
1761  !
1762  ! -- Check to make sure that angles are available
1763  if (this%dis%con%ianglex == 0) then
1764  write (errmsg, '(a)') 'Error. ANGLDEGX not provided in '// &
1765  'discretization file, but K22 was specified. '
1766  call store_error(errmsg)
1767  end if
1768  !
1769  ! -- Check to make sure values are greater than or equal to zero
1770  nerr = 0
1771  do n = 1, size(this%k22)
1772  if (this%ik22overk /= 0) this%k22(n) = this%k22(n) * this%k11(n)
1773  if (this%k22(n) <= dzero) then
1774  nerr = nerr + 1
1775  if (nerr <= 20) then
1776  call this%dis%noder_to_string(n, cellstr)
1777  write (errmsg, fmtkerr) trim(adjustl(aname(4))), trim(cellstr), &
1778  this%k22(n)
1779  call store_error(errmsg)
1780  end if
1781  end if
1782  end do
1783  if (nerr > 20) then
1784  write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(4)))
1785  call store_error(errmsg)
1786  end if
1787  end if
1788  !
1789  ! -- check for wetdry conflicts
1790  if (this%irewet == 1) then
1791  if (this%iwetdry == 0) then
1792  write (errmsg, '(a, a, a)') 'Error in GRIDDATA block: ', &
1793  trim(adjustl(aname(5))), ' not found.'
1794  call store_error(errmsg)
1795  end if
1796  end if
1797  !
1798  ! -- Check for angle conflicts
1799  if (this%iangle1 /= 0) then
1800  do n = 1, size(this%angle1)
1801  this%angle1(n) = this%angle1(n) * dpio180
1802  end do
1803  else
1804  if (this%ixt3d /= 0) then
1805  this%iangle1 = 1
1806  write (this%iout, '(a)') 'XT3D IN USE, BUT ANGLE1 NOT SPECIFIED. '// &
1807  'SETTING ANGLE1 TO ZERO.'
1808  do n = 1, size(this%angle1)
1809  this%angle1(n) = dzero
1810  end do
1811  end if
1812  end if
1813  if (this%iangle2 /= 0) then
1814  if (this%iangle1 == 0) then
1815  write (errmsg, '(a)') 'ANGLE2 SPECIFIED BUT NOT ANGLE1. '// &
1816  'ANGLE2 REQUIRES ANGLE1. '
1817  call store_error(errmsg)
1818  end if
1819  if (this%iangle3 == 0) then
1820  write (errmsg, '(a)') 'ANGLE2 SPECIFIED BUT NOT ANGLE3. '// &
1821  'SPECIFY BOTH OR NEITHER ONE. '
1822  call store_error(errmsg)
1823  end if
1824  do n = 1, size(this%angle2)
1825  this%angle2(n) = this%angle2(n) * dpio180
1826  end do
1827  end if
1828  if (this%iangle3 /= 0) then
1829  if (this%iangle1 == 0) then
1830  write (errmsg, '(a)') 'ANGLE3 SPECIFIED BUT NOT ANGLE1. '// &
1831  'ANGLE3 REQUIRES ANGLE1. '
1832  call store_error(errmsg)
1833  end if
1834  if (this%iangle2 == 0) then
1835  write (errmsg, '(a)') 'ANGLE3 SPECIFIED BUT NOT ANGLE2. '// &
1836  'SPECIFY BOTH OR NEITHER ONE. '
1837  call store_error(errmsg)
1838  end if
1839  do n = 1, size(this%angle3)
1840  this%angle3(n) = this%angle3(n) * dpio180
1841  end do
1842  end if
1843  !
1844  ! -- terminate if data errors
1845  if (count_errors() > 0) then
1846  call store_error_filename(this%input_fname)
1847  end if
real(dp), parameter dpio180
real constant
Definition: Constants.f90:130
Here is the call graph for this function:

◆ preprocess_input()

subroutine gwfnpfmodule::preprocess_input ( class(gwfnpftype)  this)

This routine consists of the following steps:

  1. convert cells to noflow when all transmissive parameters equal zero
  2. perform initial wetting and drying
  3. initialize cell saturation
  4. calculate saturated conductance (when not xt3d)
  5. If NEWTON under-relaxation, determine lower most node
    Parameters
    thisthe instance of the NPF package

Definition at line 1860 of file gwf-npf.f90.

1861  ! -- modules
1862  use constantsmodule, only: linelength
1864  ! -- dummy
1865  class(GwfNpfType) :: this !< the instance of the NPF package
1866  ! -- local
1867  integer(I4B) :: n, m, ii, nn
1868  real(DP) :: hyn, hym
1869  real(DP) :: satn, topn, botn
1870  integer(I4B) :: nextn
1871  real(DP) :: minbot, botm
1872  logical :: finished
1873  character(len=LINELENGTH) :: cellstr, errmsg
1874  ! -- format
1875  character(len=*), parameter :: fmtcnv = &
1876  "(1X,'CELL ', A, &
1877  &' ELIMINATED BECAUSE ALL HYDRAULIC CONDUCTIVITIES TO NODE ARE 0.')"
1878  character(len=*), parameter :: fmtnct = &
1879  &"(1X,'Negative cell thickness at cell ', A)"
1880  character(len=*), parameter :: fmtihbe = &
1881  &"(1X,'Initial head, bottom elevation:',1P,2G13.5)"
1882  character(len=*), parameter :: fmttebe = &
1883  &"(1X,'Top elevation, bottom elevation:',1P,2G13.5)"
1884  !
1885  do n = 1, this%dis%nodes
1886  this%ithickstartflag(n) = 0
1887  end do
1888  !
1889  ! -- Insure that each cell has at least one non-zero transmissive parameter
1890  ! Note that a cell can be deactivated even if it has a valid connection
1891  ! to another model.
1892  nodeloop: do n = 1, this%dis%nodes
1893  !
1894  ! -- Skip if already inactive
1895  if (this%ibound(n) == 0) then
1896  if (this%irewet /= 0) then
1897  if (this%wetdry(n) == dzero) cycle nodeloop
1898  else
1899  cycle nodeloop
1900  end if
1901  end if
1902  !
1903  ! -- Cycle if k11 is not zero
1904  if (this%k11(n) /= dzero) cycle nodeloop
1905  !
1906  ! -- Cycle if at least one vertical connection has non-zero k33
1907  ! for n and m
1908  do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
1909  m = this%dis%con%ja(ii)
1910  if (this%dis%con%ihc(this%dis%con%jas(ii)) == 0) then
1911  hyn = this%k11(n)
1912  if (this%ik33 /= 0) hyn = this%k33(n)
1913  if (hyn /= dzero) then
1914  hym = this%k11(m)
1915  if (this%ik33 /= 0) hym = this%k33(m)
1916  if (hym /= dzero) cycle
1917  end if
1918  end if
1919  end do
1920  !
1921  ! -- If this part of the loop is reached, then all connections have
1922  ! zero transmissivity, so convert to noflow.
1923  this%ibound(n) = 0
1924  this%hnew(n) = this%hnoflo
1925  if (this%irewet /= 0) this%wetdry(n) = dzero
1926  call this%dis%noder_to_string(n, cellstr)
1927  write (this%iout, fmtcnv) trim(adjustl(cellstr))
1928  !
1929  end do nodeloop
1930  !
1931  ! -- Preprocess cell status and heads based on initial conditions
1932  if (this%inewton == 0) then
1933  !
1934  ! -- For standard formulation (non-Newton) call wetdry routine
1935  call this%wd(0, this%hnew)
1936  else
1937  !
1938  ! -- Newton formulation, so adjust heads to be above bottom
1939  ! (Not used in present formulation because variable cv
1940  ! cannot be used with Newton)
1941  if (this%ivarcv == 1) then
1942  do n = 1, this%dis%nodes
1943  if (this%hnew(n) < this%dis%bot(n)) then
1944  this%hnew(n) = this%dis%bot(n) + dem6
1945  end if
1946  end do
1947  end if
1948  end if
1949  !
1950  ! -- If THCKSTRT is not active, then loop through icelltype and replace
1951  ! any negative values with 1.
1952  if (this%ithickstrt == 0) then
1953  do n = 1, this%dis%nodes
1954  if (this%icelltype(n) < 0) then
1955  this%icelltype(n) = 1
1956  end if
1957  end do
1958  end if
1959  !
1960  ! -- Initialize sat to zero for ibound=0 cells, unless the cell can
1961  ! rewet. Initialize sat to the saturated fraction based on strt
1962  ! if icelltype is negative and the THCKSTRT option is in effect.
1963  ! Initialize sat to 1.0 for all other cells in order to calculate
1964  ! condsat in next section.
1965  do n = 1, this%dis%nodes
1966  if (this%ibound(n) == 0) then
1967  this%sat(n) = done
1968  if (this%icelltype(n) < 0 .and. this%ithickstrt /= 0) then
1969  this%ithickstartflag(n) = 1
1970  this%icelltype(n) = 0
1971  end if
1972  else
1973  topn = this%dis%top(n)
1974  botn = this%dis%bot(n)
1975  if (this%icelltype(n) < 0 .and. this%ithickstrt /= 0) then
1976  call this%thksat(n, this%ic%strt(n), satn)
1977  if (botn > this%ic%strt(n)) then
1978  call this%dis%noder_to_string(n, cellstr)
1979  write (errmsg, fmtnct) trim(adjustl(cellstr))
1980  call store_error(errmsg)
1981  write (errmsg, fmtihbe) this%ic%strt(n), botn
1982  call store_error(errmsg)
1983  end if
1984  this%ithickstartflag(n) = 1
1985  this%icelltype(n) = 0
1986  else
1987  satn = done
1988  if (botn > topn) then
1989  call this%dis%noder_to_string(n, cellstr)
1990  write (errmsg, fmtnct) trim(adjustl(cellstr))
1991  call store_error(errmsg)
1992  write (errmsg, fmttebe) topn, botn
1993  call store_error(errmsg)
1994  end if
1995  end if
1996  this%sat(n) = satn
1997  end if
1998  end do
1999  if (count_errors() > 0) then
2000  call store_error_filename(this%input_fname)
2001  end if
2002  !
2003  ! -- Calculate condsat, but only if xt3d is not active. If xt3d is
2004  ! active, then condsat is allocated to size of zero.
2005  if (this%ixt3d == 0) then
2006  !
2007  ! -- Calculate the saturated conductance for all connections assuming
2008  ! that saturation is 1 (except for case where icelltype was entered
2009  ! as a negative value and THCKSTRT option in effect)
2010  do n = 1, this%dis%nodes
2011  call this%calc_condsat(n, .true.)
2012  end do
2013  !
2014  end if
2015  !
2016  ! -- Determine the lower most node
2017  if (this%igwfnewtonur /= 0) then
2018  call mem_reallocate(this%ibotnode, this%dis%nodes, 'IBOTNODE', &
2019  trim(this%memoryPath))
2020  do n = 1, this%dis%nodes
2021  !
2022  minbot = this%dis%bot(n)
2023  nn = n
2024  finished = .false.
2025  do while (.not. finished)
2026  nextn = 0
2027  !
2028  ! -- Go through the connecting cells
2029  do ii = this%dis%con%ia(nn) + 1, this%dis%con%ia(nn + 1) - 1
2030  !
2031  ! -- Set the m cell number
2032  m = this%dis%con%ja(ii)
2033  botm = this%dis%bot(m)
2034  !
2035  ! -- select vertical connections: ihc == 0
2036  if (this%dis%con%ihc(this%dis%con%jas(ii)) == 0) then
2037  if (m > nn .and. botm < minbot) then
2038  nextn = m
2039  minbot = botm
2040  end if
2041  end if
2042  end do
2043  if (nextn > 0) then
2044  nn = nextn
2045  else
2046  finished = .true.
2047  end if
2048  end do
2049  this%ibotnode(n) = nn
2050  end do
2051  end if
2052  !
2053  ! -- nullify unneeded gwf pointers
2054  this%igwfnewtonur => null()
Here is the call graph for this function:

◆ rewet_check()

subroutine gwfnpfmodule::rewet_check ( class(gwfnpftype)  this,
integer(i4b), intent(in)  kiter,
integer(i4b), intent(in)  node,
real(dp), intent(in)  hm,
integer(i4b), intent(in)  ibdm,
integer(i4b), intent(in)  ihc,
real(dp), dimension(:), intent(inout)  hnew,
integer(i4b), intent(out)  irewet 
)

This method can be called from any external object that has a head that can be used to rewet the GWF cell node. The ihc value is used to determine if it is a vertical or horizontal connection, which can operate differently depending on user settings.

Definition at line 2279 of file gwf-npf.f90.

2280  ! -- dummy
2281  class(GwfNpfType) :: this
2282  integer(I4B), intent(in) :: kiter
2283  integer(I4B), intent(in) :: node
2284  real(DP), intent(in) :: hm
2285  integer(I4B), intent(in) :: ibdm
2286  integer(I4B), intent(in) :: ihc
2287  real(DP), intent(inout), dimension(:) :: hnew
2288  integer(I4B), intent(out) :: irewet
2289  ! -- local
2290  integer(I4B) :: itflg
2291  real(DP) :: wd, awd, turnon, bbot
2292  !
2293  irewet = 0
2294  !
2295  ! -- Convert a dry cell to wet if it meets the criteria
2296  if (this%irewet > 0) then
2297  itflg = mod(kiter, this%iwetit)
2298  if (itflg == 0) then
2299  if (this%ibound(node) == 0 .and. this%wetdry(node) /= dzero) then
2300  !
2301  ! -- Calculate wetting elevation
2302  bbot = this%dis%bot(node)
2303  wd = this%wetdry(node)
2304  awd = wd
2305  if (wd < 0) awd = -wd
2306  turnon = bbot + awd
2307  !
2308  ! -- Check head in adjacent cells to see if wetting elevation has
2309  ! been reached
2310  if (ihc == c3d_vertical) then
2311  !
2312  ! -- check cell below
2313  if (ibdm > 0 .and. hm >= turnon) irewet = 1
2314  else
2315  if (wd > dzero) then
2316  !
2317  ! -- check horizontally adjacent cells
2318  if (ibdm > 0 .and. hm >= turnon) irewet = 1
2319  end if
2320  end if
2321  !
2322  if (irewet == 1) then
2323  ! -- rewet cell; use equation 3a if ihdwet=0; use equation 3b if
2324  ! ihdwet is not 0.
2325  if (this%ihdwet == 0) then
2326  hnew(node) = bbot + this%wetfct * (hm - bbot)
2327  else
2328  hnew(node) = bbot + this%wetfct * awd !(hm - bbot)
2329  end if
2330  this%ibound(node) = 30000
2331  end if
2332  end if
2333  end if
2334  end if

◆ sav_sat()

subroutine gwfnpfmodule::sav_sat ( class(gwfnpftype)  this,
integer(i4b), intent(in)  ibinun 
)
private

Definition at line 2750 of file gwf-npf.f90.

2751  ! -- dummy
2752  class(GwfNpfType) :: this
2753  integer(I4B), intent(in) :: ibinun
2754  ! -- local
2755  character(len=16) :: text
2756  character(len=16), dimension(1) :: auxtxt
2757  real(DP), dimension(1) :: a
2758  integer(I4B) :: n
2759  integer(I4B) :: naux
2760  !
2761  ! -- Write the header
2762  text = ' DATA-SAT'
2763  naux = 1
2764  auxtxt(:) = [' sat']
2765  call this%dis%record_srcdst_list_header(text, this%name_model, &
2766  this%packName, this%name_model, &
2767  this%packName, naux, auxtxt, ibinun, &
2768  this%dis%nodes, this%iout)
2769  !
2770  ! -- Write a zero for Q, and then write saturation as an aux variables
2771  do n = 1, this%dis%nodes
2772  a(1) = this%sat(n)
2773  call this%dis%record_mf6_list_entry(ibinun, n, n, dzero, naux, a)
2774  end do

◆ sav_spdis()

subroutine gwfnpfmodule::sav_spdis ( class(gwfnpftype)  this,
integer(i4b), intent(in)  ibinun 
)

Definition at line 2722 of file gwf-npf.f90.

2723  ! -- dummy
2724  class(GwfNpfType) :: this
2725  integer(I4B), intent(in) :: ibinun
2726  ! -- local
2727  character(len=16) :: text
2728  character(len=16), dimension(3) :: auxtxt
2729  integer(I4B) :: n
2730  integer(I4B) :: naux
2731  !
2732  ! -- Write the header
2733  text = ' DATA-SPDIS'
2734  naux = 3
2735  auxtxt(:) = [' qx', ' qy', ' qz']
2736  call this%dis%record_srcdst_list_header(text, this%name_model, &
2737  this%packName, this%name_model, &
2738  this%packName, naux, auxtxt, ibinun, &
2739  this%dis%nodes, this%iout)
2740  !
2741  ! -- Write a zero for Q, and then write qx, qy, qz as aux variables
2742  do n = 1, this%dis%nodes
2743  call this%dis%record_mf6_list_entry(ibinun, n, n, dzero, naux, &
2744  this%spdis(:, n))
2745  end do

◆ set_edge_properties()

subroutine gwfnpfmodule::set_edge_properties ( class(gwfnpftype)  this,
integer(i4b), intent(in)  nodedge,
integer(i4b), intent(in)  ihcedge,
real(dp), intent(in)  q,
real(dp), intent(in)  area,
real(dp), intent(in)  nx,
real(dp), intent(in)  ny,
real(dp), intent(in)  distance 
)
private

Definition at line 2819 of file gwf-npf.f90.

2821  ! -- dummy
2822  class(GwfNpfType) :: this
2823  integer(I4B), intent(in) :: nodedge
2824  integer(I4B), intent(in) :: ihcedge
2825  real(DP), intent(in) :: q
2826  real(DP), intent(in) :: area
2827  real(DP), intent(in) :: nx
2828  real(DP), intent(in) :: ny
2829  real(DP), intent(in) :: distance
2830  ! -- local
2831  integer(I4B) :: lastedge
2832  !
2833  this%lastedge = this%lastedge + 1
2834  lastedge = this%lastedge
2835  this%nodedge(lastedge) = nodedge
2836  this%ihcedge(lastedge) = ihcedge
2837  this%propsedge(1, lastedge) = q
2838  this%propsedge(2, lastedge) = area
2839  this%propsedge(3, lastedge) = nx
2840  this%propsedge(4, lastedge) = ny
2841  this%propsedge(5, lastedge) = distance
2842  !
2843  ! -- If this is the last edge, then the next call must be starting a new
2844  ! edge properties assignment loop, so need to reset lastedge to 0
2845  if (this%lastedge == this%nedges) this%lastedge = 0

◆ set_options()

subroutine gwfnpfmodule::set_options ( class(gwfnpftype)  this,
type(gwfnpfoptionstype), intent(in)  options 
)

Definition at line 1465 of file gwf-npf.f90.

1466  ! -- dummy
1467  class(GwfNpftype) :: this
1468  type(GwfNpfOptionsType), intent(in) :: options
1469  !
1470  this%ithickstrt = options%ithickstrt
1471  this%ihighcellsat = options%ihighcellsat
1472  this%iperched = options%iperched
1473  this%ivarcv = options%ivarcv
1474  this%idewatcv = options%idewatcv
1475  this%irewet = options%irewet
1476  this%wetfct = options%wetfct
1477  this%iwetit = options%iwetit
1478  this%ihdwet = options%ihdwet

◆ sgwf_npf_qcalc()

subroutine gwfnpfmodule::sgwf_npf_qcalc ( class(gwfnpftype)  this,
integer(i4b), intent(in)  n,
integer(i4b), intent(in)  m,
real(dp), intent(in)  hn,
real(dp), intent(in)  hm,
integer(i4b), intent(in)  icon,
real(dp), intent(inout)  qnm 
)
private

Definition at line 864 of file gwf-npf.f90.

865  ! -- dummy
866  class(GwfNpfType) :: this
867  integer(I4B), intent(in) :: n
868  integer(I4B), intent(in) :: m
869  real(DP), intent(in) :: hn
870  real(DP), intent(in) :: hm
871  integer(I4B), intent(in) :: icon
872  real(DP), intent(inout) :: qnm
873  ! -- local
874  real(DP) :: hyn, hym
875  real(DP) :: condnm
876  real(DP) :: hntemp, hmtemp
877  real(DP) :: satn, satm
878  integer(I4B) :: ihc
879  !
880  ! -- Initialize
881  ihc = this%dis%con%ihc(this%dis%con%jas(icon))
882  hyn = this%hy_eff(n, m, ihc, ipos=icon)
883  hym = this%hy_eff(m, n, ihc, ipos=icon)
884  !
885  ! -- Calculate conductance
886  if (ihc == c3d_vertical) then
887  condnm = vcond(this%ibound(n), this%ibound(m), &
888  this%icelltype(n), this%icelltype(m), this%inewton, &
889  this%ivarcv, this%idewatcv, &
890  this%condsat(this%dis%con%jas(icon)), hn, hm, &
891  hyn, hym, &
892  this%sat(n), this%sat(m), &
893  this%dis%top(n), this%dis%top(m), &
894  this%dis%bot(n), this%dis%bot(m), &
895  this%dis%con%hwva(this%dis%con%jas(icon)))
896  else
897  satn = this%sat(n)
898  satm = this%sat(m)
899  if (this%ihighcellsat /= 0) then
900  call this%highest_cell_saturation(n, m, hn, hm, satn, satm)
901  end if
902 
903  condnm = hcond(this%ibound(n), this%ibound(m), &
904  this%icelltype(n), this%icelltype(m), &
905  this%inewton, &
906  this%dis%con%ihc(this%dis%con%jas(icon)), &
907  this%icellavg, &
908  this%condsat(this%dis%con%jas(icon)), &
909  hn, hm, satn, satm, hyn, hym, &
910  this%dis%top(n), this%dis%top(m), &
911  this%dis%bot(n), this%dis%bot(m), &
912  this%dis%con%cl1(this%dis%con%jas(icon)), &
913  this%dis%con%cl2(this%dis%con%jas(icon)), &
914  this%dis%con%hwva(this%dis%con%jas(icon)))
915  end if
916  !
917  ! -- Initialize hntemp and hmtemp
918  hntemp = hn
919  hmtemp = hm
920  !
921  ! -- Check and adjust for dewatered conditions
922  if (this%iperched /= 0) then
923  if (this%dis%con%ihc(this%dis%con%jas(icon)) == 0) then
924  if (n > m) then
925  if (this%icelltype(n) /= 0) then
926  if (hn < this%dis%top(n)) hntemp = this%dis%bot(m)
927  end if
928  else
929  if (this%icelltype(m) /= 0) then
930  if (hm < this%dis%top(m)) hmtemp = this%dis%bot(n)
931  end if
932  end if
933  end if
934  end if
935  !
936  ! -- Calculate flow positive into cell n
937  qnm = condnm * (hmtemp - hntemp)
Here is the call graph for this function:

◆ sgwf_npf_thksat()

subroutine gwfnpfmodule::sgwf_npf_thksat ( class(gwfnpftype)  this,
integer(i4b), intent(in)  n,
real(dp), intent(in)  hn,
real(dp), intent(inout)  thksat 
)
private

Definition at line 841 of file gwf-npf.f90.

842  ! -- dummy
843  class(GwfNpfType) :: this
844  integer(I4B), intent(in) :: n
845  real(DP), intent(in) :: hn
846  real(DP), intent(inout) :: thksat
847  !
848  ! -- Standard Formulation
849  if (hn >= this%dis%top(n)) then
850  thksat = done
851  else
852  thksat = (hn - this%dis%bot(n)) / (this%dis%top(n) - this%dis%bot(n))
853  end if
854  !
855  ! -- Newton-Raphson Formulation
856  if (this%inewton /= 0) then
857  thksat = squadraticsaturation(this%dis%top(n), this%dis%bot(n), hn, &
858  this%satomega)
859  end if
Here is the call graph for this function:

◆ sgwf_npf_wdmsg()

subroutine gwfnpfmodule::sgwf_npf_wdmsg ( class(gwfnpftype)  this,
integer(i4b), intent(in)  icode,
integer(i4b), intent(inout)  ncnvrt,
character(len=30), dimension(5), intent(inout)  nodcnvrt,
character(len=3), dimension(5), intent(inout)  acnvrt,
integer(i4b), intent(inout)  ihdcnv,
integer(i4b), intent(in)  kiter,
integer(i4b), intent(in)  n 
)
private

Definition at line 2339 of file gwf-npf.f90.

2341  ! -- modules
2342  use tdismodule, only: kstp, kper
2343  ! -- dummy
2344  class(GwfNpfType) :: this
2345  integer(I4B), intent(in) :: icode
2346  integer(I4B), intent(inout) :: ncnvrt
2347  character(len=30), dimension(5), intent(inout) :: nodcnvrt
2348  character(len=3), dimension(5), intent(inout) :: acnvrt
2349  integer(I4B), intent(inout) :: ihdcnv
2350  integer(I4B), intent(in) :: kiter
2351  integer(I4B), intent(in) :: n
2352  ! -- local
2353  integer(I4B) :: l
2354  ! -- formats
2355  character(len=*), parameter :: fmtcnvtn = &
2356  "(1X,/1X,'CELL CONVERSIONS FOR ITER.=',I0, &
2357  &' STEP=',I0,' PERIOD=',I0,' (NODE or LRC)')"
2358  character(len=*), parameter :: fmtnode = "(1X,3X,5(A4, A20))"
2359  !
2360  ! -- Keep track of cell conversions
2361  if (icode > 0) then
2362  ncnvrt = ncnvrt + 1
2363  call this%dis%noder_to_string(n, nodcnvrt(ncnvrt))
2364  if (icode == 1) then
2365  acnvrt(ncnvrt) = 'DRY'
2366  else
2367  acnvrt(ncnvrt) = 'WET'
2368  end if
2369  end if
2370  !
2371  ! -- Print a line if 5 conversions have occurred or if icode indicates that a
2372  ! partial line should be printed
2373  if (ncnvrt == 5 .or. (icode == 0 .and. ncnvrt > 0)) then
2374  if (ihdcnv == 0) write (this%iout, fmtcnvtn) kiter, kstp, kper
2375  ihdcnv = 1
2376  write (this%iout, fmtnode) &
2377  (acnvrt(l), trim(adjustl(nodcnvrt(l))), l=1, ncnvrt)
2378  ncnvrt = 0
2379  end if

◆ sgwf_npf_wetdry()

subroutine gwfnpfmodule::sgwf_npf_wetdry ( class(gwfnpftype)  this,
integer(i4b), intent(in)  kiter,
real(dp), dimension(:), intent(inout)  hnew 
)
private

Definition at line 2173 of file gwf-npf.f90.

2174  ! -- modules
2175  use tdismodule, only: kstp, kper
2177  use constantsmodule, only: linelength
2178  ! -- dummy
2179  class(GwfNpfType) :: this
2180  integer(I4B), intent(in) :: kiter
2181  real(DP), intent(inout), dimension(:) :: hnew
2182  ! -- local
2183  integer(I4B) :: n, m, ii, ihc
2184  real(DP) :: ttop, bbot, thick
2185  integer(I4B) :: ncnvrt, ihdcnv
2186  character(len=30), dimension(5) :: nodcnvrt
2187  character(len=30) :: nodestr
2188  character(len=3), dimension(5) :: acnvrt
2189  character(len=LINELENGTH) :: errmsg
2190  integer(I4B) :: irewet
2191  ! -- formats
2192  character(len=*), parameter :: fmtnct = &
2193  "(1X,/1X,'Negative cell thickness at (layer,row,col)', &
2194  &I4,',',I5,',',I5)"
2195  character(len=*), parameter :: fmttopbot = &
2196  &"(1X,'Top elevation, bottom elevation:',1P,2G13.5)"
2197  character(len=*), parameter :: fmttopbotthk = &
2198  &"(1X,'Top elevation, bottom elevation, thickness:',1P,3G13.5)"
2199  character(len=*), parameter :: fmtdrychd = &
2200  &"(1X,/1X,'CONSTANT-HEAD CELL WENT DRY -- SIMULATION ABORTED')"
2201  character(len=*), parameter :: fmtni = &
2202  &"(1X,'CELLID=',a,' ITERATION=',I0,' TIME STEP=',I0,' STRESS PERIOD=',I0)"
2203  !
2204  ! -- Initialize
2205  ncnvrt = 0
2206  ihdcnv = 0
2207  !
2208  ! -- Convert dry cells to wet
2209  do n = 1, this%dis%nodes
2210  do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
2211  m = this%dis%con%ja(ii)
2212  ihc = this%dis%con%ihc(this%dis%con%jas(ii))
2213  call this%rewet_check(kiter, n, hnew(m), this%ibound(m), ihc, hnew, &
2214  irewet)
2215  if (irewet == 1) then
2216  call this%wdmsg(2, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2217  end if
2218  end do
2219  end do
2220  !
2221  ! -- Perform drying
2222  do n = 1, this%dis%nodes
2223  !
2224  ! -- cycle if inactive or confined
2225  if (this%ibound(n) == 0) cycle
2226  if (this%icelltype(n) == 0) cycle
2227  !
2228  ! -- check for negative cell thickness
2229  bbot = this%dis%bot(n)
2230  ttop = this%dis%top(n)
2231  if (bbot > ttop) then
2232  write (errmsg, fmtnct) n
2233  call store_error(errmsg)
2234  write (errmsg, fmttopbot) ttop, bbot
2235  call store_error(errmsg)
2236  call store_error_filename(this%input_fname)
2237  end if
2238  !
2239  ! -- Calculate saturated thickness
2240  if (this%icelltype(n) /= 0) then
2241  if (hnew(n) < ttop) ttop = hnew(n)
2242  end if
2243  thick = ttop - bbot
2244  !
2245  ! -- If thick<0 print message, set hnew, and ibound
2246  if (thick <= dzero) then
2247  call this%wdmsg(1, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2248  hnew(n) = this%hdry
2249  if (this%ibound(n) < 0) then
2250  errmsg = 'CONSTANT-HEAD CELL WENT DRY -- SIMULATION ABORTED'
2251  call store_error(errmsg)
2252  write (errmsg, fmttopbotthk) ttop, bbot, thick
2253  call store_error(errmsg)
2254  call this%dis%noder_to_string(n, nodestr)
2255  write (errmsg, fmtni) trim(adjustl(nodestr)), kiter, kstp, kper
2256  call store_error(errmsg)
2257  call store_error_filename(this%input_fname)
2258  end if
2259  this%ibound(n) = 0
2260  end if
2261  end do
2262  !
2263  ! -- Print remaining cell conversions
2264  call this%wdmsg(0, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2265  !
2266  ! -- Change ibound from 30000 to 1
2267  do n = 1, this%dis%nodes
2268  if (this%ibound(n) == 30000) this%ibound(n) = 1
2269  end do
Here is the call graph for this function:

◆ source_griddata()

subroutine gwfnpfmodule::source_griddata ( class(gwfnpftype)  this)

Definition at line 1604 of file gwf-npf.f90.

1605  ! -- modules
1606  use simmodule, only: count_errors, store_error
1610  ! -- dummy
1611  class(GwfNpftype) :: this
1612  ! -- locals
1613  character(len=LINELENGTH) :: errmsg
1614  type(GwfNpfParamFoundType) :: found
1615  logical, dimension(2) :: afound
1616  integer(I4B), dimension(:), pointer, contiguous :: map
1617  !
1618  ! -- set map to convert user input data into reduced data
1619  map => null()
1620  if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
1621  !
1622  ! -- update defaults with idm sourced values
1623  call mem_set_value(this%icelltype, 'ICELLTYPE', this%input_mempath, map, &
1624  found%icelltype)
1625  call mem_set_value(this%k11, 'K', this%input_mempath, map, found%k, &
1626  release=.false.)
1627  call mem_set_value(this%k33, 'K33', this%input_mempath, map, found%k33)
1628  call mem_set_value(this%k22, 'K22', this%input_mempath, map, found%k22)
1629  call mem_set_value(this%wetdry, 'WETDRY', this%input_mempath, map, &
1630  found%wetdry)
1631  call mem_set_value(this%angle1, 'ANGLE1', this%input_mempath, map, &
1632  found%angle1)
1633  call mem_set_value(this%angle2, 'ANGLE2', this%input_mempath, map, &
1634  found%angle2)
1635  call mem_set_value(this%angle3, 'ANGLE3', this%input_mempath, map, &
1636  found%angle3)
1637  !
1638  ! -- ensure ICELLTYPE was found
1639  if (.not. found%icelltype) then
1640  write (errmsg, '(a)') 'Error in GRIDDATA block: ICELLTYPE not found.'
1641  call store_error(errmsg)
1642  end if
1643  !
1644  ! -- ensure K was found
1645  if (.not. found%k) then
1646  write (errmsg, '(a)') 'Error in GRIDDATA block: K not found.'
1647  call store_error(errmsg)
1648  end if
1649  !
1650  ! -- set error if ik33overk set with no k33
1651  if (.not. found%k33 .and. this%ik33overk /= 0) then
1652  write (errmsg, '(a)') 'K33OVERK option specified but K33 not specified.'
1653  call store_error(errmsg)
1654  end if
1655  !
1656  ! -- set error if ik22overk set with no k22
1657  if (.not. found%k22 .and. this%ik22overk /= 0) then
1658  write (errmsg, '(a)') 'K22OVERK option specified but K22 not specified.'
1659  call store_error(errmsg)
1660  end if
1661  !
1662  ! -- handle found side effects
1663  if (found%k33) this%ik33 = 1
1664  if (found%k22) this%ik22 = 1
1665  if (found%wetdry) this%iwetdry = 1
1666  if (found%angle1) this%iangle1 = 1
1667  if (found%angle2) this%iangle2 = 1
1668  if (found%angle3) this%iangle3 = 1
1669  !
1670  ! -- handle not found side effects
1671  if (.not. found%k33) then
1672  call mem_set_value(this%k33, 'K', this%input_mempath, map, afound(1), &
1673  release=.false.)
1674  end if
1675  if (.not. found%k22) then
1676  call mem_set_value(this%k22, 'K', this%input_mempath, map, afound(2), &
1677  release=.false.)
1678  end if
1679  if (.not. found%wetdry) call mem_reallocate(this%wetdry, 1, 'WETDRY', &
1680  trim(this%memoryPath))
1681  if (.not. found%angle1 .and. this%ixt3d == 0) &
1682  call mem_reallocate(this%angle1, 0, 'ANGLE1', trim(this%memoryPath))
1683  if (.not. found%angle2 .and. this%ixt3d == 0) &
1684  call mem_reallocate(this%angle2, 0, 'ANGLE2', trim(this%memoryPath))
1685  if (.not. found%angle3 .and. this%ixt3d == 0) &
1686  call mem_reallocate(this%angle3, 0, 'ANGLE3', trim(this%memoryPath))
1687  !
1688  ! -- cleanup
1689  call memorystore_release('K', this%input_mempath)
1690  !
1691  ! -- log griddata
1692  if (this%iout > 0) then
1693  call this%log_griddata(found)
1694  end if
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
Here is the call graph for this function:

◆ source_options()

subroutine gwfnpfmodule::source_options ( class(gwfnpftype)  this)

Definition at line 1374 of file gwf-npf.f90.

1375  ! -- modules
1380  use sourcecommonmodule, only: filein_fname
1382  ! -- dummy
1383  class(GwfNpftype) :: this
1384  ! -- locals
1385  character(len=LENVARNAME), dimension(3) :: cellavg_method = &
1386  &[character(len=LENVARNAME) :: 'LOGARITHMIC', 'AMT-LMK', 'AMT-HMK']
1387  type(gwfnpfparamfoundtype) :: found
1388  type(CharacterStringType), dimension(:), pointer, contiguous :: tvk6_mempaths
1389  character(len=LINELENGTH) :: tvk6_filename
1390  character(len=LENMEMPATH) :: tvk6_mempath
1391  !
1392  ! -- update defaults with idm sourced values
1393  call mem_set_value(this%iprflow, 'IPRFLOW', this%input_mempath, found%iprflow)
1394  call mem_set_value(this%ipakcb, 'IPAKCB', this%input_mempath, found%ipakcb)
1395  call mem_set_value(this%icellavg, 'CELLAVG', this%input_mempath, &
1396  cellavg_method, found%cellavg)
1397  call mem_set_value(this%ithickstrt, 'ITHICKSTRT', this%input_mempath, &
1398  found%ithickstrt)
1399  call mem_set_value(this%ihighcellsat, 'IHIGHCELLSAT', this%input_mempath, &
1400  found%ihighcellsat)
1401  call mem_set_value(this%iperched, 'IPERCHED', this%input_mempath, &
1402  found%iperched)
1403  call mem_set_value(this%ivarcv, 'IVARCV', this%input_mempath, found%ivarcv)
1404  call mem_set_value(this%idewatcv, 'IDEWATCV', this%input_mempath, &
1405  found%idewatcv)
1406  call mem_set_value(this%ixt3d, 'IXT3D', this%input_mempath, found%ixt3d)
1407  call mem_set_value(this%ixt3drhs, 'IXT3DRHS', this%input_mempath, &
1408  found%ixt3drhs)
1409  call mem_set_value(this%isavspdis, 'ISAVSPDIS', this%input_mempath, &
1410  found%isavspdis)
1411  call mem_set_value(this%isavsat, 'ISAVSAT', this%input_mempath, found%isavsat)
1412  call mem_set_value(this%ik22overk, 'IK22OVERK', this%input_mempath, &
1413  found%ik22overk)
1414  call mem_set_value(this%ik33overk, 'IK33OVERK', this%input_mempath, &
1415  found%ik33overk)
1416  call mem_set_value(this%inewton, 'INEWTON', this%input_mempath, found%inewton)
1417  call mem_set_value(this%satomega, 'SATOMEGA', this%input_mempath, &
1418  found%satomega)
1419  call mem_set_value(this%irewet, 'IREWET', this%input_mempath, found%irewet)
1420  call mem_set_value(this%wetfct, 'WETFCT', this%input_mempath, found%wetfct)
1421  call mem_set_value(this%iwetit, 'IWETIT', this%input_mempath, found%iwetit)
1422  call mem_set_value(this%ihdwet, 'IHDWET', this%input_mempath, found%ihdwet)
1423  !
1424  ! -- save flows option active
1425  if (found%ipakcb) this%ipakcb = -1
1426  !
1427  ! -- xt3d active with rhs
1428  if (found%ixt3d .and. found%ixt3drhs) this%ixt3d = 2
1429  !
1430  ! -- save specific discharge active
1431  if (found%isavspdis) this%icalcspdis = this%isavspdis
1432  !
1433  ! -- no newton specified
1434  if (found%inewton) then
1435  this%inewton = 0
1436  this%iasym = 0
1437  end if
1438  !
1439  ! -- TVK6 subpackage
1440  if (filein_fname(tvk6_filename, 'TVK6_FILENAME', &
1441  this%input_mempath, this%input_fname)) then
1442  call mem_setptr(tvk6_mempaths, 'TVK6_MEMPATH', this%input_mempath)
1443  tvk6_mempath = tvk6_mempaths(1)
1444  this%intvk = 1 ! tvk active
1445  call tvk_cr(this%tvk, this%name_model, tvk6_mempath, this%intvk, this%iout)
1446  end if
1447  !
1448  ! -- verify ALTERNATIVE_CELL_AVERAGING input value is supported
1449  if (found%cellavg) then
1450  if (this%icellavg == 0) then
1451  errmsg = 'Unrecognized input value for ALTERNATIVE_CELL_AVERAGING option.'
1452  call store_error(errmsg)
1453  call store_error_filename(this%input_fname)
1454  end if
1455  end if
1456  !
1457  ! -- log options
1458  if (this%iout > 0) then
1459  call this%log_options(found)
1460  end if
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
This module contains the SourceCommonModule.
Definition: SourceCommon.f90:7
logical(lgp) function, public filein_fname(filename, tagname, input_mempath, input_fname)
enforce and set a single input filename provided via FILEIN keyword
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
Here is the call graph for this function:

◆ store_original_k_arrays()

subroutine gwfnpfmodule::store_original_k_arrays ( class(gwfnpftype)  this,
integer(i4b), intent(in)  ncells,
integer(i4b), intent(in)  njas 
)

The K arrays (K11, etc.) get multiplied by the viscosity ratio so that subsequent uses of K already take into account the effect of viscosity. Thus the original user-specified K array values are lost unless they are backed up in k11input, for example. In a new stress period/time step, the values in k11input are multiplied by the viscosity ratio, not k11 since it contains viscosity-adjusted hydraulic conductivity values.

Definition at line 1219 of file gwf-npf.f90.

1220  ! -- modules
1222  ! -- dummy
1223  class(GwfNpftype) :: this
1224  integer(I4B), intent(in) :: ncells
1225  integer(I4B), intent(in) :: njas
1226  ! -- local
1227  integer(I4B) :: n
1228  !
1229  ! -- Retain copy of user-specified K arrays
1230  do n = 1, ncells
1231  this%k11input(n) = this%k11(n)
1232  this%k22input(n) = this%k22(n)
1233  this%k33input(n) = this%k33(n)
1234  end do