MODFLOW 6  version 6.7.0.dev3
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 1216 of file gwf-npf.f90.

1217  ! -- dummy
1218  class(GwfNpftype) :: this
1219  integer(I4B), intent(in) :: ncells
1220  integer(I4B), intent(in) :: njas
1221  ! -- local
1222  integer(I4B) :: n
1223  !
1224  call mem_allocate(this%ithickstartflag, ncells, 'ITHICKSTARTFLAG', &
1225  this%memoryPath)
1226  call mem_allocate(this%icelltype, ncells, 'ICELLTYPE', this%memoryPath)
1227  call mem_allocate(this%k11, ncells, 'K11', this%memoryPath)
1228  call mem_allocate(this%sat, ncells, 'SAT', this%memoryPath)
1229  call mem_allocate(this%condsat, njas, 'CONDSAT', this%memoryPath)
1230  !
1231  ! -- Optional arrays dimensioned to full size initially
1232  call mem_allocate(this%k22, ncells, 'K22', this%memoryPath)
1233  call mem_allocate(this%k33, ncells, 'K33', this%memoryPath)
1234  call mem_allocate(this%wetdry, ncells, 'WETDRY', this%memoryPath)
1235  call mem_allocate(this%angle1, ncells, 'ANGLE1', this%memoryPath)
1236  call mem_allocate(this%angle2, ncells, 'ANGLE2', this%memoryPath)
1237  call mem_allocate(this%angle3, ncells, 'ANGLE3', this%memoryPath)
1238  !
1239  ! -- Optional arrays
1240  call mem_allocate(this%ibotnode, 0, 'IBOTNODE', this%memoryPath)
1241  call mem_allocate(this%nodedge, 0, 'NODEDGE', this%memoryPath)
1242  call mem_allocate(this%ihcedge, 0, 'IHCEDGE', this%memoryPath)
1243  call mem_allocate(this%propsedge, 0, 0, 'PROPSEDGE', this%memoryPath)
1244  call mem_allocate(this%iedge_ptr, 0, 'NREDGESNODE', this%memoryPath)
1245  call mem_allocate(this%edge_idxs, 0, 'EDGEIDXS', this%memoryPath)
1246  !
1247  ! -- Optional arrays only needed when vsc package is active
1248  call mem_allocate(this%k11input, 0, 'K11INPUT', this%memoryPath)
1249  call mem_allocate(this%k22input, 0, 'K22INPUT', this%memoryPath)
1250  call mem_allocate(this%k33input, 0, 'K33INPUT', this%memoryPath)
1251  !
1252  ! -- Specific discharge is (re-)allocated when nedges is known
1253  call mem_allocate(this%spdis, 3, 0, 'SPDIS', this%memoryPath)
1254  !
1255  ! -- Time-varying property flag arrays
1256  call mem_allocate(this%nodekchange, ncells, 'NODEKCHANGE', this%memoryPath)
1257  !
1258  ! -- initialize iangle1, iangle2, iangle3, and wetdry
1259  do n = 1, ncells
1260  this%angle1(n) = dzero
1261  this%angle2(n) = dzero
1262  this%angle3(n) = dzero
1263  this%wetdry(n) = dzero
1264  this%nodekchange(n) = dzero
1265  end do
1266  !
1267  ! -- allocate variable names
1268  allocate (this%aname(this%iname))
1269  this%aname = [' ICELLTYPE', ' K', &
1270  ' K33', ' K22', &
1271  ' WETDRY', ' ANGLE1', &
1272  ' 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 1097 of file gwf-npf.f90.

1098  ! -- modules
1100  ! -- dummy
1101  class(GwfNpftype) :: this
1102  !
1103  ! -- allocate scalars in NumericalPackageType
1104  call this%NumericalPackageType%allocate_scalars()
1105  !
1106  ! -- Allocate scalars
1107  call mem_allocate(this%iname, 'INAME', this%memoryPath)
1108  call mem_allocate(this%ixt3d, 'IXT3D', this%memoryPath)
1109  call mem_allocate(this%ixt3drhs, 'IXT3DRHS', this%memoryPath)
1110  call mem_allocate(this%satomega, 'SATOMEGA', this%memoryPath)
1111  call mem_allocate(this%hnoflo, 'HNOFLO', this%memoryPath)
1112  call mem_allocate(this%hdry, 'HDRY', this%memoryPath)
1113  call mem_allocate(this%icellavg, 'ICELLAVG', this%memoryPath)
1114  call mem_allocate(this%iavgkeff, 'IAVGKEFF', this%memoryPath)
1115  call mem_allocate(this%ik22, 'IK22', this%memoryPath)
1116  call mem_allocate(this%ik33, 'IK33', this%memoryPath)
1117  call mem_allocate(this%ik22overk, 'IK22OVERK', this%memoryPath)
1118  call mem_allocate(this%ik33overk, 'IK33OVERK', this%memoryPath)
1119  call mem_allocate(this%iperched, 'IPERCHED', this%memoryPath)
1120  call mem_allocate(this%ivarcv, 'IVARCV', this%memoryPath)
1121  call mem_allocate(this%idewatcv, 'IDEWATCV', this%memoryPath)
1122  call mem_allocate(this%ithickstrt, 'ITHICKSTRT', this%memoryPath)
1123  call mem_allocate(this%ihighcellsat, 'IHIGHCELLSAT', this%memoryPath)
1124  call mem_allocate(this%icalcspdis, 'ICALCSPDIS', this%memoryPath)
1125  call mem_allocate(this%isavspdis, 'ISAVSPDIS', this%memoryPath)
1126  call mem_allocate(this%isavsat, 'ISAVSAT', this%memoryPath)
1127  call mem_allocate(this%irewet, 'IREWET', this%memoryPath)
1128  call mem_allocate(this%wetfct, 'WETFCT', this%memoryPath)
1129  call mem_allocate(this%iwetit, 'IWETIT', this%memoryPath)
1130  call mem_allocate(this%ihdwet, 'IHDWET', this%memoryPath)
1131  call mem_allocate(this%iangle1, 'IANGLE1', this%memoryPath)
1132  call mem_allocate(this%iangle2, 'IANGLE2', this%memoryPath)
1133  call mem_allocate(this%iangle3, 'IANGLE3', this%memoryPath)
1134  call mem_allocate(this%iwetdry, 'IWETDRY', this%memoryPath)
1135  call mem_allocate(this%nedges, 'NEDGES', this%memoryPath)
1136  call mem_allocate(this%lastedge, 'LASTEDGE', this%memoryPath)
1137  call mem_allocate(this%intvk, 'INTVK', this%memoryPath)
1138  call mem_allocate(this%invsc, 'INVSC', this%memoryPath)
1139  call mem_allocate(this%kchangeper, 'KCHANGEPER', this%memoryPath)
1140  call mem_allocate(this%kchangestp, 'KCHANGESTP', this%memoryPath)
1141  !
1142  ! -- set pointer to inewtonur
1143  call mem_setptr(this%igwfnewtonur, 'INEWTONUR', &
1144  create_mem_path(this%name_model))
1145  !
1146  ! -- Initialize value
1147  this%iname = 8
1148  this%ixt3d = 0
1149  this%ixt3drhs = 0
1150  this%satomega = dzero
1151  this%hnoflo = dhnoflo !1.d30
1152  this%hdry = dhdry !-1.d30
1153  this%icellavg = ccond_hmean
1154  this%iavgkeff = 0
1155  this%ik22 = 0
1156  this%ik33 = 0
1157  this%ik22overk = 0
1158  this%ik33overk = 0
1159  this%iperched = 0
1160  this%ivarcv = 0
1161  this%idewatcv = 0
1162  this%ithickstrt = 0
1163  this%ihighcellsat = 0
1164  this%icalcspdis = 0
1165  this%isavspdis = 0
1166  this%isavsat = 0
1167  this%irewet = 0
1168  this%wetfct = done
1169  this%iwetit = 1
1170  this%ihdwet = 0
1171  this%iangle1 = 0
1172  this%iangle2 = 0
1173  this%iangle3 = 0
1174  this%iwetdry = 0
1175  this%nedges = 0
1176  this%lastedge = 0
1177  this%intvk = 0
1178  this%invsc = 0
1179  this%kchangeper = 0
1180  this%kchangestp = 0
1181  !
1182  ! -- If newton is on, then NPF creates asymmetric matrix
1183  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 2021 of file gwf-npf.f90.

2022  ! -- dummy variables
2023  class(GwfNpfType) :: this
2024  integer(I4B), intent(in) :: node
2025  logical, intent(in) :: upperOnly
2026  ! -- local variables
2027  integer(I4B) :: ii, m, n, ihc, jj
2028  real(DP) :: topm, topn, topnode, botm, botn, botnode, satm, satn, satnode
2029  real(DP) :: hyn, hym, hn, hm, fawidth, csat
2030  !
2031  satnode = this%calc_initial_sat(node)
2032  !
2033  topnode = this%dis%top(node)
2034  botnode = this%dis%bot(node)
2035  !
2036  ! -- Go through the connecting cells
2037  do ii = this%dis%con%ia(node) + 1, this%dis%con%ia(node + 1) - 1
2038  !
2039  ! -- Set the m cell number and cycle if lower triangle connection and
2040  ! -- we're not updating both upper and lower matrix parts for this node
2041  m = this%dis%con%ja(ii)
2042  jj = this%dis%con%jas(ii)
2043  if (m < node) then
2044  if (upperonly) cycle
2045  ! m => node, n => neighbour
2046  n = m
2047  m = node
2048  topm = topnode
2049  botm = botnode
2050  satm = satnode
2051  topn = this%dis%top(n)
2052  botn = this%dis%bot(n)
2053  satn = this%calc_initial_sat(n)
2054  else
2055  ! n => node, m => neighbour
2056  n = node
2057  topn = topnode
2058  botn = botnode
2059  satn = satnode
2060  topm = this%dis%top(m)
2061  botm = this%dis%bot(m)
2062  satm = this%calc_initial_sat(m)
2063  end if
2064  !
2065  ihc = this%dis%con%ihc(jj)
2066  hyn = this%hy_eff(n, m, ihc, ipos=ii)
2067  hym = this%hy_eff(m, n, ihc, ipos=ii)
2068  if (this%ithickstartflag(n) == 0) then
2069  hn = topn
2070  else
2071  hn = this%ic%strt(n)
2072  end if
2073  if (this%ithickstartflag(m) == 0) then
2074  hm = topm
2075  else
2076  hm = this%ic%strt(m)
2077  end if
2078  !
2079  ! -- Calculate conductance depending on whether connection is
2080  ! vertical (0), horizontal (1), or staggered horizontal (2)
2081  if (ihc == c3d_vertical) then
2082  !
2083  ! -- Vertical conductance for fully saturated conditions
2084  csat = vcond(1, 1, 1, 1, 0, 1, 1, done, &
2085  botn, botm, &
2086  hyn, hym, &
2087  satn, satm, &
2088  topn, topm, &
2089  botn, botm, &
2090  this%dis%con%hwva(jj))
2091  else
2092  !
2093  ! -- Horizontal conductance for fully saturated conditions
2094  fawidth = this%dis%con%hwva(jj)
2095  csat = hcond(1, 1, 1, 1, 0, &
2096  ihc, &
2097  this%icellavg, &
2098  done, &
2099  hn, hm, satn, satm, hyn, hym, &
2100  topn, topm, &
2101  botn, botm, &
2102  this%dis%con%cl1(jj), &
2103  this%dis%con%cl2(jj), &
2104  fawidth)
2105  end if
2106  this%condsat(jj) = csat
2107  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 2117 of file gwf-npf.f90.

2118  ! -- dummy variables
2119  class(GwfNpfType) :: this
2120  integer(I4B), intent(in) :: n
2121  ! -- Return
2122  real(DP) :: satn
2123  !
2124  satn = done
2125  if (this%ibound(n) /= 0 .and. this%ithickstartflag(n) /= 0) then
2126  call this%thksat(n, this%ic%strt(n), satn)
2127  end if

◆ calc_max_conns()

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

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

2752  class(GwfNpfType) :: this
2753  integer(I4B) :: max_conns
2754  ! local
2755  integer(I4B) :: n, m, ic
2756 
2757  max_conns = 0
2758  do n = 1, this%dis%nodes
2759 
2760  ! Count internal model connections
2761  ic = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
2762 
2763  ! Add edge connections
2764  do m = 1, this%nedges
2765  if (this%nodedge(m) == n) then
2766  ic = ic + 1
2767  end if
2768  end do
2769 
2770  ! Set max number of connections for any cell
2771  if (ic > max_conns) max_conns = ic
2772  end do
2773 

◆ calc_spdis()

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

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

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

2853  ! -- dummy
2854  class(GwfNpfType) :: this !< this NPF instance
2855  integer(I4B) :: n !< node n
2856  integer(I4B) :: m !< node m
2857  integer(I4B) :: ihc !< 1 = horizontal connection, 0 for vertical
2858  ! -- return
2859  real(DP) :: satThickness !< saturated thickness
2860  !
2861  satthickness = thksatnm(this%ibound(n), &
2862  this%ibound(m), &
2863  this%icelltype(n), &
2864  this%icelltype(m), &
2865  this%inewton, &
2866  ihc, &
2867  this%hnew(n), &
2868  this%hnew(m), &
2869  this%sat(n), &
2870  this%sat(m), &
2871  this%dis%top(n), &
2872  this%dis%top(m), &
2873  this%dis%bot(n), &
2874  this%dis%bot(m))

◆ check_options()

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

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

1449  ! -- modules
1450  use simmodule, only: store_error, store_warning, &
1452  use constantsmodule, only: linelength
1453  ! -- dummy
1454  class(GwfNpftype) :: this
1455  !
1456  ! -- set omega value used for saturation calculations
1457  if (this%inewton > 0) then
1458  this%satomega = dem6
1459  end if
1460  !
1461  if (this%inewton > 0) then
1462  if (this%iperched > 0) then
1463  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1464  'BE USED WITH PERCHED OPTION.'
1465  call store_error(errmsg)
1466  end if
1467  if (this%ivarcv > 0) then
1468  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1469  'BE USED WITH VARIABLECV OPTION.'
1470  call store_error(errmsg)
1471  end if
1472  if (this%irewet > 0) then
1473  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. NEWTON OPTION CANNOT '// &
1474  'BE USED WITH REWET OPTION.'
1475  call store_error(errmsg)
1476  end if
1477  else
1478  if (this%ihighcellsat /= 0) then
1479  write (warnmsg, '(a)') 'HIGHEST_CELL_SATURATION '// &
1480  'option cannot be used when NEWTON option in not specified. '// &
1481  'Resetting HIGHEST_CELL_SATURATION option to off.'
1482  this%ihighcellsat = 0
1483  call store_warning(warnmsg)
1484  end if
1485  end if
1486  !
1487  if (this%ixt3d /= 0) then
1488  if (this%icellavg > 0) then
1489  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. '// &
1490  'ALTERNATIVE_CELL_AVERAGING OPTION '// &
1491  'CANNOT BE USED WITH XT3D OPTION.'
1492  call store_error(errmsg)
1493  end if
1494  if (this%ithickstrt > 0) then
1495  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. THICKSTRT OPTION '// &
1496  'CANNOT BE USED WITH XT3D OPTION.'
1497  call store_error(errmsg)
1498  end if
1499  if (this%iperched > 0) then
1500  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. PERCHED OPTION '// &
1501  'CANNOT BE USED WITH XT3D OPTION.'
1502  call store_error(errmsg)
1503  end if
1504  if (this%ivarcv > 0) then
1505  write (errmsg, '(a)') 'ERROR IN NPF OPTIONS. VARIABLECV OPTION '// &
1506  'CANNOT BE USED WITH XT3D OPTION.'
1507  call store_error(errmsg)
1508  end if
1509  end if
1510  !
1511  ! -- Terminate if errors
1512  if (count_errors() > 0) then
1513  call store_error_filename(this%input_fname)
1514  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:236
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:203
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 592 of file gwf-npf.f90.

593  ! dummy
594  class(GwfNpfType) :: this
595  integer(I4B), intent(in) :: n, m
596  real(DP), intent(in) :: hn, hm
597  real(DP), intent(inout) :: satn, satm
598  ! local
599  integer(I4B) :: ihdbot
600  real(DP) :: botn, botm
601  real(DP) :: top, bot
602 
603  botn = this%dis%bot(n)
604  botm = this%dis%bot(m)
605 
606  ihdbot = n
607  if (botm > botn) ihdbot = m
608 
609  ! recalculate saturation if the difference in elevation between
610  ! two cells exceed a threshold value
611  if (abs(botm - botn) >= dem2) then
612  top = this%dis%top(ihdbot)
613  bot = this%dis%bot(ihdbot)
614  satn = squadraticsaturation(top, bot, hn, this%satomega)
615  satm = squadraticsaturation(top, bot, hm, this%satomega)
616  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 2351 of file gwf-npf.f90.

2352  ! -- return
2353  real(DP) :: hy
2354  ! -- dummy
2355  class(GwfNpfType) :: this
2356  integer(I4B), intent(in) :: n
2357  integer(I4B), intent(in) :: m
2358  integer(I4B), intent(in) :: ihc
2359  integer(I4B), intent(in), optional :: ipos
2360  real(DP), dimension(3), intent(in), optional :: vg
2361  ! -- local
2362  integer(I4B) :: iipos
2363  real(DP) :: hy11, hy22, hy33
2364  real(DP) :: ang1, ang2, ang3
2365  real(DP) :: vg1, vg2, vg3
2366  !
2367  ! -- Initialize
2368  iipos = 0
2369  if (present(ipos)) iipos = ipos
2370  hy11 = this%k11(n)
2371  hy22 = this%k11(n)
2372  hy33 = this%k11(n)
2373  hy22 = this%k22(n)
2374  hy33 = this%k33(n)
2375  !
2376  ! -- Calculate effective K based on whether connection is vertical
2377  ! or horizontal
2378  if (ihc == c3d_vertical) then
2379  !
2380  ! -- Handle rotated anisotropy case that would affect the effective
2381  ! vertical hydraulic conductivity
2382  hy = hy33
2383  if (this%iangle2 > 0) then
2384  if (present(vg)) then
2385  vg1 = vg(1)
2386  vg2 = vg(2)
2387  vg3 = vg(3)
2388  else
2389  call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, iipos)
2390  end if
2391  ang1 = this%angle1(n)
2392  ang2 = this%angle2(n)
2393  ang3 = dzero
2394  if (this%iangle3 > 0) ang3 = this%angle3(n)
2395  hy = hyeff(hy11, hy22, hy33, ang1, ang2, ang3, vg1, vg2, vg3, &
2396  this%iavgkeff)
2397  end if
2398  !
2399  else
2400  !
2401  ! -- Handle horizontal case
2402  hy = hy11
2403  if (this%ik22 > 0) then
2404  if (present(vg)) then
2405  vg1 = vg(1)
2406  vg2 = vg(2)
2407  vg3 = vg(3)
2408  else
2409  call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, iipos)
2410  end if
2411  ang1 = dzero
2412  ang2 = dzero
2413  ang3 = dzero
2414  if (this%iangle1 > 0) then
2415  ang1 = this%angle1(n)
2416  if (this%iangle2 > 0) then
2417  ang2 = this%angle2(n)
2418  if (this%iangle3 > 0) ang3 = this%angle3(n)
2419  end if
2420  end if
2421  hy = hyeff(hy11, hy22, hy33, ang1, ang2, ang3, vg1, vg2, vg3, &
2422  this%iavgkeff)
2423  end if
2424  !
2425  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 2741 of file gwf-npf.f90.

2742  ! -- dummy
2743  class(GwfNpfType) :: this
2744  integer(I4B), intent(in) :: nedges
2745  !
2746  this%nedges = this%nedges + nedges

◆ log_griddata()

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

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

1520  ! -- modules
1522  ! -- dummy
1523  class(GwfNpfType) :: this
1524  type(GwfNpfParamFoundType), intent(in) :: found
1525  !
1526  write (this%iout, '(1x,a)') 'Setting NPF Griddata'
1527  !
1528  if (found%icelltype) then
1529  write (this%iout, '(4x,a)') 'ICELLTYPE set from input file'
1530  end if
1531  !
1532  if (found%k) then
1533  write (this%iout, '(4x,a)') 'K set from input file'
1534  end if
1535  !
1536  if (found%k33) then
1537  write (this%iout, '(4x,a)') 'K33 set from input file'
1538  else
1539  write (this%iout, '(4x,a)') 'K33 not provided. Setting K33 = K.'
1540  end if
1541  !
1542  if (found%k22) then
1543  write (this%iout, '(4x,a)') 'K22 set from input file'
1544  else
1545  write (this%iout, '(4x,a)') 'K22 not provided. Setting K22 = K.'
1546  end if
1547  !
1548  if (found%wetdry) then
1549  write (this%iout, '(4x,a)') 'WETDRY set from input file'
1550  end if
1551  !
1552  if (found%angle1) then
1553  write (this%iout, '(4x,a)') 'ANGLE1 set from input file'
1554  end if
1555  !
1556  if (found%angle2) then
1557  write (this%iout, '(4x,a)') 'ANGLE2 set from input file'
1558  end if
1559  !
1560  if (found%angle3) then
1561  write (this%iout, '(4x,a)') 'ANGLE3 set from input file'
1562  end if
1563  !
1564  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 1277 of file gwf-npf.f90.

1278  ! -- modules
1279  use kindmodule, only: lgp
1281  ! -- dummy
1282  class(GwfNpftype) :: this
1283  ! -- locals
1284  type(GwfNpfParamFoundType), intent(in) :: found
1285  !
1286  write (this%iout, '(1x,a)') 'Setting NPF Options'
1287  if (found%iprflow) &
1288  write (this%iout, '(4x,a)') 'Cell-by-cell flow information will be printed &
1289  &to listing file whenever ICBCFL is not zero.'
1290  if (found%ipakcb) &
1291  write (this%iout, '(4x,a)') 'Cell-by-cell flow information will be saved &
1292  &to binary file whenever ICBCFL is not zero.'
1293  if (found%cellavg) &
1294  write (this%iout, '(4x,a,i0)') 'Alternative cell averaging [1=logarithmic, &
1295  &2=AMT-LMK, 3=AMT-HMK] set to: ', &
1296  this%icellavg
1297  if (found%ithickstrt) &
1298  write (this%iout, '(4x,a)') 'THICKSTRT option has been activated.'
1299  if (found%ihighcellsat) &
1300  write (this%iout, '(4x,a)') 'HIGHEST_CELL_SATURATION option &
1301  &has been activated.'
1302  if (found%iperched) &
1303  write (this%iout, '(4x,a)') 'Vertical flow will be adjusted for perched &
1304  &conditions.'
1305  if (found%ivarcv) &
1306  write (this%iout, '(4x,a)') 'Vertical conductance varies with water table.'
1307  if (found%idewatcv) &
1308  write (this%iout, '(4x,a)') 'Vertical conductance is calculated using &
1309  &only the saturated thickness and properties &
1310  &of the overlying cell if the head in the &
1311  &underlying cell is below its top.'
1312  if (found%ixt3d) write (this%iout, '(4x,a)') 'XT3D formulation is selected.'
1313  if (found%ixt3drhs) &
1314  write (this%iout, '(4x,a)') 'XT3D RHS formulation is selected.'
1315  if (found%isavspdis) &
1316  write (this%iout, '(4x,a)') 'Specific discharge will be calculated at cell &
1317  &centers and written to DATA-SPDIS in budget &
1318  &file when requested.'
1319  if (found%isavsat) &
1320  write (this%iout, '(4x,a)') 'Saturation will be written to DATA-SAT in &
1321  &budget file when requested.'
1322  if (found%ik22overk) &
1323  write (this%iout, '(4x,a)') 'Values specified for K22 are anisotropy &
1324  &ratios and will be multiplied by K before &
1325  &being used in calculations.'
1326  if (found%ik33overk) &
1327  write (this%iout, '(4x,a)') 'Values specified for K33 are anisotropy &
1328  &ratios and will be multiplied by K before &
1329  &being used in calculations.'
1330  if (found%inewton) &
1331  write (this%iout, '(4x,a)') 'NEWTON-RAPHSON method disabled for unconfined &
1332  &cells'
1333  if (found%satomega) &
1334  write (this%iout, '(4x,a,1pg15.6)') 'Saturation omega: ', this%satomega
1335  if (found%irewet) &
1336  write (this%iout, '(4x,a)') 'Rewetting is active.'
1337  if (found%wetfct) &
1338  write (this%iout, '(4x,a,1pg15.6)') &
1339  'Wetting factor (WETFCT) has been set to: ', this%wetfct
1340  if (found%iwetit) &
1341  write (this%iout, '(4x,a,i5)') &
1342  'Wetting iteration interval (IWETIT) has been set to: ', this%iwetit
1343  if (found%ihdwet) &
1344  write (this%iout, '(4x,a,i5)') &
1345  'Head rewet equation (IHDWET) has been set to: ', this%ihdwet
1346  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 382 of file gwf-npf.f90.

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

◆ 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
290  ! -- dummy
291  class(GwfNpftype) :: this !< instance of the NPF package
292  type(GwfIcType), pointer, intent(in) :: ic !< initial conditions
293  type(GwfVscType), pointer, intent(in) :: vsc !< viscosity package
294  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: ibound !< model ibound array
295  real(DP), dimension(:), pointer, contiguous, intent(inout) :: hnew !< pointer to model head array
296  ! -- local
297  integer(I4B) :: n
298  !
299  ! -- Store pointers to arguments that were passed in
300  this%ic => ic
301  this%ibound => ibound
302  this%hnew => hnew
303  !
304  if (this%icalcspdis == 1) then
305  call mem_reallocate(this%spdis, 3, this%dis%nodes, 'SPDIS', this%memoryPath)
306  call mem_reallocate(this%nodedge, this%nedges, 'NODEDGE', this%memoryPath)
307  call mem_reallocate(this%ihcedge, this%nedges, 'IHCEDGE', this%memoryPath)
308  call mem_reallocate(this%propsedge, 5, this%nedges, 'PROPSEDGE', &
309  this%memoryPath)
310  call mem_reallocate(this%iedge_ptr, this%dis%nodes + 1, &
311  'NREDGESNODE', this%memoryPath)
312  call mem_reallocate(this%edge_idxs, this%nedges, &
313  'EDGEIDXS', this%memoryPath)
314 
315  do n = 1, this%nedges
316  this%edge_idxs(n) = 0
317  end do
318  do n = 1, this%dis%nodes
319  this%iedge_ptr(n) = 0
320  this%spdis(:, n) = dzero
321  end do
322  end if
323  !
324  ! -- Store pointer to VSC if active
325  if (this%invsc /= 0) then
326  this%vsc => vsc
327  end if
328  !
329  ! -- allocate arrays to store original user input in case TVK/VSC modify them
330  if (this%invsc > 0) then
331  !
332  ! -- Reallocate arrays that store user-input values.
333  call mem_reallocate(this%k11input, this%dis%nodes, 'K11INPUT', &
334  this%memoryPath)
335  call mem_reallocate(this%k22input, this%dis%nodes, 'K22INPUT', &
336  this%memoryPath)
337  call mem_reallocate(this%k33input, this%dis%nodes, 'K33INPUT', &
338  this%memoryPath)
339  ! Allocate arrays that will store the original K values. When VSC active,
340  ! the current Kxx arrays carry the viscosity-adjusted K values.
341  ! This approach leverages existing functionality that makes use of K.
342  call this%store_original_k_arrays(this%dis%nodes, this%dis%njas)
343  end if
344  !
345  ! -- preprocess data
346  call this%preprocess_input()
347  !
348  ! -- xt3d
349  if (this%ixt3d /= 0) then
350  call this%xt3d%xt3d_ar(ibound, this%k11, this%ik33, this%k33, &
351  this%sat, this%ik22, this%k22, &
352  this%iangle1, this%iangle2, this%iangle3, &
353  this%angle1, this%angle2, this%angle3, &
354  this%inewton, this%icelltype)
355  end if
356  !
357  ! -- TVK
358  if (this%intvk /= 0) then
359  call this%tvk%ar(this%dis)
360  end if

◆ 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 446 of file gwf-npf.f90.

447  ! -- dummy
448  class(GwfNpfType) :: this
449  integer(I4B) :: kiter
450  integer(I4B), intent(in) :: nodes
451  real(DP), intent(inout), dimension(nodes) :: hnew
452  ! -- local
453  integer(I4B) :: n
454  real(DP) :: satn
455  !
456  ! -- Perform wetting and drying
457  if (this%inewton /= 1) then
458  call this%wd(kiter, hnew)
459  end if
460  !
461  ! -- Calculate saturation for convertible cells
462  do n = 1, this%dis%nodes
463  if (this%icelltype(n) /= 0) then
464  if (this%ibound(n) == 0) then
465  satn = dzero
466  else
467  call this%thksat(n, hnew(n), satn)
468  end if
469  this%sat(n) = satn
470  end if
471  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 788 of file gwf-npf.f90.

789  ! -- dummy
790  class(GwfNpfType) :: this
791  real(DP), intent(inout), dimension(:) :: hnew
792  real(DP), intent(inout), dimension(:) :: flowja
793  ! -- local
794  integer(I4B) :: n, ipos, m
795  real(DP) :: qnm
796  !
797  ! -- Calculate the flow across each cell face and store in flowja
798  !
799  if (this%ixt3d /= 0) then
800  call this%xt3d%xt3d_flowja(hnew, flowja)
801  else
802  !
803  do n = 1, this%dis%nodes
804  do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
805  m = this%dis%con%ja(ipos)
806  if (m < n) cycle
807  call this%qcalc(n, m, hnew(n), hnew(m), ipos, qnm)
808  flowja(ipos) = qnm
809  flowja(this%dis%con%isym(ipos)) = -qnm
810  end do
811  end do
812  !
813  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 995 of file gwf-npf.f90.

996  ! -- modules
999  ! -- dummy
1000  class(GwfNpftype) :: this
1001 
1002  ! free spdis work structure
1003  if (this%icalcspdis == 1 .and. this%spdis_wa%is_created()) &
1004  call this%spdis_wa%destroy()
1005  deallocate (this%spdis_wa)
1006  !
1007  ! -- Deallocate input memory
1008  call memorystore_remove(this%name_model, 'NPF', idm_context)
1009  !
1010  ! -- TVK
1011  if (this%intvk /= 0) then
1012  call this%tvk%da()
1013  deallocate (this%tvk)
1014  end if
1015  !
1016  ! -- VSC
1017  if (this%invsc /= 0) then
1018  nullify (this%vsc)
1019  end if
1020  !
1021  ! -- Strings
1022  !
1023  ! -- Scalars
1024  call mem_deallocate(this%iname)
1025  call mem_deallocate(this%ixt3d)
1026  call mem_deallocate(this%ixt3drhs)
1027  call mem_deallocate(this%satomega)
1028  call mem_deallocate(this%hnoflo)
1029  call mem_deallocate(this%hdry)
1030  call mem_deallocate(this%icellavg)
1031  call mem_deallocate(this%iavgkeff)
1032  call mem_deallocate(this%ik22)
1033  call mem_deallocate(this%ik33)
1034  call mem_deallocate(this%iperched)
1035  call mem_deallocate(this%ivarcv)
1036  call mem_deallocate(this%idewatcv)
1037  call mem_deallocate(this%ithickstrt)
1038  call mem_deallocate(this%ihighcellsat)
1039  call mem_deallocate(this%isavspdis)
1040  call mem_deallocate(this%isavsat)
1041  call mem_deallocate(this%icalcspdis)
1042  call mem_deallocate(this%irewet)
1043  call mem_deallocate(this%wetfct)
1044  call mem_deallocate(this%iwetit)
1045  call mem_deallocate(this%ihdwet)
1046  call mem_deallocate(this%ibotnode)
1047  call mem_deallocate(this%iwetdry)
1048  call mem_deallocate(this%iangle1)
1049  call mem_deallocate(this%iangle2)
1050  call mem_deallocate(this%iangle3)
1051  call mem_deallocate(this%nedges)
1052  call mem_deallocate(this%lastedge)
1053  call mem_deallocate(this%ik22overk)
1054  call mem_deallocate(this%ik33overk)
1055  call mem_deallocate(this%intvk)
1056  call mem_deallocate(this%invsc)
1057  call mem_deallocate(this%kchangeper)
1058  call mem_deallocate(this%kchangestp)
1059  !
1060  ! -- Deallocate arrays
1061  deallocate (this%aname)
1062  call mem_deallocate(this%ithickstartflag)
1063  call mem_deallocate(this%icelltype)
1064  call mem_deallocate(this%k11)
1065  call mem_deallocate(this%k22)
1066  call mem_deallocate(this%k33)
1067  call mem_deallocate(this%k11input)
1068  call mem_deallocate(this%k22input)
1069  call mem_deallocate(this%k33input)
1070  call mem_deallocate(this%sat, 'SAT', this%memoryPath)
1071  call mem_deallocate(this%condsat)
1072  call mem_deallocate(this%wetdry)
1073  call mem_deallocate(this%angle1)
1074  call mem_deallocate(this%angle2)
1075  call mem_deallocate(this%angle3)
1076  call mem_deallocate(this%nodedge)
1077  call mem_deallocate(this%ihcedge)
1078  call mem_deallocate(this%propsedge)
1079  call mem_deallocate(this%iedge_ptr)
1080  call mem_deallocate(this%edge_idxs)
1081  call mem_deallocate(this%spdis, 'SPDIS', this%memoryPath)
1082  call mem_deallocate(this%nodekchange)
1083  !
1084  ! -- deallocate parent
1085  call this%NumericalPackageType%da()
1086 
1087  ! pointers
1088  this%hnew => null()
1089 
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 476 of file gwf-npf.f90.

477  ! -- modules
478  use constantsmodule, only: done
479  ! -- dummy
480  class(GwfNpfType) :: this
481  integer(I4B) :: kiter
482  class(MatrixBaseType), pointer :: matrix_sln
483  integer(I4B), intent(in), dimension(:) :: idxglo
484  real(DP), intent(inout), dimension(:) :: rhs
485  real(DP), intent(inout), dimension(:) :: hnew
486  ! -- local
487  integer(I4B) :: n, m, ii, idiag, ihc
488  integer(I4B) :: isymcon, idiagm
489  real(DP) :: hyn, hym
490  real(DP) :: cond
491  real(DP) :: satn
492  real(DP) :: satm
493  !
494  ! -- Calculate conductance and put into amat
495  !
496  if (this%ixt3d /= 0) then
497  call this%xt3d%xt3d_fc(kiter, matrix_sln, idxglo, rhs, hnew)
498  else
499  do n = 1, this%dis%nodes
500  do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
501  if (this%dis%con%mask(ii) == 0) cycle
502 
503  m = this%dis%con%ja(ii)
504  !
505  ! -- Calculate conductance only for upper triangle but insert into
506  ! upper and lower parts of amat.
507  if (m < n) cycle
508  ihc = this%dis%con%ihc(this%dis%con%jas(ii))
509  hyn = this%hy_eff(n, m, ihc, ipos=ii)
510  hym = this%hy_eff(m, n, ihc, ipos=ii)
511  !
512  ! -- Vertical connection
513  if (ihc == c3d_vertical) then
514  !
515  ! -- Calculate vertical conductance
516  cond = vcond(this%ibound(n), this%ibound(m), &
517  this%icelltype(n), this%icelltype(m), this%inewton, &
518  this%ivarcv, this%idewatcv, &
519  this%condsat(this%dis%con%jas(ii)), hnew(n), hnew(m), &
520  hyn, hym, &
521  this%sat(n), this%sat(m), &
522  this%dis%top(n), this%dis%top(m), &
523  this%dis%bot(n), this%dis%bot(m), &
524  this%dis%con%hwva(this%dis%con%jas(ii)))
525  !
526  ! -- Vertical flow for perched conditions
527  if (this%iperched /= 0) then
528  if (this%icelltype(m) /= 0) then
529  if (hnew(m) < this%dis%top(m)) then
530  !
531  ! -- Fill row n
532  idiag = this%dis%con%ia(n)
533  rhs(n) = rhs(n) - cond * this%dis%bot(n)
534  call matrix_sln%add_value_pos(idxglo(idiag), -cond)
535  !
536  ! -- Fill row m
537  isymcon = this%dis%con%isym(ii)
538  call matrix_sln%add_value_pos(idxglo(isymcon), cond)
539  rhs(m) = rhs(m) + cond * this%dis%bot(n)
540  !
541  ! -- cycle the connection loop
542  cycle
543  end if
544  end if
545  end if
546  !
547  else
548  satn = this%sat(n)
549  satm = this%sat(m)
550  if (this%ihighcellsat /= 0) then
551  call this%highest_cell_saturation(n, m, &
552  hnew(n), hnew(m), &
553  satn, satm)
554  end if
555  !
556  ! -- Horizontal conductance
557  cond = hcond(this%ibound(n), this%ibound(m), &
558  this%icelltype(n), this%icelltype(m), &
559  this%inewton, &
560  this%dis%con%ihc(this%dis%con%jas(ii)), &
561  this%icellavg, &
562  this%condsat(this%dis%con%jas(ii)), &
563  hnew(n), hnew(m), satn, satm, hyn, hym, &
564  this%dis%top(n), this%dis%top(m), &
565  this%dis%bot(n), this%dis%bot(m), &
566  this%dis%con%cl1(this%dis%con%jas(ii)), &
567  this%dis%con%cl2(this%dis%con%jas(ii)), &
568  this%dis%con%hwva(this%dis%con%jas(ii)))
569  end if
570  !
571  ! -- Fill row n
572  idiag = this%dis%con%ia(n)
573  call matrix_sln%add_value_pos(idxglo(ii), cond)
574  call matrix_sln%add_value_pos(idxglo(idiag), -cond)
575  !
576  ! -- Fill row m
577  isymcon = this%dis%con%isym(ii)
578  idiagm = this%dis%con%ia(m)
579  call matrix_sln%add_value_pos(idxglo(isymcon), cond)
580  call matrix_sln%add_value_pos(idxglo(idiagm), -cond)
581  end do
582  end do
583  !
584  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 621 of file gwf-npf.f90.

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

749  ! -- dummy
750  class(GwfNpfType) :: this
751  integer(I4B), intent(in) :: neqmod
752  real(DP), dimension(neqmod), intent(inout) :: x
753  real(DP), dimension(neqmod), intent(in) :: xtemp
754  real(DP), dimension(neqmod), intent(inout) :: dx
755  integer(I4B), intent(inout) :: inewtonur
756  real(DP), intent(inout) :: dxmax
757  integer(I4B), intent(inout) :: locmax
758  ! -- local
759  integer(I4B) :: n
760  real(DP) :: botm
761  real(DP) :: xx
762  real(DP) :: dxx
763  !
764  ! -- Newton-Raphson under-relaxation
765  do n = 1, this%dis%nodes
766  if (this%ibound(n) < 1) cycle
767  if (this%icelltype(n) > 0) then
768  botm = this%dis%bot(this%ibotnode(n))
769  ! -- only apply Newton-Raphson under-relaxation if
770  ! solution head is below the bottom of the model
771  if (x(n) < botm) then
772  inewtonur = 1
773  xx = xtemp(n) * (done - dp9) + botm * dp9
774  dxx = x(n) - xx
775  if (abs(dxx) > abs(dxmax)) then
776  locmax = n
777  dxmax = dxx
778  end if
779  x(n) = xx
780  dx(n) = dzero
781  end if
782  end if
783  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 956 of file gwf-npf.f90.

957  ! -- modules
958  use tdismodule, only: kper, kstp
959  use constantsmodule, only: lenbigline
960  ! -- dummy
961  class(GwfNpfType) :: this
962  integer(I4B), intent(in) :: ibudfl
963  real(DP), intent(inout), dimension(:) :: flowja
964  ! -- local
965  character(len=LENBIGLINE) :: line
966  character(len=30) :: tempstr
967  integer(I4B) :: n, ipos, m
968  real(DP) :: qnm
969  ! -- formats
970  character(len=*), parameter :: fmtiprflow = &
971  &"(/,4x,'CALCULATED INTERCELL FLOW FOR PERIOD ', i0, ' STEP ', i0)"
972  !
973  ! -- Write flowja to list file if requested
974  if (ibudfl /= 0 .and. this%iprflow > 0) then
975  write (this%iout, fmtiprflow) kper, kstp
976  do n = 1, this%dis%nodes
977  line = ''
978  call this%dis%noder_to_string(n, tempstr)
979  line = trim(tempstr)//':'
980  do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
981  m = this%dis%con%ja(ipos)
982  call this%dis%noder_to_string(m, tempstr)
983  line = trim(line)//' '//trim(tempstr)
984  qnm = flowja(ipos)
985  write (tempstr, '(1pg15.6)') qnm
986  line = trim(line)//' '//trim(adjustl(tempstr))
987  end do
988  write (this%iout, '(a)') trim(line)
989  end do
990  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 367 of file gwf-npf.f90.

368  implicit none
369  ! -- dummy
370  class(GwfNpfType) :: this
371  !
372  ! -- TVK
373  if (this%intvk /= 0) then
374  call this%tvk%rp()
375  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 919 of file gwf-npf.f90.

920  ! -- dummy
921  class(GwfNpfType) :: this
922  real(DP), dimension(:), intent(in) :: flowja
923  integer(I4B), intent(in) :: icbcfl
924  integer(I4B), intent(in) :: icbcun
925  ! -- local
926  integer(I4B) :: ibinun
927  !
928  ! -- Set unit number for binary output
929  if (this%ipakcb < 0) then
930  ibinun = icbcun
931  elseif (this%ipakcb == 0) then
932  ibinun = 0
933  else
934  ibinun = this%ipakcb
935  end if
936  if (icbcfl == 0) ibinun = 0
937  !
938  ! -- Write the face flows if requested
939  if (ibinun /= 0) then
940  call this%dis%record_connection_array(flowja, ibinun, this%iout)
941  end if
942  !
943  ! -- Calculate specific discharge at cell centers and write, if requested
944  if (this%isavspdis /= 0) then
945  if (ibinun /= 0) call this%sav_spdis(ibinun)
946  end if
947  !
948  ! -- Save saturation, if requested
949  if (this%isavsat /= 0) then
950  if (ibinun /= 0) call this%sav_sat(ibinun)
951  end if

◆ prepare_edge_lookup()

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

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

2808  class(GwfNpfType) :: this
2809  ! local
2810  integer(I4B) :: i, inode, iedge
2811  integer(I4B) :: n, start, end
2812  integer(I4B) :: prev_cnt, strt_idx, ipos
2813 
2814  do i = 1, size(this%iedge_ptr)
2815  this%iedge_ptr(i) = 0
2816  end do
2817  do i = 1, size(this%edge_idxs)
2818  this%edge_idxs(i) = 0
2819  end do
2820 
2821  ! count
2822  do iedge = 1, this%nedges
2823  n = this%nodedge(iedge)
2824  this%iedge_ptr(n) = this%iedge_ptr(n) + 1
2825  end do
2826 
2827  ! determine start indexes
2828  prev_cnt = this%iedge_ptr(1)
2829  this%iedge_ptr(1) = 1
2830  do inode = 2, this%dis%nodes + 1
2831  strt_idx = this%iedge_ptr(inode - 1) + prev_cnt
2832  prev_cnt = this%iedge_ptr(inode)
2833  this%iedge_ptr(inode) = strt_idx
2834  end do
2835 
2836  ! loop over edges to fill lookup table
2837  do iedge = 1, this%nedges
2838  n = this%nodedge(iedge)
2839  start = this%iedge_ptr(n)
2840  end = this%iedge_ptr(n + 1) - 1
2841  do ipos = start, end
2842  if (this%edge_idxs(ipos) > 0) cycle ! go to next
2843  this%edge_idxs(ipos) = iedge
2844  exit
2845  end do
2846  end do
2847 

◆ prepcheck()

subroutine gwfnpfmodule::prepcheck ( class(gwfnpftype this)

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

1659  ! -- modules
1660  use constantsmodule, only: linelength, dpio180
1662  ! -- dummy
1663  class(GwfNpfType) :: this
1664  ! -- local
1665  character(len=24), dimension(:), pointer :: aname
1666  character(len=LINELENGTH) :: cellstr, errmsg
1667  integer(I4B) :: nerr, n
1668  ! -- format
1669  character(len=*), parameter :: fmtkerr = &
1670  &"(1x, 'Hydraulic property ',a,' is <= 0 for cell ',a, ' ', 1pg15.6)"
1671  character(len=*), parameter :: fmtkerr2 = &
1672  &"(1x, '... ', i0,' additional errors not shown for ',a)"
1673  !
1674  ! -- initialize
1675  aname => this%aname
1676  !
1677  ! -- check k11
1678  nerr = 0
1679  do n = 1, size(this%k11)
1680  if (this%k11(n) <= dzero) then
1681  nerr = nerr + 1
1682  if (nerr <= 20) then
1683  call this%dis%noder_to_string(n, cellstr)
1684  write (errmsg, fmtkerr) trim(adjustl(aname(2))), trim(cellstr), &
1685  this%k11(n)
1686  call store_error(errmsg)
1687  end if
1688  end if
1689  end do
1690  if (nerr > 20) then
1691  write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(2)))
1692  call store_error(errmsg)
1693  end if
1694  !
1695  ! -- check k33 because it was read
1696  if (this%ik33 /= 0) then
1697  !
1698  ! -- Check to make sure values are greater than or equal to zero
1699  nerr = 0
1700  do n = 1, size(this%k33)
1701  if (this%ik33overk /= 0) this%k33(n) = this%k33(n) * this%k11(n)
1702  if (this%k33(n) <= dzero) then
1703  nerr = nerr + 1
1704  if (nerr <= 20) then
1705  call this%dis%noder_to_string(n, cellstr)
1706  write (errmsg, fmtkerr) trim(adjustl(aname(3))), trim(cellstr), &
1707  this%k33(n)
1708  call store_error(errmsg)
1709  end if
1710  end if
1711  end do
1712  if (nerr > 20) then
1713  write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(3)))
1714  call store_error(errmsg)
1715  end if
1716  end if
1717  !
1718  ! -- check k22 because it was read
1719  if (this%ik22 /= 0) then
1720  !
1721  ! -- Check to make sure that angles are available
1722  if (this%dis%con%ianglex == 0) then
1723  write (errmsg, '(a)') 'Error. ANGLDEGX not provided in '// &
1724  'discretization file, but K22 was specified. '
1725  call store_error(errmsg)
1726  end if
1727  !
1728  ! -- Check to make sure values are greater than or equal to zero
1729  nerr = 0
1730  do n = 1, size(this%k22)
1731  if (this%ik22overk /= 0) this%k22(n) = this%k22(n) * this%k11(n)
1732  if (this%k22(n) <= dzero) then
1733  nerr = nerr + 1
1734  if (nerr <= 20) then
1735  call this%dis%noder_to_string(n, cellstr)
1736  write (errmsg, fmtkerr) trim(adjustl(aname(4))), trim(cellstr), &
1737  this%k22(n)
1738  call store_error(errmsg)
1739  end if
1740  end if
1741  end do
1742  if (nerr > 20) then
1743  write (errmsg, fmtkerr2) nerr, trim(adjustl(aname(4)))
1744  call store_error(errmsg)
1745  end if
1746  end if
1747  !
1748  ! -- check for wetdry conflicts
1749  if (this%irewet == 1) then
1750  if (this%iwetdry == 0) then
1751  write (errmsg, '(a, a, a)') 'Error in GRIDDATA block: ', &
1752  trim(adjustl(aname(5))), ' not found.'
1753  call store_error(errmsg)
1754  end if
1755  end if
1756  !
1757  ! -- Check for angle conflicts
1758  if (this%iangle1 /= 0) then
1759  do n = 1, size(this%angle1)
1760  this%angle1(n) = this%angle1(n) * dpio180
1761  end do
1762  else
1763  if (this%ixt3d /= 0) then
1764  this%iangle1 = 1
1765  write (this%iout, '(a)') 'XT3D IN USE, BUT ANGLE1 NOT SPECIFIED. '// &
1766  'SETTING ANGLE1 TO ZERO.'
1767  do n = 1, size(this%angle1)
1768  this%angle1(n) = dzero
1769  end do
1770  end if
1771  end if
1772  if (this%iangle2 /= 0) then
1773  if (this%iangle1 == 0) then
1774  write (errmsg, '(a)') 'ANGLE2 SPECIFIED BUT NOT ANGLE1. '// &
1775  'ANGLE2 REQUIRES ANGLE1. '
1776  call store_error(errmsg)
1777  end if
1778  if (this%iangle3 == 0) then
1779  write (errmsg, '(a)') 'ANGLE2 SPECIFIED BUT NOT ANGLE3. '// &
1780  'SPECIFY BOTH OR NEITHER ONE. '
1781  call store_error(errmsg)
1782  end if
1783  do n = 1, size(this%angle2)
1784  this%angle2(n) = this%angle2(n) * dpio180
1785  end do
1786  end if
1787  if (this%iangle3 /= 0) then
1788  if (this%iangle1 == 0) then
1789  write (errmsg, '(a)') 'ANGLE3 SPECIFIED BUT NOT ANGLE1. '// &
1790  'ANGLE3 REQUIRES ANGLE1. '
1791  call store_error(errmsg)
1792  end if
1793  if (this%iangle2 == 0) then
1794  write (errmsg, '(a)') 'ANGLE3 SPECIFIED BUT NOT ANGLE2. '// &
1795  'SPECIFY BOTH OR NEITHER ONE. '
1796  call store_error(errmsg)
1797  end if
1798  do n = 1, size(this%angle3)
1799  this%angle3(n) = this%angle3(n) * dpio180
1800  end do
1801  end if
1802  !
1803  ! -- terminate if data errors
1804  if (count_errors() > 0) then
1805  call store_error_filename(this%input_fname)
1806  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 1819 of file gwf-npf.f90.

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

2239  ! -- dummy
2240  class(GwfNpfType) :: this
2241  integer(I4B), intent(in) :: kiter
2242  integer(I4B), intent(in) :: node
2243  real(DP), intent(in) :: hm
2244  integer(I4B), intent(in) :: ibdm
2245  integer(I4B), intent(in) :: ihc
2246  real(DP), intent(inout), dimension(:) :: hnew
2247  integer(I4B), intent(out) :: irewet
2248  ! -- local
2249  integer(I4B) :: itflg
2250  real(DP) :: wd, awd, turnon, bbot
2251  !
2252  irewet = 0
2253  !
2254  ! -- Convert a dry cell to wet if it meets the criteria
2255  if (this%irewet > 0) then
2256  itflg = mod(kiter, this%iwetit)
2257  if (itflg == 0) then
2258  if (this%ibound(node) == 0 .and. this%wetdry(node) /= dzero) then
2259  !
2260  ! -- Calculate wetting elevation
2261  bbot = this%dis%bot(node)
2262  wd = this%wetdry(node)
2263  awd = wd
2264  if (wd < 0) awd = -wd
2265  turnon = bbot + awd
2266  !
2267  ! -- Check head in adjacent cells to see if wetting elevation has
2268  ! been reached
2269  if (ihc == c3d_vertical) then
2270  !
2271  ! -- check cell below
2272  if (ibdm > 0 .and. hm >= turnon) irewet = 1
2273  else
2274  if (wd > dzero) then
2275  !
2276  ! -- check horizontally adjacent cells
2277  if (ibdm > 0 .and. hm >= turnon) irewet = 1
2278  end if
2279  end if
2280  !
2281  if (irewet == 1) then
2282  ! -- rewet cell; use equation 3a if ihdwet=0; use equation 3b if
2283  ! ihdwet is not 0.
2284  if (this%ihdwet == 0) then
2285  hnew(node) = bbot + this%wetfct * (hm - bbot)
2286  else
2287  hnew(node) = bbot + this%wetfct * awd !(hm - bbot)
2288  end if
2289  this%ibound(node) = 30000
2290  end if
2291  end if
2292  end if
2293  end if

◆ sav_sat()

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

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

2710  ! -- dummy
2711  class(GwfNpfType) :: this
2712  integer(I4B), intent(in) :: ibinun
2713  ! -- local
2714  character(len=16) :: text
2715  character(len=16), dimension(1) :: auxtxt
2716  real(DP), dimension(1) :: a
2717  integer(I4B) :: n
2718  integer(I4B) :: naux
2719  !
2720  ! -- Write the header
2721  text = ' DATA-SAT'
2722  naux = 1
2723  auxtxt(:) = [' sat']
2724  call this%dis%record_srcdst_list_header(text, this%name_model, &
2725  this%packName, this%name_model, &
2726  this%packName, naux, auxtxt, ibinun, &
2727  this%dis%nodes, this%iout)
2728  !
2729  ! -- Write a zero for Q, and then write saturation as an aux variables
2730  do n = 1, this%dis%nodes
2731  a(1) = this%sat(n)
2732  call this%dis%record_mf6_list_entry(ibinun, n, n, dzero, naux, a)
2733  end do

◆ sav_spdis()

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

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

2682  ! -- dummy
2683  class(GwfNpfType) :: this
2684  integer(I4B), intent(in) :: ibinun
2685  ! -- local
2686  character(len=16) :: text
2687  character(len=16), dimension(3) :: auxtxt
2688  integer(I4B) :: n
2689  integer(I4B) :: naux
2690  !
2691  ! -- Write the header
2692  text = ' DATA-SPDIS'
2693  naux = 3
2694  auxtxt(:) = [' qx', ' qy', ' qz']
2695  call this%dis%record_srcdst_list_header(text, this%name_model, &
2696  this%packName, this%name_model, &
2697  this%packName, naux, auxtxt, ibinun, &
2698  this%dis%nodes, this%iout)
2699  !
2700  ! -- Write a zero for Q, and then write qx, qy, qz as aux variables
2701  do n = 1, this%dis%nodes
2702  call this%dis%record_mf6_list_entry(ibinun, n, n, dzero, naux, &
2703  this%spdis(:, n))
2704  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 2778 of file gwf-npf.f90.

2780  ! -- dummy
2781  class(GwfNpfType) :: this
2782  integer(I4B), intent(in) :: nodedge
2783  integer(I4B), intent(in) :: ihcedge
2784  real(DP), intent(in) :: q
2785  real(DP), intent(in) :: area
2786  real(DP), intent(in) :: nx
2787  real(DP), intent(in) :: ny
2788  real(DP), intent(in) :: distance
2789  ! -- local
2790  integer(I4B) :: lastedge
2791  !
2792  this%lastedge = this%lastedge + 1
2793  lastedge = this%lastedge
2794  this%nodedge(lastedge) = nodedge
2795  this%ihcedge(lastedge) = ihcedge
2796  this%propsedge(1, lastedge) = q
2797  this%propsedge(2, lastedge) = area
2798  this%propsedge(3, lastedge) = nx
2799  this%propsedge(4, lastedge) = ny
2800  this%propsedge(5, lastedge) = distance
2801  !
2802  ! -- If this is the last edge, then the next call must be starting a new
2803  ! edge properties assignment loop, so need to reset lastedge to 0
2804  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 1429 of file gwf-npf.f90.

1430  ! -- dummy
1431  class(GwfNpftype) :: this
1432  type(GwfNpfOptionsType), intent(in) :: options
1433  !
1434  this%icellavg = options%icellavg
1435  this%ithickstrt = options%ithickstrt
1436  this%ihighcellsat = options%ihighcellsat
1437  this%iperched = options%iperched
1438  this%ivarcv = options%ivarcv
1439  this%idewatcv = options%idewatcv
1440  this%irewet = options%irewet
1441  this%wetfct = options%wetfct
1442  this%iwetit = options%iwetit
1443  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 841 of file gwf-npf.f90.

842  ! -- dummy
843  class(GwfNpfType) :: this
844  integer(I4B), intent(in) :: n
845  integer(I4B), intent(in) :: m
846  real(DP), intent(in) :: hn
847  real(DP), intent(in) :: hm
848  integer(I4B), intent(in) :: icon
849  real(DP), intent(inout) :: qnm
850  ! -- local
851  real(DP) :: hyn, hym
852  real(DP) :: condnm
853  real(DP) :: hntemp, hmtemp
854  real(DP) :: satn, satm
855  integer(I4B) :: ihc
856  !
857  ! -- Initialize
858  ihc = this%dis%con%ihc(this%dis%con%jas(icon))
859  hyn = this%hy_eff(n, m, ihc, ipos=icon)
860  hym = this%hy_eff(m, n, ihc, ipos=icon)
861  !
862  ! -- Calculate conductance
863  if (ihc == c3d_vertical) then
864  condnm = vcond(this%ibound(n), this%ibound(m), &
865  this%icelltype(n), this%icelltype(m), this%inewton, &
866  this%ivarcv, this%idewatcv, &
867  this%condsat(this%dis%con%jas(icon)), hn, hm, &
868  hyn, hym, &
869  this%sat(n), this%sat(m), &
870  this%dis%top(n), this%dis%top(m), &
871  this%dis%bot(n), this%dis%bot(m), &
872  this%dis%con%hwva(this%dis%con%jas(icon)))
873  else
874  satn = this%sat(n)
875  satm = this%sat(m)
876  if (this%ihighcellsat /= 0) then
877  call this%highest_cell_saturation(n, m, hn, hm, satn, satm)
878  end if
879 
880  condnm = hcond(this%ibound(n), this%ibound(m), &
881  this%icelltype(n), this%icelltype(m), &
882  this%inewton, &
883  this%dis%con%ihc(this%dis%con%jas(icon)), &
884  this%icellavg, &
885  this%condsat(this%dis%con%jas(icon)), &
886  hn, hm, satn, satm, hyn, hym, &
887  this%dis%top(n), this%dis%top(m), &
888  this%dis%bot(n), this%dis%bot(m), &
889  this%dis%con%cl1(this%dis%con%jas(icon)), &
890  this%dis%con%cl2(this%dis%con%jas(icon)), &
891  this%dis%con%hwva(this%dis%con%jas(icon)))
892  end if
893  !
894  ! -- Initialize hntemp and hmtemp
895  hntemp = hn
896  hmtemp = hm
897  !
898  ! -- Check and adjust for dewatered conditions
899  if (this%iperched /= 0) then
900  if (this%dis%con%ihc(this%dis%con%jas(icon)) == 0) then
901  if (n > m) then
902  if (this%icelltype(n) /= 0) then
903  if (hn < this%dis%top(n)) hntemp = this%dis%bot(m)
904  end if
905  else
906  if (this%icelltype(m) /= 0) then
907  if (hm < this%dis%top(m)) hmtemp = this%dis%bot(n)
908  end if
909  end if
910  end if
911  end if
912  !
913  ! -- Calculate flow positive into cell n
914  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 818 of file gwf-npf.f90.

819  ! -- dummy
820  class(GwfNpfType) :: this
821  integer(I4B), intent(in) :: n
822  real(DP), intent(in) :: hn
823  real(DP), intent(inout) :: thksat
824  !
825  ! -- Standard Formulation
826  if (hn >= this%dis%top(n)) then
827  thksat = done
828  else
829  thksat = (hn - this%dis%bot(n)) / (this%dis%top(n) - this%dis%bot(n))
830  end if
831  !
832  ! -- Newton-Raphson Formulation
833  if (this%inewton /= 0) then
834  thksat = squadraticsaturation(this%dis%top(n), this%dis%bot(n), hn, &
835  this%satomega)
836  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 2298 of file gwf-npf.f90.

2300  ! -- modules
2301  use tdismodule, only: kstp, kper
2302  ! -- dummy
2303  class(GwfNpfType) :: this
2304  integer(I4B), intent(in) :: icode
2305  integer(I4B), intent(inout) :: ncnvrt
2306  character(len=30), dimension(5), intent(inout) :: nodcnvrt
2307  character(len=3), dimension(5), intent(inout) :: acnvrt
2308  integer(I4B), intent(inout) :: ihdcnv
2309  integer(I4B), intent(in) :: kiter
2310  integer(I4B), intent(in) :: n
2311  ! -- local
2312  integer(I4B) :: l
2313  ! -- formats
2314  character(len=*), parameter :: fmtcnvtn = &
2315  "(1X,/1X,'CELL CONVERSIONS FOR ITER.=',I0, &
2316  &' STEP=',I0,' PERIOD=',I0,' (NODE or LRC)')"
2317  character(len=*), parameter :: fmtnode = "(1X,3X,5(A4, A20))"
2318  !
2319  ! -- Keep track of cell conversions
2320  if (icode > 0) then
2321  ncnvrt = ncnvrt + 1
2322  call this%dis%noder_to_string(n, nodcnvrt(ncnvrt))
2323  if (icode == 1) then
2324  acnvrt(ncnvrt) = 'DRY'
2325  else
2326  acnvrt(ncnvrt) = 'WET'
2327  end if
2328  end if
2329  !
2330  ! -- Print a line if 5 conversions have occurred or if icode indicates that a
2331  ! partial line should be printed
2332  if (ncnvrt == 5 .or. (icode == 0 .and. ncnvrt > 0)) then
2333  if (ihdcnv == 0) write (this%iout, fmtcnvtn) kiter, kstp, kper
2334  ihdcnv = 1
2335  write (this%iout, fmtnode) &
2336  (acnvrt(l), trim(adjustl(nodcnvrt(l))), l=1, ncnvrt)
2337  ncnvrt = 0
2338  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 2132 of file gwf-npf.f90.

2133  ! -- modules
2134  use tdismodule, only: kstp, kper
2136  use constantsmodule, only: linelength
2137  ! -- dummy
2138  class(GwfNpfType) :: this
2139  integer(I4B), intent(in) :: kiter
2140  real(DP), intent(inout), dimension(:) :: hnew
2141  ! -- local
2142  integer(I4B) :: n, m, ii, ihc
2143  real(DP) :: ttop, bbot, thick
2144  integer(I4B) :: ncnvrt, ihdcnv
2145  character(len=30), dimension(5) :: nodcnvrt
2146  character(len=30) :: nodestr
2147  character(len=3), dimension(5) :: acnvrt
2148  character(len=LINELENGTH) :: errmsg
2149  integer(I4B) :: irewet
2150  ! -- formats
2151  character(len=*), parameter :: fmtnct = &
2152  "(1X,/1X,'Negative cell thickness at (layer,row,col)', &
2153  &I4,',',I5,',',I5)"
2154  character(len=*), parameter :: fmttopbot = &
2155  &"(1X,'Top elevation, bottom elevation:',1P,2G13.5)"
2156  character(len=*), parameter :: fmttopbotthk = &
2157  &"(1X,'Top elevation, bottom elevation, thickness:',1P,3G13.5)"
2158  character(len=*), parameter :: fmtdrychd = &
2159  &"(1X,/1X,'CONSTANT-HEAD CELL WENT DRY -- SIMULATION ABORTED')"
2160  character(len=*), parameter :: fmtni = &
2161  &"(1X,'CELLID=',a,' ITERATION=',I0,' TIME STEP=',I0,' STRESS PERIOD=',I0)"
2162  !
2163  ! -- Initialize
2164  ncnvrt = 0
2165  ihdcnv = 0
2166  !
2167  ! -- Convert dry cells to wet
2168  do n = 1, this%dis%nodes
2169  do ii = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
2170  m = this%dis%con%ja(ii)
2171  ihc = this%dis%con%ihc(this%dis%con%jas(ii))
2172  call this%rewet_check(kiter, n, hnew(m), this%ibound(m), ihc, hnew, &
2173  irewet)
2174  if (irewet == 1) then
2175  call this%wdmsg(2, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2176  end if
2177  end do
2178  end do
2179  !
2180  ! -- Perform drying
2181  do n = 1, this%dis%nodes
2182  !
2183  ! -- cycle if inactive or confined
2184  if (this%ibound(n) == 0) cycle
2185  if (this%icelltype(n) == 0) cycle
2186  !
2187  ! -- check for negative cell thickness
2188  bbot = this%dis%bot(n)
2189  ttop = this%dis%top(n)
2190  if (bbot > ttop) then
2191  write (errmsg, fmtnct) n
2192  call store_error(errmsg)
2193  write (errmsg, fmttopbot) ttop, bbot
2194  call store_error(errmsg)
2195  call store_error_filename(this%input_fname)
2196  end if
2197  !
2198  ! -- Calculate saturated thickness
2199  if (this%icelltype(n) /= 0) then
2200  if (hnew(n) < ttop) ttop = hnew(n)
2201  end if
2202  thick = ttop - bbot
2203  !
2204  ! -- If thick<0 print message, set hnew, and ibound
2205  if (thick <= dzero) then
2206  call this%wdmsg(1, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2207  hnew(n) = this%hdry
2208  if (this%ibound(n) < 0) then
2209  errmsg = 'CONSTANT-HEAD CELL WENT DRY -- SIMULATION ABORTED'
2210  call store_error(errmsg)
2211  write (errmsg, fmttopbotthk) ttop, bbot, thick
2212  call store_error(errmsg)
2213  call this%dis%noder_to_string(n, nodestr)
2214  write (errmsg, fmtni) trim(adjustl(nodestr)), kiter, kstp, kper
2215  call store_error(errmsg)
2216  call store_error_filename(this%input_fname)
2217  end if
2218  this%ibound(n) = 0
2219  end if
2220  end do
2221  !
2222  ! -- Print remaining cell conversions
2223  call this%wdmsg(0, ncnvrt, nodcnvrt, acnvrt, ihdcnv, kiter, n)
2224  !
2225  ! -- Change ibound from 30000 to 1
2226  do n = 1, this%dis%nodes
2227  if (this%ibound(n) == 30000) this%ibound(n) = 1
2228  end do
Here is the call graph for this function:

◆ source_griddata()

subroutine gwfnpfmodule::source_griddata ( class(gwfnpftype this)

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

1570  ! -- modules
1571  use simmodule, only: count_errors, store_error
1575  ! -- dummy
1576  class(GwfNpftype) :: this
1577  ! -- locals
1578  character(len=LINELENGTH) :: errmsg
1579  type(GwfNpfParamFoundType) :: found
1580  logical, dimension(2) :: afound
1581  integer(I4B), dimension(:), pointer, contiguous :: map
1582  !
1583  ! -- set map to convert user input data into reduced data
1584  map => null()
1585  if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
1586  !
1587  ! -- update defaults with idm sourced values
1588  call mem_set_value(this%icelltype, 'ICELLTYPE', this%input_mempath, map, &
1589  found%icelltype)
1590  call mem_set_value(this%k11, 'K', this%input_mempath, map, found%k)
1591  call mem_set_value(this%k33, 'K33', this%input_mempath, map, found%k33)
1592  call mem_set_value(this%k22, 'K22', this%input_mempath, map, found%k22)
1593  call mem_set_value(this%wetdry, 'WETDRY', this%input_mempath, map, &
1594  found%wetdry)
1595  call mem_set_value(this%angle1, 'ANGLE1', this%input_mempath, map, &
1596  found%angle1)
1597  call mem_set_value(this%angle2, 'ANGLE2', this%input_mempath, map, &
1598  found%angle2)
1599  call mem_set_value(this%angle3, 'ANGLE3', this%input_mempath, map, &
1600  found%angle3)
1601  !
1602  ! -- ensure ICELLTYPE was found
1603  if (.not. found%icelltype) then
1604  write (errmsg, '(a)') 'Error in GRIDDATA block: ICELLTYPE not found.'
1605  call store_error(errmsg)
1606  end if
1607  !
1608  ! -- ensure K was found
1609  if (.not. found%k) then
1610  write (errmsg, '(a)') 'Error in GRIDDATA block: K not found.'
1611  call store_error(errmsg)
1612  end if
1613  !
1614  ! -- set error if ik33overk set with no k33
1615  if (.not. found%k33 .and. this%ik33overk /= 0) then
1616  write (errmsg, '(a)') 'K33OVERK option specified but K33 not specified.'
1617  call store_error(errmsg)
1618  end if
1619  !
1620  ! -- set error if ik22overk set with no k22
1621  if (.not. found%k22 .and. this%ik22overk /= 0) then
1622  write (errmsg, '(a)') 'K22OVERK option specified but K22 not specified.'
1623  call store_error(errmsg)
1624  end if
1625  !
1626  ! -- handle found side effects
1627  if (found%k33) this%ik33 = 1
1628  if (found%k22) this%ik22 = 1
1629  if (found%wetdry) this%iwetdry = 1
1630  if (found%angle1) this%iangle1 = 1
1631  if (found%angle2) this%iangle2 = 1
1632  if (found%angle3) this%iangle3 = 1
1633  !
1634  ! -- handle not found side effects
1635  if (.not. found%k33) then
1636  call mem_set_value(this%k33, 'K', this%input_mempath, map, afound(1))
1637  end if
1638  if (.not. found%k22) then
1639  call mem_set_value(this%k22, 'K', this%input_mempath, map, afound(2))
1640  end if
1641  if (.not. found%wetdry) call mem_reallocate(this%wetdry, 1, 'WETDRY', &
1642  trim(this%memoryPath))
1643  if (.not. found%angle1 .and. this%ixt3d == 0) &
1644  call mem_reallocate(this%angle1, 0, 'ANGLE1', trim(this%memoryPath))
1645  if (.not. found%angle2 .and. this%ixt3d == 0) &
1646  call mem_reallocate(this%angle2, 0, 'ANGLE2', trim(this%memoryPath))
1647  if (.not. found%angle3 .and. this%ixt3d == 0) &
1648  call mem_reallocate(this%angle3, 0, 'ANGLE3', trim(this%memoryPath))
1649  !
1650  ! -- log griddata
1651  if (this%iout > 0) then
1652  call this%log_griddata(found)
1653  end if
Here is the call graph for this function:

◆ source_options()

subroutine gwfnpfmodule::source_options ( class(gwfnpftype this)

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

1352  ! -- modules
1358  use sourcecommonmodule, only: filein_fname
1359  ! -- dummy
1360  class(GwfNpftype) :: this
1361  ! -- locals
1362  character(len=LENVARNAME), dimension(3) :: cellavg_method = &
1363  &[character(len=LENVARNAME) :: 'LOGARITHMIC', 'AMT-LMK', 'AMT-HMK']
1364  type(gwfnpfparamfoundtype) :: found
1365  character(len=LINELENGTH) :: tvk6_filename
1366  !
1367  ! -- update defaults with idm sourced values
1368  call mem_set_value(this%iprflow, 'IPRFLOW', this%input_mempath, found%iprflow)
1369  call mem_set_value(this%ipakcb, 'IPAKCB', this%input_mempath, found%ipakcb)
1370  call mem_set_value(this%icellavg, 'CELLAVG', this%input_mempath, &
1371  cellavg_method, found%cellavg)
1372  call mem_set_value(this%ithickstrt, 'ITHICKSTRT', this%input_mempath, &
1373  found%ithickstrt)
1374  call mem_set_value(this%ihighcellsat, 'IHIGHCELLSAT', this%input_mempath, &
1375  found%ihighcellsat)
1376  call mem_set_value(this%iperched, 'IPERCHED', this%input_mempath, &
1377  found%iperched)
1378  call mem_set_value(this%ivarcv, 'IVARCV', this%input_mempath, found%ivarcv)
1379  call mem_set_value(this%idewatcv, 'IDEWATCV', this%input_mempath, &
1380  found%idewatcv)
1381  call mem_set_value(this%ixt3d, 'IXT3D', this%input_mempath, found%ixt3d)
1382  call mem_set_value(this%ixt3drhs, 'IXT3DRHS', this%input_mempath, &
1383  found%ixt3drhs)
1384  call mem_set_value(this%isavspdis, 'ISAVSPDIS', this%input_mempath, &
1385  found%isavspdis)
1386  call mem_set_value(this%isavsat, 'ISAVSAT', this%input_mempath, found%isavsat)
1387  call mem_set_value(this%ik22overk, 'IK22OVERK', this%input_mempath, &
1388  found%ik22overk)
1389  call mem_set_value(this%ik33overk, 'IK33OVERK', this%input_mempath, &
1390  found%ik33overk)
1391  call mem_set_value(this%inewton, 'INEWTON', this%input_mempath, found%inewton)
1392  call mem_set_value(this%satomega, 'SATOMEGA', this%input_mempath, &
1393  found%satomega)
1394  call mem_set_value(this%irewet, 'IREWET', this%input_mempath, found%irewet)
1395  call mem_set_value(this%wetfct, 'WETFCT', this%input_mempath, found%wetfct)
1396  call mem_set_value(this%iwetit, 'IWETIT', this%input_mempath, found%iwetit)
1397  call mem_set_value(this%ihdwet, 'IHDWET', this%input_mempath, found%ihdwet)
1398  !
1399  ! -- save flows option active
1400  if (found%ipakcb) this%ipakcb = -1
1401  !
1402  ! -- xt3d active with rhs
1403  if (found%ixt3d .and. found%ixt3drhs) this%ixt3d = 2
1404  !
1405  ! -- save specific discharge active
1406  if (found%isavspdis) this%icalcspdis = this%isavspdis
1407  !
1408  ! -- no newton specified
1409  if (found%inewton) then
1410  this%inewton = 0
1411  this%iasym = 0
1412  end if
1413  !
1414  ! -- enforce 0 or 1 TVK6_FILENAME entries in option block
1415  if (filein_fname(tvk6_filename, 'TVK6_FILENAME', this%input_mempath, &
1416  this%input_fname)) then
1417  call openfile(this%intvk, this%iout, tvk6_filename, 'TVK')
1418  call tvk_cr(this%tvk, this%name_model, this%intvk, this%iout)
1419  end if
1420  !
1421  ! -- log options
1422  if (this%iout > 0) then
1423  call this%log_options(found)
1424  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 1196 of file gwf-npf.f90.

1197  ! -- modules
1199  ! -- dummy
1200  class(GwfNpftype) :: this
1201  integer(I4B), intent(in) :: ncells
1202  integer(I4B), intent(in) :: njas
1203  ! -- local
1204  integer(I4B) :: n
1205  !
1206  ! -- Retain copy of user-specified K arrays
1207  do n = 1, ncells
1208  this%k11input(n) = this%k11(n)
1209  this%k22input(n) = this%k22(n)
1210  this%k33input(n) = this%k33(n)
1211  end do