MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
gwfsfrcrosssectionutilsmodule Module Reference

This module contains stateless sfr subroutines and functions. More...

Functions/Subroutines

real(dp) function, public get_saturated_topwidth (npts, stations)
 Calculate the saturated top width for a reach. More...
 
real(dp) function, public get_wetted_topwidth (npts, stations, heights, d)
 Calculate the wetted top width for a reach. More...
 
real(dp) function get_wet_vert_face (n, npts, heights, d, leftface)
 Calculate wetted vertical height. More...
 
real(dp) function, public get_wetted_perimeter (npts, stations, heights, d)
 Calculate the wetted perimeter for a reach. More...
 
real(dp) function, public get_cross_section_area (npts, stations, heights, d)
 Calculate the cross-sectional area for a reach. More...
 
real(dp) function, public get_hydraulic_radius (npts, stations, heights, d)
 Calculate the hydraulic radius for a reach. More...
 
real(dp) function, public get_mannings_section (npts, stations, heights, roughfracs, roughness, conv_fact, slope, d)
 Calculate the manning's discharge for a reach. More...
 
subroutine determine_vert_neighbors (npts, stations, heights, leftv, rightv)
 Determine vertical segments. More...
 
subroutine get_wetted_perimeters (npts, stations, heights, d, p)
 Calculate the wetted perimeters for each line segment. More...
 
subroutine get_cross_section_areas (npts, stations, heights, d, a)
 Calculate the cross-sectional areas for each line segment. More...
 
subroutine get_wetted_topwidths (npts, stations, heights, d, w)
 Calculate the wetted top widths for each line segment. More...
 
pure subroutine get_wetted_station (x0, x1, d0, d1, dmax, dmin, d)
 Calculate the station values for the wetted portion of the cross-section. More...
 

Detailed Description

This module contains the functions to calculate the wetted perimeter and cross-sectional area for a reach cross-section that are used in the streamflow routing (SFR) package. It also contains subroutines to calculate the wetted perimeter and cross-sectional area for each line segment in the cross-section. This module does not depend on the SFR package.

Function/Subroutine Documentation

◆ determine_vert_neighbors()

subroutine gwfsfrcrosssectionutilsmodule::determine_vert_neighbors ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations,
real(dp), dimension(npts), intent(in)  heights,
logical, dimension(npts - 1), intent(inout)  leftv,
logical, dimension(npts - 1), intent(inout)  rightv 
)
private

Subroutine to cycle through each segment (npts - 1) and determine whether neighboring segments are vertically-oriented.

Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)
[in]heightscross-section height data

Definition at line 313 of file SfrCrossSectionUtils.f90.

314  ! -- dummy
315  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
316  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
317  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
318  logical, dimension(npts - 1), intent(inout) :: leftv
319  logical, dimension(npts - 1), intent(inout) :: rightv
320  ! -- local
321  integer(I4B) :: n
322  !
323  ! -- default neighboring segments to false unless determined otherwise
324  ! o 2 pt x-section has 1 segment (no neighbors to eval)
325  ! o 3+ pt x-section has at the very least one neighbor to eval
326  do n = 1, npts - 1
327  leftv(n) = .false.
328  rightv(n) = .false.
329  ! -- left neighbor
330  if (n > 1) then
331  if (stations(n - 1) == stations(n) .and. heights(n - 1) > heights(n)) then
332  leftv(n) = .true.
333  end if
334  end if
335  ! -- right neighbor
336  if (n < npts - 1) then
337  if (stations(n + 2) == stations(n + 1) .and. &
338  heights(n + 2) > heights(n + 1)) then
339  rightv(n) = .true.
340  end if
341  end if
342  end do
343  !
344  ! -- return
345  return
Here is the caller graph for this function:

◆ get_cross_section_area()

real(dp) function, public gwfsfrcrosssectionutilsmodule::get_cross_section_area ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations,
real(dp), dimension(npts), intent(in)  heights,
real(dp), intent(in)  d 
)

Function to calculate the cross-sectional area for a reach using the cross-section station-height data given a passed depth.

Returns
a cross-sectional area
Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)
[in]heightscross-section height data
[in]ddepth to evaluate cross-section

Definition at line 160 of file SfrCrossSectionUtils.f90.

161  ! -- dummy variables
162  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
163  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
164  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
165  real(DP), intent(in) :: d !< depth to evaluate cross-section
166  ! -- local variables
167  integer(I4B) :: n
168  real(DP) :: a
169  real(DP), dimension(npts - 1) :: areas
170  !
171  ! -- initialize the area
172  a = dzero
173  !
174  ! -- calculate the cross-sectional area for each line segment
175  call get_cross_section_areas(npts, stations, heights, d, areas)
176  !
177  ! -- calculate the cross-sectional area
178  do n = 1, npts - 1
179  a = a + areas(n)
180  end do
181  !
182  ! -- return
183  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_cross_section_areas()

subroutine gwfsfrcrosssectionutilsmodule::get_cross_section_areas ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations,
real(dp), dimension(npts), intent(in)  heights,
real(dp), intent(in)  d,
real(dp), dimension(npts - 1), intent(inout)  a 
)
private

Subroutine to calculate the cross-sectional area for each line segment that defines the reach using the cross-section station-height data given a passed depth.

Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)
[in]heightscross-section height data
[in]ddepth to evaluate cross-section
[in,out]across-sectional area for each line segment

Definition at line 439 of file SfrCrossSectionUtils.f90.

440  ! -- dummy variables
441  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
442  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
443  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
444  real(DP), intent(in) :: d !< depth to evaluate cross-section
445  real(DP), dimension(npts - 1), intent(inout) :: a !< cross-sectional area for each line segment
446  ! -- local variables
447  integer(I4B) :: n
448  real(DP) :: x0
449  real(DP) :: x1
450  real(DP) :: d0
451  real(DP) :: d1
452  real(DP) :: dmax
453  real(DP) :: dmin
454  real(DP) :: xlen
455  !
456  ! -- iterate over the station-height data
457  do n = 1, npts - 1
458  !
459  ! -- initialize the cross-sectional area
460  a(n) = dzero
461  !
462  ! -- initialize station-height data for segment
463  x0 = stations(n)
464  x1 = stations(n + 1)
465  d0 = heights(n)
466  d1 = heights(n + 1)
467  !
468  ! -- get the start and end station position of the wetted segment
469  call get_wetted_station(x0, x1, d0, d1, dmax, dmin, d)
470  !
471  ! -- calculate the cross-sectional area for the segment
472  xlen = x1 - x0
473  if (xlen > dzero) then
474  !
475  ! -- add the area above dmax
476  if (d > dmax) then
477  a(n) = xlen * (d - dmax)
478  end if
479  !
480  ! -- add the area below dmax
481  if (dmax /= dmin .and. d > dmin) then
482  if (d < dmax) then
483  a(n) = a(n) + dhalf * (d - dmin) * xlen
484  else
485  a(n) = a(n) + dhalf * (dmax - dmin) * xlen
486  end if
487  end if
488  end if
489  end do
490  !
491  ! -- return
492  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_hydraulic_radius()

real(dp) function, public gwfsfrcrosssectionutilsmodule::get_hydraulic_radius ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations,
real(dp), dimension(npts), intent(in)  heights,
real(dp), intent(in)  d 
)

Function to calculate the hydraulic radius for a reach using the cross-section station-height data given a passed depth.

Returns
r hydraulic radius
Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)
[in]heightscross-section height data
[in]ddepth to evaluate cross-section

Definition at line 193 of file SfrCrossSectionUtils.f90.

194  ! -- dummy variables
195  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
196  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
197  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
198  real(DP), intent(in) :: d !< depth to evaluate cross-section
199  ! -- local variables
200  integer(I4B) :: n
201  real(DP) :: r
202  real(DP) :: p
203  real(DP) :: a
204  real(DP), dimension(npts - 1) :: areas
205  real(DP), dimension(npts - 1) :: perimeters
206  !
207  ! -- initialize the hydraulic radius, perimeter, and area
208  r = dzero
209  p = dzero
210  a = dzero
211  !
212  ! -- calculate the wetted perimeter for each line segment
213  call get_wetted_perimeters(npts, stations, heights, d, perimeters)
214  !
215  ! -- calculate the wetted perimenter
216  do n = 1, npts - 1
217  p = p + perimeters(n)
218  end do
219  !
220  ! -- calculate the hydraulic radius only if the perimeter is non-zero
221  if (p > dzero) then
222  !
223  ! -- calculate the cross-sectional area for each line segment
224  call get_cross_section_areas(npts, stations, heights, d, areas)
225  !
226  ! -- calculate the cross-sectional area
227  do n = 1, npts - 1
228  a = a + areas(n)
229  end do
230  !
231  ! -- calculate the hydraulic radius
232  r = a / p
233  end if
234  !
235  ! -- return
236  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_mannings_section()

real(dp) function, public gwfsfrcrosssectionutilsmodule::get_mannings_section ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations,
real(dp), dimension(npts), intent(in)  heights,
real(dp), dimension(npts), intent(in)  roughfracs,
real(dp), intent(in)  roughness,
real(dp), intent(in)  conv_fact,
real(dp), intent(in)  slope,
real(dp), intent(in)  d 
)

Function to calculate the mannings discharge for a reach by calculating the discharge for each section, which can have a unique Manning's coefficient given a passed depth.

Returns
q reach discharge
Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)
[in]heightscross-section height data
[in]roughfracscross-section Mannings roughness fraction data
[in]roughnessbase reach roughness
[in]conv_factunit conversion factor
[in]slopereach slope
[in]ddepth to evaluate cross-section

Definition at line 247 of file SfrCrossSectionUtils.f90.

249  ! -- dummy variables
250  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
251  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
252  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
253  real(DP), dimension(npts), intent(in) :: roughfracs !< cross-section Mannings roughness fraction data
254  real(DP), intent(in) :: roughness !< base reach roughness
255  real(DP), intent(in) :: conv_fact !< unit conversion factor
256  real(DP), intent(in) :: slope !< reach slope
257  real(DP), intent(in) :: d !< depth to evaluate cross-section
258  ! -- local variables
259  integer(I4B) :: n
260  real(DP) :: q
261  real(DP) :: rh
262  real(DP) :: r
263  real(DP) :: p
264  real(DP) :: a
265  real(DP), dimension(npts - 1) :: areas
266  real(DP), dimension(npts - 1) :: perimeters
267  !
268  ! -- initialize the hydraulic radius, perimeter, and area
269  q = dzero
270  rh = dzero
271  r = dzero
272  p = dzero
273  a = dzero
274  !
275  ! -- calculate the wetted perimeter for each line segment
276  call get_wetted_perimeters(npts, stations, heights, d, perimeters)
277  !
278  ! -- calculate the wetted perimenter
279  do n = 1, npts - 1
280  p = p + perimeters(n)
281  end do
282  !
283  ! -- calculate the hydraulic radius only if the perimeter is non-zero
284  if (p > dzero) then
285  !
286  ! -- calculate the cross-sectional area for each line segment
287  call get_cross_section_areas(npts, stations, heights, d, areas)
288  !
289  ! -- calculate the cross-sectional area
290  do n = 1, npts - 1
291  p = perimeters(n)
292  r = roughness * roughfracs(n)
293  if (p * r > dzero) then
294  a = areas(n)
295  rh = a / p
296  q = q + conv_fact * a * rh**dtwothirds * sqrt(slope) / r
297  end if
298  end do
299  end if
300  !
301  ! -- return
302  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_saturated_topwidth()

real(dp) function, public gwfsfrcrosssectionutilsmodule::get_saturated_topwidth ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations 
)

Function to calculate the maximum top width for a reach using the cross-section station data.

Returns
w saturated top width
Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)

Definition at line 34 of file SfrCrossSectionUtils.f90.

35  ! -- dummy variables
36  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
37  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
38  ! -- local variables
39  real(DP) :: w
40  !
41  ! -- calculate the saturated top width
42  if (npts > 1) then
43  w = stations(npts) - stations(1)
44  else
45  w = stations(1)
46  end if
47  !
48  ! -- return
49  return
Here is the caller graph for this function:

◆ get_wet_vert_face()

real(dp) function gwfsfrcrosssectionutilsmodule::get_wet_vert_face ( integer(i4b), intent(in)  n,
integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  heights,
real(dp), intent(in)  d,
logical, intent(in)  leftface 
)
private

For segments flanked by vertically-oriented neighboring segments, return the length of the submerged, vertically-oriented, neighboring face

Parameters
[in]nindex to be evaluated
[in]nptslength of heights vector
[in]heightscross-section height data
Returns
vertically wetted face length

Definition at line 91 of file SfrCrossSectionUtils.f90.

92  ! -- dummy
93  integer(I4B), intent(in) :: n !< index to be evaluated
94  integer(I4B), intent(in) :: npts !< length of heights vector
95  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
96  real(DP), intent(in) :: d
97  logical, intent(in) :: leftface
98  ! -- local
99  real(DP) :: vwf !< vertically wetted face length
100  !
101  ! -- calculate the vertically-oriented wetted face length
102  if (leftface) then
103  if (heights(n - 1) > d) then
104  vwf = d - heights(n)
105  else if (heights(n - 1) > heights(n)) then
106  vwf = heights(n - 1) - heights(n)
107  end if
108  else
109  if (heights(n + 2) > d) then
110  vwf = d - heights(n + 1)
111  else if (heights(n + 2) > heights(n + 1)) then
112  vwf = heights(n + 2) - heights(n + 1)
113  end if
114  end if
115  !
116  ! -- return
117  return
Here is the caller graph for this function:

◆ get_wetted_perimeter()

real(dp) function, public gwfsfrcrosssectionutilsmodule::get_wetted_perimeter ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations,
real(dp), dimension(npts), intent(in)  heights,
real(dp), intent(in)  d 
)

Function to calculate the wetted perimeter for a reach using the cross-section station-height data given a passed depth.

Returns
p wetted perimeter
Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)
[in]heightscross-section height data
[in]ddepth to evaluate cross-section

Definition at line 127 of file SfrCrossSectionUtils.f90.

128  ! -- dummy variables
129  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
130  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
131  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
132  real(DP), intent(in) :: d !< depth to evaluate cross-section
133  ! -- local variables
134  integer(I4B) :: n
135  real(DP) :: p
136  real(DP), dimension(npts - 1) :: perimeters
137  !
138  ! -- initialize the wetted perimeter for the reach
139  p = dzero
140  !
141  ! -- calculate the wetted perimeter for each line segment
142  call get_wetted_perimeters(npts, stations, heights, d, perimeters)
143  !
144  ! -- calculate the wetted perimenter
145  do n = 1, npts - 1
146  p = p + perimeters(n)
147  end do
148  !
149  ! -- return
150  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_wetted_perimeters()

subroutine gwfsfrcrosssectionutilsmodule::get_wetted_perimeters ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations,
real(dp), dimension(npts), intent(in)  heights,
real(dp), intent(in)  d,
real(dp), dimension(npts - 1), intent(inout)  p 
)
private

Subroutine to calculate the wetted perimeter for each line segment that defines the reach using the cross-section station-height data given a passed depth.

Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)
[in]heightscross-section height data
[in]ddepth to evaluate cross-section
[in,out]pwetted perimeter for each line segment

Definition at line 355 of file SfrCrossSectionUtils.f90.

356  ! -- dummy variables
357  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
358  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
359  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
360  real(DP), intent(in) :: d !< depth to evaluate cross-section
361  real(DP), dimension(npts - 1), intent(inout) :: p !< wetted perimeter for each line segment
362  ! -- local variables
363  integer(I4B) :: n
364  real(DP) :: x0
365  real(DP) :: x1
366  real(DP) :: d0
367  real(DP) :: d1
368  real(DP) :: dmax
369  real(DP) :: dmin
370  real(DP) :: xlen
371  real(DP) :: dlen
372  logical, dimension(npts - 1) :: leftv, rightv
373  !
374  ! -- set neighbor status
375  call determine_vert_neighbors(npts, stations, heights, leftv, rightv)
376  !
377  ! -- iterate over the station-height data
378  do n = 1, npts - 1
379  !
380  ! -- initialize the wetted perimeter
381  p(n) = dzero
382  !
383  ! -- initialize station-height data for segment
384  x0 = stations(n)
385  x1 = stations(n + 1)
386  d0 = heights(n)
387  d1 = heights(n + 1)
388  !
389  ! -- get the start and end station position of the wetted segment
390  call get_wetted_station(x0, x1, d0, d1, dmax, dmin, d)
391  !
392  ! -- calculate the wetted perimeter for the segment
393  ! - bottom wetted length
394  xlen = x1 - x0
395  dlen = dzero
396  if (xlen > dzero) then
397  if (d > dmax) then
398  dlen = dmax - dmin
399  else
400  dlen = d - dmin
401  end if
402  else
403  if (d > dmin) then
404  dlen = min(d, dmax) - dmin
405  else
406  dlen = dzero
407  end if
408  end if
409  p(n) = sqrt(xlen**dtwo + dlen**dtwo)
410  !
411  ! -- if neighboring segments are vertical, account for their
412  ! contribution to wetted perimeter
413  !
414  ! left neighbor (if applicable)
415  if (n > 1) then
416  if (leftv(n)) then
417  p(n) = p(n) + get_wet_vert_face(n, npts, heights, d, .true.)
418  end if
419  end if
420  ! right neighbor (if applicable)
421  if (n < npts - 1) then
422  if (rightv(n)) then
423  p(n) = p(n) + get_wet_vert_face(n, npts, heights, d, .false.)
424  end if
425  end if
426  end do
427  !
428  ! -- return
429  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_wetted_station()

pure subroutine gwfsfrcrosssectionutilsmodule::get_wetted_station ( real(dp), intent(inout)  x0,
real(dp), intent(inout)  x1,
real(dp), intent(in)  d0,
real(dp), intent(in)  d1,
real(dp), intent(inout)  dmax,
real(dp), intent(inout)  dmin,
real(dp), intent(in)  d 
)
private

Subroutine to calculate the station values that define the extent of the wetted portion of the cross section for a line segment. The left (x0) and right (x1) station positions are altered if the passed depth is less than the maximum line segment depth. If the line segment is dry the left and right station are equal. Otherwise the wetted station values are equal to the full line segment or smaller if the passed depth is less than the maximum line segment depth.

Parameters
[in,out]x0left station position
[in,out]x1right station position
[in]d0depth at the left station
[in]d1depth at the right station
[in,out]dmaxmaximum depth
[in,out]dminminimum depth
[in]ddepth to evaluate cross-section

Definition at line 549 of file SfrCrossSectionUtils.f90.

550  ! -- dummy variables
551  real(DP), intent(inout) :: x0 !< left station position
552  real(DP), intent(inout) :: x1 !< right station position
553  real(DP), intent(in) :: d0 !< depth at the left station
554  real(DP), intent(in) :: d1 !< depth at the right station
555  real(DP), intent(inout) :: dmax !< maximum depth
556  real(DP), intent(inout) :: dmin !< minimum depth
557  real(DP), intent(in) :: d !< depth to evaluate cross-section
558  ! -- local variables
559  real(DP) :: xlen
560  real(DP) :: dlen
561  real(DP) :: slope
562  real(DP) :: dx
563  real(DP) :: xt
564  real(DP) :: xt0
565  real(DP) :: xt1
566  !
567  ! -- calculate the minimum and maximum depth
568  dmin = min(d0, d1)
569  dmax = max(d0, d1)
570  !
571  ! -- if d is less than or equal to the minimum value the
572  ! station length (xlen) is zero
573  if (d <= dmin) then
574  x1 = x0
575  ! -- if d is between dmin and dmax station length is less
576  ! than d1 - d0
577  else if (d < dmax) then
578  xlen = x1 - x0
579  dlen = d1 - d0
580  if (abs(dlen) > dzero) then
581  slope = xlen / dlen
582  else
583  slope = dzero
584  end if
585  if (d0 > d1) then
586  dx = (d - d1) * slope
587  xt = x1 + dx
588  xt0 = xt
589  xt1 = x1
590  else
591  dx = (d - d0) * slope
592  xt = x0 + dx
593  xt0 = x0
594  xt1 = xt
595  end if
596  x0 = xt0
597  x1 = xt1
598  end if
599  !
600  ! -- return
601  return
Here is the caller graph for this function:

◆ get_wetted_topwidth()

real(dp) function, public gwfsfrcrosssectionutilsmodule::get_wetted_topwidth ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations,
real(dp), dimension(npts), intent(in)  heights,
real(dp), intent(in)  d 
)

Function to calculate the wetted top width for a reach using the cross-section station-height data given a passed depth.

Returns
w wetted top width
Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)
[in]heightscross-section height data
[in]ddepth to evaluate cross-section

Definition at line 59 of file SfrCrossSectionUtils.f90.

60  ! -- dummy variables
61  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
62  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
63  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
64  real(DP), intent(in) :: d !< depth to evaluate cross-section
65  ! -- local variables
66  integer(I4B) :: n
67  real(DP) :: w
68  real(DP), dimension(npts - 1) :: widths
69  !
70  ! -- initialize the wetted perimeter for the reach
71  w = dzero
72  !
73  ! -- calculate the wetted top width for each line segment
74  call get_wetted_topwidths(npts, stations, heights, d, widths)
75  !
76  ! -- calculate the wetted top widths
77  do n = 1, npts - 1
78  w = w + widths(n)
79  end do
80  !
81  ! -- return
82  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_wetted_topwidths()

subroutine gwfsfrcrosssectionutilsmodule::get_wetted_topwidths ( integer(i4b), intent(in)  npts,
real(dp), dimension(npts), intent(in)  stations,
real(dp), dimension(npts), intent(in)  heights,
real(dp), intent(in)  d,
real(dp), dimension(npts - 1), intent(inout)  w 
)
private

Subroutine to calculate the wetted top width for each line segment that defines the reach using the cross-section station-height data given a passed depth.

Parameters
[in]nptsnumber of station-height data for a reach
[in]stationscross-section station distances (x-distance)
[in]heightscross-section height data
[in]ddepth to evaluate cross-section
[in,out]wwetted top widths for each line segment

Definition at line 502 of file SfrCrossSectionUtils.f90.

503  ! -- dummy variables
504  integer(I4B), intent(in) :: npts !< number of station-height data for a reach
505  real(DP), dimension(npts), intent(in) :: stations !< cross-section station distances (x-distance)
506  real(DP), dimension(npts), intent(in) :: heights !< cross-section height data
507  real(DP), intent(in) :: d !< depth to evaluate cross-section
508  real(DP), dimension(npts - 1), intent(inout) :: w !< wetted top widths for each line segment
509  ! -- local variables
510  integer(I4B) :: n
511  real(DP) :: x0
512  real(DP) :: x1
513  real(DP) :: d0
514  real(DP) :: d1
515  real(DP) :: dmax
516  real(DP) :: dmin
517  !
518  ! -- iterate over the station-height data
519  do n = 1, npts - 1
520  !
521  ! -- initialize station-height data for segment
522  x0 = stations(n)
523  x1 = stations(n + 1)
524  d0 = heights(n)
525  d1 = heights(n + 1)
526  !
527  ! -- get the start and end station position of the wetted segment
528  call get_wetted_station(x0, x1, d0, d1, dmax, dmin, d)
529  !
530  ! -- calculate the wetted top width for the segment
531  w(n) = x1 - x0
532  end do
533  !
534  ! -- return
535  return
Here is the call graph for this function:
Here is the caller graph for this function: