MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
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...
 
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...
 
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 988 of file Disv2d.f90.

989  ! -- dummy
990  class(Disv2dType) :: this
991  !
992  ! -- Allocate arrays in DisBaseType (mshape, top, bot, area)
993  call this%DisBaseType%allocate_arrays()
994  !
995  ! -- Allocate arrays for DisvType
996  if (this%nodes < this%nodesuser) then
997  call mem_allocate(this%nodeuser, this%nodes, 'NODEUSER', this%memoryPath)
998  call mem_allocate(this%nodereduced, this%nodesuser, 'NODEREDUCED', &
999  this%memoryPath)
1000  else
1001  call mem_allocate(this%nodeuser, 1, 'NODEUSER', this%memoryPath)
1002  call mem_allocate(this%nodereduced, 1, 'NODEREDUCED', this%memoryPath)
1003  end if
1004  ! -- Initialize
1005  this%mshape(1) = this%nodes
1006  !

◆ allocate_scalars()

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

Definition at line 968 of file Disv2d.f90.

969  ! -- dummy
970  class(Disv2dType) :: this
971  character(len=*), intent(in) :: name_model
972  character(len=*), intent(in) :: input_mempath
973  !
974  ! -- Allocate parent scalars
975  call this%DisBaseType%allocate_scalars(name_model, input_mempath)
976  !
977  ! -- Allocate
978  call mem_allocate(this%nvert, 'NVERT', this%memoryPath)
979  !
980  ! -- Initialize
981  this%nvert = 0
982  this%ndim = 1
983  !

◆ connect()

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

Definition at line 596 of file Disv2d.f90.

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

873  ! -- dummy
874  class(Disv2dType) :: this
875  integer(I4B), intent(in) :: noden !< cell (reduced nn)
876  integer(I4B), intent(in) :: nodem !< neighbor (reduced nn)
877  integer(I4B), intent(in) :: ihc !< horizontal connection flag
878  real(DP), intent(inout) :: xcomp
879  real(DP), intent(inout) :: ycomp
880  real(DP), intent(inout) :: zcomp
881  integer(I4B), intent(in) :: ipos
882  ! -- local
883  real(DP) :: angle, dmult
884  !
885  ! -- Set vector components based on ihc
886  if (ihc == 0) then
887  xcomp = dzero
888  ycomp = dzero
889  if (nodem < noden) then
890  !
891  ! -- nodem must be above noden, so upward connection
892  zcomp = done
893  else
894  !
895  ! -- nodem must be below noden, so downward connection
896  zcomp = -done
897  end if
898  else
899  ! -- find from anglex, since anglex is symmetric, need to flip vector
900  ! for lower triangle (nodem < noden)
901  !ipos = this%con%getjaindex(noden, nodem)
902  angle = this%con%anglex(this%con%jas(ipos))
903  dmult = done
904  if (nodem < noden) dmult = -done
905  xcomp = cos(angle) * dmult
906  ycomp = sin(angle) * dmult
907  zcomp = dzero
908  end if
909  !

◆ 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 917 of file Disv2d.f90.

919  ! -- dummy
920  class(Disv2dType) :: this
921  integer(I4B), intent(in) :: noden !< cell (reduced nn)
922  integer(I4B), intent(in) :: nodem !< neighbor (reduced nn)
923  logical, intent(in) :: nozee !< do not use z in calculations
924  real(DP), intent(in) :: satn !< not used for disv1d
925  real(DP), intent(in) :: satm !< not used for disv1d
926  integer(I4B), intent(in) :: ihc !< horizontal connection flag
927  real(DP), intent(inout) :: xcomp !< x component of connection vector
928  real(DP), intent(inout) :: ycomp !< y component of connection vector
929  real(DP), intent(inout) :: zcomp !< z component of connection vector
930  real(DP), intent(inout) :: conlen !< calculated straight-line distance between cell centers
931  ! -- local
932  integer(I4B) :: nodeun, nodeum
933  real(DP) :: xn, xm, yn, ym, zn, zm
934 
935  ! horizontal connection, with possible z component due to cell offsets
936  ! and/or water table conditions
937  if (nozee) then
938  zn = dzero
939  zm = dzero
940  else
941  zn = this%bot(noden)
942  zm = this%bot(nodem)
943  end if
944  nodeun = this%get_nodeuser(noden)
945  nodeum = this%get_nodeuser(nodem)
946  xn = this%cellxy(1, nodeun)
947  yn = this%cellxy(2, nodeun)
948  xm = this%cellxy(1, nodeum)
949  ym = this%cellxy(2, nodeum)
950  call line_unit_vector(xn, yn, zn, xm, ym, zm, xcomp, ycomp, zcomp, &
951  conlen)
952 
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 507 of file Disv2d.f90.

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

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

◆ disv2d_da()

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

Definition at line 152 of file Disv2d.f90.

153  ! -- modules
157  ! -- dummy
158  class(Disv2dType) :: this
159  ! -- local
160 
161  ! -- Deallocate idm memory
162  call memorylist_remove(this%name_model, 'DISV2D', idm_context)
163 
164  ! -- scalars
165  call mem_deallocate(this%nvert)
166 
167  ! -- arrays
168  call mem_deallocate(this%nodeuser)
169  call mem_deallocate(this%nodereduced)
170  call mem_deallocate(this%bottom)
171  call mem_deallocate(this%idomain)
172 
173  ! -- cdl hack for arrays for vertices and cell2d blocks
174  call mem_deallocate(this%vertices)
175  call mem_deallocate(this%cellxy)
176  call mem_deallocate(this%iavert)
177  call mem_deallocate(this%javert)
178  !
179  ! -- DisBaseType deallocate
180  call this%DisBaseType%dis_da()
181  !
182  ! -- Return
183  return
subroutine, public memorylist_remove(component, subcomponent, context)
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=linelength) idm_context
Here is the call graph for this function:

◆ disv2d_df()

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

Definition at line 144 of file Disv2d.f90.

145  ! -- dummy
146  class(Disv2dType) :: this
147  !
148  call this%grid_finalize()
149  !

◆ disv2d_load()

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

Definition at line 129 of file Disv2d.f90.

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

◆ 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 1016 of file Disv2d.f90.

1017  ! -- dummy
1018  class(Disv2dType) :: this
1019  integer(I4B), intent(in) :: icell2d
1020  ! -- return
1021  real(DP) :: area
1022  ! -- local
1023  integer(I4B) :: ivert
1024  integer(I4B) :: nvert
1025  integer(I4B) :: icount
1026  integer(I4B) :: iv1
1027  real(DP) :: x
1028  real(DP) :: y
1029  real(DP) :: x1
1030  real(DP) :: y1
1031  !
1032  area = dzero
1033  nvert = this%iavert(icell2d + 1) - this%iavert(icell2d)
1034  icount = 1
1035  iv1 = this%javert(this%iavert(icell2d))
1036  x1 = this%vertices(1, iv1)
1037  y1 = this%vertices(2, iv1)
1038  do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1039  x = this%vertices(1, this%javert(ivert))
1040  if (icount < nvert) then
1041  y = this%vertices(2, this%javert(ivert + 1))
1042  else
1043  y = this%vertices(2, this%javert(this%iavert(icell2d)))
1044  end if
1045  area = area + (x - x1) * (y - y1)
1046  icount = icount + 1
1047  end do
1048  !
1049  icount = 1
1050  do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1051  y = this%vertices(2, this%javert(ivert))
1052  if (icount < nvert) then
1053  x = this%vertices(1, this%javert(ivert + 1))
1054  else
1055  x = this%vertices(1, this%javert(this%iavert(icell2d)))
1056  end if
1057  area = area - (x - x1) * (y - y1)
1058  icount = icount + 1
1059  end do
1060  !
1061  area = -done * area * dhalf
1062  !

◆ get_dis_type()

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

Definition at line 957 of file Disv2d.f90.

958  ! -- dummy
959  class(Disv2dType), intent(in) :: this
960  character(len=*), intent(out) :: dis_type
961  !
962  dis_type = "DISV2D"
963  !

◆ 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 837 of file Disv2d.f90.

838  ! -- return
839  integer(I4B) :: nodenumber
840  ! -- dummy
841  class(Disv2dType), intent(in) :: this
842  integer(I4B), intent(in) :: nodeu
843  integer(I4B), intent(in) :: icheck
844  ! -- local
845  !
846  ! -- check the node number if requested
847  if (icheck /= 0) then
848  !
849  ! -- If within valid range, convert to reduced nodenumber
850  if (nodeu < 1 .or. nodeu > this%nodesuser) then
851  nodenumber = 0
852  write (errmsg, '(a,i0,a,i0,a)') &
853  'Node number (', nodeu, ') is less than 1 or greater than nodes (', &
854  this%nodesuser, ').'
855  call store_error(errmsg)
856  else
857  nodenumber = nodeu
858  if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
859  end if
860  else
861  nodenumber = nodeu
862  if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
863  end if
864  !
Here is the call graph for this function:

◆ 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 1222 of file Disv2d.f90.

1223  ! -- dummy
1224  class(Disv2dType), intent(inout) :: this
1225  integer(I4B), intent(in) :: ic !< cell number (reduced)
1226  real(DP), allocatable, intent(out) :: polyverts(:, :) !< polygon vertices (column-major indexing)
1227  logical(LGP), intent(in), optional :: closed !< whether to close the polygon, duplicating a vertex (default false)
1228  ! -- local
1229  integer(I4B) :: icu, icu2d, iavert, nverts, m, j
1230  logical(LGP) :: lclosed
1231  !
1232  ! count vertices
1233  icu = this%get_nodeuser(ic)
1234  icu2d = icu - ((icu - 1) / this%nodes) * this%nodes
1235  nverts = this%iavert(icu2d + 1) - this%iavert(icu2d) - 1
1236  if (nverts .le. 0) nverts = nverts + size(this%javert)
1237  !
1238  ! check closed option
1239  if (.not. (present(closed))) then
1240  lclosed = .false.
1241  else
1242  lclosed = closed
1243  end if
1244  !
1245  ! allocate vertices array
1246  if (lclosed) then
1247  allocate (polyverts(2, nverts + 1))
1248  else
1249  allocate (polyverts(2, nverts))
1250  end if
1251  !
1252  ! set vertices
1253  iavert = this%iavert(icu2d)
1254  do m = 1, nverts
1255  j = this%javert(iavert - 1 + m)
1256  polyverts(:, m) = (/this%vertices(1, j), this%vertices(2, j)/)
1257  end do
1258  !
1259  ! close if enabled
1260  if (lclosed) &
1261  polyverts(:, nverts + 1) = polyverts(:, 1)
1262  !

◆ 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
400  ncell_count = 0
401  do j = 1, this%nodes
402  if (this%idomain(j) > 0) ncell_count = ncell_count + 1
403  end do
404  !
405  ! -- Check to make sure nodes is a valid number
406  if (ncell_count == 0) then
407  call store_error('Model does not have any active nodes. &
408  &Ensure IDOMAIN array has some values greater &
409  &than zero.')
410  call store_error_filename(this%input_fname)
411  end if
412 
413  if (count_errors() > 0) then
414  call store_error_filename(this%input_fname)
415  end if
416  !
417  ! -- Array size is now known, so allocate
418  call this%allocate_arrays()
419  !
420  ! -- Fill the nodereduced array with the reduced nodenumber, or
421  ! a negative number to indicate it is a pass-through cell, or
422  ! a zero to indicate that the cell is excluded from the
423  ! solution.
424  if (this%nodes < this%nodesuser) then
425  node = 1
426  noder = 1
427  do j = 1, this%nodes
428  if (this%idomain(j) > 0) then
429  this%nodereduced(node) = noder
430  noder = noder + 1
431  else
432  this%nodereduced(node) = 0
433  end if
434  node = node + 1
435  end do
436  end if
437  !
438  ! -- allocate and fill nodeuser if a reduced grid
439  if (this%nodes < this%nodesuser) then
440  node = 1
441  noder = 1
442  do j = 1, this%nodes
443  if (this%idomain(j) > 0) then
444  this%nodeuser(noder) = node
445  noder = noder + 1
446  end if
447  node = node + 1
448  end do
449  end if
450 
451  ! Copy bottom into bot
452  do node = 1, this%nodesuser
453  this%bot(node) = this%bottom(node)
454  end do
455 
456  ! -- Move bottom into bot
457  ! and set x and y center coordinates
458  node = 0
459  do j = 1, this%nodes
460  node = node + 1
461  noder = node
462  if (this%nodes < this%nodesuser) noder = this%nodereduced(node)
463  if (noder <= 0) cycle
464  this%bot(noder) = this%bottom(j)
465  this%xc(noder) = this%cellxy(1, j)
466  this%yc(noder) = this%cellxy(2, j)
467  end do
468  !
469  ! -- Build connections
470  call this%connect()
471  !
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%nodes
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 1149 of file Disv2d.f90.

1151  ! -- return
1152  integer(I4B) :: nodeu
1153  ! -- dummy
1154  class(Disv2dType) :: this
1155  character(len=*), intent(inout) :: cellid
1156  integer(I4B), intent(in) :: inunit
1157  integer(I4B), intent(in) :: iout
1158  logical, optional, intent(in) :: flag_string
1159  logical, optional, intent(in) :: allow_zero
1160  ! -- local
1161  integer(I4B) :: j, nodes
1162  integer(I4B) :: lloclocal, ndum, istat, n
1163  integer(I4B) :: istart, istop
1164  real(DP) :: r
1165  !
1166  if (present(flag_string)) then
1167  if (flag_string) then
1168  ! Check to see if first token in cellid can be read as an integer.
1169  lloclocal = 1
1170  call urword(cellid, lloclocal, istart, istop, 1, ndum, r, iout, inunit)
1171  read (cellid(istart:istop), *, iostat=istat) n
1172  if (istat /= 0) then
1173  ! First token in cellid is not an integer; return flag to this effect.
1174  nodeu = -2
1175  return
1176  end if
1177  end if
1178  end if
1179  !
1180  nodes = this%mshape(1)
1181  !
1182  lloclocal = 1
1183  call urword(cellid, lloclocal, istart, istop, 2, j, r, iout, inunit)
1184  !
1185  if (j == 0) then
1186  if (present(allow_zero)) then
1187  if (allow_zero) then
1188  nodeu = 0
1189  return
1190  end if
1191  end if
1192  end if
1193  !
1194  errmsg = ''
1195  !
1196  if (j < 1 .or. j > nodes) then
1197  write (errmsg, '(a,1x,a,i0,a)') &
1198  trim(adjustl(errmsg)), 'Cell2d number in list (', j, &
1199  ') is outside of the grid.'
1200  end if
1201  !
1202  nodeu = get_node(1, 1, j, 1, 1, nodes)
1203  !
1204  if (nodeu < 1 .or. nodeu > this%nodesuser) then
1205  write (errmsg, '(a,1x,a,i0,a)') &
1206  trim(adjustl(errmsg)), &
1207  "Cell number cannot be determined for cellid ("// &
1208  trim(adjustl(cellid))//") and results in a user "// &
1209  "node number (", nodeu, ") that is outside of the grid."
1210  end if
1211  !
1212  if (len_trim(adjustl(errmsg)) > 0) then
1213  call store_error(errmsg)
1214  call store_error_unit(inunit)
1215  end if
1216  !
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 1071 of file Disv2d.f90.

1073  ! -- dummy
1074  class(Disv2dType) :: this
1075  integer(I4B), intent(inout) :: lloc
1076  integer(I4B), intent(inout) :: istart
1077  integer(I4B), intent(inout) :: istop
1078  integer(I4B), intent(in) :: in
1079  integer(I4B), intent(in) :: iout
1080  character(len=*), intent(inout) :: line
1081  logical, optional, intent(in) :: flag_string
1082  logical, optional, intent(in) :: allow_zero
1083  integer(I4B) :: nodeu
1084  ! -- local
1085  integer(I4B) :: j, nodes
1086  integer(I4B) :: lloclocal, ndum, istat, n
1087  real(DP) :: r
1088  !
1089  if (present(flag_string)) then
1090  if (flag_string) then
1091  ! Check to see if first token in line can be read as an integer.
1092  lloclocal = lloc
1093  call urword(line, lloclocal, istart, istop, 1, ndum, r, iout, in)
1094  read (line(istart:istop), *, iostat=istat) n
1095  if (istat /= 0) then
1096  ! First token in line is not an integer; return flag to this effect.
1097  nodeu = -2
1098  return
1099  end if
1100  end if
1101  end if
1102  !
1103  nodes = this%mshape(1)
1104  !
1105  call urword(line, lloc, istart, istop, 2, j, r, iout, in)
1106  !
1107  if (j == 0) then
1108  if (present(allow_zero)) then
1109  if (allow_zero) then
1110  nodeu = 0
1111  return
1112  end if
1113  end if
1114  end if
1115  !
1116  errmsg = ''
1117  !
1118  if (j < 1 .or. j > nodes) then
1119  write (errmsg, '(a,1x,a,i0,a)') &
1120  trim(adjustl(errmsg)), 'Cell number in list (', j, &
1121  ') is outside of the grid.'
1122  end if
1123  !
1124  nodeu = get_node(1, 1, j, 1, 1, nodes)
1125  !
1126  if (nodeu < 1 .or. nodeu > this%nodesuser) then
1127  write (errmsg, '(a,1x,a,i0,a)') &
1128  trim(adjustl(errmsg)), &
1129  "Node number in list (", nodeu, ") is outside of the grid. "// &
1130  "Cell number cannot be determined in line '"// &
1131  trim(adjustl(line))//"'."
1132  end if
1133  !
1134  if (len_trim(adjustl(errmsg)) > 0) then
1135  call store_error(errmsg)
1136  call store_error_unit(in)
1137  end if
1138  !
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 809 of file Disv2d.f90.

810  ! -- dummy
811  class(Disv2dType) :: this
812  integer(I4B), intent(in) :: nodeu
813  integer(I4B), dimension(:), intent(inout) :: arr
814  ! -- local
815  integer(I4B) :: isize
816  integer(I4B) :: i, j, k
817  !
818  ! -- check the size of arr
819  isize = size(arr)
820  if (isize /= this%ndim) then
821  write (errmsg, '(a,i0,a,i0,a)') &
822  'Program error: nodeu_to_array size of array (', isize, &
823  ') is not equal to the discretization dimension (', this%ndim, ').'
824  call store_error(errmsg, terminate=.true.)
825  end if
826  !
827  ! -- get k, i, j
828  call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
829  !
830  ! -- fill array
831  arr(1) = j
832  !
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 792 of file Disv2d.f90.

793  ! -- dummy
794  class(Disv2dType) :: this
795  integer(I4B), intent(in) :: nodeu
796  character(len=*), intent(inout) :: str
797  ! -- local
798  integer(I4B) :: i, j, k
799  character(len=10) :: jstr
800  !
801  call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
802  write (jstr, '(i10)') j
803  str = '('//trim(adjustl(jstr))//')'
804  !
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 1270 of file Disv2d.f90.

1272  ! -- dummy
1273  class(Disv2dType), intent(inout) :: this
1274  real(DP), dimension(:), pointer, contiguous, intent(inout) :: darray !< double precision array to record
1275  integer(I4B), intent(in) :: iout !< ascii output unit number
1276  integer(I4B), intent(in) :: iprint !< whether to print the array
1277  integer(I4B), intent(in) :: idataun !< binary output unit number, if negative don't write by layers, write entire array
1278  character(len=*), intent(in) :: aname !< text descriptor
1279  character(len=*), intent(in) :: cdatafmp !< write format
1280  integer(I4B), intent(in) :: nvaluesp !< values per line
1281  integer(I4B), intent(in) :: nwidthp !< number width
1282  character(len=*), intent(in) :: editdesc !< format type (I, G, F, S, E)
1283  real(DP), intent(in) :: dinact !< double precision value for cells excluded from model domain
1284  ! -- local
1285  integer(I4B) :: k, ifirst
1286  integer(I4B) :: nlay
1287  integer(I4B) :: nrow
1288  integer(I4B) :: ncol
1289  integer(I4B) :: nval
1290  integer(I4B) :: nodeu, noder
1291  integer(I4B) :: istart, istop
1292  real(DP), dimension(:), pointer, contiguous :: dtemp
1293  ! -- formats
1294  character(len=*), parameter :: fmthsv = &
1295  "(1X,/1X,a,' WILL BE SAVED ON UNIT ',I4, &
1296  &' AT END OF TIME STEP',I5,', STRESS PERIOD ',I4)"
1297  !
1298  ! -- set variables
1299  nlay = 1
1300  nrow = 1
1301  ncol = this%mshape(1)
1302  !
1303  ! -- If this is a reduced model, then copy the values from darray into
1304  ! dtemp.
1305  if (this%nodes < this%nodesuser) then
1306  nval = this%nodes
1307  dtemp => this%dbuff
1308  do nodeu = 1, this%nodesuser
1309  noder = this%get_nodenumber(nodeu, 0)
1310  if (noder <= 0) then
1311  dtemp(nodeu) = dinact
1312  cycle
1313  end if
1314  dtemp(nodeu) = darray(noder)
1315  end do
1316  else
1317  nval = this%nodes
1318  dtemp => darray
1319  end if
1320  !
1321  ! -- Print to iout if iprint /= 0
1322  if (iprint /= 0) then
1323  istart = 1
1324  do k = 1, nlay
1325  istop = istart + nrow * ncol - 1
1326  call ulaprufw(ncol, nrow, kstp, kper, k, iout, dtemp(istart:istop), &
1327  aname, cdatafmp, nvaluesp, nwidthp, editdesc)
1328  istart = istop + 1
1329  end do
1330  end if
1331  !
1332  ! -- Save array to an external file.
1333  if (idataun > 0) then
1334  ! -- write to binary file by layer
1335  ifirst = 1
1336  istart = 1
1337  do k = 1, nlay
1338  istop = istart + nrow * ncol - 1
1339  if (ifirst == 1) write (iout, fmthsv) &
1340  trim(adjustl(aname)), idataun, &
1341  kstp, kper
1342  ifirst = 0
1343  call ulasav(dtemp(istart:istop), aname, kstp, kper, &
1344  pertim, totim, ncol, nrow, k, idataun)
1345  istart = istop + 1
1346  end do
1347  elseif (idataun < 0) then
1348  !
1349  ! -- write entire array as one record
1350  call ubdsv1(kstp, kper, aname, -idataun, dtemp, ncol, nrow, nlay, &
1351  iout, delt, pertim, totim)
1352  end if
1353  !
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 1358 of file Disv2d.f90.

1361  ! -- dummy
1362  class(Disv2dType) :: this
1363  character(len=16), intent(in) :: text
1364  character(len=16), intent(in) :: textmodel
1365  character(len=16), intent(in) :: textpackage
1366  character(len=16), intent(in) :: dstmodel
1367  character(len=16), intent(in) :: dstpackage
1368  integer(I4B), intent(in) :: naux
1369  character(len=16), dimension(:), intent(in) :: auxtxt
1370  integer(I4B), intent(in) :: ibdchn
1371  integer(I4B), intent(in) :: nlist
1372  integer(I4B), intent(in) :: iout
1373  ! -- local
1374  integer(I4B) :: nlay, nrow, ncol
1375  !
1376  nlay = 1
1377  nrow = 1
1378  ncol = this%mshape(1)
1379  !
1380  ! -- Use ubdsv06 to write list header
1381  call ubdsv06(kstp, kper, text, textmodel, textpackage, dstmodel, dstpackage, &
1382  ibdchn, naux, auxtxt, ncol, nrow, nlay, &
1383  nlist, iout, delt, pertim, totim)
1384  !
Here is the call graph for this function:

◆ source_cell2d()

subroutine disv2dmodule::source_cell2d ( class(disv2dtype this)

Definition at line 548 of file Disv2d.f90.

549  ! -- dummy
550  class(Disv2dType) :: this
551  ! -- locals
552  integer(I4B), dimension(:), contiguous, pointer :: icell2d => null()
553  integer(I4B), dimension(:), contiguous, pointer :: ncvert => null()
554  integer(I4B), dimension(:), contiguous, pointer :: icvert => null()
555  real(DP), dimension(:), contiguous, pointer :: cell_x => null()
556  real(DP), dimension(:), contiguous, pointer :: cell_y => null()
557  integer(I4B) :: i
558  !
559  ! -- set pointers to input path ncvert and icvert
560  call mem_setptr(icell2d, 'ICELL2D', this%input_mempath)
561  call mem_setptr(ncvert, 'NCVERT', this%input_mempath)
562  call mem_setptr(icvert, 'ICVERT', this%input_mempath)
563  !
564  ! --
565  if (associated(icell2d) .and. associated(ncvert) &
566  .and. associated(icvert)) then
567  call this%define_cellverts(icell2d, ncvert, icvert)
568  else
569  call store_error('Required cell vertex array(s) [ICELL2D, NCVERT, ICVERT] &
570  &not found.')
571  end if
572  !
573  ! -- copy cell center idm sourced values to local arrays
574  call mem_setptr(cell_x, 'XC', this%input_mempath)
575  call mem_setptr(cell_y, 'YC', this%input_mempath)
576  !
577  ! -- set cell centers
578  if (associated(cell_x) .and. associated(cell_y)) then
579  do i = 1, this%nodes
580  this%cellxy(1, i) = cell_x(i)
581  this%cellxy(2, i) = cell_y(i)
582  end do
583  else
584  call store_error('Required cell center arrays not found.')
585  end if
586  !
587  ! -- log
588  if (this%iout > 0) then
589  write (this%iout, '(1x,a)') 'Discretization Cell2d data loaded'
590  end if
591  !
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%nodes, 'CELLXY', this%memoryPath)
317  !
318  ! -- initialize all cells to be active (idomain = 1)
319  do j = 1, this%nodes
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 476 of file Disv2d.f90.

477  ! -- dummy
478  class(Disv2dType) :: this
479  ! -- local
480  integer(I4B) :: i
481  real(DP), dimension(:), contiguous, pointer :: vert_x => null()
482  real(DP), dimension(:), contiguous, pointer :: vert_y => null()
483  !
484  ! -- set pointers to memory manager input arrays
485  call mem_setptr(vert_x, 'XV', this%input_mempath)
486  call mem_setptr(vert_y, 'YV', this%input_mempath)
487  !
488  ! -- set vertices 2d array
489  if (associated(vert_x) .and. associated(vert_y)) then
490  do i = 1, this%nvert
491  this%vertices(1, i) = vert_x(i)
492  this%vertices(2, i) = vert_y(i)
493  end do
494  else
495  call store_error('Required Vertex arrays not found.')
496  end if
497  !
498  ! -- log
499  if (this%iout > 0) then
500  write (this%iout, '(1x,a)') 'Discretization Vertex data loaded'
501  end if
502  !
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 666 of file Disv2d.f90.

667  ! -- modules
668  use openspecmodule, only: access, form
669  ! -- dummy
670  class(Disv2dType) :: this
671  integer(I4B), dimension(:), intent(in) :: icelltype
672  ! -- local
673  integer(I4B) :: iunit, i, ntxt
674  integer(I4B), parameter :: lentxt = 100
675  character(len=50) :: txthdr
676  character(len=lentxt) :: txt
677  character(len=LINELENGTH) :: fname
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  ntxt = 18
685  !
686  ! -- Open the file
687  fname = trim(this%input_fname)//'.grb'
688  iunit = getunit()
689  write (this%iout, fmtgrdsave) iunit, trim(adjustl(fname))
690  call openfile(iunit, this%iout, trim(adjustl(fname)), 'DATA(BINARY)', &
691  form, access, 'REPLACE')
692  !
693  ! -- write header information
694  write (txthdr, '(a)') 'GRID DISV2D'
695  txthdr(50:50) = new_line('a')
696  write (iunit) txthdr
697  write (txthdr, '(a)') 'VERSION 1'
698  txthdr(50:50) = new_line('a')
699  write (iunit) txthdr
700  write (txthdr, '(a, i0)') 'NTXT ', ntxt
701  txthdr(50:50) = new_line('a')
702  write (iunit) txthdr
703  write (txthdr, '(a, i0)') 'LENTXT ', lentxt
704  txthdr(50:50) = new_line('a')
705  write (iunit) txthdr
706  !
707  ! -- write variable definitions
708  write (txt, '(3a, i0)') 'NCELLS ', 'INTEGER ', 'NDIM 0 # ', this%nodesuser
709  txt(lentxt:lentxt) = new_line('a')
710  write (iunit) txt
711  write (txt, '(3a, i0)') 'NODES ', 'INTEGER ', 'NDIM 0 # ', this%nodes
712  txt(lentxt:lentxt) = new_line('a')
713  write (iunit) txt
714  write (txt, '(3a, i0)') 'NVERT ', 'INTEGER ', 'NDIM 0 # ', this%nvert
715  txt(lentxt:lentxt) = new_line('a')
716  write (iunit) txt
717  write (txt, '(3a, i0)') 'NJAVERT ', 'INTEGER ', 'NDIM 0 # ', size(this%javert)
718  txt(lentxt:lentxt) = new_line('a')
719  write (iunit) txt
720  write (txt, '(3a, i0)') 'NJA ', 'INTEGER ', 'NDIM 0 # ', this%con%nja
721  txt(lentxt:lentxt) = new_line('a')
722  write (iunit) txt
723  write (txt, '(3a, 1pg25.15e3)') &
724  'XORIGIN ', 'DOUBLE ', 'NDIM 0 # ', this%xorigin
725  txt(lentxt:lentxt) = new_line('a')
726  write (iunit) txt
727  write (txt, '(3a, 1pg25.15e3)') &
728  'YORIGIN ', 'DOUBLE ', 'NDIM 0 # ', this%yorigin
729  txt(lentxt:lentxt) = new_line('a')
730  write (iunit) txt
731  write (txt, '(3a, 1pg25.15e3)') 'ANGROT ', 'DOUBLE ', 'NDIM 0 # ', this%angrot
732  txt(lentxt:lentxt) = new_line('a')
733  write (iunit) txt
734  write (txt, '(3a, i0)') 'BOTM ', 'DOUBLE ', 'NDIM 1 ', this%nodesuser
735  txt(lentxt:lentxt) = new_line('a')
736  write (iunit) txt
737  write (txt, '(3a, i0)') 'VERTICES ', 'DOUBLE ', 'NDIM 2 2 ', this%nvert
738  txt(lentxt:lentxt) = new_line('a')
739  write (iunit) txt
740  write (txt, '(3a, i0)') 'CELLX ', 'DOUBLE ', 'NDIM 1 ', this%nodes
741  txt(lentxt:lentxt) = new_line('a')
742  write (iunit) txt
743  write (txt, '(3a, i0)') 'CELLY ', 'DOUBLE ', 'NDIM 1 ', this%nodes
744  txt(lentxt:lentxt) = new_line('a')
745  write (iunit) txt
746  write (txt, '(3a, i0)') 'IAVERT ', 'INTEGER ', 'NDIM 1 ', this%nodes + 1
747  txt(lentxt:lentxt) = new_line('a')
748  write (iunit) txt
749  write (txt, '(3a, i0)') 'JAVERT ', 'INTEGER ', 'NDIM 1 ', size(this%javert)
750  txt(lentxt:lentxt) = new_line('a')
751  write (iunit) txt
752  write (txt, '(3a, i0)') 'IA ', 'INTEGER ', 'NDIM 1 ', this%nodesuser + 1
753  txt(lentxt:lentxt) = new_line('a')
754  write (iunit) txt
755  write (txt, '(3a, i0)') 'JA ', 'INTEGER ', 'NDIM 1 ', size(this%con%jausr)
756  txt(lentxt:lentxt) = new_line('a')
757  write (iunit) txt
758  write (txt, '(3a, i0)') 'IDOMAIN ', 'INTEGER ', 'NDIM 1 ', this%nodesuser
759  txt(lentxt:lentxt) = new_line('a')
760  write (iunit) txt
761  write (txt, '(3a, i0)') 'ICELLTYPE ', 'INTEGER ', 'NDIM 1 ', this%nodesuser
762  txt(lentxt:lentxt) = new_line('a')
763  write (iunit) txt
764  !
765  ! -- write data
766  write (iunit) this%nodesuser ! ncells
767  write (iunit) this%nodes ! nodes
768  write (iunit) this%nvert ! nvert
769  write (iunit) size(this%javert) ! njavert
770  write (iunit) this%nja ! nja
771  write (iunit) this%xorigin ! xorigin
772  write (iunit) this%yorigin ! yorigin
773  write (iunit) this%angrot ! angrot
774  write (iunit) this%bottom ! botm
775  write (iunit) this%vertices ! vertices
776  write (iunit) (this%cellxy(1, i), i=1, this%nodes) ! cellx
777  write (iunit) (this%cellxy(2, i), i=1, this%nodes) ! celly
778  write (iunit) this%iavert ! iavert
779  write (iunit) this%javert ! javert
780  write (iunit) this%con%iausr ! iausr
781  write (iunit) this%con%jausr ! jausr
782  write (iunit) this%idomain ! idomain
783  write (iunit) icelltype ! icelltype
784  !
785  ! -- Close the file
786  close (iunit)
787  !
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
Here is the call graph for this function: