MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
swf-cxs.f90
Go to the documentation of this file.
1 ! The SwfCxsType package is assigned for a model
2 ! and can be used to calculate wetted area, wetted
3 ! perimeter, hydraulic radius, composite roughness, etc.
4 ! even if the user doesn't specify a CXS Package.
6 
7  use kindmodule, only: dp, i4b, lgp
11  use simvariablesmodule, only: errmsg
12  use simmodule, only: store_error
14  use basedismodule, only: disbasetype
15 
16  implicit none
17  private
18  public :: swfcxstype, cxs_cr
19 
20  type, extends(numericalpackagetype) :: swfcxstype
21 
22  ! provided as input
23  integer(I4B), pointer :: nsections => null() !< number of cross section
24  integer(I4B), pointer :: npoints => null() !< total number of cross-section points
25  integer(I4B), dimension(:), pointer, contiguous :: idcxs => null() !< cross section id number, size nsections
26  integer(I4B), dimension(:), pointer, contiguous :: nxspoints => null() !< number of cross section points for section, size nsections
27  real(dp), dimension(:), pointer, contiguous :: xfraction => null() !< cross-section relative x distance, of size npoints
28  real(dp), dimension(:), pointer, contiguous :: height => null() !< cross-section heights, of size npoints
29  real(dp), dimension(:), pointer, contiguous :: manfraction => null() !< cross-section roughness data, of size npoints
30 
31  ! calculated from input
32  integer(I4B), dimension(:), pointer, contiguous :: iacross => null() !< pointers to cross-section data for each section, of size nsections + 1
33 
34  contains
35 
36  procedure :: allocate_scalars
37  procedure :: allocate_arrays
38  procedure :: source_options
39  procedure :: log_options
40  procedure :: source_dimensions
41  procedure :: log_dimensions
42  procedure :: source_packagedata
43  procedure :: log_packagedata
45  procedure :: log_crosssectiondata
46  procedure :: cxs_da
48  procedure :: get_area
49  procedure :: get_wetted_perimeter => cxs_wetted_perimeter
50  procedure :: get_roughness
51  procedure :: get_conveyance => cxs_conveyance
52  procedure :: get_hydraulic_radius
53  procedure :: write_cxs_table
54 
55  end type swfcxstype
56 
57 contains
58 
59  !> @brief create package
60  !<
61  subroutine cxs_cr(pobj, name_model, input_mempath, inunit, iout, dis)
62  ! -- modules
64  ! -- dummy
65  type(swfcxstype), pointer :: pobj
66  character(len=*), intent(in) :: name_model
67  character(len=*), intent(in) :: input_mempath
68  integer(I4B), intent(in) :: inunit
69  integer(I4B), intent(in) :: iout
70  class(disbasetype), pointer, intent(inout) :: dis !< the pointer to the discretization
71  ! -- locals
72  logical(LGP) :: found_fname
73  ! -- formats
74  character(len=*), parameter :: fmtheader = &
75  "(1x, /1x, 'CXS -- CROSS SECTION PACKAGE, VERSION 1, 5/24/2023', &
76  &' INPUT READ FROM MEMPATH: ', A, /)"
77  !
78  ! -- Create the object
79  allocate (pobj)
80 
81  ! -- create name and memory path
82  call pobj%set_names(1, name_model, 'CXS', 'CXS')
83 
84  ! -- Allocate scalars
85  call pobj%allocate_scalars()
86 
87  ! -- Set variables
88  pobj%input_mempath = input_mempath
89  pobj%inunit = inunit
90  pobj%iout = iout
91  pobj%dis => dis
92 
93  ! -- set name of input file
94  call mem_set_value(pobj%input_fname, 'INPUT_FNAME', pobj%input_mempath, &
95  found_fname)
96 
97  ! -- check if package is enabled
98  if (inunit > 0) then
99 
100  ! -- Print a message identifying the package.
101  write (iout, fmtheader) input_mempath
102 
103  ! -- source options
104  call pobj%source_options()
105 
106  ! -- source dimensions
107  call pobj%source_dimensions()
108 
109  ! -- allocate arrays
110  call pobj%allocate_arrays()
111 
112  ! -- source dimensions
113  call pobj%source_packagedata()
114 
115  ! -- source dimensions
116  call pobj%source_crosssectiondata()
117 
118  end if
119  end subroutine cxs_cr
120 
121  !> @ brief Allocate scalars
122  !!
123  !! Allocate and initialize scalars for the package. The base model
124  !! allocate scalars method is also called.
125  !!
126  !<
127  subroutine allocate_scalars(this)
128  ! -- modules
129  ! -- dummy
130  class(swfcxstype) :: this
131  !
132  ! -- allocate scalars in NumericalPackageType
133  call this%NumericalPackageType%allocate_scalars()
134  !
135  ! -- Allocate scalars
136  call mem_allocate(this%nsections, 'NSECTIONS', this%memoryPath)
137  call mem_allocate(this%npoints, 'NPOINTS', this%memoryPath)
138 
139  ! -- initialize
140  this%nsections = 0
141  this%npoints = 0
142  end subroutine allocate_scalars
143 
144  !> @brief Copy options from IDM into package
145  !<
146  subroutine source_options(this)
147  ! -- modules
148  use kindmodule, only: lgp
152  ! -- dummy
153  class(swfcxstype) :: this
154  ! -- locals
155  character(len=LENMEMPATH) :: idmMemoryPath
156  type(swfcxsparamfoundtype) :: found
157  !
158  ! -- set memory path
159  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
160  !
161  ! -- update defaults with idm sourced values
162  call mem_set_value(this%iprpak, 'PRINT_INPUT', idmmemorypath, &
163  found%iprpak)
164  !
165  ! -- log values to list file
166  if (this%iout > 0) then
167  call this%log_options(found)
168  end if
169  end subroutine source_options
170 
171  !> @brief Write user options to list file
172  !<
173  subroutine log_options(this, found)
175  class(swfcxstype) :: this
176  type(swfcxsparamfoundtype), intent(in) :: found
177 
178  write (this%iout, '(1x,a)') 'Setting CXS Options'
179 
180  if (found%iprpak) then
181  write (this%iout, '(4x,a)') 'Package information will be printed.'
182  end if
183 
184  write (this%iout, '(1x,a,/)') 'End Setting CXS Options'
185 
186  end subroutine log_options
187 
188  !> @brief Copy options from IDM into package
189  !<
190  subroutine source_dimensions(this)
191  ! -- modules
192  use kindmodule, only: lgp
196  ! -- dummy
197  class(swfcxstype) :: this
198  ! -- locals
199  character(len=LENMEMPATH) :: idmMemoryPath
200  type(swfcxsparamfoundtype) :: found
201  !
202  ! -- set memory path
203  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
204  !
205  ! -- update defaults with idm sourced values
206  call mem_set_value(this%nsections, 'NSECTIONS', idmmemorypath, &
207  found%nsections)
208  call mem_set_value(this%npoints, 'NPOINTS', idmmemorypath, &
209  found%npoints)
210  !
211  ! -- ensure nsections was found
212  if (.not. found%nsections) then
213  write (errmsg, '(a)') 'Error in DIMENSIONS block: NSECTIONS not found.'
214  call store_error(errmsg)
215  end if
216  !
217  ! -- ensure npoints was found
218  if (.not. found%npoints) then
219  write (errmsg, '(a)') 'Error in DIMENSIONS block: NPOINTS not found.'
220  call store_error(errmsg)
221  end if
222  !
223  ! -- log values to list file
224  if (this%iout > 0) then
225  call this%log_dimensions(found)
226  end if
227  end subroutine source_dimensions
228 
229  !> @brief Write user options to list file
230  !<
231  subroutine log_dimensions(this, found)
233  class(swfcxstype) :: this
234  type(swfcxsparamfoundtype), intent(in) :: found
235 
236  write (this%iout, '(1x,a)') 'Setting CXS Dimensions'
237 
238  if (found%nsections) then
239  write (this%iout, '(4x,a)') 'NSECTIONS set from input file.'
240  end if
241 
242  if (found%npoints) then
243  write (this%iout, '(4x,a)') 'NPOINTS set from input file.'
244  end if
245 
246  write (this%iout, '(1x,a,/)') 'End Setting CXS Dimensions'
247 
248  end subroutine log_dimensions
249 
250  !> @brief allocate memory for arrays
251  !<
252  subroutine allocate_arrays(this)
253  ! -- dummy
254  class(swfcxstype) :: this
255  ! -- locals
256  integer(I4B) :: n
257  !
258  ! -- arrays allocation
259  call mem_allocate(this%idcxs, this%nsections, &
260  'IDCXS', this%memoryPath)
261  call mem_allocate(this%nxspoints, this%nsections, &
262  'NXSPOINTS', this%memoryPath)
263  call mem_allocate(this%xfraction, this%npoints, &
264  'XFRACTION', this%memoryPath)
265  call mem_allocate(this%height, this%npoints, &
266  'HEIGHT', this%memoryPath)
267  call mem_allocate(this%manfraction, this%npoints, &
268  'MANFRACTION', this%memoryPath)
269  call mem_allocate(this%iacross, this%nsections + 1, &
270  'IACROSS', this%memoryPath)
271 
272  ! -- initialization
273  do n = 1, this%nsections
274  this%idcxs(n) = 0
275  this%nxspoints(n) = 0
276  end do
277  do n = 1, this%npoints
278  this%xfraction(n) = dzero
279  this%height(n) = dzero
280  this%manfraction(n) = dzero
281  end do
282  do n = 1, this%nsections + 1
283  this%iacross(n) = 0
284  end do
285  end subroutine allocate_arrays
286 
287  !> @brief Copy options from IDM into package
288  !<
289  subroutine source_packagedata(this)
290  ! -- modules
291  use kindmodule, only: lgp
295  ! -- dummy
296  class(swfcxstype) :: this
297  ! -- locals
298  character(len=LENMEMPATH) :: idmMemoryPath
299  type(swfcxsparamfoundtype) :: found
300  !
301  ! -- set memory path
302  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
303  !
304  ! -- update defaults with idm sourced values
305  call mem_set_value(this%idcxs, 'IDCXS', idmmemorypath, &
306  found%idcxs)
307  call mem_set_value(this%nxspoints, 'NXSPOINTS', idmmemorypath, &
308  found%nxspoints)
309  !
310  ! -- ensure idcxs was found
311  if (.not. found%idcxs) then
312  write (errmsg, '(a)') 'Error in PACKAGEDATA block: IDCXS not found.'
313  call store_error(errmsg)
314  end if
315  !
316  ! -- ensure nxspoints was found
317  if (.not. found%nxspoints) then
318  write (errmsg, '(a)') 'Error in PACKAGEDATA block: NXSPOINTS not found.'
319  call store_error(errmsg)
320  end if
321  !
322  ! -- log values to list file
323  if (this%iout > 0) then
324  call this%log_packagedata(found)
325  end if
326  !
327  ! -- Calculate the iacross index array using nxspoints
328  call calc_iacross(this%nxspoints, this%iacross)
329  end subroutine source_packagedata
330 
331  !> @brief Calculate index pointer array iacross from nxspoints
332  !<
333  subroutine calc_iacross(nxspoints, iacross)
334  integer(I4B), dimension(:), intent(in) :: nxspoints
335  integer(I4B), dimension(:), intent(inout) :: iacross
336  integer(I4B) :: n
337  iacross(1) = 1
338  do n = 1, size(nxspoints)
339  iacross(n + 1) = iacross(n) + nxspoints(n)
340  end do
341  end subroutine calc_iacross
342 
343  !> @brief Write user packagedata to list file
344  !<
345  subroutine log_packagedata(this, found)
347  class(swfcxstype) :: this
348  type(swfcxsparamfoundtype), intent(in) :: found
349 
350  write (this%iout, '(1x,a)') 'Setting CXS Package Data'
351 
352  if (found%idcxs) then
353  write (this%iout, '(4x,a)') 'IDCXS set from input file.'
354  end if
355 
356  if (found%nxspoints) then
357  write (this%iout, '(4x,a)') 'NXSPOINTS set from input file.'
358  end if
359 
360  write (this%iout, '(1x,a,/)') 'End Setting CXS Package Data'
361 
362  end subroutine log_packagedata
363 
364  !> @brief Copy options from IDM into package
365  !<
366  subroutine source_crosssectiondata(this)
367  ! -- modules
368  use kindmodule, only: lgp
372  ! -- dummy
373  class(swfcxstype) :: this
374  ! -- locals
375  character(len=LENMEMPATH) :: idmMemoryPath
376  type(swfcxsparamfoundtype) :: found
377  !
378  ! -- set memory path
379  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
380  !
381  ! -- update defaults with idm sourced values
382  call mem_set_value(this%xfraction, 'XFRACTION', idmmemorypath, &
383  found%xfraction)
384  call mem_set_value(this%height, 'HEIGHT', idmmemorypath, &
385  found%height)
386  call mem_set_value(this%manfraction, 'MANFRACTION', idmmemorypath, &
387  found%manfraction)
388  !
389  ! -- ensure xfraction was found
390  if (.not. found%xfraction) then
391  write (errmsg, '(a)') &
392  'Error in CROSSSECTIONDATA block: xfraction not found.'
393  call store_error(errmsg)
394  end if
395  !
396  ! -- ensure height was found
397  if (.not. found%height) then
398  write (errmsg, '(a)') &
399  'Error in CROSSSECTIONDATA block: HEIGHT not found.'
400  call store_error(errmsg)
401  end if
402  !
403  ! -- ensure manfraction was found
404  if (.not. found%manfraction) then
405  write (errmsg, '(a)') &
406  'Error in CROSSSECTIONDATA block: MANFRACTION not found.'
407  call store_error(errmsg)
408  end if
409  !
410  ! -- log values to list file
411  if (this%iout > 0) then
412  call this%log_crosssectiondata(found)
413  end if
414  end subroutine source_crosssectiondata
415 
416  !> @brief Write user packagedata to list file
417  !<
418  subroutine log_crosssectiondata(this, found)
420  class(swfcxstype) :: this
421  type(swfcxsparamfoundtype), intent(in) :: found
422 
423  write (this%iout, '(1x,a)') 'Setting CXS Cross Section Data'
424 
425  if (found%xfraction) then
426  write (this%iout, '(4x,a)') 'XFRACTION set from input file.'
427  end if
428 
429  if (found%height) then
430  write (this%iout, '(4x,a)') 'HEIGHT set from input file.'
431  end if
432 
433  if (found%manfraction) then
434  write (this%iout, '(4x,a)') 'MANFRACTION set from input file.'
435  end if
436 
437  write (this%iout, '(1x,a,/)') 'End Setting CXS Cross Section Data'
438 
439  end subroutine log_crosssectiondata
440 
441  subroutine write_cxs_table(this, idcxs, width, slope, rough, unitconv)
442  ! -- module
443  use sortmodule, only: qsort, unique_values
444  ! -- dummy
445  class(swfcxstype) :: this
446  integer(I4B), intent(in) :: idcxs
447  real(DP), intent(in) :: width
448  real(DP), intent(in) :: slope
449  real(DP), intent(in) :: rough
450  real(DP), intent(in) :: unitconv
451  ! -- local
452  integer(I4B) :: ipt
453  real(DP) :: d
454  real(DP) :: a
455  real(DP) :: rh
456  real(DP) :: wp
457  real(DP) :: r
458  real(DP) :: c
459  real(DP) :: q
460  integer(I4B) :: i0
461  integer(I4B) :: i1
462  integer(I4B) :: npts
463  integer(I4B) :: icalcmeth
464  real(DP), dimension(:), allocatable :: depths
465  real(DP), dimension(:), allocatable :: depths_unique
466  integer(I4B), dimension(:), allocatable :: indx
467 
468  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
469 
470  if (npts > 0) then
471 
472  write (this%iout, *) 'Processing information for cross section ', idcxs
473  write (this%iout, *) 'Depth Area WettedP HydRad Rough Conveyance Q'
474 
475  allocate (depths(npts))
476  allocate (indx(size(depths)))
477 
478  depths(:) = this%height(:)
479  call qsort(indx, depths)
480  call unique_values(depths, depths_unique)
481 
482  do ipt = 1, size(depths_unique)
483  d = depths_unique(ipt)
484  a = this%get_area(idcxs, width, d)
485  wp = this%get_wetted_perimeter(idcxs, width, d)
486  rh = this%get_hydraulic_radius(idcxs, width, d, a)
487  r = this%get_roughness(idcxs, width, d, rough, slope)
488  c = this%get_conveyance(idcxs, width, d, rough)
489  if (slope > dzero) then
490  q = unitconv * c * sqrt(slope)
491  else
492  q = dzero
493  end if
494  write (this%iout, *) d, a, wp, rh, r, c, q
495  end do
496 
497  deallocate (depths)
498  deallocate (depths_unique)
499  write (this%iout, *) 'Done processing information for cross section ', idcxs
500 
501  end if
502  end subroutine write_cxs_table
503 
504  !> @brief deallocate memory
505  !<
506  subroutine cxs_da(this)
507  ! -- modules
511  ! -- dummy
512  class(swfcxstype) :: this
513  !
514  ! -- Deallocate input memory
515  call memorystore_remove(this%name_model, 'CXS', idm_context)
516  !
517  ! -- Scalars
518  call mem_deallocate(this%nsections)
519  call mem_deallocate(this%npoints)
520  !
521  ! -- Deallocate arrays if the package was created
522  ! from an input file
523  if (this%inunit > 0) then
524  call mem_deallocate(this%idcxs)
525  call mem_deallocate(this%nxspoints)
526  call mem_deallocate(this%xfraction)
527  call mem_deallocate(this%height)
528  call mem_deallocate(this%manfraction)
529  call mem_deallocate(this%iacross)
530  end if
531  !
532  ! -- deallocate parent
533  call this%NumericalPackageType%da()
534  end subroutine cxs_da
535 
536  subroutine get_cross_section_info(this, idcxs, i0, i1, npts, icalcmeth)
537  ! -- dummy
538  class(swfcxstype) :: this
539  integer(I4B), intent(in) :: idcxs !< cross section id number
540  integer(I4B), intent(inout) :: i0 !< starting cross section point number
541  integer(I4B), intent(inout) :: i1 !< ending cross section point number
542  integer(I4B), intent(inout) :: npts !< number of points in cross section
543  integer(I4B), intent(inout) :: icalcmeth !< calculation method for mannings roughness
544  ! -- local
545  !
546  ! -- Return npts = 0 if this package does not have input file
547  if (this%inunit == 0 .or. idcxs == 0) then
548  npts = 0
549  i0 = 1
550  i1 = 1
551  icalcmeth = 0
552  else
553  !
554  ! -- If the cross section id is 0, then it is a hydraulically wide channel,
555  ! and only width and rough are needed (not xfraction, height, and manfraction)
556  if (idcxs > 0) then
557  i0 = this%iacross(idcxs)
558  i1 = this%iacross(idcxs + 1) - 1
559  else
560  i0 = 1
561  i1 = 1
562  end if
563  ! set icalcmeth based on number of cross section points
564  npts = i1 - i0 + 1
565  icalcmeth = 0 ! linear composite mannings resistance
566  if (npts > 4) then
567  icalcmeth = 0 ! sum q by cross section segments
568  end if
569  end if
570  end subroutine get_cross_section_info
571 
572  function get_area(this, idcxs, width, depth) result(area)
573  ! -- modules
575  ! -- dummy
576  class(swfcxstype) :: this
577  integer(I4B), intent(in) :: idcxs !< cross section id
578  real(dp), intent(in) :: width !< width in reach
579  real(dp), intent(in) :: depth !< stage in reach
580  ! -- local
581  real(dp) :: area
582  integer(I4B) :: i0
583  integer(I4B) :: i1
584  integer(I4B) :: npts
585  integer(I4B) :: icalcmeth
586  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
587  if (npts == 0) then
588  area = width * depth
589  else
590  area = get_cross_section_area(npts, &
591  this%xfraction(i0:i1), &
592  this%height(i0:i1), &
593  width, depth)
594  end if
595  end function get_area
596 
597  function cxs_wetted_perimeter(this, idcxs, width, depth) result(wp)
598  ! -- modules
600  ! -- dummy
601  class(swfcxstype) :: this
602  integer(I4B), intent(in) :: idcxs !< cross section id
603  real(dp), intent(in) :: width !< width in reach
604  real(dp), intent(in) :: depth !< stage in reach
605  ! -- local
606  real(dp) :: wp
607  integer(I4B) :: i0
608  integer(I4B) :: i1
609  integer(I4B) :: npts
610  integer(I4B) :: icalcmeth
611  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
612  if (npts == 0) then
613  wp = width
614  else
615  wp = get_wetted_perimeter(npts, &
616  this%xfraction(i0:i1), &
617  this%height(i0:i1), &
618  width, depth)
619  end if
620  end function cxs_wetted_perimeter
621 
622  function get_roughness(this, idcxs, width, depth, rough, &
623  slope) result(roughc)
624  ! -- modules
626  ! -- dummy
627  class(swfcxstype) :: this
628  integer(I4B), intent(in) :: idcxs !< cross section id
629  real(dp), intent(in) :: width !< width in reach
630  real(dp), intent(in) :: depth !< stage in reach
631  real(dp), intent(in) :: rough !< mannings value provided for the reach
632  real(dp), intent(in) :: slope !< slope value provided for the reach
633  ! -- local
634  real(dp) :: roughc !< calculated composite roughness
635  integer(I4B) :: i0
636  integer(I4B) :: i1
637  integer(I4B) :: npts
638  integer(I4B) :: icalcmeth
639  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
640  if (npts == 0) then
641  roughc = rough
642  else
643  roughc = calc_composite_roughness(npts, &
644  depth, &
645  width, &
646  rough, &
647  slope, &
648  this%xfraction(i0:i1), &
649  this%height(i0:i1), &
650  this%manfraction(i0:i1), &
651  icalcmeth)
652  end if
653  end function get_roughness
654 
655  !> @brief Calculate and return conveyance
656  !!
657  !! Conveyance = area * hydraulic_radius ** (2/3) / mannings_roughness
658  !! If idcxs = 0 (no cross section specified) then reach is
659  !< hydraulically wide and hydraulic radius is equal to depth.
660  function cxs_conveyance(this, idcxs, width, depth, &
661  rough) result(conveyance)
662  ! -- modules
664  ! -- dummy
665  class(swfcxstype) :: this
666  integer(I4B), intent(in) :: idcxs !< cross section id
667  real(dp), intent(in) :: width !< width in reach
668  real(dp), intent(in) :: depth !< stage in reach
669  real(dp), intent(in) :: rough !< mannings value provided for the reach
670  ! -- return
671  real(dp) :: conveyance !< calculated composite roughness
672  ! -- local
673  real(dp) :: a
674  real(dp) :: rh
675  integer(I4B) :: i0
676  integer(I4B) :: i1
677  integer(I4B) :: npts
678  integer(I4B) :: icalcmeth
679  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
680  if (npts == 0) then
681  a = depth * width
682  rh = depth
683  conveyance = a * rh**dtwothirds / rough
684  else
685  conveyance = get_conveyance(npts, &
686  this%xfraction(i0:i1), &
687  this%height(i0:i1), &
688  this%manfraction(i0:i1), &
689  width, rough, depth)
690  end if
691  end function cxs_conveyance
692 
693  function get_hydraulic_radius(this, idcxs, width, depth, area) result(r)
694  ! -- modules
696  ! -- dummy
697  class(swfcxstype) :: this
698  integer(I4B), intent(in) :: idcxs !< cross section id
699  real(dp), intent(in) :: width !< width in reach
700  real(dp), intent(in) :: depth !< stage in reach
701  real(dp), intent(in), optional :: area !< area of the reach
702  ! -- local
703  real(dp) :: r !< calculated hydraulic radius
704  real(dp) :: a
705  integer(I4B) :: i0
706  integer(I4B) :: i1
707  integer(I4B) :: npts
708  integer(I4B) :: icalcmeth
709  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
710  if (present(area)) then
711  a = area
712  else
713  a = this%get_area(idcxs, width, depth)
714  end if
715  if (npts == 0) then
716  r = a / width
717  else
718  r = get_hydraulic_radius_xf(npts, &
719  this%xfraction(i0:i1), &
720  this%height(i0:i1), &
721  width, depth)
722  end if
723  end function get_hydraulic_radius
724 
725 end module swfcxsmodule
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dtwothirds
real constant 2/3
Definition: Constants.f90:70
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
integer(i4b), parameter lenmempath
maximum length of the memory path
Definition: Constants.f90:27
This module defines variable data types.
Definition: kind.f90:8
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public memorystore_remove(component, subcomponent, context)
This module contains the base numerical package type.
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
subroutine source_packagedata(this)
Copy options from IDM into package.
Definition: swf-cxs.f90:290
real(dp) function cxs_wetted_perimeter(this, idcxs, width, depth)
Definition: swf-cxs.f90:598
subroutine source_options(this)
Copy options from IDM into package.
Definition: swf-cxs.f90:147
real(dp) function get_roughness(this, idcxs, width, depth, rough, slope)
Definition: swf-cxs.f90:624
subroutine allocate_arrays(this)
allocate memory for arrays
Definition: swf-cxs.f90:253
subroutine log_options(this, found)
Write user options to list file.
Definition: swf-cxs.f90:174
subroutine calc_iacross(nxspoints, iacross)
Calculate index pointer array iacross from nxspoints.
Definition: swf-cxs.f90:334
real(dp) function get_hydraulic_radius(this, idcxs, width, depth, area)
Definition: swf-cxs.f90:694
subroutine log_dimensions(this, found)
Write user options to list file.
Definition: swf-cxs.f90:232
subroutine get_cross_section_info(this, idcxs, i0, i1, npts, icalcmeth)
Definition: swf-cxs.f90:537
real(dp) function get_area(this, idcxs, width, depth)
Definition: swf-cxs.f90:573
subroutine source_dimensions(this)
Copy options from IDM into package.
Definition: swf-cxs.f90:191
subroutine cxs_da(this)
deallocate memory
Definition: swf-cxs.f90:507
subroutine source_crosssectiondata(this)
Copy options from IDM into package.
Definition: swf-cxs.f90:367
real(dp) function cxs_conveyance(this, idcxs, width, depth, rough)
Calculate and return conveyance.
Definition: swf-cxs.f90:662
subroutine allocate_scalars(this)
@ brief Allocate scalars
Definition: swf-cxs.f90:128
subroutine log_crosssectiondata(this, found)
Write user packagedata to list file.
Definition: swf-cxs.f90:419
subroutine, public cxs_cr(pobj, name_model, input_mempath, inunit, iout, dis)
create package
Definition: swf-cxs.f90:62
subroutine log_packagedata(this, found)
Write user packagedata to list file.
Definition: swf-cxs.f90:346
subroutine write_cxs_table(this, idcxs, width, slope, rough, unitconv)
Definition: swf-cxs.f90:442
This module contains stateless sfr subroutines and functions.
Definition: SwfCxsUtils.f90:11
real(dp) function, public get_hydraulic_radius_xf(npts, xfraction, heights, width, d)
Calculate the hydraulic radius for a reach.
real(dp) function, public calc_composite_roughness(npts, depth, width, rough, slope, cxs_xf, cxs_h, cxs_rf, linmeth)
real(dp) function, public get_cross_section_area(npts, xfraction, heights, width, d)
Calculate the cross-sectional area for a reach.
real(dp) function, public get_conveyance(npts, xfraction, heights, cxs_rf, width, rough, d)
Calculate conveyance.
real(dp) function, public get_wetted_perimeter(npts, xfraction, heights, width, d)
Calculate the wetted perimeter for a reach.