MODFLOW 6  version 6.7.0.dev1
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 check_packagedata (this)
 Check packagedata. 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)
 
real(dp) function get_wetted_top_width (this, idcxs, width, depth)
 
real(dp) function get_maximum_top_width (this, idcxs, width)
 

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine swfcxsmodule::allocate_arrays ( class(swfcxstype this)

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

256  ! -- dummy
257  class(SwfCxsType) :: this
258  ! -- locals
259  integer(I4B) :: n
260  !
261  ! -- arrays allocation
262  call mem_allocate(this%idcxs, this%nsections, &
263  'IDCXS', this%memoryPath)
264  call mem_allocate(this%nxspoints, this%nsections, &
265  'NXSPOINTS', this%memoryPath)
266  call mem_allocate(this%xfraction, this%npoints, &
267  'XFRACTION', this%memoryPath)
268  call mem_allocate(this%height, this%npoints, &
269  'HEIGHT', this%memoryPath)
270  call mem_allocate(this%manfraction, this%npoints, &
271  'MANFRACTION', this%memoryPath)
272  call mem_allocate(this%iacross, this%nsections + 1, &
273  'IACROSS', this%memoryPath)
274 
275  ! -- initialization
276  do n = 1, this%nsections
277  this%idcxs(n) = 0
278  this%nxspoints(n) = 0
279  end do
280  do n = 1, this%npoints
281  this%xfraction(n) = dzero
282  this%height(n) = dzero
283  this%manfraction(n) = dzero
284  end do
285  do n = 1, this%nsections + 1
286  this%iacross(n) = 0
287  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 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

◆ calc_iacross()

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

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

340  integer(I4B), dimension(:), intent(in) :: nxspoints
341  integer(I4B), dimension(:), intent(inout) :: iacross
342  integer(I4B) :: n
343  iacross(1) = 1
344  do n = 1, size(nxspoints)
345  iacross(n + 1) = iacross(n) + nxspoints(n)
346  end do
Here is the caller graph for this function:

◆ check_packagedata()

subroutine swfcxsmodule::check_packagedata ( class(swfcxstype this)
private
Parameters
thisthis instance

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

352  ! dummy arguments
353  class(SwfCxsType) :: this !< this instance
354  ! local variables
355  integer(I4B) :: i
356 
357  ! Check that all cross section IDs are in range
358  do i = 1, size(this%idcxs)
359  if (this%idcxs(i) <= 0 .or. this%idcxs(i) > this%nsections) then
360  write (errmsg, '(a, i0, a)') &
361  'IDCXS values must be greater than 0 and less than NSECTIONS. &
362  &Found ', this%idcxs(i), '.'
363  call store_error(errmsg)
364  end if
365  end do
366 
367  ! Check that nxspoints are greater than one
368  do i = 1, size(this%nxspoints)
369  if (this%nxspoints(i) <= 1) then
370  write (errmsg, '(a, i0, a, i0, a)') &
371  'NXSPOINTS values must be greater than 1 for each cross section. &
372  &Found ', this%nxspoints(i), ' for cross section ', this%idcxs(i), '.'
373  call store_error(errmsg)
374  end if
375  end do
376 
377  ! write summary of package error messages
378  if (count_errors() > 0) then
379  call store_error_filename(this%input_fname)
380  end if
381 
Here is the call 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 701 of file swf-cxs.f90.

703  ! -- modules
705  ! -- dummy
706  class(SwfCxsType) :: this
707  integer(I4B), intent(in) :: idcxs !< cross section id
708  real(DP), intent(in) :: width !< width in reach
709  real(DP), intent(in) :: depth !< stage in reach
710  real(DP), intent(in) :: rough !< mannings value provided for the reach
711  ! -- return
712  real(DP) :: conveyance !< calculated composite roughness
713  ! -- local
714  real(DP) :: a
715  real(DP) :: rh
716  integer(I4B) :: i0
717  integer(I4B) :: i1
718  integer(I4B) :: npts
719  integer(I4B) :: icalcmeth
720  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
721  if (npts == 0) then
722  a = depth * width
723  rh = depth
724  conveyance = a * rh**dtwothirds / rough
725  else
726  conveyance = get_conveyance(npts, &
727  this%xfraction(i0:i1), &
728  this%height(i0:i1), &
729  this%manfraction(i0:i1), &
730  width, rough, depth)
731  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 64 of file swf-cxs.f90.

65  ! -- modules
67  ! -- dummy
68  type(SwfCxsType), pointer :: pobj
69  character(len=*), intent(in) :: name_model
70  character(len=*), intent(in) :: input_mempath
71  integer(I4B), intent(in) :: inunit
72  integer(I4B), intent(in) :: iout
73  class(DisBaseType), pointer, intent(inout) :: dis !< the pointer to the discretization
74  ! -- locals
75  logical(LGP) :: found_fname
76  ! -- formats
77  character(len=*), parameter :: fmtheader = &
78  "(1x, /1x, 'CXS -- CROSS SECTION PACKAGE, VERSION 1, 5/24/2023', &
79  &' INPUT READ FROM MEMPATH: ', A, /)"
80  !
81  ! -- Create the object
82  allocate (pobj)
83 
84  ! -- create name and memory path
85  call pobj%set_names(1, name_model, 'CXS', 'CXS')
86 
87  ! -- Allocate scalars
88  call pobj%allocate_scalars()
89 
90  ! -- Set variables
91  pobj%input_mempath = input_mempath
92  pobj%inunit = inunit
93  pobj%iout = iout
94  pobj%dis => dis
95 
96  ! -- set name of input file
97  call mem_set_value(pobj%input_fname, 'INPUT_FNAME', pobj%input_mempath, &
98  found_fname)
99 
100  ! -- check if package is enabled
101  if (inunit > 0) then
102 
103  ! -- Print a message identifying the package.
104  write (iout, fmtheader) input_mempath
105 
106  ! -- source options
107  call pobj%source_options()
108 
109  ! -- source dimensions
110  call pobj%source_dimensions()
111 
112  ! -- allocate arrays
113  call pobj%allocate_arrays()
114 
115  ! -- source dimensions
116  call pobj%source_packagedata()
117 
118  ! -- source dimensions
119  call pobj%source_crosssectiondata()
120 
121  end if
Here is the caller graph for this function:

◆ cxs_da()

subroutine swfcxsmodule::cxs_da ( class(swfcxstype this)

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

548  ! -- modules
552  ! -- dummy
553  class(SwfCxsType) :: this
554  !
555  ! -- Deallocate input memory
556  call memorystore_remove(this%name_model, 'CXS', idm_context)
557  !
558  ! -- Scalars
559  call mem_deallocate(this%nsections)
560  call mem_deallocate(this%npoints)
561  !
562  ! -- Deallocate arrays if the package was created
563  ! from an input file
564  if (this%inunit > 0) then
565  call mem_deallocate(this%idcxs)
566  call mem_deallocate(this%nxspoints)
567  call mem_deallocate(this%xfraction)
568  call mem_deallocate(this%height)
569  call mem_deallocate(this%manfraction)
570  call mem_deallocate(this%iacross)
571  end if
572  !
573  ! -- deallocate parent
574  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 638 of file swf-cxs.f90.

639  ! -- modules
641  ! -- dummy
642  class(SwfCxsType) :: this
643  integer(I4B), intent(in) :: idcxs !< cross section id
644  real(DP), intent(in) :: width !< width in reach
645  real(DP), intent(in) :: depth !< stage in reach
646  ! -- local
647  real(DP) :: wp
648  integer(I4B) :: i0
649  integer(I4B) :: i1
650  integer(I4B) :: npts
651  integer(I4B) :: icalcmeth
652  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
653  if (npts == 0) then
654  wp = width
655  else
656  wp = get_wetted_perimeter(npts, &
657  this%xfraction(i0:i1), &
658  this%height(i0:i1), &
659  width, depth)
660  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 613 of file swf-cxs.f90.

614  ! -- modules
616  ! -- dummy
617  class(SwfCxsType) :: this
618  integer(I4B), intent(in) :: idcxs !< cross section id
619  real(DP), intent(in) :: width !< width in reach
620  real(DP), intent(in) :: depth !< stage in reach
621  ! -- local
622  real(DP) :: area
623  integer(I4B) :: i0
624  integer(I4B) :: i1
625  integer(I4B) :: npts
626  integer(I4B) :: icalcmeth
627  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
628  if (npts == 0) then
629  area = width * depth
630  else
631  area = get_cross_section_area(npts, &
632  this%xfraction(i0:i1), &
633  this%height(i0:i1), &
634  width, depth)
635  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 577 of file swf-cxs.f90.

578  ! -- dummy
579  class(SwfCxsType) :: this
580  integer(I4B), intent(in) :: idcxs !< cross section id number
581  integer(I4B), intent(inout) :: i0 !< starting cross section point number
582  integer(I4B), intent(inout) :: i1 !< ending cross section point number
583  integer(I4B), intent(inout) :: npts !< number of points in cross section
584  integer(I4B), intent(inout) :: icalcmeth !< calculation method for mannings roughness
585  ! -- local
586  !
587  ! -- Return npts = 0 if this package does not have input file
588  if (this%inunit == 0 .or. idcxs == 0) then
589  npts = 0
590  i0 = 1
591  i1 = 1
592  icalcmeth = 0
593  else
594  !
595  ! -- If the cross section id is 0, then it is a hydraulically wide channel,
596  ! and only width and rough are needed (not xfraction, height, and manfraction)
597  if (idcxs > 0) then
598  i0 = this%iacross(idcxs)
599  i1 = this%iacross(idcxs + 1) - 1
600  else
601  i0 = 1
602  i1 = 1
603  end if
604  ! set icalcmeth based on number of cross section points
605  npts = i1 - i0 + 1
606  icalcmeth = 0 ! linear composite mannings resistance
607  if (npts > 4) then
608  icalcmeth = 0 ! sum q by cross section segments
609  end if
610  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 734 of file swf-cxs.f90.

735  ! -- modules
737  ! -- dummy
738  class(SwfCxsType) :: this
739  integer(I4B), intent(in) :: idcxs !< cross section id
740  real(DP), intent(in) :: width !< width in reach
741  real(DP), intent(in) :: depth !< stage in reach
742  real(DP), intent(in), optional :: area !< area of the reach
743  ! -- local
744  real(DP) :: r !< calculated hydraulic radius
745  real(DP) :: a
746  integer(I4B) :: i0
747  integer(I4B) :: i1
748  integer(I4B) :: npts
749  integer(I4B) :: icalcmeth
750  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
751  if (present(area)) then
752  a = area
753  else
754  a = this%get_area(idcxs, width, depth)
755  end if
756  if (npts == 0) then
757  r = a / width
758  else
759  r = get_hydraulic_radius_xf(npts, &
760  this%xfraction(i0:i1), &
761  this%height(i0:i1), &
762  width, depth)
763  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_maximum_top_width()

real(dp) function swfcxsmodule::get_maximum_top_width ( class(swfcxstype this,
integer(i4b), intent(in)  idcxs,
real(dp), intent(in)  width 
)
Parameters
[in]idcxscross section id
[in]widthwidth in reach
Returns
calculated hydraulic radius

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

790  ! modules
792  ! dummy
793  class(SwfCxsType) :: this
794  integer(I4B), intent(in) :: idcxs !< cross section id
795  real(DP), intent(in) :: width !< width in reach
796  ! local
797  real(DP) :: r !< calculated hydraulic radius
798  integer(I4B) :: i0
799  integer(I4B) :: i1
800  integer(I4B) :: npts
801  integer(I4B) :: icalcmeth
802  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
803  if (npts == 0) then
804  r = width
805  else
806  r = get_saturated_topwidth(npts, this%xfraction(i0:i1), width)
807  end if
real(dp) function, public get_saturated_topwidth(npts, xfraction, width)
Calculate the saturated top width 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 663 of file swf-cxs.f90.

665  ! -- modules
667  ! -- dummy
668  class(SwfCxsType) :: this
669  integer(I4B), intent(in) :: idcxs !< cross section id
670  real(DP), intent(in) :: width !< width in reach
671  real(DP), intent(in) :: depth !< stage in reach
672  real(DP), intent(in) :: rough !< mannings value provided for the reach
673  real(DP), intent(in) :: slope !< slope value provided for the reach
674  ! -- local
675  real(DP) :: roughc !< calculated composite roughness
676  integer(I4B) :: i0
677  integer(I4B) :: i1
678  integer(I4B) :: npts
679  integer(I4B) :: icalcmeth
680  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
681  if (npts == 0) then
682  roughc = rough
683  else
684  roughc = calc_composite_roughness(npts, &
685  depth, &
686  width, &
687  rough, &
688  slope, &
689  this%xfraction(i0:i1), &
690  this%height(i0:i1), &
691  this%manfraction(i0:i1), &
692  icalcmeth)
693  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:

◆ get_wetted_top_width()

real(dp) function swfcxsmodule::get_wetted_top_width ( 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
Returns
calculated hydraulic radius

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

767  ! modules
769  ! dummy
770  class(SwfCxsType) :: this
771  integer(I4B), intent(in) :: idcxs !< cross section id
772  real(DP), intent(in) :: width !< width in reach
773  real(DP), intent(in) :: depth !< stage in reach
774  ! local
775  real(DP) :: r !< calculated hydraulic radius
776  integer(I4B) :: i0
777  integer(I4B) :: i1
778  integer(I4B) :: npts
779  integer(I4B) :: icalcmeth
780  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
781  if (npts == 0) then
782  r = width
783  else
784  r = get_wetted_topwidth(npts, this%xfraction(i0:i1), &
785  this%height(i0:i1), width, depth)
786  end if
real(dp) function, public get_wetted_topwidth(npts, xfraction, heights, width, d)
Calculate the wetted top width for a reach.
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 459 of file swf-cxs.f90.

461  class(SwfCxsType) :: this
462  type(SwfCxsParamFoundType), intent(in) :: found
463 
464  write (this%iout, '(1x,a)') 'Setting CXS Cross Section Data'
465 
466  if (found%xfraction) then
467  write (this%iout, '(4x,a)') 'XFRACTION set from input file.'
468  end if
469 
470  if (found%height) then
471  write (this%iout, '(4x,a)') 'HEIGHT set from input file.'
472  end if
473 
474  if (found%manfraction) then
475  write (this%iout, '(4x,a)') 'MANFRACTION set from input file.'
476  end if
477 
478  write (this%iout, '(1x,a,/)') 'End Setting CXS Cross Section Data'
479 

◆ log_dimensions()

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

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

236  class(SwfCxsType) :: this
237  type(SwfCxsParamFoundType), intent(in) :: found
238 
239  write (this%iout, '(1x,a)') 'Setting CXS Dimensions'
240 
241  if (found%nsections) then
242  write (this%iout, '(4x,a)') 'NSECTIONS set from input file.'
243  end if
244 
245  if (found%npoints) then
246  write (this%iout, '(4x,a)') 'NPOINTS set from input file.'
247  end if
248 
249  write (this%iout, '(1x,a,/)') 'End Setting CXS Dimensions'
250 

◆ log_options()

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

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

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

◆ log_packagedata()

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

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

388  class(SwfCxsType) :: this
389  type(SwfCxsParamFoundType), intent(in) :: found
390 
391  write (this%iout, '(1x,a)') 'Setting CXS Package Data'
392 
393  if (found%idcxs) then
394  write (this%iout, '(4x,a)') 'IDCXS set from input file.'
395  end if
396 
397  if (found%nxspoints) then
398  write (this%iout, '(4x,a)') 'NXSPOINTS set from input file.'
399  end if
400 
401  write (this%iout, '(1x,a,/)') 'End Setting CXS Package Data'
402 

◆ source_crosssectiondata()

subroutine swfcxsmodule::source_crosssectiondata ( class(swfcxstype this)

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

408  ! -- modules
409  use kindmodule, only: lgp
413  ! -- dummy
414  class(SwfCxsType) :: this
415  ! -- locals
416  character(len=LENMEMPATH) :: idmMemoryPath
417  type(SwfCxsParamFoundType) :: found
418  !
419  ! -- set memory path
420  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
421  !
422  ! -- update defaults with idm sourced values
423  call mem_set_value(this%xfraction, 'XFRACTION', idmmemorypath, &
424  found%xfraction)
425  call mem_set_value(this%height, 'HEIGHT', idmmemorypath, &
426  found%height)
427  call mem_set_value(this%manfraction, 'MANFRACTION', idmmemorypath, &
428  found%manfraction)
429  !
430  ! -- ensure xfraction was found
431  if (.not. found%xfraction) then
432  write (errmsg, '(a)') &
433  'Error in CROSSSECTIONDATA block: xfraction not found.'
434  call store_error(errmsg)
435  end if
436  !
437  ! -- ensure height was found
438  if (.not. found%height) then
439  write (errmsg, '(a)') &
440  'Error in CROSSSECTIONDATA block: HEIGHT not found.'
441  call store_error(errmsg)
442  end if
443  !
444  ! -- ensure manfraction was found
445  if (.not. found%manfraction) then
446  write (errmsg, '(a)') &
447  'Error in CROSSSECTIONDATA block: MANFRACTION not found.'
448  call store_error(errmsg)
449  end if
450  !
451  ! -- log values to list file
452  if (this%iout > 0) then
453  call this%log_crosssectiondata(found)
454  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 193 of file swf-cxs.f90.

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

◆ source_options()

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

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

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

◆ source_packagedata()

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

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

293  ! modules
294  use kindmodule, only: lgp
298  ! dummy
299  class(SwfCxsType) :: this
300  ! locals
301  character(len=LENMEMPATH) :: idmMemoryPath
302  type(SwfCxsParamFoundType) :: found
303 
304  ! set memory path
305  idmmemorypath = create_mem_path(this%name_model, 'CXS', idm_context)
306 
307  ! update defaults with idm sourced values
308  call mem_set_value(this%idcxs, 'IDCXS', idmmemorypath, &
309  found%idcxs)
310  call mem_set_value(this%nxspoints, 'NXSPOINTS', idmmemorypath, &
311  found%nxspoints)
312 
313  ! ensure idcxs was found
314  if (.not. found%idcxs) then
315  write (errmsg, '(a)') 'Error in PACKAGEDATA block: IDCXS not found.'
316  call store_error(errmsg)
317  end if
318 
319  ! ensure nxspoints was found
320  if (.not. found%nxspoints) then
321  write (errmsg, '(a)') 'Error in PACKAGEDATA block: NXSPOINTS not found.'
322  call store_error(errmsg)
323  end if
324 
325  ! log values to list file
326  if (this%iout > 0) then
327  call this%log_packagedata(found)
328  end if
329 
330  ! Check to make sure package data is valid
331  call this%check_packagedata()
332 
333  ! Calculate the iacross index array using nxspoints
334  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 482 of file swf-cxs.f90.

483  ! -- module
484  use sortmodule, only: qsort, unique_values
485  ! -- dummy
486  class(SwfCxsType) :: this
487  integer(I4B), intent(in) :: idcxs
488  real(DP), intent(in) :: width
489  real(DP), intent(in) :: slope
490  real(DP), intent(in) :: rough
491  real(DP), intent(in) :: unitconv
492  ! -- local
493  integer(I4B) :: ipt
494  real(DP) :: d
495  real(DP) :: a
496  real(DP) :: rh
497  real(DP) :: wp
498  real(DP) :: r
499  real(DP) :: c
500  real(DP) :: q
501  integer(I4B) :: i0
502  integer(I4B) :: i1
503  integer(I4B) :: npts
504  integer(I4B) :: icalcmeth
505  real(DP), dimension(:), allocatable :: depths
506  real(DP), dimension(:), allocatable :: depths_unique
507  integer(I4B), dimension(:), allocatable :: indx
508 
509  call this%get_cross_section_info(idcxs, i0, i1, npts, icalcmeth)
510 
511  if (npts > 0) then
512 
513  write (this%iout, *) 'Processing information for cross section ', idcxs
514  write (this%iout, *) 'Depth Area WettedP HydRad Rough Conveyance Q'
515 
516  allocate (depths(npts))
517  allocate (indx(size(depths)))
518 
519  depths(:) = this%height(:)
520  call qsort(indx, depths)
521  call unique_values(depths, depths_unique)
522 
523  do ipt = 1, size(depths_unique)
524  d = depths_unique(ipt)
525  a = this%get_area(idcxs, width, d)
526  wp = this%get_wetted_perimeter(idcxs, width, d)
527  rh = this%get_hydraulic_radius(idcxs, width, d, a)
528  r = this%get_roughness(idcxs, width, d, rough, slope)
529  c = this%get_conveyance(idcxs, width, d, rough)
530  if (slope > dzero) then
531  q = unitconv * c * sqrt(slope)
532  else
533  q = dzero
534  end if
535  write (this%iout, *) d, a, wp, rh, r, c, q
536  end do
537 
538  deallocate (depths)
539  deallocate (depths_unique)
540  write (this%iout, *) 'Done processing information for cross section ', idcxs
541 
542  end if