MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
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 252 of file swf-cxs.f90.

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

◆ 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 127 of file swf-cxs.f90.

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

◆ calc_iacross()

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

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

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
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 660 of file swf-cxs.f90.

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
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
Here is the caller graph for this function:

◆ cxs_da()

subroutine swfcxsmodule::cxs_da ( class(swfcxstype this)

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

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()
subroutine, public memorystore_remove(component, subcomponent, context)
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=linelength) idm_context
Here is the call graph for this function:

◆ 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 597 of file swf-cxs.f90.

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
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 572 of file swf-cxs.f90.

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
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 536 of file swf-cxs.f90.

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

◆ 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 693 of file swf-cxs.f90.

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
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 622 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  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
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 418 of file swf-cxs.f90.

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 

◆ log_dimensions()

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

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

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 

◆ log_options()

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

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

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 

◆ log_packagedata()

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

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

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 

◆ source_crosssectiondata()

subroutine swfcxsmodule::source_crosssectiondata ( class(swfcxstype this)

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

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
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 190 of file swf-cxs.f90.

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
Here is the call graph for this function:

◆ source_options()

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

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

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
Here is the call graph for this function:

◆ source_packagedata()

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

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

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)
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 441 of file swf-cxs.f90.

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