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

Data Types

type  swfcxstype
 

Functions/Subroutines

subroutine, public cxs_cr (pobj, name_model, input_mempath, inunit, iout, dis)
 create package More...
 
subroutine allocate_scalars (this)
 @ brief Allocate scalars More...
 
subroutine source_options (this)
 Copy options from IDM into package. More...
 
subroutine log_options (this, found)
 Write user options to list file. More...
 
subroutine source_dimensions (this)
 Copy options from IDM into package. More...
 
subroutine log_dimensions (this, found)
 Write user options to list file. More...
 
subroutine allocate_arrays (this)
 allocate memory for arrays More...
 
subroutine source_packagedata (this)
 Copy options from IDM into package. More...
 
subroutine calc_iacross (nxspoints, iacross)
 Calculate index pointer array iacross from nxspoints. More...
 
subroutine log_packagedata (this, found)
 Write user packagedata to list file. More...
 
subroutine source_crosssectiondata (this)
 Copy options from IDM into package. More...
 
subroutine log_crosssectiondata (this, found)
 Write user packagedata to list file. More...
 
subroutine write_cxs_table (this, idcxs, width, slope, rough, unitconv)
 
subroutine cxs_da (this)
 deallocate memory More...
 
subroutine get_cross_section_info (this, idcxs, i0, i1, npts, icalcmeth)
 
real(dp) function get_area (this, idcxs, width, depth)
 
real(dp) function cxs_wetted_perimeter (this, idcxs, width, depth)
 
real(dp) function get_roughness (this, idcxs, width, depth, rough, slope)
 
real(dp) function cxs_conveyance (this, idcxs, width, depth, rough)
 Calculate and return conveyance. More...
 
real(dp) function get_hydraulic_radius (this, idcxs, width, depth, area)
 

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine swfcxsmodule::allocate_arrays ( class(swfcxstype this)

Definition at line 263 of file swf-cxs.f90.

264  ! -- dummy
265  class(SwfCxsType) :: this
266  ! -- locals
267  integer(I4B) :: n
268  !
269  ! -- arrays allocation
270  call mem_allocate(this%idcxs, this%nsections, &
271  'IDCXS', this%memoryPath)
272  call mem_allocate(this%nxspoints, this%nsections, &
273  'NXSPOINTS', this%memoryPath)
274  call mem_allocate(this%xfraction, this%npoints, &
275  'XFRACTION', this%memoryPath)
276  call mem_allocate(this%height, this%npoints, &
277  'HEIGHT', this%memoryPath)
278  call mem_allocate(this%manfraction, this%npoints, &
279  'MANFRACTION', this%memoryPath)
280  call mem_allocate(this%iacross, this%nsections + 1, &
281  'IACROSS', this%memoryPath)
282 
283  ! -- initialization
284  do n = 1, this%nsections
285  this%idcxs(n) = 0
286  this%nxspoints(n) = 0
287  end do
288  do n = 1, this%npoints
289  this%xfraction(n) = dzero
290  this%height(n) = dzero
291  this%manfraction(n) = dzero
292  end do
293  do n = 1, this%nsections + 1
294  this%iacross(n) = 0
295  end do
296 
297  ! -- Return
298  return

◆ allocate_scalars()

subroutine swfcxsmodule::allocate_scalars ( class(swfcxstype this)

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

Definition at line 130 of file swf-cxs.f90.

131  ! -- modules
132  ! -- dummy
133  class(SwfCxsType) :: this
134  !
135  ! -- allocate scalars in NumericalPackageType
136  call this%NumericalPackageType%allocate_scalars()
137  !
138  ! -- Allocate scalars
139  call mem_allocate(this%nsections, 'NSECTIONS', this%memoryPath)
140  call mem_allocate(this%npoints, 'NPOINTS', this%memoryPath)
141 
142  ! -- initialize
143  this%nsections = 0
144  this%npoints = 0
145 
146  return

◆ calc_iacross()

subroutine swfcxsmodule::calc_iacross ( integer(i4b), dimension(:), intent(in)  nxspoints,
integer(i4b), dimension(:), intent(inout)  iacross 
)

Definition at line 350 of file swf-cxs.f90.

351  integer(I4B), dimension(:), intent(in) :: nxspoints
352  integer(I4B), dimension(:), intent(inout) :: iacross
353  integer(I4B) :: n
354  iacross(1) = 1
355  do n = 1, size(nxspoints)
356  iacross(n + 1) = iacross(n) + nxspoints(n)
357  end do
Here is the caller graph for this function:

◆ cxs_conveyance()

real(dp) function swfcxsmodule::cxs_conveyance ( class(swfcxstype this,
integer(i4b), intent(in)  idcxs,
real(dp), intent(in)  width,
real(dp), intent(in)  depth,
real(dp), intent(in)  rough 
)

Conveyance = area * hydraulic_radius ** (2/3) / mannings_roughness If idcxs = 0 (no cross section specified) then reach is

Parameters
[in]idcxscross section id
[in]widthwidth in reach
[in]depthstage in reach
[in]roughmannings value provided for the reach
Returns
calculated composite roughness

Definition at line 686 of file swf-cxs.f90.

688  ! -- modules
690  ! -- dummy
691  class(SwfCxsType) :: this
692  integer(I4B), intent(in) :: idcxs !< cross section id
693  real(DP), intent(in) :: width !< width in reach
694  real(DP), intent(in) :: depth !< stage in reach
695  real(DP), intent(in) :: rough !< mannings value provided for the reach
696  ! -- return
697  real(DP) :: conveyance !< calculated composite roughness
698  ! -- local
699  real(DP) :: a
700  real(DP) :: rh
701  integer(I4B) :: i0
702  integer(I4B) :: i1
703  integer(I4B) :: npts
704  integer(I4B) :: icalcmeth
705  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
706  if (npts == 0) then
707  a = depth * width
708  rh = depth
709  conveyance = a * rh**dtwothirds / rough
710  else
711  conveyance = get_conveyance(npts, &
712  this%xfraction(i0:i1), &
713  this%height(i0:i1), &
714  this%manfraction(i0:i1), &
715  width, rough, depth)
716  end if
This module contains stateless sfr subroutines and functions.
Definition: SwfCxsUtils.f90:11
real(dp) function, public get_conveyance(npts, xfraction, heights, cxs_rf, width, rough, d)
Calculate conveyance.
Here is the call graph for this function:

◆ cxs_cr()

subroutine, public swfcxsmodule::cxs_cr ( type(swfcxstype), pointer  pobj,
character(len=*), intent(in)  name_model,
character(len=*), intent(in)  input_mempath,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
class(disbasetype), intent(inout), pointer  dis 
)
Parameters
[in,out]disthe pointer to the discretization

Definition at line 61 of file swf-cxs.f90.

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 
120  ! -- Return
121  return
Here is the caller graph for this function:

◆ cxs_da()

subroutine swfcxsmodule::cxs_da ( class(swfcxstype this)

Definition at line 528 of file swf-cxs.f90.

529  ! -- modules
533  ! -- dummy
534  class(SwfCxsType) :: this
535  !
536  ! -- Deallocate input memory
537  call memorylist_remove(this%name_model, 'CXS', idm_context)
538  !
539  ! -- Scalars
540  call mem_deallocate(this%nsections)
541  call mem_deallocate(this%npoints)
542  !
543  ! -- Deallocate arrays if the package was created
544  ! from an input file
545  if (this%inunit > 0) then
546  call mem_deallocate(this%idcxs)
547  call mem_deallocate(this%nxspoints)
548  call mem_deallocate(this%xfraction)
549  call mem_deallocate(this%height)
550  call mem_deallocate(this%manfraction)
551  call mem_deallocate(this%iacross)
552  end if
553  !
554  ! -- deallocate parent
555  call this%NumericalPackageType%da()
556  !
557  ! -- Return
558  return
subroutine, public memorylist_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:

◆ cxs_wetted_perimeter()

real(dp) function swfcxsmodule::cxs_wetted_perimeter ( class(swfcxstype this,
integer(i4b), intent(in)  idcxs,
real(dp), intent(in)  width,
real(dp), intent(in)  depth 
)
Parameters
[in]idcxscross section id
[in]widthwidth in reach
[in]depthstage in reach

Definition at line 623 of file swf-cxs.f90.

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  ! -- local
632  real(DP) :: wp
633  integer(I4B) :: i0
634  integer(I4B) :: i1
635  integer(I4B) :: npts
636  integer(I4B) :: icalcmeth
637  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
638  if (npts == 0) then
639  wp = width
640  else
641  wp = get_wetted_perimeter(npts, &
642  this%xfraction(i0:i1), &
643  this%height(i0:i1), &
644  width, depth)
645  end if
real(dp) function, public get_wetted_perimeter(npts, xfraction, heights, width, d)
Calculate the wetted perimeter for a reach.
Here is the call graph for this function:

◆ get_area()

real(dp) function swfcxsmodule::get_area ( class(swfcxstype this,
integer(i4b), intent(in)  idcxs,
real(dp), intent(in)  width,
real(dp), intent(in)  depth 
)
private
Parameters
[in]idcxscross section id
[in]widthwidth in reach
[in]depthstage in reach

Definition at line 598 of file swf-cxs.f90.

599  ! -- modules
601  ! -- dummy
602  class(SwfCxsType) :: this
603  integer(I4B), intent(in) :: idcxs !< cross section id
604  real(DP), intent(in) :: width !< width in reach
605  real(DP), intent(in) :: depth !< stage in reach
606  ! -- local
607  real(DP) :: area
608  integer(I4B) :: i0
609  integer(I4B) :: i1
610  integer(I4B) :: npts
611  integer(I4B) :: icalcmeth
612  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
613  if (npts == 0) then
614  area = width * depth
615  else
616  area = get_cross_section_area(npts, &
617  this%xfraction(i0:i1), &
618  this%height(i0:i1), &
619  width, depth)
620  end if
real(dp) function, public get_cross_section_area(npts, xfraction, heights, width, d)
Calculate the cross-sectional area for a reach.
Here is the call graph for this function:

◆ get_cross_section_info()

subroutine swfcxsmodule::get_cross_section_info ( class(swfcxstype this,
integer(i4b), intent(in)  idcxs,
integer(i4b), intent(inout)  i0,
integer(i4b), intent(inout)  i1,
integer(i4b), intent(inout)  npts,
integer(i4b), intent(inout)  icalcmeth 
)
Parameters
[in]idcxscross section id number
[in,out]i0starting cross section point number
[in,out]i1ending cross section point number
[in,out]nptsnumber of points in cross section
[in,out]icalcmethcalculation method for mannings roughness

Definition at line 561 of file swf-cxs.f90.

562  ! -- dummy
563  class(SwfCxsType) :: this
564  integer(I4B), intent(in) :: idcxs !< cross section id number
565  integer(I4B), intent(inout) :: i0 !< starting cross section point number
566  integer(I4B), intent(inout) :: i1 !< ending cross section point number
567  integer(I4B), intent(inout) :: npts !< number of points in cross section
568  integer(I4B), intent(inout) :: icalcmeth !< calculation method for mannings roughness
569  ! -- local
570  !
571  ! -- Return npts = 0 if this package does not have input file
572  if (this%inunit == 0 .or. idcxs == 0) then
573  npts = 0
574  i0 = 1
575  i1 = 1
576  icalcmeth = 0
577  else
578  !
579  ! -- If the cross section id is 0, then it is a hydraulically wide channel,
580  ! and only width and rough are needed (not xfraction, height, and manfraction)
581  if (idcxs > 0) then
582  i0 = this%iacross(idcxs)
583  i1 = this%iacross(idcxs + 1) - 1
584  else
585  i0 = 1
586  i1 = 1
587  end if
588  ! set icalcmeth based on number of cross section points
589  npts = i1 - i0 + 1
590  icalcmeth = 0 ! linear composite mannings resistance
591  if (npts > 4) then
592  icalcmeth = 0 ! sum q by cross section segments
593  end if
594  end if
595  return

◆ get_hydraulic_radius()

real(dp) function swfcxsmodule::get_hydraulic_radius ( class(swfcxstype this,
integer(i4b), intent(in)  idcxs,
real(dp), intent(in)  width,
real(dp), intent(in)  depth,
real(dp), intent(in), optional  area 
)
Parameters
[in]idcxscross section id
[in]widthwidth in reach
[in]depthstage in reach
[in]areaarea of the reach
Returns
calculated hydraulic radius

Definition at line 719 of file swf-cxs.f90.

720  ! -- modules
722  ! -- dummy
723  class(SwfCxsType) :: this
724  integer(I4B), intent(in) :: idcxs !< cross section id
725  real(DP), intent(in) :: width !< width in reach
726  real(DP), intent(in) :: depth !< stage in reach
727  real(DP), intent(in), optional :: area !< area of the reach
728  ! -- local
729  real(DP) :: r !< calculated hydraulic radius
730  real(DP) :: a
731  integer(I4B) :: i0
732  integer(I4B) :: i1
733  integer(I4B) :: npts
734  integer(I4B) :: icalcmeth
735  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
736  if (present(area)) then
737  a = area
738  else
739  a = this%get_area(idcxs, width, depth)
740  end if
741  if (npts == 0) then
742  r = a / width
743  else
744  r = get_hydraulic_radius_xf(npts, &
745  this%xfraction(i0:i1), &
746  this%height(i0:i1), &
747  width, depth)
748  end if
real(dp) function, public get_hydraulic_radius_xf(npts, xfraction, heights, width, d)
Calculate the hydraulic radius for a reach.
Here is the call graph for this function:

◆ get_roughness()

real(dp) function swfcxsmodule::get_roughness ( class(swfcxstype this,
integer(i4b), intent(in)  idcxs,
real(dp), intent(in)  width,
real(dp), intent(in)  depth,
real(dp), intent(in)  rough,
real(dp), intent(in)  slope 
)
Parameters
[in]idcxscross section id
[in]widthwidth in reach
[in]depthstage in reach
[in]roughmannings value provided for the reach
[in]slopeslope value provided for the reach
Returns
calculated composite roughness

Definition at line 648 of file swf-cxs.f90.

650  ! -- modules
652  ! -- dummy
653  class(SwfCxsType) :: this
654  integer(I4B), intent(in) :: idcxs !< cross section id
655  real(DP), intent(in) :: width !< width in reach
656  real(DP), intent(in) :: depth !< stage in reach
657  real(DP), intent(in) :: rough !< mannings value provided for the reach
658  real(DP), intent(in) :: slope !< slope value provided for the reach
659  ! -- local
660  real(DP) :: roughc !< calculated composite roughness
661  integer(I4B) :: i0
662  integer(I4B) :: i1
663  integer(I4B) :: npts
664  integer(I4B) :: icalcmeth
665  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
666  if (npts == 0) then
667  roughc = rough
668  else
669  roughc = calc_composite_roughness(npts, &
670  depth, &
671  width, &
672  rough, &
673  slope, &
674  this%xfraction(i0:i1), &
675  this%height(i0:i1), &
676  this%manfraction(i0:i1), &
677  icalcmeth)
678  end if
real(dp) function, public calc_composite_roughness(npts, depth, width, rough, slope, cxs_xf, cxs_h, cxs_rf, linmeth)
Here is the call graph for this function:

◆ log_crosssectiondata()

subroutine swfcxsmodule::log_crosssectiondata ( class(swfcxstype this,
type(swfcxsparamfoundtype), intent(in)  found 
)

Definition at line 438 of file swf-cxs.f90.

440  class(SwfCxsType) :: this
441  type(SwfCxsParamFoundType), intent(in) :: found
442 
443  write (this%iout, '(1x,a)') 'Setting CXS Cross Section Data'
444 
445  if (found%xfraction) then
446  write (this%iout, '(4x,a)') 'XFRACTION set from input file.'
447  end if
448 
449  if (found%height) then
450  write (this%iout, '(4x,a)') 'HEIGHT set from input file.'
451  end if
452 
453  if (found%manfraction) then
454  write (this%iout, '(4x,a)') 'MANFRACTION set from input file.'
455  end if
456 
457  write (this%iout, '(1x,a,/)') 'End Setting CXS Cross Section Data'
458 

◆ log_dimensions()

subroutine swfcxsmodule::log_dimensions ( class(swfcxstype this,
type(swfcxsparamfoundtype), intent(in)  found 
)

Definition at line 242 of file swf-cxs.f90.

244  class(SwfCxsType) :: this
245  type(SwfCxsParamFoundType), intent(in) :: found
246 
247  write (this%iout, '(1x,a)') 'Setting CXS Dimensions'
248 
249  if (found%nsections) then
250  write (this%iout, '(4x,a)') 'NSECTIONS set from input file.'
251  end if
252 
253  if (found%npoints) then
254  write (this%iout, '(4x,a)') 'NPOINTS set from input file.'
255  end if
256 
257  write (this%iout, '(1x,a,/)') 'End Setting CXS Dimensions'
258 

◆ log_options()

subroutine swfcxsmodule::log_options ( class(swfcxstype this,
type(swfcxsparamfoundtype), intent(in)  found 
)

Definition at line 181 of file swf-cxs.f90.

183  class(SwfCxsType) :: this
184  type(SwfCxsParamFoundType), intent(in) :: found
185 
186  write (this%iout, '(1x,a)') 'Setting CXS Options'
187 
188  if (found%iprpak) then
189  write (this%iout, '(4x,a)') 'Package information will be printed.'
190  end if
191 
192  write (this%iout, '(1x,a,/)') 'End Setting CXS Options'
193 

◆ log_packagedata()

subroutine swfcxsmodule::log_packagedata ( class(swfcxstype this,
type(swfcxsparamfoundtype), intent(in)  found 
)
private

Definition at line 362 of file swf-cxs.f90.

364  class(SwfCxsType) :: this
365  type(SwfCxsParamFoundType), intent(in) :: found
366 
367  write (this%iout, '(1x,a)') 'Setting CXS Package Data'
368 
369  if (found%idcxs) then
370  write (this%iout, '(4x,a)') 'IDCXS set from input file.'
371  end if
372 
373  if (found%nxspoints) then
374  write (this%iout, '(4x,a)') 'NXSPOINTS set from input file.'
375  end if
376 
377  write (this%iout, '(1x,a,/)') 'End Setting CXS Package Data'
378 

◆ source_crosssectiondata()

subroutine swfcxsmodule::source_crosssectiondata ( class(swfcxstype this)

Definition at line 383 of file swf-cxs.f90.

384  ! -- modules
385  use kindmodule, only: lgp
389  ! -- dummy
390  class(SwfCxsType) :: this
391  ! -- locals
392  character(len=LENMEMPATH) :: idmMemoryPath
393  type(SwfCxsParamFoundType) :: found
394  !
395  ! -- set memory path
396  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
397  !
398  ! -- update defaults with idm sourced values
399  call mem_set_value(this%xfraction, 'XFRACTION', idmmemorypath, &
400  found%xfraction)
401  call mem_set_value(this%height, 'HEIGHT', idmmemorypath, &
402  found%height)
403  call mem_set_value(this%manfraction, 'MANFRACTION', idmmemorypath, &
404  found%manfraction)
405  !
406  ! -- ensure xfraction was found
407  if (.not. found%xfraction) then
408  write (errmsg, '(a)') &
409  'Error in CROSSSECTIONDATA block: xfraction not found.'
410  call store_error(errmsg)
411  end if
412  !
413  ! -- ensure height was found
414  if (.not. found%height) then
415  write (errmsg, '(a)') &
416  'Error in CROSSSECTIONDATA block: HEIGHT not found.'
417  call store_error(errmsg)
418  end if
419  !
420  ! -- ensure manfraction was found
421  if (.not. found%manfraction) then
422  write (errmsg, '(a)') &
423  'Error in CROSSSECTIONDATA block: MANFRACTION not found.'
424  call store_error(errmsg)
425  end if
426  !
427  ! -- log values to list file
428  if (this%iout > 0) then
429  call this%log_crosssectiondata(found)
430  end if
431  !
432  ! -- Return
433  return
This module defines variable data types.
Definition: kind.f90:8
Here is the call graph for this function:

◆ source_dimensions()

subroutine swfcxsmodule::source_dimensions ( class(swfcxstype this)

Definition at line 198 of file swf-cxs.f90.

199  ! -- modules
200  use kindmodule, only: lgp
204  ! -- dummy
205  class(SwfCxsType) :: this
206  ! -- locals
207  character(len=LENMEMPATH) :: idmMemoryPath
208  type(SwfCxsParamFoundType) :: found
209  !
210  ! -- set memory path
211  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
212  !
213  ! -- update defaults with idm sourced values
214  call mem_set_value(this%nsections, 'NSECTIONS', idmmemorypath, &
215  found%nsections)
216  call mem_set_value(this%npoints, 'NPOINTS', idmmemorypath, &
217  found%npoints)
218  !
219  ! -- ensure nsections was found
220  if (.not. found%nsections) then
221  write (errmsg, '(a)') 'Error in DIMENSIONS block: NSECTIONS not found.'
222  call store_error(errmsg)
223  end if
224  !
225  ! -- ensure npoints was found
226  if (.not. found%npoints) then
227  write (errmsg, '(a)') 'Error in DIMENSIONS block: NPOINTS not found.'
228  call store_error(errmsg)
229  end if
230  !
231  ! -- log values to list file
232  if (this%iout > 0) then
233  call this%log_dimensions(found)
234  end if
235  !
236  ! -- Return
237  return
Here is the call graph for this function:

◆ source_options()

subroutine swfcxsmodule::source_options ( class(swfcxstype this)
private

Definition at line 151 of file swf-cxs.f90.

152  ! -- modules
153  use kindmodule, only: lgp
157  ! -- dummy
158  class(SwfCxsType) :: this
159  ! -- locals
160  character(len=LENMEMPATH) :: idmMemoryPath
161  type(SwfCxsParamFoundType) :: found
162  !
163  ! -- set memory path
164  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
165  !
166  ! -- update defaults with idm sourced values
167  call mem_set_value(this%iprpak, 'PRINT_INPUT', idmmemorypath, &
168  found%iprpak)
169  !
170  ! -- log values to list file
171  if (this%iout > 0) then
172  call this%log_options(found)
173  end if
174  !
175  ! -- Return
176  return
Here is the call graph for this function:

◆ source_packagedata()

subroutine swfcxsmodule::source_packagedata ( class(swfcxstype this)
private

Definition at line 303 of file swf-cxs.f90.

304  ! -- modules
305  use kindmodule, only: lgp
309  ! -- dummy
310  class(SwfCxsType) :: this
311  ! -- locals
312  character(len=LENMEMPATH) :: idmMemoryPath
313  type(SwfCxsParamFoundType) :: found
314  !
315  ! -- set memory path
316  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
317  !
318  ! -- update defaults with idm sourced values
319  call mem_set_value(this%idcxs, 'IDCXS', idmmemorypath, &
320  found%idcxs)
321  call mem_set_value(this%nxspoints, 'NXSPOINTS', idmmemorypath, &
322  found%nxspoints)
323  !
324  ! -- ensure idcxs was found
325  if (.not. found%idcxs) then
326  write (errmsg, '(a)') 'Error in PACKAGEDATA block: IDCXS not found.'
327  call store_error(errmsg)
328  end if
329  !
330  ! -- ensure nxspoints was found
331  if (.not. found%nxspoints) then
332  write (errmsg, '(a)') 'Error in PACKAGEDATA block: NXSPOINTS not found.'
333  call store_error(errmsg)
334  end if
335  !
336  ! -- log values to list file
337  if (this%iout > 0) then
338  call this%log_packagedata(found)
339  end if
340  !
341  ! -- Calculate the iacross index array using nxspoints
342  call calc_iacross(this%nxspoints, this%iacross)
343  !
344  ! -- Return
345  return
Here is the call graph for this function:

◆ write_cxs_table()

subroutine swfcxsmodule::write_cxs_table ( class(swfcxstype this,
integer(i4b), intent(in)  idcxs,
real(dp), intent(in)  width,
real(dp), intent(in)  slope,
real(dp), intent(in)  rough,
real(dp), intent(in)  unitconv 
)

Definition at line 461 of file swf-cxs.f90.

462  ! -- module
463  use sortmodule, only: qsort, unique_values
464  ! -- dummy
465  class(SwfCxsType) :: this
466  integer(I4B), intent(in) :: idcxs
467  real(DP), intent(in) :: width
468  real(DP), intent(in) :: slope
469  real(DP), intent(in) :: rough
470  real(DP), intent(in) :: unitconv
471  ! -- local
472  integer(I4B) :: ipt
473  real(DP) :: d
474  real(DP) :: a
475  real(DP) :: rh
476  real(DP) :: wp
477  real(DP) :: r
478  real(DP) :: c
479  real(DP) :: q
480  integer(I4B) :: i0
481  integer(I4B) :: i1
482  integer(I4B) :: npts
483  integer(I4B) :: icalcmeth
484  real(DP), dimension(:), allocatable :: depths
485  real(DP), dimension(:), allocatable :: depths_unique
486  integer(I4B), dimension(:), allocatable :: indx
487 
488  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
489 
490  if (npts > 0) then
491 
492  write (this%iout, *) 'Processing information for cross section ', idcxs
493  write (this%iout, *) 'Depth Area WettedP HydRad Rough Conveyance Q'
494 
495  allocate (depths(npts))
496  allocate (indx(size(depths)))
497 
498  depths(:) = this%height(:)
499  call qsort(indx, depths)
500  call unique_values(depths, depths_unique)
501 
502  do ipt = 1, size(depths_unique)
503  d = depths_unique(ipt)
504  a = this%get_area(idcxs, width, d)
505  wp = this%get_wetted_perimeter(idcxs, width, d)
506  rh = this%get_hydraulic_radius(idcxs, width, d, a)
507  r = this%get_roughness(idcxs, width, d, rough, slope)
508  c = this%get_conveyance(idcxs, width, d, rough)
509  if (slope > dzero) then
510  q = unitconv * c * sqrt(slope)
511  else
512  q = dzero
513  end if
514  write (this%iout, *) d, a, wp, rh, r, c, q
515  end do
516 
517  deallocate (depths)
518  deallocate (depths_unique)
519  write (this%iout, *) 'Done processing information for cross section ', idcxs
520 
521  end if
522 
523  return