MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwfconductanceutilsmodule Module Reference

This module contains stateless conductance functions. More...

Enumerations

enum  { ccond_hmean = 0 , ccond_lmean = 1 , ccond_amtlmk = 2 , ccond_amthmk = 3 }
 enumerator that defines the conductance options More...

Functions/Subroutines

real(dp) function, public hcond (ibdn, ibdm, ictn, ictm, iupstream, ihc, icellavg, condsat, hn, hm, satn, satm, hkn, hkm, topn, topm, botn, botm, cln, clm, fawidth)
 Horizontal conductance between two cells.
real(dp) function convertible_upstream (hn, hm, satn, satm, condsat)
 Convertible cell(s) with upstream weighted horizontal conductance.
real(dp) function convertible_standard (ihc, icellavg, satn, satm, hkn, hkm, topn, topm, botn, botm, cln, clm, fawidth)
 Convertible cell(s) with standard weighted horizontal conductance.
real(dp) function, public vcond (ibdn, ibdm, ictn, ictm, inewton, ivarcv, idewatcv, condsat, hn, hm, vkn, vkm, satn, satm, topn, topm, botn, botm, flowarea)
 Vertical conductance between two cells.
real(dp) function, public condmean (k1, k2, thick1, thick2, cl1, cl2, width, iavgmeth)
 Calculate the conductance between two cells.
real(dp) function logmean (d1, d2)
 Calculate the the logarithmic mean of two double precision numbers.
real(dp) function, public thksatnm (ibdn, ibdm, ictn, ictm, iupstream, ihc, hn, hm, satn, satm, topn, topm, botn, botm)
 Calculate wetted cell thickness at interface between two cells.
real(dp) function, public staggered_thkfrac (top, bot, sat, topc, botc)
 Calculate the thickness fraction for staggered grids.
real(dp) function, public flow_area (ihc, hwva, top, bot, sat, topc, botc)
 Calculate the saturated flow area of a cell for a connection.

Detailed Description

This module contains the functions to calculate the horizontal and vertical conductance between two cells that are used in the the node property flow (NPF) package. It also contains functions to calculate the wetted cell fraction. This module does not depend on the NPF package.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ccond_hmean 

Harmonic mean.

ccond_lmean 

Logarithmic mean.

ccond_amtlmk 

Arithmetic-mean thickness and logarithmic-mean hydraulic conductivity.

ccond_amthmk 

Arithmetic-mean thickness and harmonic-mean hydraulic conductivity.

Definition at line 28 of file GwfConductanceUtils.f90.

Function/Subroutine Documentation

◆ condmean()

real(dp) function, public gwfconductanceutilsmodule::condmean ( real(dp), intent(in) k1,
real(dp), intent(in) k2,
real(dp), intent(in) thick1,
real(dp), intent(in) thick2,
real(dp), intent(in) cl1,
real(dp), intent(in) cl2,
real(dp), intent(in) width,
integer(i4b), intent(in) iavgmeth )
Returns
mean conductance between two cells
Parameters
[in]k1hydraulic conductivity for cell n (in the direction of cell m)
[in]k2hydraulic conductivity for cell m (in the direction of celln)
[in]thick1saturated thickness for cell 1
[in]thick2saturated thickness for cell 2
[in]cl1distance from the center of cell n to the shared face with cell m
[in]cl2distance from the center of cell m to the shared face with cell n
[in]widthwidth of cell perpendicular to flow
[in]iavgmethaveraging method

Definition at line 241 of file GwfConductanceUtils.f90.

242 ! return variable
243 real(DP) :: condmean !< mean conductance between two cells
244 ! dummy
245 real(DP), intent(in) :: k1 !< hydraulic conductivity for cell n (in the direction of cell m)
246 real(DP), intent(in) :: k2 !< hydraulic conductivity for cell m (in the direction of celln)
247 real(DP), intent(in) :: thick1 !< saturated thickness for cell 1
248 real(DP), intent(in) :: thick2 !< saturated thickness for cell 2
249 real(DP), intent(in) :: cl1 !< distance from the center of cell n to the shared face with cell m
250 real(DP), intent(in) :: cl2 !< distance from the center of cell m to the shared face with cell n
251 real(DP), intent(in) :: width !< width of cell perpendicular to flow
252 integer(I4B), intent(in) :: iavgmeth !< averaging method
253 ! local
254 real(DP) :: t1
255 real(DP) :: t2
256 real(DP) :: tmean
257 real(DP) :: kmean
258 real(DP) :: denom
259 !
260 ! Initialize
261 t1 = k1 * thick1
262 t2 = k2 * thick2
263
264 ! Averaging method
265 select case (iavgmeth)
266
267 case (ccond_hmean)
268 if (t1 * t2 > dzero) then
269 condmean = width * t1 * t2 / (t1 * cl2 + t2 * cl1)
270 else
271 condmean = dzero
272 end if
273
274 case (ccond_lmean)
275 if (t1 * t2 > dzero) then
276 tmean = logmean(t1, t2)
277 else
278 tmean = dzero
279 end if
280 condmean = tmean * width / (cl1 + cl2)
281
282 case (ccond_amtlmk)
283 if (k1 * k2 > dzero) then
284 kmean = logmean(k1, k2)
285 else
286 kmean = dzero
287 end if
288 condmean = kmean * dhalf * (thick1 + thick2) * width / (cl1 + cl2)
289
290 case (ccond_amthmk)
291 denom = (k1 * cl2 + k2 * cl1)
292 if (denom > dzero) then
293 kmean = k1 * k2 / denom
294 else
295 kmean = dzero
296 end if
297 condmean = kmean * dhalf * (thick1 + thick2) * width
298 end select
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convertible_standard()

real(dp) function gwfconductanceutilsmodule::convertible_standard ( integer(i4b), intent(in) ihc,
integer(i4b), intent(in) icellavg,
real(dp), intent(in) satn,
real(dp), intent(in) satm,
real(dp), intent(in) hkn,
real(dp), intent(in) hkm,
real(dp), intent(in) topn,
real(dp), intent(in) topm,
real(dp), intent(in) botn,
real(dp), intent(in) botm,
real(dp), intent(in) cln,
real(dp), intent(in) clm,
real(dp), intent(in) fawidth )
private
Returns
horizontal conductance between two cells
Parameters
[in]ihcconnection type
[in]icellavgcell averaging option
[in]satncell n wetted cell fraction
[in]satmcell m wetted cell fraction
[in]hknhorizontal hydraulic conductivity for cell n (in the direction of cell m)
[in]hkmhorizontal hydraulic conductivity for cell m (in the direction of cell n)
[in]topntop of cell n
[in]topmtop of cell m
[in]botnbottom of cell n
[in]botmbottom of cell m
[in]clndistance from the center of cell n to the shared face with cell m
[in]clmdistance from the center of cell m to the shared face with cell n
[in]fawidthwidth of cell perpendicular to flow

Definition at line 118 of file GwfConductanceUtils.f90.

121 ! return variable
122 real(DP) :: condnm !< horizontal conductance between two cells
123 ! dummy
124 integer(I4B), intent(in) :: ihc !< connection type
125 integer(I4B), intent(in) :: icellavg !< cell averaging option
126 real(DP), intent(in) :: satn !< cell n wetted cell fraction
127 real(DP), intent(in) :: satm !< cell m wetted cell fraction
128 real(DP), intent(in) :: hkn !< horizontal hydraulic conductivity for cell n (in the direction of cell m)
129 real(DP), intent(in) :: hkm !< horizontal hydraulic conductivity for cell m (in the direction of cell n)
130 real(DP), intent(in) :: topn !< top of cell n
131 real(DP), intent(in) :: topm !< top of cell m
132 real(DP), intent(in) :: botn !< bottom of cell n
133 real(DP), intent(in) :: botm !< bottom of cell m
134 real(DP), intent(in) :: cln !< distance from the center of cell n to the shared face with cell m
135 real(DP), intent(in) :: clm !< distance from the center of cell m to the shared face with cell n
136 real(DP), intent(in) :: fawidth !< width of cell perpendicular to flow
137 ! local
138 real(DP) :: thksatn
139 real(DP) :: thksatm
140
141 if (ihc == c3d_staggered) then
142 thksatn = staggered_thkfrac(topn, botn, satn, topm, botm)
143 thksatm = staggered_thkfrac(topm, botm, satm, topn, botn)
144 else
145 thksatn = satn * (topn - botn)
146 thksatm = satm * (topm - botm)
147 end if
148 condnm = condmean(hkn, hkm, thksatn, thksatm, cln, clm, &
149 fawidth, icellavg)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convertible_upstream()

real(dp) function gwfconductanceutilsmodule::convertible_upstream ( real(dp), intent(in) hn,
real(dp), intent(in) hm,
real(dp), intent(in) satn,
real(dp), intent(in) satm,
real(dp), intent(in) condsat )
private
Returns
horizontal conductance between two cells
Parameters
[in]condsatsaturated conductance
[in]hncell n head
[in]hmcell m head
[in]satncell n wetted cell fraction
[in]satmcell m wetted cell fraction

Definition at line 91 of file GwfConductanceUtils.f90.

93 ! return variable
94 real(DP) :: condnm !< horizontal conductance between two cells
95 ! dummy
96 real(DP), intent(in) :: condsat !< saturated conductance
97 real(DP), intent(in) :: hn !< cell n head
98 real(DP), intent(in) :: hm !< cell m head
99 real(DP), intent(in) :: satn !< cell n wetted cell fraction
100 real(DP), intent(in) :: satm !< cell m wetted cell fraction
101 ! local
102 real(DP) :: sat_up
103
104 if (hn > hm) then
105 sat_up = satn
106 else if (hm > hn) then
107 sat_up = satm
108 else
109 ! equal heads have no upstream cell; use the larger saturation so the
110 ! result does not depend on cell order
111 sat_up = max(satn, satm)
112 end if
113 condnm = sat_up * condsat
Here is the caller graph for this function:

◆ flow_area()

real(dp) function, public gwfconductanceutilsmodule::flow_area ( integer(i4b), intent(in) ihc,
real(dp), intent(in) hwva,
real(dp), intent(in) top,
real(dp), intent(in) bot,
real(dp), intent(in) sat,
real(dp), intent(in) topc,
real(dp), intent(in) botc )

Vertical connections use the connection area. Horizontal connections use the connection width times the cell's saturated thickness, limited to the overlap with the connected cell for vertically staggered connections.

Returns
saturated flow area for cell
Parameters
[in]ihcconnection type
[in]hwvaconnection area or width
[in]toptop of cell
[in]botbottom of cell
[in]satcell saturation
[in]topctop of connected cell
[in]botcbottom of connected cell

Definition at line 419 of file GwfConductanceUtils.f90.

420 ! return variable
421 real(DP) :: res !< saturated flow area for cell
422 ! dummy
423 integer(I4B), intent(in) :: ihc !< connection type
424 real(DP), intent(in) :: hwva !< connection area or width
425 real(DP), intent(in) :: top !< top of cell
426 real(DP), intent(in) :: bot !< bottom of cell
427 real(DP), intent(in) :: sat !< cell saturation
428 real(DP), intent(in) :: topc !< top of connected cell
429 real(DP), intent(in) :: botc !< bottom of connected cell
430 ! local
431 real(DP) :: thksat
432
433 if (ihc == c3d_vertical) then
434 res = hwva
435 else
436 if (ihc == c3d_staggered) then
437 thksat = staggered_thkfrac(top, bot, sat, topc, botc)
438 else
439 thksat = (top - bot) * sat
440 end if
441 res = thksat * hwva
442 end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hcond()

real(dp) function, public gwfconductanceutilsmodule::hcond ( integer(i4b), intent(in) ibdn,
integer(i4b), intent(in) ibdm,
integer(i4b), intent(in) ictn,
integer(i4b), intent(in) ictm,
integer(i4b), intent(in) iupstream,
integer(i4b), intent(in) ihc,
integer(i4b), intent(in) icellavg,
real(dp), intent(in) condsat,
real(dp), intent(in) hn,
real(dp), intent(in) hm,
real(dp), intent(in) satn,
real(dp), intent(in) satm,
real(dp), intent(in) hkn,
real(dp), intent(in) hkm,
real(dp), intent(in) topn,
real(dp), intent(in) topm,
real(dp), intent(in) botn,
real(dp), intent(in) botm,
real(dp), intent(in) cln,
real(dp), intent(in) clm,
real(dp), intent(in) fawidth )

This function uses a weighted transmissivity in the harmonic mean conductance calculations. This differs from the MODFLOW-NWT and MODFLOW-USG conductance calculations for the Newton-Raphson formulation which use a weighted hydraulic conductivity.

Returns
horizontal conductance between two cells
Parameters
[in]ibdncell n active flag
[in]ibdmcell m active flag
[in]ictncell n convertible cell flag
[in]ictmcell m convertible cell flag
[in]iupstreamflag for upstream weighting
[in]ihcconnection type
[in]icellavgcell averaging option
[in]condsatsaturated conductance
[in]hncell n head
[in]hmcell m head
[in]satncell n wetted cell fraction
[in]satmcell m wetted cell fraction
[in]hknhorizontal hydraulic conductivity for cell n (in the direction of cell m)
[in]hkmhorizontal hydraulic conductivity for cell m (in the direction of cell n)
[in]topntop of cell n
[in]topmtop of cell m
[in]botnbottom of cell n
[in]botmbottom of cell m
[in]clndistance from the center of cell n to the shared face with cell m
[in]clmdistance from the center of cell m to the shared face with cell n
[in]fawidthwidth of cell perpendicular to flow

Definition at line 44 of file GwfConductanceUtils.f90.

48 ! return variable
49 real(DP) :: condnm !< horizontal conductance between two cells
50 ! dummy
51 integer(I4B), intent(in) :: ibdn !< cell n active flag
52 integer(I4B), intent(in) :: ibdm !< cell m active flag
53 integer(I4B), intent(in) :: ictn !< cell n convertible cell flag
54 integer(I4B), intent(in) :: ictm !< cell m convertible cell flag
55 integer(I4B), intent(in) :: iupstream !< flag for upstream weighting
56 integer(I4B), intent(in) :: ihc !< connection type
57 integer(I4B), intent(in) :: icellavg !< cell averaging option
58 real(DP), intent(in) :: condsat !< saturated conductance
59 real(DP), intent(in) :: hn !< cell n head
60 real(DP), intent(in) :: hm !< cell m head
61 real(DP), intent(in) :: satn !< cell n wetted cell fraction
62 real(DP), intent(in) :: satm !< cell m wetted cell fraction
63 real(DP), intent(in) :: hkn !< horizontal hydraulic conductivity for cell n (in the direction of cell m)
64 real(DP), intent(in) :: hkm !< horizontal hydraulic conductivity for cell m (in the direction of cell n)
65 real(DP), intent(in) :: topn !< top of cell n
66 real(DP), intent(in) :: topm !< top of cell m
67 real(DP), intent(in) :: botn !< bottom of cell n
68 real(DP), intent(in) :: botm !< bottom of cell m
69 real(DP), intent(in) :: cln !< distance from the center of cell n to the shared face with cell m
70 real(DP), intent(in) :: clm !< distance from the center of cell m to the shared face with cell n
71 real(DP), intent(in) :: fawidth !< width of cell perpendicular to flow
72
73 ! n or m is inactive
74 if (ibdn == 0 .or. ibdm == 0) then
75 condnm = dzero
76 ! both cells are non-convertible
77 elseif (ictn == 0 .and. ictm == 0) then
78 condnm = condsat
79 else if (iupstream == 1) then
80 condnm = convertible_upstream(hn, hm, satn, satm, condsat)
81 else
82 condnm = convertible_standard(ihc, icellavg, &
83 satn, satm, hkn, hkm, &
84 topn, topm, botn, botm, &
85 cln, clm, fawidth)
86 end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ logmean()

real(dp) function gwfconductanceutilsmodule::logmean ( real(dp), intent(in) d1,
real(dp), intent(in) d2 )
private

Use an approximation if the ratio is near 1

Returns
logarithmic mean for two number
Parameters
[in]d1first number
[in]d2second number

Definition at line 305 of file GwfConductanceUtils.f90.

306 ! return variable
307 real(DP) :: logmean !< logarithmic mean for two number
308 ! dummy
309 real(DP), intent(in) :: d1 !< first number
310 real(DP), intent(in) :: d2 !< second number
311 ! local
312 real(DP) :: drat
313
314 drat = d2 / d1
315 if (drat <= dlnlow .or. drat >= dlnhigh) then
316 logmean = (d2 - d1) / log(drat)
317 else
318 logmean = dhalf * (d1 + d2)
319 end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ staggered_thkfrac()

real(dp) function, public gwfconductanceutilsmodule::staggered_thkfrac ( real(dp) top,
real(dp) bot,
real(dp) sat,
real(dp) topc,
real(dp) botc )
Returns
staggered thickness fraction for cell
Parameters
toptop of cell
botbottom of cell
satcell saturation
topctop of connected cell
botcbottom of connected cells

Definition at line 392 of file GwfConductanceUtils.f90.

393 ! return variable
394 real(DP) :: res !< staggered thickness fraction for cell
395 ! dummy
396 real(DP) :: top !< top of cell
397 real(DP) :: bot !< bottom of cell
398 real(DP) :: sat !< cell saturation
399 real(DP) :: topc !< top of connected cell
400 real(DP) :: botc !< bottom of connected cells
401 ! local
402 real(DP) :: sill_top
403 real(DP) :: sill_bot
404 real(DP) :: tp
405
406 sill_top = min(top, topc)
407 sill_bot = max(bot, botc)
408 tp = bot + sat * (top - bot)
409 res = max(min(tp, sill_top) - sill_bot, dzero)
Here is the caller graph for this function:

◆ thksatnm()

real(dp) function, public gwfconductanceutilsmodule::thksatnm ( integer(i4b), intent(in) ibdn,
integer(i4b), intent(in) ibdm,
integer(i4b), intent(in) ictn,
integer(i4b), intent(in) ictm,
integer(i4b), intent(in) iupstream,
integer(i4b), intent(in) ihc,
real(dp), intent(in) hn,
real(dp), intent(in) hm,
real(dp), intent(in) satn,
real(dp), intent(in) satm,
real(dp), intent(in) topn,
real(dp), intent(in) topm,
real(dp), intent(in) botn,
real(dp), intent(in) botm )
Returns
wetted cell thickness for connection nm
Parameters
[in]ibdncell n active flag
[in]ibdmcell m active flag
[in]ictncell n convertible cell flag
[in]ictmcell m convertible cell flag
[in]iupstreamflag for upstream weighting
[in]ihcconnection type
[in]hncell n head
[in]hmcell m head
[in]satncell n wetted cell fraction
[in]satmcell m wetted cell fraction
[in]topntop of cell n
[in]topmtop of cell m
[in]botnbottom of cell n
[in]botmbottom of cell m

Definition at line 324 of file GwfConductanceUtils.f90.

326 ! return variable
327 real(DP) :: res !< wetted cell thickness for connection nm
328 ! dummy
329 integer(I4B), intent(in) :: ibdn !< cell n active flag
330 integer(I4B), intent(in) :: ibdm !< cell m active flag
331 integer(I4B), intent(in) :: ictn !< cell n convertible cell flag
332 integer(I4B), intent(in) :: ictm !< cell m convertible cell flag
333 integer(I4B), intent(in) :: iupstream !< flag for upstream weighting
334 integer(I4B), intent(in) :: ihc !< connection type
335 real(DP), intent(in) :: hn !< cell n head
336 real(DP), intent(in) :: hm !< cell m head
337 real(DP), intent(in) :: satn !< cell n wetted cell fraction
338 real(DP), intent(in) :: satm !< cell m wetted cell fraction
339 real(DP), intent(in) :: topn !< top of cell n
340 real(DP), intent(in) :: topm !< top of cell m
341 real(DP), intent(in) :: botn !< bottom of cell n
342 real(DP), intent(in) :: botm !< bottom of cell m
343 ! local
344 real(DP) :: thksatn
345 real(DP) :: thksatm
346 real(DP) :: sill_top
347 real(DP) :: sill_bot
348 !
349 ! n or m is inactive
350 if (ibdn == 0 .or. ibdm == 0) then
351 res = dzero
352 !
353 ! both cells are non-convertible
354 elseif (ictn == 0 .and. ictm == 0) then
355 if (ihc == c3d_staggered) then
356 sill_top = min(topn, topm)
357 sill_bot = max(botn, botm)
358
359 thksatn = max(sill_top - sill_bot, dzero)
360 thksatm = thksatn
361 else
362 thksatn = topn - botn
363 thksatm = topm - botm
364 end if
365 res = dhalf * (thksatn + thksatm)
366 !
367 ! At least one of the cells is convertible
368 elseif (iupstream == 1) then
369 if (hn > hm) then
370 res = satn * (topn - botn)
371 else if (hm > hn) then
372 res = satm * (topm - botm)
373 else
374 res = max(satn * (topn - botn), satm * (topm - botm))
375 end if
376 !
377 ! At least one of the cells is convertible and not upstream weighted
378 else
379 if (ihc == c3d_staggered) then
380 thksatn = staggered_thkfrac(topn, botn, satn, topm, botm)
381 thksatm = staggered_thkfrac(topm, botm, satm, topn, botn)
382 else
383 thksatn = satn * (topn - botn)
384 thksatm = satm * (topm - botm)
385 end if
386 res = dhalf * (thksatn + thksatm)
387 end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vcond()

real(dp) function, public gwfconductanceutilsmodule::vcond ( integer(i4b), intent(in) ibdn,
integer(i4b), intent(in) ibdm,
integer(i4b), intent(in) ictn,
integer(i4b), intent(in) ictm,
integer(i4b), intent(in) inewton,
integer(i4b), intent(in) ivarcv,
integer(i4b), intent(in) idewatcv,
real(dp), intent(in) condsat,
real(dp), intent(in) hn,
real(dp), intent(in) hm,
real(dp), intent(in) vkn,
real(dp), intent(in) vkm,
real(dp), intent(in) satn,
real(dp), intent(in) satm,
real(dp), intent(in) topn,
real(dp), intent(in) topm,
real(dp), intent(in) botn,
real(dp), intent(in) botm,
real(dp), intent(in) flowarea )
Parameters
[in]ibdncell n active flag
[in]ibdmcell m active flag
[in]ictncell n convertible cell flag
[in]ictmcell m convertible cell flag
[in]inewtonflag for Newton-Raphson formulation
[in]ivarcvvariable vertical conductance flag
[in]idewatcvdewatered vertical conductance flag
[in]condsatsaturated conductance
[in]hncell n head
[in]hmcell m head
[in]vknvertical hydraulic conductivity for cell n (in the direction of cell m)
[in]vkmvertical hydraulic conductivity for cell m (in the direction of cell n)
[in]satncell n wetted cell fraction
[in]satmcell m wetted cell fraction
[in]topntop of cell n
[in]topmtop of cell m
[in]botnbottom of cell n
[in]botmbottom of cell m
[in]flowareaflow area between cell n and m

Definition at line 154 of file GwfConductanceUtils.f90.

157 ! return variable
158 real(DP) :: condnm
159 ! dummy
160 integer(I4B), intent(in) :: ibdn !< cell n active flag
161 integer(I4B), intent(in) :: ibdm !< cell m active flag
162 integer(I4B), intent(in) :: ictn !< cell n convertible cell flag
163 integer(I4B), intent(in) :: ictm !< cell m convertible cell flag
164 integer(I4B), intent(in) :: inewton !< flag for Newton-Raphson formulation
165 integer(I4B), intent(in) :: ivarcv !< variable vertical conductance flag
166 integer(I4B), intent(in) :: idewatcv !< dewatered vertical conductance flag
167 real(DP), intent(in) :: condsat !< saturated conductance
168 real(DP), intent(in) :: hn !< cell n head
169 real(DP), intent(in) :: hm !< cell m head
170 real(DP), intent(in) :: vkn !< vertical hydraulic conductivity for cell n (in the direction of cell m)
171 real(DP), intent(in) :: vkm !< vertical hydraulic conductivity for cell m (in the direction of cell n)
172 real(DP), intent(in) :: satn !< cell n wetted cell fraction
173 real(DP), intent(in) :: satm !< cell m wetted cell fraction
174 real(DP), intent(in) :: topn !< top of cell n
175 real(DP), intent(in) :: topm !< top of cell m
176 real(DP), intent(in) :: botn !< bottom of cell n
177 real(DP), intent(in) :: botm !< bottom of cell m
178 real(DP), intent(in) :: flowarea !< flow area between cell n and m
179 ! local
180 real(DP) :: satntmp
181 real(DP) :: satmtmp
182 real(DP) :: bovk1
183 real(DP) :: bovk2
184 real(DP) :: denom
185 !
186 ! Either n or m is inactive
187 if (ibdn == 0 .or. ibdm == 0) then
188 condnm = dzero
189 !
190 ! constantcv
191 elseif (ivarcv == 0) then
192 condnm = condsat
193 !
194 ! both cells are non-convertible
195 elseif (ictn == 0 .and. ictm == 0) then
196 condnm = condsat
197 !
198 ! both cells are fully saturated
199 elseif (hn >= topn .and. hm >= topm) then
200 condnm = condsat
201 !
202 ! At least one cell is partially saturated, so recalculate vertical
203 ! conductance for this connection
204 ! todo: upstream weighting?
205 else
206 !
207 ! Default is for CV correction (dewatered option); use underlying
208 ! saturation of 1.
209 satntmp = satn
210 satmtmp = satm
211 if (idewatcv == 0) then
212 if (botn > botm) then
213 satmtmp = done
214 else
215 satntmp = done
216 end if
217 else
218 if (botn > botm) then
219 if (satmtmp < done) then
220 satmtmp = dzero
221 end if
222 else
223 if (satntmp < done) then
224 satntmp = dzero
225 end if
226 end if
227 end if
228 bovk1 = satntmp * (topn - botn) * dhalf / vkn
229 bovk2 = satmtmp * (topm - botm) * dhalf / vkm
230 denom = (bovk1 + bovk2)
231 if (denom /= dzero) then
232 condnm = flowarea / denom
233 else
234 condnm = dzero
235 end if
236 end if
Here is the caller graph for this function: