MODFLOW 6  version 6.7.0.dev2
USGS Modular Hydrologic Model
disv2dmodule Module Reference

Data Types

type  disv2dtype
 Vertex grid discretization. More...
 
type  disvfoundtype
 

Functions/Subroutines

subroutine, public disv2d_cr (dis, name_model, input_mempath, inunit, iout)
 Create a new discretization by vertices object. More...
 
subroutine disv2d_load (this)
 Transfer IDM data into this discretization object. More...
 
subroutine disv2d_df (this)
 Define the discretization. More...
 
subroutine disv2d_da (this)
 
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 dimensions from IDM into package. More...
 
subroutine log_dimensions (this, found)
 Write dimensions to list file. More...
 
subroutine source_griddata (this)
 Copy grid data from IDM into package. More...
 
subroutine log_griddata (this, found)
 Write griddata found to list file. More...
 
subroutine grid_finalize (this)
 Finalize grid (check properties, allocate arrays, compute connections) More...
 
subroutine source_vertices (this)
 Load grid vertices from IDM into package. More...
 
subroutine define_cellverts (this, icell2d, ncvert, icvert)
 Build data structures to hold cell vertex info. More...
 
subroutine source_cell2d (this)
 Copy cell2d data from IDM into package. More...
 
subroutine connect (this)
 Build grid connections. More...
 
subroutine write_grb (this, icelltype)
 Write a binary grid file. More...
 
subroutine nodeu_to_string (this, nodeu, str)
 Convert a user nodenumber to a string (nodenumber) or (k,j) More...
 
subroutine nodeu_to_array (this, nodeu, arr)
 Convert a user nodenumber to an array (nodenumber) or (k,j) More...
 
integer(i4b) function get_nodenumber_idx1 (this, nodeu, icheck)
 Get reduced node number from user node number. More...
 
subroutine connection_normal (this, noden, nodem, ihc, xcomp, ycomp, zcomp, ipos)
 Get normal vector components between the cell and a given neighbor. More...
 
subroutine connection_vector (this, noden, nodem, nozee, satn, satm, ihc, xcomp, ycomp, zcomp, conlen)
 Get unit vector components between the cell and a given neighbor. More...
 
subroutine get_dis_type (this, dis_type)
 Get the discretization type. More...
 
integer(i4b) function get_dis_enum (this)
 Get the discretization type enumeration. More...
 
subroutine allocate_scalars (this, name_model, input_mempath)
 Allocate and initialize scalars. More...
 
subroutine allocate_arrays (this)
 Allocate and initialize arrays. More...
 
real(dp) function get_cell2d_area (this, icell2d)
 Get the signed area of the cell. More...
 
integer(i4b) function nodeu_from_string (this, lloc, istart, istop, in, iout, line, flag_string, allow_zero)
 Convert a string to a user nodenumber. More...
 
integer(i4b) function nodeu_from_cellid (this, cellid, inunit, iout, flag_string, allow_zero)
 Convert a cellid string to a user nodenumber. More...
 
subroutine get_polyverts (this, ic, polyverts, closed)
 Get a 2D array of polygon vertices, listed in clockwise order beginning with the lower left corner. More...
 
integer(i4b) function get_npolyverts (this, ic, closed)
 Get the number of cell polygon vertices. More...
 
integer(i4b) function get_max_npolyverts (this, closed)
 Get the maximum number of cell polygon vertices. More...
 
subroutine record_array (this, darray, iout, iprint, idataun, aname, cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
 Record a double precision array. More...
 
subroutine record_srcdst_list_header (this, text, textmodel, textpackage, dstmodel, dstpackage, naux, auxtxt, ibdchn, nlist, iout)
 Record list header for imeth=6. More...
 

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine disv2dmodule::allocate_arrays ( class(disv2dtype this)
private

Definition at line 1020 of file Disv2d.f90.

1021  ! dummy
1022  class(Disv2dType) :: this
1023 
1024  ! Allocate arrays in DisBaseType (mshape, top, bot, area)
1025  call this%DisBaseType%allocate_arrays()
1026  !
1027  ! Allocate arrays for DisvType
1028  if (this%nodes < this%nodesuser) then
1029  call mem_allocate(this%nodeuser, this%nodes, 'NODEUSER', this%memoryPath)
1030  call mem_allocate(this%nodereduced, this%nodesuser, 'NODEREDUCED', &
1031  this%memoryPath)
1032  else
1033  call mem_allocate(this%nodeuser, 1, 'NODEUSER', this%memoryPath)
1034  call mem_allocate(this%nodereduced, 1, 'NODEREDUCED', this%memoryPath)
1035  end if
1036 
1037  ! Initialize
1038  this%mshape(1) = this%nodesuser
1039 

◆ allocate_scalars()

subroutine disv2dmodule::allocate_scalars ( class(disv2dtype this,
character(len=*), intent(in)  name_model,
character(len=*), intent(in)  input_mempath 
)

Definition at line 1000 of file Disv2d.f90.

1001  ! -- dummy
1002  class(Disv2dType) :: this
1003  character(len=*), intent(in) :: name_model
1004  character(len=*), intent(in) :: input_mempath
1005  !
1006  ! -- Allocate parent scalars
1007  call this%DisBaseType%allocate_scalars(name_model, input_mempath)
1008  !
1009  ! -- Allocate
1010  call mem_allocate(this%nvert, 'NVERT', this%memoryPath)
1011  !
1012  ! -- Initialize
1013  this%nvert = 0
1014  this%ndim = 1
1015  !

◆ connect()

subroutine disv2dmodule::connect ( class(disv2dtype this)
private

Definition at line 593 of file Disv2d.f90.

594  ! -- dummy
595  class(Disv2dType) :: this
596  ! -- local
597  integer(I4B) :: j
598  integer(I4B) :: noder, nrsize
599  integer(I4B) :: narea_eq_zero
600  integer(I4B) :: narea_lt_zero
601  real(DP) :: area
602  !
603  ! -- Initialize
604  narea_eq_zero = 0
605  narea_lt_zero = 0
606  !
607  ! -- Assign the cell area
608  do j = 1, this%nodesuser
609  area = this%get_cell2d_area(j)
610  noder = this%get_nodenumber(j, 0)
611  if (noder > 0) this%area(noder) = area
612  if (area < dzero) then
613  narea_lt_zero = narea_lt_zero + 1
614  write (errmsg, '(a,i0,a)') &
615  &'Calculated CELL2D area less than zero for cell ', j, '.'
616  call store_error(errmsg)
617  end if
618  if (area == dzero) then
619  narea_eq_zero = narea_eq_zero + 1
620  write (errmsg, '(a,i0,a)') &
621  'Calculated CELL2D area is zero for cell ', j, '.'
622  call store_error(errmsg)
623  end if
624  end do
625  !
626  ! -- check for errors
627  if (count_errors() > 0) then
628  if (narea_lt_zero > 0) then
629  write (errmsg, '(i0,a)') narea_lt_zero, &
630  ' cell(s) have an area less than zero. Calculated cell &
631  &areas must be greater than zero. Negative areas often &
632  &mean vertices are not listed in clockwise order.'
633  call store_error(errmsg)
634  end if
635  if (narea_eq_zero > 0) then
636  write (errmsg, '(i0,a)') narea_eq_zero, &
637  ' cell(s) have an area equal to zero. Calculated cell &
638  &areas must be greater than zero. Calculated cell &
639  &areas equal to zero indicate that the cell is not defined &
640  &by a valid polygon.'
641  call store_error(errmsg)
642  end if
643  call store_error_filename(this%input_fname)
644  end if
645  !
646  ! -- create and fill the connections object
647  nrsize = 0
648  if (this%nodes < this%nodesuser) nrsize = this%nodes
649  allocate (this%con)
650  call this%con%disvconnections(this%name_model, this%nodes, &
651  this%nodesuser, 1, nrsize, &
652  this%nvert, this%vertices, this%iavert, &
653  this%javert, this%cellxy, &
654  this%bot, this%bot, &
655  this%nodereduced, this%nodeuser)
656  this%nja = this%con%nja
657  this%njas = this%con%njas
658  !
Here is the call graph for this function:

◆ connection_normal()

subroutine disv2dmodule::connection_normal ( class(disv2dtype this,
integer(i4b), intent(in)  noden,
integer(i4b), intent(in)  nodem,
integer(i4b), intent(in)  ihc,
real(dp), intent(inout)  xcomp,
real(dp), intent(inout)  ycomp,
real(dp), intent(inout)  zcomp,
integer(i4b), intent(in)  ipos 
)
private

The normal points outward from the shared face between noden and nodem.

Parameters
[in]nodencell (reduced nn)
[in]nodemneighbor (reduced nn)
[in]ihchorizontal connection flag

Definition at line 895 of file Disv2d.f90.

897  ! -- dummy
898  class(Disv2dType) :: this
899  integer(I4B), intent(in) :: noden !< cell (reduced nn)
900  integer(I4B), intent(in) :: nodem !< neighbor (reduced nn)
901  integer(I4B), intent(in) :: ihc !< horizontal connection flag
902  real(DP), intent(inout) :: xcomp
903  real(DP), intent(inout) :: ycomp
904  real(DP), intent(inout) :: zcomp
905  integer(I4B), intent(in) :: ipos
906  ! -- local
907  real(DP) :: angle, dmult
908  !
909  ! -- Set vector components based on ihc
910  if (ihc == 0) then
911  xcomp = dzero
912  ycomp = dzero
913  if (nodem < noden) then
914  !
915  ! -- nodem must be above noden, so upward connection
916  zcomp = done
917  else
918  !
919  ! -- nodem must be below noden, so downward connection
920  zcomp = -done
921  end if
922  else
923  ! -- find from anglex, since anglex is symmetric, need to flip vector
924  ! for lower triangle (nodem < noden)
925  !ipos = this%con%getjaindex(noden, nodem)
926  angle = this%con%anglex(this%con%jas(ipos))
927  dmult = done
928  if (nodem < noden) dmult = -done
929  xcomp = cos(angle) * dmult
930  ycomp = sin(angle) * dmult
931  zcomp = dzero
932  end if
933  !

◆ connection_vector()

subroutine disv2dmodule::connection_vector ( class(disv2dtype this,
integer(i4b), intent(in)  noden,
integer(i4b), intent(in)  nodem,
logical, intent(in)  nozee,
real(dp), intent(in)  satn,
real(dp), intent(in)  satm,
integer(i4b), intent(in)  ihc,
real(dp), intent(inout)  xcomp,
real(dp), intent(inout)  ycomp,
real(dp), intent(inout)  zcomp,
real(dp), intent(inout)  conlen 
)
private

Saturation must be provided to compute cell center vertical coordinates. Also return the straight-line connection length.

Parameters
[in]nodencell (reduced nn)
[in]nodemneighbor (reduced nn)
[in]nozeedo not use z in calculations
[in]satnnot used for disv1d
[in]satmnot used for disv1d
[in]ihchorizontal connection flag
[in,out]xcompx component of connection vector
[in,out]ycompy component of connection vector
[in,out]zcompz component of connection vector
[in,out]conlencalculated straight-line distance between cell centers

Definition at line 941 of file Disv2d.f90.

943  ! -- dummy
944  class(Disv2dType) :: this
945  integer(I4B), intent(in) :: noden !< cell (reduced nn)
946  integer(I4B), intent(in) :: nodem !< neighbor (reduced nn)
947  logical, intent(in) :: nozee !< do not use z in calculations
948  real(DP), intent(in) :: satn !< not used for disv1d
949  real(DP), intent(in) :: satm !< not used for disv1d
950  integer(I4B), intent(in) :: ihc !< horizontal connection flag
951  real(DP), intent(inout) :: xcomp !< x component of connection vector
952  real(DP), intent(inout) :: ycomp !< y component of connection vector
953  real(DP), intent(inout) :: zcomp !< z component of connection vector
954  real(DP), intent(inout) :: conlen !< calculated straight-line distance between cell centers
955  ! -- local
956  integer(I4B) :: nodeun, nodeum
957  real(DP) :: xn, xm, yn, ym, zn, zm
958 
959  ! horizontal connection, with possible z component due to cell offsets
960  ! and/or water table conditions
961  if (nozee) then
962  zn = dzero
963  zm = dzero
964  else
965  zn = this%bot(noden)
966  zm = this%bot(nodem)
967  end if
968  nodeun = this%get_nodeuser(noden)
969  nodeum = this%get_nodeuser(nodem)
970  xn = this%cellxy(1, nodeun)
971  yn = this%cellxy(2, nodeun)
972  xm = this%cellxy(1, nodeum)
973  ym = this%cellxy(2, nodeum)
974  call line_unit_vector(xn, yn, zn, xm, ym, zm, xcomp, ycomp, zcomp, &
975  conlen)
976 
Here is the call graph for this function:

◆ define_cellverts()

subroutine disv2dmodule::define_cellverts ( class(disv2dtype this,
integer(i4b), dimension(:), intent(in), pointer, contiguous  icell2d,
integer(i4b), dimension(:), intent(in), pointer, contiguous  ncvert,
integer(i4b), dimension(:), intent(in), pointer, contiguous  icvert 
)
private

Definition at line 504 of file Disv2d.f90.

505  ! -- modules
506  use sparsemodule, only: sparsematrix
507  ! -- dummy
508  class(Disv2dType) :: this
509  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: icell2d
510  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: ncvert
511  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: icvert
512  ! -- locals
513  type(sparsematrix) :: vert_spm
514  integer(I4B) :: i, j, ierr
515  integer(I4B) :: icv_idx, startvert, maxnnz = 5
516  !
517  ! -- initialize sparse matrix
518  call vert_spm%init(this%nodes, this%nvert, maxnnz)
519  !
520  ! -- add sparse matrix connections from input memory paths
521  icv_idx = 1
522  do i = 1, this%nodes
523  if (icell2d(i) /= i) call store_error('ICELL2D input sequence violation.')
524  do j = 1, ncvert(i)
525  call vert_spm%addconnection(i, icvert(icv_idx), 0)
526  if (j == 1) then
527  startvert = icvert(icv_idx)
528  elseif (j == ncvert(i) .and. (icvert(icv_idx) /= startvert)) then
529  call vert_spm%addconnection(i, startvert, 0)
530  end if
531  icv_idx = icv_idx + 1
532  end do
533  end do
534  !
535  ! -- allocate and fill iavert and javert
536  call mem_allocate(this%iavert, this%nodes + 1, 'IAVERT', this%memoryPath)
537  call mem_allocate(this%javert, vert_spm%nnz, 'JAVERT', this%memoryPath)
538  call vert_spm%filliaja(this%iavert, this%javert, ierr)
539  call vert_spm%destroy()
540  !
Here is the call graph for this function:

◆ disv2d_cr()

subroutine, public disv2dmodule::disv2d_cr ( class(disbasetype), pointer  dis,
character(len=*), intent(in)  name_model,
character(len=*), intent(in)  input_mempath,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout 
)

Definition at line 96 of file Disv2d.f90.

97  ! -- dummy
98  class(DisBaseType), pointer :: dis
99  character(len=*), intent(in) :: name_model
100  character(len=*), intent(in) :: input_mempath
101  integer(I4B), intent(in) :: inunit
102  integer(I4B), intent(in) :: iout
103  ! -- local
104  type(Disv2dType), pointer :: disnew
105  ! -- formats
106  character(len=*), parameter :: fmtheader = &
107  "(1X, /1X, 'DISV -- VERTEX GRID DISCRETIZATION PACKAGE,', &
108  &' VERSION 1 : 12/23/2015 - INPUT READ FROM MEMPATH: ', A, //)"
109  !
110  allocate (disnew)
111  dis => disnew
112  call disnew%allocate_scalars(name_model, input_mempath)
113  dis%inunit = inunit
114  dis%iout = iout
115  !
116  ! -- If disv enabled
117  if (inunit > 0) then
118  !
119  ! -- Identify package
120  if (iout > 0) then
121  write (iout, fmtheader) dis%input_mempath
122  end if
123  !
124  ! -- load disv
125  call disnew%disv2d_load()
126  end if
127  !
Here is the caller graph for this function:

◆ disv2d_da()

subroutine disv2dmodule::disv2d_da ( class(disv2dtype this)
private

Definition at line 155 of file Disv2d.f90.

156  ! -- modules
160  ! -- dummy
161  class(Disv2dType) :: this
162  ! -- local
163 
164  ! -- Deallocate idm memory
165  call memorystore_remove(this%name_model, 'DISV2D', idm_context)
166 
167  ! -- scalars
168  call mem_deallocate(this%nvert)
169 
170  ! -- arrays
171  call mem_deallocate(this%nodeuser)
172  call mem_deallocate(this%nodereduced)
173  call mem_deallocate(this%bottom)
174  call mem_deallocate(this%idomain)
175 
176  ! -- cdl hack for arrays for vertices and cell2d blocks
177  call mem_deallocate(this%vertices)
178  call mem_deallocate(this%cellxy)
179  call mem_deallocate(this%iavert)
180  call mem_deallocate(this%javert)
181  !
182  ! -- DisBaseType deallocate
183  call this%DisBaseType%dis_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:

◆ disv2d_df()

subroutine disv2dmodule::disv2d_df ( class(disv2dtype this)
private

Definition at line 147 of file Disv2d.f90.

148  ! -- dummy
149  class(Disv2dType) :: this
150  !
151  call this%grid_finalize()
152  !

◆ disv2d_load()

subroutine disv2dmodule::disv2d_load ( class(disv2dtype this)
private

Definition at line 132 of file Disv2d.f90.

133  ! -- dummy
134  class(Disv2dType) :: this
135  !
136  ! -- source input data
137  call this%source_options()
138  call this%source_dimensions()
139  call this%source_griddata()
140  call this%source_vertices()
141  call this%source_cell2d()
142  !

◆ get_cell2d_area()

real(dp) function disv2dmodule::get_cell2d_area ( class(disv2dtype this,
integer(i4b), intent(in)  icell2d 
)
private

A negative result means points are in counter-clockwise orientation. Area is computed from the formula: a = 1/2 *[(x1*y2 + x2*y3 + x3*y4 + ... + xn*y1) - (x2*y1 + x3*y2 + x4*y3 + ... + x1*yn)]

Definition at line 1049 of file Disv2d.f90.

1050  ! -- dummy
1051  class(Disv2dType) :: this
1052  integer(I4B), intent(in) :: icell2d
1053  ! -- return
1054  real(DP) :: area
1055  ! -- local
1056  integer(I4B) :: ivert
1057  integer(I4B) :: nvert
1058  integer(I4B) :: icount
1059  integer(I4B) :: iv1
1060  real(DP) :: x
1061  real(DP) :: y
1062  real(DP) :: x1
1063  real(DP) :: y1
1064  !
1065  area = dzero
1066  nvert = this%iavert(icell2d + 1) - this%iavert(icell2d)
1067  icount = 1
1068  iv1 = this%javert(this%iavert(icell2d))
1069  x1 = this%vertices(1, iv1)
1070  y1 = this%vertices(2, iv1)
1071  do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1072  x = this%vertices(1, this%javert(ivert))
1073  if (icount < nvert) then
1074  y = this%vertices(2, this%javert(ivert + 1))
1075  else
1076  y = this%vertices(2, this%javert(this%iavert(icell2d)))
1077  end if
1078  area = area + (x - x1) * (y - y1)
1079  icount = icount + 1
1080  end do
1081  !
1082  icount = 1
1083  do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1084  y = this%vertices(2, this%javert(ivert))
1085  if (icount < nvert) then
1086  x = this%vertices(1, this%javert(ivert + 1))
1087  else
1088  x = this%vertices(1, this%javert(this%iavert(icell2d)))
1089  end if
1090  area = area - (x - x1) * (y - y1)
1091  icount = icount + 1
1092  end do
1093  !
1094  area = -done * area * dhalf
1095  !

◆ get_dis_enum()

integer(i4b) function disv2dmodule::get_dis_enum ( class(disv2dtype), intent(in)  this)
private

Definition at line 991 of file Disv2d.f90.

992  use constantsmodule, only: disv2d
993  class(Disv2dType), intent(in) :: this
994  integer(I4B) :: dis_enum
995  dis_enum = disv2d
This module contains simulation constants.
Definition: Constants.f90:9
@ disv2d
DISV2D6 discretization.
Definition: Constants.f90:164

◆ get_dis_type()

subroutine disv2dmodule::get_dis_type ( class(disv2dtype), intent(in)  this,
character(len=*), intent(out)  dis_type 
)
private

Definition at line 981 of file Disv2d.f90.

982  ! -- dummy
983  class(Disv2dType), intent(in) :: this
984  character(len=*), intent(out) :: dis_type
985  !
986  dis_type = "DISV2D"
987  !

◆ get_max_npolyverts()

integer(i4b) function disv2dmodule::get_max_npolyverts ( class(disv2dtype), intent(inout)  this,
logical(lgp), intent(in), optional  closed 
)
private
Parameters
[in]closedwhether to close the polygon, duplicating a vertex

Definition at line 1316 of file Disv2d.f90.

1317  class(Disv2dType), intent(inout) :: this
1318  logical(LGP), intent(in), optional :: closed !< whether to close the polygon, duplicating a vertex
1319  integer(I4B) :: max_npolyverts
1320  ! local
1321  integer(I4B) :: ic
1322 
1323  max_npolyverts = 0
1324  do ic = 1, this%nodes
1325  max_npolyverts = max(max_npolyverts, this%get_npolyverts(ic, closed))
1326  end do

◆ get_nodenumber_idx1()

integer(i4b) function disv2dmodule::get_nodenumber_idx1 ( class(disv2dtype), intent(in)  this,
integer(i4b), intent(in)  nodeu,
integer(i4b), intent(in)  icheck 
)
private

Definition at line 861 of file Disv2d.f90.

862  ! return
863  integer(I4B) :: nodenumber
864  ! dummy
865  class(Disv2dType), intent(in) :: this
866  integer(I4B), intent(in) :: nodeu
867  integer(I4B), intent(in) :: icheck
868  ! local
869 
870  ! check the node number if requested
871  if (icheck /= 0) then
872 
873  ! If within valid range, convert to reduced nodenumber
874  if (nodeu < 1 .or. nodeu > this%nodesuser) then
875  nodenumber = 0
876  write (errmsg, '(a,i0,a,i0,a)') &
877  'Node number (', nodeu, ') is less than 1 or greater than nodes (', &
878  this%nodesuser, ').'
879  call store_error(errmsg)
880  else
881  nodenumber = nodeu
882  if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
883  end if
884  else
885  nodenumber = nodeu
886  if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
887  end if
888 
Here is the call graph for this function:

◆ get_npolyverts()

integer(i4b) function disv2dmodule::get_npolyverts ( class(disv2dtype), intent(inout)  this,
integer(i4b), intent(in)  ic,
logical(lgp), intent(in), optional  closed 
)
private
Parameters
[in]closedwhether to close the polygon, duplicating a vertex

Definition at line 1298 of file Disv2d.f90.

1299  class(Disv2dType), intent(inout) :: this
1300  integer(I4B), intent(in) :: ic
1301  logical(LGP), intent(in), optional :: closed !< whether to close the polygon, duplicating a vertex
1302  integer(I4B) :: npolyverts
1303  ! local
1304  integer(I4B) :: icu, icu2d, nverts
1305 
1306  npolyverts = 0
1307  icu = this%get_nodeuser(ic)
1308  icu2d = icu - ((icu - 1) / this%nodes) * this%nodes
1309  nverts = this%iavert(icu2d + 1) - this%iavert(icu2d) - 1
1310  if (present(closed)) then
1311  if (closed) npolyverts = npolyverts + 1
1312  end if

◆ get_polyverts()

subroutine disv2dmodule::get_polyverts ( class(disv2dtype), intent(inout)  this,
integer(i4b), intent(in)  ic,
real(dp), dimension(:, :), intent(out), allocatable  polyverts,
logical(lgp), intent(in), optional  closed 
)
private
Parameters
[in]iccell number (reduced)
[out]polyvertspolygon vertices (column-major indexing)
[in]closedwhether to close the polygon, duplicating a vertex (default false)

Definition at line 1255 of file Disv2d.f90.

1256  ! -- dummy
1257  class(Disv2dType), intent(inout) :: this
1258  integer(I4B), intent(in) :: ic !< cell number (reduced)
1259  real(DP), allocatable, intent(out) :: polyverts(:, :) !< polygon vertices (column-major indexing)
1260  logical(LGP), intent(in), optional :: closed !< whether to close the polygon, duplicating a vertex (default false)
1261  ! -- local
1262  integer(I4B) :: icu, icu2d, iavert, nverts, m, j
1263  logical(LGP) :: lclosed
1264  !
1265  ! count vertices
1266  icu = this%get_nodeuser(ic)
1267  icu2d = icu - ((icu - 1) / this%nodes) * this%nodes
1268  nverts = this%iavert(icu2d + 1) - this%iavert(icu2d) - 1
1269  !
1270  ! check closed option
1271  if (.not. (present(closed))) then
1272  lclosed = .false.
1273  else
1274  lclosed = closed
1275  end if
1276  !
1277  ! allocate vertices array
1278  if (lclosed) then
1279  allocate (polyverts(2, nverts + 1))
1280  else
1281  allocate (polyverts(2, nverts))
1282  end if
1283  !
1284  ! set vertices
1285  iavert = this%iavert(icu2d)
1286  do m = 1, nverts
1287  j = this%javert(iavert - 1 + m)
1288  polyverts(:, m) = (/this%vertices(1, j), this%vertices(2, j)/)
1289  end do
1290  !
1291  ! close if enabled
1292  if (lclosed) &
1293  polyverts(:, nverts + 1) = polyverts(:, 1)
1294  !

◆ grid_finalize()

subroutine disv2dmodule::grid_finalize ( class(disv2dtype this)
private

Definition at line 388 of file Disv2d.f90.

389  ! dummy
390  class(Disv2dType) :: this
391  ! locals
392  integer(I4B) :: node, noder, j, ncell_count
393  ! formats
394  character(len=*), parameter :: fmtnr = &
395  "(/1x, 'The specified IDOMAIN results in a reduced number of cells.',&
396  &/1x, 'Number of user nodes: ',I0,&
397  &/1X, 'Number of nodes in solution: ', I0, //)"
398 
399  ! count active cells and set nodes to that number
400  ncell_count = 0
401  do j = 1, this%nodesuser
402  if (this%idomain(j) > 0) ncell_count = ncell_count + 1
403  end do
404  this%nodes = ncell_count
405 
406  ! Check to make sure nodes is a valid number
407  if (ncell_count == 0) then
408  call store_error('Model does not have any active nodes. &
409  &Ensure IDOMAIN array has some values greater &
410  &than zero.')
411  call store_error_filename(this%input_fname)
412  end if
413 
414  ! Write message if reduced grid
415  if (this%nodes < this%nodesuser) then
416  write (this%iout, fmtnr) this%nodesuser, this%nodes
417  end if
418 
419  ! Array size is now known, so allocate
420  call this%allocate_arrays()
421 
422  ! Fill the nodereduced array with the reduced nodenumber, or
423  ! a negative number to indicate it is a pass-through cell, or
424  ! a zero to indicate that the cell is excluded from the
425  ! solution.
426  if (this%nodes < this%nodesuser) then
427  node = 1
428  noder = 1
429  do j = 1, this%nodesuser
430  if (this%idomain(j) > 0) then
431  this%nodereduced(node) = noder
432  noder = noder + 1
433  else
434  this%nodereduced(node) = 0
435  end if
436  node = node + 1
437  end do
438  end if
439 
440  ! allocate and fill nodeuser if a reduced grid
441  if (this%nodes < this%nodesuser) then
442  node = 1
443  noder = 1
444  do j = 1, this%nodesuser
445  if (this%idomain(j) > 0) then
446  this%nodeuser(noder) = node
447  noder = noder + 1
448  end if
449  node = node + 1
450  end do
451  end if
452 
453  ! Move bottom into bot
454  ! and set x and y center coordinates
455  node = 0
456  do j = 1, this%nodesuser
457  node = node + 1
458  noder = node
459  if (this%nodes < this%nodesuser) noder = this%nodereduced(node)
460  if (noder <= 0) cycle
461  this%bot(noder) = this%bottom(j)
462  this%xc(noder) = this%cellxy(1, j)
463  this%yc(noder) = this%cellxy(2, j)
464  end do
465 
466  ! Build connections
467  call this%connect()
468 
Here is the call graph for this function:

◆ log_dimensions()

subroutine disv2dmodule::log_dimensions ( class(disv2dtype this,
type(disvfoundtype), intent(in)  found 
)
private

Definition at line 327 of file Disv2d.f90.

328  ! -- dummy
329  class(Disv2dType) :: this
330  type(DisvFoundType), intent(in) :: found
331  !
332  write (this%iout, '(1x,a)') 'Setting Discretization Dimensions'
333  !
334  if (found%nodes) then
335  write (this%iout, '(4x,a,i0)') 'NODES = ', this%nodesuser
336  end if
337  !
338  if (found%nvert) then
339  write (this%iout, '(4x,a,i0)') 'NVERT = ', this%nvert
340  end if
341  !
342  write (this%iout, '(1x,a,/)') 'End Setting Discretization Dimensions'
343  !

◆ log_griddata()

subroutine disv2dmodule::log_griddata ( class(disv2dtype this,
type(disvfoundtype), intent(in)  found 
)
private

Definition at line 367 of file Disv2d.f90.

368  ! -- dummy
369  class(Disv2dType) :: this
370  type(DisvFoundType), intent(in) :: found
371  !
372  write (this%iout, '(1x,a)') 'Setting Discretization Griddata'
373  !
374  if (found%bottom) then
375  write (this%iout, '(4x,a)') 'BOTTOM set from input file'
376  end if
377  !
378  if (found%idomain) then
379  write (this%iout, '(4x,a)') 'IDOMAIN set from input file'
380  end if
381  !
382  write (this%iout, '(1x,a,/)') 'End Setting Discretization Griddata'
383  !

◆ log_options()

subroutine disv2dmodule::log_options ( class(disv2dtype this,
type(disvfoundtype), intent(in)  found 
)
private

Definition at line 242 of file Disv2d.f90.

243  ! -- dummy
244  class(Disv2dType) :: this
245  type(DisvFoundType), intent(in) :: found
246  !
247  write (this%iout, '(1x,a)') 'Setting Discretization Options'
248  !
249  if (found%length_units) then
250  write (this%iout, '(4x,a,i0)') 'Model length unit [0=UND, 1=FEET, &
251  &2=METERS, 3=CENTIMETERS] set as ', this%lenuni
252  end if
253  !
254  if (found%nogrb) then
255  write (this%iout, '(4x,a,i0)') 'Binary grid file [0=GRB, 1=NOGRB] &
256  &set as ', this%nogrb
257  end if
258  !
259  if (found%xorigin) then
260  write (this%iout, '(4x,a,G0)') 'XORIGIN = ', this%xorigin
261  end if
262  !
263  if (found%yorigin) then
264  write (this%iout, '(4x,a,G0)') 'YORIGIN = ', this%yorigin
265  end if
266  !
267  if (found%angrot) then
268  write (this%iout, '(4x,a,G0)') 'ANGROT = ', this%angrot
269  end if
270  !
271  write (this%iout, '(1x,a,/)') 'End Setting Discretization Options'
272  !

◆ nodeu_from_cellid()

integer(i4b) function disv2dmodule::nodeu_from_cellid ( class(disv2dtype this,
character(len=*), intent(inout)  cellid,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
logical, intent(in), optional  flag_string,
logical, intent(in), optional  allow_zero 
)
private

If flag_string is present and true, the first token may be non-numeric (e.g. boundary name). In this case, return -2.

If allow_zero is present and true, and all indices are zero, the result can be zero. If allow_zero is false, a zero in any index is an error.

Definition at line 1182 of file Disv2d.f90.

1184  ! -- return
1185  integer(I4B) :: nodeu
1186  ! -- dummy
1187  class(Disv2dType) :: this
1188  character(len=*), intent(inout) :: cellid
1189  integer(I4B), intent(in) :: inunit
1190  integer(I4B), intent(in) :: iout
1191  logical, optional, intent(in) :: flag_string
1192  logical, optional, intent(in) :: allow_zero
1193  ! -- local
1194  integer(I4B) :: j, nodes
1195  integer(I4B) :: lloclocal, ndum, istat, n
1196  integer(I4B) :: istart, istop
1197  real(DP) :: r
1198  !
1199  if (present(flag_string)) then
1200  if (flag_string) then
1201  ! Check to see if first token in cellid can be read as an integer.
1202  lloclocal = 1
1203  call urword(cellid, lloclocal, istart, istop, 1, ndum, r, iout, inunit)
1204  read (cellid(istart:istop), *, iostat=istat) n
1205  if (istat /= 0) then
1206  ! First token in cellid is not an integer; return flag to this effect.
1207  nodeu = -2
1208  return
1209  end if
1210  end if
1211  end if
1212  !
1213  nodes = this%mshape(1)
1214  !
1215  lloclocal = 1
1216  call urword(cellid, lloclocal, istart, istop, 2, j, r, iout, inunit)
1217  !
1218  if (j == 0) then
1219  if (present(allow_zero)) then
1220  if (allow_zero) then
1221  nodeu = 0
1222  return
1223  end if
1224  end if
1225  end if
1226  !
1227  errmsg = ''
1228  !
1229  if (j < 1 .or. j > nodes) then
1230  write (errmsg, '(a,1x,a,i0,a)') &
1231  trim(adjustl(errmsg)), 'Cell2d number in list (', j, &
1232  ') is outside of the grid.'
1233  end if
1234  !
1235  nodeu = get_node(1, 1, j, 1, 1, nodes)
1236  !
1237  if (nodeu < 1 .or. nodeu > this%nodesuser) then
1238  write (errmsg, '(a,1x,a,i0,a)') &
1239  trim(adjustl(errmsg)), &
1240  "Cell number cannot be determined for cellid ("// &
1241  trim(adjustl(cellid))//") and results in a user "// &
1242  "node number (", nodeu, ") that is outside of the grid."
1243  end if
1244  !
1245  if (len_trim(adjustl(errmsg)) > 0) then
1246  call store_error(errmsg)
1247  call store_error_unit(inunit)
1248  end if
1249  !
Here is the call graph for this function:

◆ nodeu_from_string()

integer(i4b) function disv2dmodule::nodeu_from_string ( class(disv2dtype this,
integer(i4b), intent(inout)  lloc,
integer(i4b), intent(inout)  istart,
integer(i4b), intent(inout)  istop,
integer(i4b), intent(in)  in,
integer(i4b), intent(in)  iout,
character(len=*), intent(inout)  line,
logical, intent(in), optional  flag_string,
logical, intent(in), optional  allow_zero 
)
private

Parse layer and within-layer cell number and return user nodenumber. If flag_string is present and true, the first token may be non-numeric (e.g. boundary name). In this case, return -2.

Definition at line 1104 of file Disv2d.f90.

1106  ! -- dummy
1107  class(Disv2dType) :: this
1108  integer(I4B), intent(inout) :: lloc
1109  integer(I4B), intent(inout) :: istart
1110  integer(I4B), intent(inout) :: istop
1111  integer(I4B), intent(in) :: in
1112  integer(I4B), intent(in) :: iout
1113  character(len=*), intent(inout) :: line
1114  logical, optional, intent(in) :: flag_string
1115  logical, optional, intent(in) :: allow_zero
1116  integer(I4B) :: nodeu
1117  ! -- local
1118  integer(I4B) :: j, nodes
1119  integer(I4B) :: lloclocal, ndum, istat, n
1120  real(DP) :: r
1121  !
1122  if (present(flag_string)) then
1123  if (flag_string) then
1124  ! Check to see if first token in line can be read as an integer.
1125  lloclocal = lloc
1126  call urword(line, lloclocal, istart, istop, 1, ndum, r, iout, in)
1127  read (line(istart:istop), *, iostat=istat) n
1128  if (istat /= 0) then
1129  ! First token in line is not an integer; return flag to this effect.
1130  nodeu = -2
1131  return
1132  end if
1133  end if
1134  end if
1135  !
1136  nodes = this%mshape(1)
1137  !
1138  call urword(line, lloc, istart, istop, 2, j, r, iout, in)
1139  !
1140  if (j == 0) then
1141  if (present(allow_zero)) then
1142  if (allow_zero) then
1143  nodeu = 0
1144  return
1145  end if
1146  end if
1147  end if
1148  !
1149  errmsg = ''
1150  !
1151  if (j < 1 .or. j > nodes) then
1152  write (errmsg, '(a,1x,a,i0,a)') &
1153  trim(adjustl(errmsg)), 'Cell number in list (', j, &
1154  ') is outside of the grid.'
1155  end if
1156  !
1157  nodeu = get_node(1, 1, j, 1, 1, nodes)
1158  !
1159  if (nodeu < 1 .or. nodeu > this%nodesuser) then
1160  write (errmsg, '(a,1x,a,i0,a)') &
1161  trim(adjustl(errmsg)), &
1162  "Node number in list (", nodeu, ") is outside of the grid. "// &
1163  "Cell number cannot be determined in line '"// &
1164  trim(adjustl(line))//"'."
1165  end if
1166  !
1167  if (len_trim(adjustl(errmsg)) > 0) then
1168  call store_error(errmsg)
1169  call store_error_unit(in)
1170  end if
1171  !
Here is the call graph for this function:

◆ nodeu_to_array()

subroutine disv2dmodule::nodeu_to_array ( class(disv2dtype this,
integer(i4b), intent(in)  nodeu,
integer(i4b), dimension(:), intent(inout)  arr 
)
private

Definition at line 833 of file Disv2d.f90.

834  ! -- dummy
835  class(Disv2dType) :: this
836  integer(I4B), intent(in) :: nodeu
837  integer(I4B), dimension(:), intent(inout) :: arr
838  ! -- local
839  integer(I4B) :: isize
840  integer(I4B) :: i, j, k
841  !
842  ! -- check the size of arr
843  isize = size(arr)
844  if (isize /= this%ndim) then
845  write (errmsg, '(a,i0,a,i0,a)') &
846  'Program error: nodeu_to_array size of array (', isize, &
847  ') is not equal to the discretization dimension (', this%ndim, ').'
848  call store_error(errmsg, terminate=.true.)
849  end if
850  !
851  ! -- get k, i, j
852  call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
853  !
854  ! -- fill array
855  arr(1) = j
856  !
Here is the call graph for this function:

◆ nodeu_to_string()

subroutine disv2dmodule::nodeu_to_string ( class(disv2dtype this,
integer(i4b), intent(in)  nodeu,
character(len=*), intent(inout)  str 
)

Definition at line 816 of file Disv2d.f90.

817  ! -- dummy
818  class(Disv2dType) :: this
819  integer(I4B), intent(in) :: nodeu
820  character(len=*), intent(inout) :: str
821  ! -- local
822  integer(I4B) :: i, j, k
823  character(len=10) :: jstr
824  !
825  call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
826  write (jstr, '(i10)') j
827  str = '('//trim(adjustl(jstr))//')'
828  !
Here is the call graph for this function:

◆ record_array()

subroutine disv2dmodule::record_array ( class(disv2dtype), intent(inout)  this,
real(dp), dimension(:), intent(inout), pointer, contiguous  darray,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  iprint,
integer(i4b), intent(in)  idataun,
character(len=*), intent(in)  aname,
character(len=*), intent(in)  cdatafmp,
integer(i4b), intent(in)  nvaluesp,
integer(i4b), intent(in)  nwidthp,
character(len=*), intent(in)  editdesc,
real(dp), intent(in)  dinact 
)
private

The array is written to a formatted or unformatted external file depending on the arguments.

Parameters
[in,out]darraydouble precision array to record
[in]ioutascii output unit number
[in]iprintwhether to print the array
[in]idataunbinary output unit number, if negative don't write by layers, write entire array
[in]anametext descriptor
[in]cdatafmpwrite format
[in]nvaluespvalues per line
[in]nwidthpnumber width
[in]editdescformat type (I, G, F, S, E)
[in]dinactdouble precision value for cells excluded from model domain

Definition at line 1334 of file Disv2d.f90.

1336  ! -- dummy
1337  class(Disv2dType), intent(inout) :: this
1338  real(DP), dimension(:), pointer, contiguous, intent(inout) :: darray !< double precision array to record
1339  integer(I4B), intent(in) :: iout !< ascii output unit number
1340  integer(I4B), intent(in) :: iprint !< whether to print the array
1341  integer(I4B), intent(in) :: idataun !< binary output unit number, if negative don't write by layers, write entire array
1342  character(len=*), intent(in) :: aname !< text descriptor
1343  character(len=*), intent(in) :: cdatafmp !< write format
1344  integer(I4B), intent(in) :: nvaluesp !< values per line
1345  integer(I4B), intent(in) :: nwidthp !< number width
1346  character(len=*), intent(in) :: editdesc !< format type (I, G, F, S, E)
1347  real(DP), intent(in) :: dinact !< double precision value for cells excluded from model domain
1348  ! -- local
1349  integer(I4B) :: k, ifirst
1350  integer(I4B) :: nlay
1351  integer(I4B) :: nrow
1352  integer(I4B) :: ncol
1353  integer(I4B) :: nval
1354  integer(I4B) :: nodeu, noder
1355  integer(I4B) :: istart, istop
1356  real(DP), dimension(:), pointer, contiguous :: dtemp
1357  ! -- formats
1358  character(len=*), parameter :: fmthsv = &
1359  "(1X,/1X,a,' WILL BE SAVED ON UNIT ',I4, &
1360  &' AT END OF TIME STEP',I5,', STRESS PERIOD ',I4)"
1361  !
1362  ! -- set variables
1363  nlay = 1
1364  nrow = 1
1365  ncol = this%mshape(1)
1366  !
1367  ! -- If this is a reduced model, then copy the values from darray into
1368  ! dtemp.
1369  if (this%nodes < this%nodesuser) then
1370  nval = this%nodes
1371  dtemp => this%dbuff
1372  do nodeu = 1, this%nodesuser
1373  noder = this%get_nodenumber(nodeu, 0)
1374  if (noder <= 0) then
1375  dtemp(nodeu) = dinact
1376  cycle
1377  end if
1378  dtemp(nodeu) = darray(noder)
1379  end do
1380  else
1381  nval = this%nodes
1382  dtemp => darray
1383  end if
1384  !
1385  ! -- Print to iout if iprint /= 0
1386  if (iprint /= 0) then
1387  istart = 1
1388  do k = 1, nlay
1389  istop = istart + nrow * ncol - 1
1390  call ulaprufw(ncol, nrow, kstp, kper, k, iout, dtemp(istart:istop), &
1391  aname, cdatafmp, nvaluesp, nwidthp, editdesc)
1392  istart = istop + 1
1393  end do
1394  end if
1395  !
1396  ! -- Save array to an external file.
1397  if (idataun > 0) then
1398  ! -- write to binary file by layer
1399  ifirst = 1
1400  istart = 1
1401  do k = 1, nlay
1402  istop = istart + nrow * ncol - 1
1403  if (ifirst == 1) write (iout, fmthsv) &
1404  trim(adjustl(aname)), idataun, &
1405  kstp, kper
1406  ifirst = 0
1407  call ulasav(dtemp(istart:istop), aname, kstp, kper, &
1408  pertim, totim, ncol, nrow, k, idataun)
1409  istart = istop + 1
1410  end do
1411  elseif (idataun < 0) then
1412  !
1413  ! -- write entire array as one record
1414  call ubdsv1(kstp, kper, aname, -idataun, dtemp, ncol, nrow, nlay, &
1415  iout, delt, pertim, totim)
1416  end if
1417  !
Here is the call graph for this function:

◆ record_srcdst_list_header()

subroutine disv2dmodule::record_srcdst_list_header ( class(disv2dtype this,
character(len=16), intent(in)  text,
character(len=16), intent(in)  textmodel,
character(len=16), intent(in)  textpackage,
character(len=16), intent(in)  dstmodel,
character(len=16), intent(in)  dstpackage,
integer(i4b), intent(in)  naux,
character(len=16), dimension(:), intent(in)  auxtxt,
integer(i4b), intent(in)  ibdchn,
integer(i4b), intent(in)  nlist,
integer(i4b), intent(in)  iout 
)
private

Definition at line 1422 of file Disv2d.f90.

1425  ! -- dummy
1426  class(Disv2dType) :: this
1427  character(len=16), intent(in) :: text
1428  character(len=16), intent(in) :: textmodel
1429  character(len=16), intent(in) :: textpackage
1430  character(len=16), intent(in) :: dstmodel
1431  character(len=16), intent(in) :: dstpackage
1432  integer(I4B), intent(in) :: naux
1433  character(len=16), dimension(:), intent(in) :: auxtxt
1434  integer(I4B), intent(in) :: ibdchn
1435  integer(I4B), intent(in) :: nlist
1436  integer(I4B), intent(in) :: iout
1437  ! -- local
1438  integer(I4B) :: nlay, nrow, ncol
1439  !
1440  nlay = 1
1441  nrow = 1
1442  ncol = this%mshape(1)
1443  !
1444  ! -- Use ubdsv06 to write list header
1445  call ubdsv06(kstp, kper, text, textmodel, textpackage, dstmodel, dstpackage, &
1446  ibdchn, naux, auxtxt, ncol, nrow, nlay, &
1447  nlist, iout, delt, pertim, totim)
1448  !
Here is the call graph for this function:

◆ source_cell2d()

subroutine disv2dmodule::source_cell2d ( class(disv2dtype this)

Definition at line 545 of file Disv2d.f90.

546  ! -- dummy
547  class(Disv2dType) :: this
548  ! -- locals
549  integer(I4B), dimension(:), contiguous, pointer :: icell2d => null()
550  integer(I4B), dimension(:), contiguous, pointer :: ncvert => null()
551  integer(I4B), dimension(:), contiguous, pointer :: icvert => null()
552  real(DP), dimension(:), contiguous, pointer :: cell_x => null()
553  real(DP), dimension(:), contiguous, pointer :: cell_y => null()
554  integer(I4B) :: i
555  !
556  ! -- set pointers to input path ncvert and icvert
557  call mem_setptr(icell2d, 'ICELL2D', this%input_mempath)
558  call mem_setptr(ncvert, 'NCVERT', this%input_mempath)
559  call mem_setptr(icvert, 'ICVERT', this%input_mempath)
560  !
561  ! --
562  if (associated(icell2d) .and. associated(ncvert) &
563  .and. associated(icvert)) then
564  call this%define_cellverts(icell2d, ncvert, icvert)
565  else
566  call store_error('Required cell vertex array(s) [ICELL2D, NCVERT, ICVERT] &
567  &not found.')
568  end if
569  !
570  ! -- copy cell center idm sourced values to local arrays
571  call mem_setptr(cell_x, 'XC', this%input_mempath)
572  call mem_setptr(cell_y, 'YC', this%input_mempath)
573  !
574  ! -- set cell centers
575  if (associated(cell_x) .and. associated(cell_y)) then
576  do i = 1, this%nodesuser
577  this%cellxy(1, i) = cell_x(i)
578  this%cellxy(2, i) = cell_y(i)
579  end do
580  else
581  call store_error('Required cell center arrays not found.')
582  end if
583  !
584  ! -- log
585  if (this%iout > 0) then
586  write (this%iout, '(1x,a)') 'Discretization Cell2d data loaded'
587  end if
588  !
Here is the call graph for this function:

◆ source_dimensions()

subroutine disv2dmodule::source_dimensions ( class(disv2dtype this)
private

Definition at line 277 of file Disv2d.f90.

278  ! -- dummy
279  class(Disv2dType) :: this
280  ! -- locals
281  integer(I4B) :: j
282  type(DisvFoundType) :: found
283  !
284  ! -- update defaults with idm sourced values
285  call mem_set_value(this%nodes, 'NODES', this%input_mempath, found%nodes)
286  call mem_set_value(this%nvert, 'NVERT', this%input_mempath, found%nvert)
287  !
288  ! -- log simulation values
289  if (this%iout > 0) then
290  call this%log_dimensions(found)
291  end if
292  !
293  ! -- verify dimensions were set
294  if (this%nodes < 1) then
295  call store_error( &
296  'NODES was not specified or was specified incorrectly.')
297  call store_error_filename(this%input_fname)
298  end if
299  if (this%nvert < 1) then
300  call store_error( &
301  'NVERT was not specified or was specified incorrectly.')
302  call store_error_filename(this%input_fname)
303  end if
304  !
305  ! -- Calculate nodesuser
306  this%nodesuser = this%nodes
307  !
308  ! -- Allocate non-reduced vectors for disv
309  call mem_allocate(this%idomain, this%nodes, 'IDOMAIN', &
310  this%memoryPath)
311  call mem_allocate(this%bottom, this%nodes, 'BOTTOM', &
312  this%memoryPath)
313  !
314  ! -- Allocate vertices array
315  call mem_allocate(this%vertices, 2, this%nvert, 'VERTICES', this%memoryPath)
316  call mem_allocate(this%cellxy, 2, this%nodesuser, 'CELLXY', this%memoryPath)
317  !
318  ! -- initialize all cells to be active (idomain = 1)
319  do j = 1, this%nodesuser
320  this%idomain(j) = 1
321  end do
322  !
Here is the call graph for this function:

◆ source_griddata()

subroutine disv2dmodule::source_griddata ( class(disv2dtype this)
private

Definition at line 348 of file Disv2d.f90.

349  ! -- dummy
350  class(Disv2dType) :: this
351  ! -- locals
352  type(DisvFoundType) :: found
353  !
354  ! -- update defaults with idm sourced values
355  call mem_set_value(this%bottom, 'BOTTOM', this%input_mempath, found%bottom)
356  call mem_set_value(this%idomain, 'IDOMAIN', this%input_mempath, found%idomain)
357  !
358  ! -- log simulation values
359  if (this%iout > 0) then
360  call this%log_griddata(found)
361  end if
362  !

◆ source_options()

subroutine disv2dmodule::source_options ( class(disv2dtype this)

Definition at line 217 of file Disv2d.f90.

218  ! -- dummy
219  class(Disv2dType) :: this
220  ! -- locals
221  character(len=LENVARNAME), dimension(3) :: lenunits = &
222  &[character(len=LENVARNAME) :: 'FEET', 'METERS', 'CENTIMETERS']
223  type(disvfoundtype) :: found
224  !
225  ! -- update defaults with idm sourced values
226  call mem_set_value(this%lenuni, 'LENGTH_UNITS', this%input_mempath, &
227  lenunits, found%length_units)
228  call mem_set_value(this%nogrb, 'NOGRB', this%input_mempath, found%nogrb)
229  call mem_set_value(this%xorigin, 'XORIGIN', this%input_mempath, found%xorigin)
230  call mem_set_value(this%yorigin, 'YORIGIN', this%input_mempath, found%yorigin)
231  call mem_set_value(this%angrot, 'ANGROT', this%input_mempath, found%angrot)
232  !
233  ! -- log values to list file
234  if (this%iout > 0) then
235  call this%log_options(found)
236  end if
237  !

◆ source_vertices()

subroutine disv2dmodule::source_vertices ( class(disv2dtype this)
private

Definition at line 473 of file Disv2d.f90.

474  ! -- dummy
475  class(Disv2dType) :: this
476  ! -- local
477  integer(I4B) :: i
478  real(DP), dimension(:), contiguous, pointer :: vert_x => null()
479  real(DP), dimension(:), contiguous, pointer :: vert_y => null()
480  !
481  ! -- set pointers to memory manager input arrays
482  call mem_setptr(vert_x, 'XV', this%input_mempath)
483  call mem_setptr(vert_y, 'YV', this%input_mempath)
484  !
485  ! -- set vertices 2d array
486  if (associated(vert_x) .and. associated(vert_y)) then
487  do i = 1, this%nvert
488  this%vertices(1, i) = vert_x(i)
489  this%vertices(2, i) = vert_y(i)
490  end do
491  else
492  call store_error('Required Vertex arrays not found.')
493  end if
494  !
495  ! -- log
496  if (this%iout > 0) then
497  write (this%iout, '(1x,a)') 'Discretization Vertex data loaded'
498  end if
499  !
Here is the call graph for this function:

◆ write_grb()

subroutine disv2dmodule::write_grb ( class(disv2dtype this,
integer(i4b), dimension(:), intent(in)  icelltype 
)
private

Definition at line 663 of file Disv2d.f90.

664  ! -- modules
665  use openspecmodule, only: access, form
666  use constantsmodule, only: lenbigline
667  ! -- dummy
668  class(Disv2dType) :: this
669  integer(I4B), dimension(:), intent(in) :: icelltype
670  ! -- local
671  integer(I4B) :: iunit, i, ntxt, version
672  integer(I4B), parameter :: lentxt = 100
673  character(len=50) :: txthdr
674  character(len=lentxt) :: txt
675  character(len=LINELENGTH) :: fname
676  character(len=LENBIGLINE) :: crs
677  logical(LGP) :: found_crs
678  ! -- formats
679  character(len=*), parameter :: fmtgrdsave = &
680  "(4X,'BINARY GRID INFORMATION WILL BE WRITTEN TO:', &
681  &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
682  !
683  ! -- Initialize
684  version = 1
685  ntxt = 18
686  !
687  call mem_set_value(crs, 'CRS', this%input_mempath, found_crs)
688  !
689  ! -- set version
690  if (found_crs) then
691  ntxt = ntxt + 1
692  version = 2
693  end if
694  !
695  ! -- Open the file
696  fname = trim(this%output_fname)
697  iunit = getunit()
698  write (this%iout, fmtgrdsave) iunit, trim(adjustl(fname))
699  call openfile(iunit, this%iout, trim(adjustl(fname)), 'DATA(BINARY)', &
700  form, access, 'REPLACE')
701  !
702  ! -- write header information
703  write (txthdr, '(a)') 'GRID DISV2D'
704  txthdr(50:50) = new_line('a')
705  write (iunit) txthdr
706  write (txthdr, '(a)') 'VERSION 1'
707  txthdr(50:50) = new_line('a')
708  write (iunit) txthdr
709  write (txthdr, '(a, i0)') 'NTXT ', ntxt
710  txthdr(50:50) = new_line('a')
711  write (iunit) txthdr
712  write (txthdr, '(a, i0)') 'LENTXT ', lentxt
713  txthdr(50:50) = new_line('a')
714  write (iunit) txthdr
715  !
716  ! -- write variable definitions
717  write (txt, '(3a, i0)') 'NCELLS ', 'INTEGER ', 'NDIM 0 # ', this%nodesuser
718  txt(lentxt:lentxt) = new_line('a')
719  write (iunit) txt
720  write (txt, '(3a, i0)') 'NODES ', 'INTEGER ', 'NDIM 0 # ', this%nodes
721  txt(lentxt:lentxt) = new_line('a')
722  write (iunit) txt
723  write (txt, '(3a, i0)') 'NVERT ', 'INTEGER ', 'NDIM 0 # ', this%nvert
724  txt(lentxt:lentxt) = new_line('a')
725  write (iunit) txt
726  write (txt, '(3a, i0)') 'NJAVERT ', 'INTEGER ', 'NDIM 0 # ', size(this%javert)
727  txt(lentxt:lentxt) = new_line('a')
728  write (iunit) txt
729  write (txt, '(3a, i0)') 'NJA ', 'INTEGER ', 'NDIM 0 # ', this%con%nja
730  txt(lentxt:lentxt) = new_line('a')
731  write (iunit) txt
732  write (txt, '(3a, 1pg25.15e3)') &
733  'XORIGIN ', 'DOUBLE ', 'NDIM 0 # ', this%xorigin
734  txt(lentxt:lentxt) = new_line('a')
735  write (iunit) txt
736  write (txt, '(3a, 1pg25.15e3)') &
737  'YORIGIN ', 'DOUBLE ', 'NDIM 0 # ', this%yorigin
738  txt(lentxt:lentxt) = new_line('a')
739  write (iunit) txt
740  write (txt, '(3a, 1pg25.15e3)') 'ANGROT ', 'DOUBLE ', 'NDIM 0 # ', this%angrot
741  txt(lentxt:lentxt) = new_line('a')
742  write (iunit) txt
743  write (txt, '(3a, i0)') 'BOTM ', 'DOUBLE ', 'NDIM 1 ', this%nodesuser
744  txt(lentxt:lentxt) = new_line('a')
745  write (iunit) txt
746  write (txt, '(3a, i0)') 'VERTICES ', 'DOUBLE ', 'NDIM 2 2 ', this%nvert
747  txt(lentxt:lentxt) = new_line('a')
748  write (iunit) txt
749  write (txt, '(3a, i0)') 'CELLX ', 'DOUBLE ', 'NDIM 1 ', this%nodesuser
750  txt(lentxt:lentxt) = new_line('a')
751  write (iunit) txt
752  write (txt, '(3a, i0)') 'CELLY ', 'DOUBLE ', 'NDIM 1 ', this%nodesuser
753  txt(lentxt:lentxt) = new_line('a')
754  write (iunit) txt
755  write (txt, '(3a, i0)') 'IAVERT ', 'INTEGER ', 'NDIM 1 ', this%nodesuser + 1
756  txt(lentxt:lentxt) = new_line('a')
757  write (iunit) txt
758  write (txt, '(3a, i0)') 'JAVERT ', 'INTEGER ', 'NDIM 1 ', size(this%javert)
759  txt(lentxt:lentxt) = new_line('a')
760  write (iunit) txt
761  write (txt, '(3a, i0)') 'IA ', 'INTEGER ', 'NDIM 1 ', this%nodesuser + 1
762  txt(lentxt:lentxt) = new_line('a')
763  write (iunit) txt
764  write (txt, '(3a, i0)') 'JA ', 'INTEGER ', 'NDIM 1 ', size(this%con%jausr)
765  txt(lentxt:lentxt) = new_line('a')
766  write (iunit) txt
767  write (txt, '(3a, i0)') 'IDOMAIN ', 'INTEGER ', 'NDIM 1 ', this%nodesuser
768  txt(lentxt:lentxt) = new_line('a')
769  write (iunit) txt
770  write (txt, '(3a, i0)') 'ICELLTYPE ', 'INTEGER ', 'NDIM 1 ', this%nodesuser
771  txt(lentxt:lentxt) = new_line('a')
772  write (iunit) txt
773  !
774  ! -- if version 2 write character array headers
775  if (version == 2) then
776  if (found_crs) then
777  write (txt, '(3a, i0)') 'CRS ', 'CHARACTER ', 'NDIM 1 ', &
778  len_trim(crs)
779  txt(lentxt:lentxt) = new_line('a')
780  write (iunit) txt
781  end if
782  end if
783  !
784  ! -- write data
785  write (iunit) this%nodesuser ! ncells
786  write (iunit) this%nodes ! nodes
787  write (iunit) this%nvert ! nvert
788  write (iunit) size(this%javert) ! njavert
789  write (iunit) this%nja ! nja
790  write (iunit) this%xorigin ! xorigin
791  write (iunit) this%yorigin ! yorigin
792  write (iunit) this%angrot ! angrot
793  write (iunit) this%bottom ! botm
794  write (iunit) this%vertices ! vertices
795  write (iunit) (this%cellxy(1, i), i=1, this%nodesuser) ! cellx
796  write (iunit) (this%cellxy(2, i), i=1, this%nodesuser) ! celly
797  write (iunit) this%iavert ! iavert
798  write (iunit) this%javert ! javert
799  write (iunit) this%con%iausr ! iausr
800  write (iunit) this%con%jausr ! jausr
801  write (iunit) this%idomain ! idomain
802  write (iunit) icelltype ! icelltype
803  !
804  ! -- if version 2 write character array data
805  if (version == 2) then
806  if (found_crs) write (iunit) trim(crs) ! crs user input
807  end if
808  !
809  ! -- Close the file
810  close (iunit)
811  !
integer(i4b), parameter lenbigline
maximum length of a big line
Definition: Constants.f90:15
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
Here is the call graph for this function: