25 integer(I4B),
pointer :: nvert => null()
26 real(dp),
dimension(:, :),
pointer,
contiguous :: vertices => null()
27 real(dp),
dimension(:, :),
pointer,
contiguous :: cellxy => null()
28 integer(I4B),
dimension(:),
pointer,
contiguous :: iavert => null()
29 integer(I4B),
dimension(:),
pointer,
contiguous :: javert => null()
30 real(dp),
dimension(:),
pointer,
contiguous :: bottom => null()
31 integer(I4B),
dimension(:),
pointer,
contiguous :: idomain => null()
70 logical :: length_units = .false.
71 logical :: nogrb = .false.
72 logical :: xorigin = .false.
73 logical :: yorigin = .false.
74 logical :: angrot = .false.
75 logical :: nodes = .false.
76 logical :: nvert = .false.
77 logical :: bottom = .false.
78 logical :: idomain = .false.
79 logical :: iv = .false.
80 logical :: xv = .false.
81 logical :: yv = .false.
82 logical :: icell2d = .false.
83 logical :: xc = .false.
84 logical :: yc = .false.
85 logical :: ncvert = .false.
86 logical :: icvert = .false.
93 subroutine disv2d_cr(dis, name_model, input_mempath, inunit, iout)
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
103 character(len=*),
parameter :: fmtheader = &
104 "(1X, /1X, 'DISV -- VERTEX GRID DISCRETIZATION PACKAGE,', &
105 &' VERSION 1 : 12/23/2015 - INPUT READ FROM MEMPATH: ', A, //)"
109 call disnew%allocate_scalars(name_model, input_mempath)
118 write (iout, fmtheader) dis%input_mempath
122 call disnew%disv2d_load()
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()
148 call this%grid_finalize()
180 call this%DisBaseType%dis_da()
218 character(len=LENVARNAME),
dimension(3) :: lenunits = &
219 &[character(len=LENVARNAME) ::
'FEET',
'METERS',
'CENTIMETERS']
223 call mem_set_value(this%lenuni,
'LENGTH_UNITS', this%input_mempath, &
224 lenunits, found%length_units)
225 call mem_set_value(this%nogrb,
'NOGRB', this%input_mempath, found%nogrb)
226 call mem_set_value(this%xorigin,
'XORIGIN', this%input_mempath, found%xorigin)
227 call mem_set_value(this%yorigin,
'YORIGIN', this%input_mempath, found%yorigin)
228 call mem_set_value(this%angrot,
'ANGROT', this%input_mempath, found%angrot)
231 if (this%iout > 0)
then
232 call this%log_options(found)
244 write (this%iout,
'(1x,a)')
'Setting Discretization Options'
246 if (found%length_units)
then
247 write (this%iout,
'(4x,a,i0)')
'Model length unit [0=UND, 1=FEET, &
248 &2=METERS, 3=CENTIMETERS] set as ', this%lenuni
251 if (found%nogrb)
then
252 write (this%iout,
'(4x,a,i0)')
'Binary grid file [0=GRB, 1=NOGRB] &
253 &set as ', this%nogrb
256 if (found%xorigin)
then
257 write (this%iout,
'(4x,a,G0)')
'XORIGIN = ', this%xorigin
260 if (found%yorigin)
then
261 write (this%iout,
'(4x,a,G0)')
'YORIGIN = ', this%yorigin
264 if (found%angrot)
then
265 write (this%iout,
'(4x,a,G0)')
'ANGROT = ', this%angrot
268 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Options'
282 call mem_set_value(this%nodes,
'NODES', this%input_mempath, found%nodes)
283 call mem_set_value(this%nvert,
'NVERT', this%input_mempath, found%nvert)
286 if (this%iout > 0)
then
287 call this%log_dimensions(found)
291 if (this%nodes < 1)
then
293 'NODES was not specified or was specified incorrectly.')
296 if (this%nvert < 1)
then
298 'NVERT was not specified or was specified incorrectly.')
303 this%nodesuser = this%nodes
306 call mem_allocate(this%idomain, this%nodes,
'IDOMAIN', &
312 call mem_allocate(this%vertices, 2, this%nvert,
'VERTICES', this%memoryPath)
313 call mem_allocate(this%cellxy, 2, this%nodesuser,
'CELLXY', this%memoryPath)
316 do j = 1, this%nodesuser
329 write (this%iout,
'(1x,a)')
'Setting Discretization Dimensions'
331 if (found%nodes)
then
332 write (this%iout,
'(4x,a,i0)')
'NODES = ', this%nodesuser
335 if (found%nvert)
then
336 write (this%iout,
'(4x,a,i0)')
'NVERT = ', this%nvert
339 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Dimensions'
352 call mem_set_value(this%bottom,
'BOTTOM', this%input_mempath, found%bottom)
353 call mem_set_value(this%idomain,
'IDOMAIN', this%input_mempath, found%idomain)
356 if (this%iout > 0)
then
357 call this%log_griddata(found)
369 write (this%iout,
'(1x,a)')
'Setting Discretization Griddata'
371 if (found%bottom)
then
372 write (this%iout,
'(4x,a)')
'BOTTOM set from input file'
375 if (found%idomain)
then
376 write (this%iout,
'(4x,a)')
'IDOMAIN set from input file'
379 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Griddata'
389 integer(I4B) :: node, noder, j, ncell_count
391 character(len=*),
parameter :: fmtnr = &
392 "(/1x, 'The specified IDOMAIN results in a reduced number of cells.',&
393 &/1x, 'Number of user nodes: ',I0,&
394 &/1X, 'Number of nodes in solution: ', I0, //)"
398 do j = 1, this%nodesuser
399 if (this%idomain(j) > 0) ncell_count = ncell_count + 1
401 this%nodes = ncell_count
404 if (ncell_count == 0)
then
405 call store_error(
'Model does not have any active nodes. &
406 &Ensure IDOMAIN array has some values greater &
412 if (this%nodes < this%nodesuser)
then
413 write (this%iout, fmtnr) this%nodesuser, this%nodes
417 call this%allocate_arrays()
423 if (this%nodes < this%nodesuser)
then
426 do j = 1, this%nodesuser
427 if (this%idomain(j) > 0)
then
428 this%nodereduced(node) = noder
431 this%nodereduced(node) = 0
438 if (this%nodes < this%nodesuser)
then
441 do j = 1, this%nodesuser
442 if (this%idomain(j) > 0)
then
443 this%nodeuser(noder) = node
453 do j = 1, this%nodesuser
456 if (this%nodes < this%nodesuser) noder = this%nodereduced(node)
457 if (noder <= 0) cycle
458 this%bot(noder) = this%bottom(j)
459 this%xc(noder) = this%cellxy(1, j)
460 this%yc(noder) = this%cellxy(2, j)
475 real(DP),
dimension(:),
contiguous,
pointer :: vert_x => null()
476 real(DP),
dimension(:),
contiguous,
pointer :: vert_y => null()
479 call mem_setptr(vert_x,
'XV', this%input_mempath)
480 call mem_setptr(vert_y,
'YV', this%input_mempath)
483 if (
associated(vert_x) .and.
associated(vert_y))
then
485 this%vertices(1, i) = vert_x(i)
486 this%vertices(2, i) = vert_y(i)
489 call store_error(
'Required Vertex arrays not found.')
493 if (this%iout > 0)
then
494 write (this%iout,
'(1x,a)')
'Discretization Vertex data loaded'
506 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: icell2d
507 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: ncvert
508 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: icvert
511 integer(I4B) :: i, j, ierr
512 integer(I4B) :: icv_idx, startvert, maxnnz = 5
515 call vert_spm%init(this%nodes, this%nvert, maxnnz)
520 if (icell2d(i) /= i)
call store_error(
'ICELL2D input sequence violation.')
522 call vert_spm%addconnection(i, icvert(icv_idx), 0)
524 startvert = icvert(icv_idx)
525 elseif (j == ncvert(i) .and. (icvert(icv_idx) /= startvert))
then
526 call vert_spm%addconnection(i, startvert, 0)
528 icv_idx = icv_idx + 1
533 call mem_allocate(this%iavert, this%nodes + 1,
'IAVERT', this%memoryPath)
534 call mem_allocate(this%javert, vert_spm%nnz,
'JAVERT', this%memoryPath)
535 call vert_spm%filliaja(this%iavert, this%javert, ierr)
536 call vert_spm%destroy()
546 integer(I4B),
dimension(:),
contiguous,
pointer :: icell2d => null()
547 integer(I4B),
dimension(:),
contiguous,
pointer :: ncvert => null()
548 integer(I4B),
dimension(:),
contiguous,
pointer :: icvert => null()
549 real(DP),
dimension(:),
contiguous,
pointer :: cell_x => null()
550 real(DP),
dimension(:),
contiguous,
pointer :: cell_y => null()
554 call mem_setptr(icell2d,
'ICELL2D', this%input_mempath)
555 call mem_setptr(ncvert,
'NCVERT', this%input_mempath)
556 call mem_setptr(icvert,
'ICVERT', this%input_mempath)
559 if (
associated(icell2d) .and.
associated(ncvert) &
560 .and.
associated(icvert))
then
561 call this%define_cellverts(icell2d, ncvert, icvert)
563 call store_error(
'Required cell vertex array(s) [ICELL2D, NCVERT, ICVERT] &
568 call mem_setptr(cell_x,
'XC', this%input_mempath)
569 call mem_setptr(cell_y,
'YC', this%input_mempath)
572 if (
associated(cell_x) .and.
associated(cell_y))
then
573 do i = 1, this%nodesuser
574 this%cellxy(1, i) = cell_x(i)
575 this%cellxy(2, i) = cell_y(i)
578 call store_error(
'Required cell center arrays not found.')
582 if (this%iout > 0)
then
583 write (this%iout,
'(1x,a)')
'Discretization Cell2d data loaded'
595 integer(I4B) :: noder, nrsize
596 integer(I4B) :: narea_eq_zero
597 integer(I4B) :: narea_lt_zero
605 do j = 1, this%nodesuser
606 area = this%get_cell2d_area(j)
607 noder = this%get_nodenumber(j, 0)
608 if (noder > 0) this%area(noder) = area
609 if (area <
dzero)
then
610 narea_lt_zero = narea_lt_zero + 1
611 write (
errmsg,
'(a,i0,a)') &
612 &
'Calculated CELL2D area less than zero for cell ', j,
'.'
615 if (area ==
dzero)
then
616 narea_eq_zero = narea_eq_zero + 1
617 write (
errmsg,
'(a,i0,a)') &
618 'Calculated CELL2D area is zero for cell ', j,
'.'
625 if (narea_lt_zero > 0)
then
626 write (
errmsg,
'(i0,a)') narea_lt_zero, &
627 ' cell(s) have an area less than zero. Calculated cell &
628 &areas must be greater than zero. Negative areas often &
629 &mean vertices are not listed in clockwise order.'
632 if (narea_eq_zero > 0)
then
633 write (
errmsg,
'(i0,a)') narea_eq_zero, &
634 ' cell(s) have an area equal to zero. Calculated cell &
635 &areas must be greater than zero. Calculated cell &
636 &areas equal to zero indicate that the cell is not defined &
637 &by a valid polygon.'
645 if (this%nodes < this%nodesuser) nrsize = this%nodes
647 call this%con%disvconnections(this%name_model, this%nodes, &
648 this%nodesuser, 1, nrsize, &
649 this%nvert, this%vertices, this%iavert, &
650 this%javert, this%cellxy, &
651 this%bot, this%bot, &
652 this%nodereduced, this%nodeuser)
653 this%nja = this%con%nja
654 this%njas = this%con%njas
665 integer(I4B),
dimension(:),
intent(in) :: icelltype
667 integer(I4B) :: iunit, i, ntxt
668 integer(I4B),
parameter :: lentxt = 100
669 character(len=50) :: txthdr
670 character(len=lentxt) :: txt
671 character(len=LINELENGTH) :: fname
673 character(len=*),
parameter :: fmtgrdsave = &
674 "(4X,'BINARY GRID INFORMATION WILL BE WRITTEN TO:', &
675 &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
681 fname = trim(this%input_fname)//
'.grb'
683 write (this%iout, fmtgrdsave) iunit, trim(adjustl(fname))
684 call openfile(iunit, this%iout, trim(adjustl(fname)),
'DATA(BINARY)', &
688 write (txthdr,
'(a)')
'GRID DISV2D'
689 txthdr(50:50) = new_line(
'a')
691 write (txthdr,
'(a)')
'VERSION 1'
692 txthdr(50:50) = new_line(
'a')
694 write (txthdr,
'(a, i0)')
'NTXT ', ntxt
695 txthdr(50:50) = new_line(
'a')
697 write (txthdr,
'(a, i0)')
'LENTXT ', lentxt
698 txthdr(50:50) = new_line(
'a')
702 write (txt,
'(3a, i0)')
'NCELLS ',
'INTEGER ',
'NDIM 0 # ', this%nodesuser
703 txt(lentxt:lentxt) = new_line(
'a')
705 write (txt,
'(3a, i0)')
'NODES ',
'INTEGER ',
'NDIM 0 # ', this%nodes
706 txt(lentxt:lentxt) = new_line(
'a')
708 write (txt,
'(3a, i0)')
'NVERT ',
'INTEGER ',
'NDIM 0 # ', this%nvert
709 txt(lentxt:lentxt) = new_line(
'a')
711 write (txt,
'(3a, i0)')
'NJAVERT ',
'INTEGER ',
'NDIM 0 # ',
size(this%javert)
712 txt(lentxt:lentxt) = new_line(
'a')
714 write (txt,
'(3a, i0)')
'NJA ',
'INTEGER ',
'NDIM 0 # ', this%con%nja
715 txt(lentxt:lentxt) = new_line(
'a')
717 write (txt,
'(3a, 1pg25.15e3)') &
718 'XORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%xorigin
719 txt(lentxt:lentxt) = new_line(
'a')
721 write (txt,
'(3a, 1pg25.15e3)') &
722 'YORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%yorigin
723 txt(lentxt:lentxt) = new_line(
'a')
725 write (txt,
'(3a, 1pg25.15e3)')
'ANGROT ',
'DOUBLE ',
'NDIM 0 # ', this%angrot
726 txt(lentxt:lentxt) = new_line(
'a')
728 write (txt,
'(3a, i0)')
'BOTM ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
729 txt(lentxt:lentxt) = new_line(
'a')
731 write (txt,
'(3a, i0)')
'VERTICES ',
'DOUBLE ',
'NDIM 2 2 ', this%nvert
732 txt(lentxt:lentxt) = new_line(
'a')
734 write (txt,
'(3a, i0)')
'CELLX ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
735 txt(lentxt:lentxt) = new_line(
'a')
737 write (txt,
'(3a, i0)')
'CELLY ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
738 txt(lentxt:lentxt) = new_line(
'a')
740 write (txt,
'(3a, i0)')
'IAVERT ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
741 txt(lentxt:lentxt) = new_line(
'a')
743 write (txt,
'(3a, i0)')
'JAVERT ',
'INTEGER ',
'NDIM 1 ',
size(this%javert)
744 txt(lentxt:lentxt) = new_line(
'a')
746 write (txt,
'(3a, i0)')
'IA ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
747 txt(lentxt:lentxt) = new_line(
'a')
749 write (txt,
'(3a, i0)')
'JA ',
'INTEGER ',
'NDIM 1 ',
size(this%con%jausr)
750 txt(lentxt:lentxt) = new_line(
'a')
752 write (txt,
'(3a, i0)')
'IDOMAIN ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
753 txt(lentxt:lentxt) = new_line(
'a')
755 write (txt,
'(3a, i0)')
'ICELLTYPE ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
756 txt(lentxt:lentxt) = new_line(
'a')
760 write (iunit) this%nodesuser
761 write (iunit) this%nodes
762 write (iunit) this%nvert
763 write (iunit)
size(this%javert)
764 write (iunit) this%nja
765 write (iunit) this%xorigin
766 write (iunit) this%yorigin
767 write (iunit) this%angrot
768 write (iunit) this%bottom
769 write (iunit) this%vertices
770 write (iunit) (this%cellxy(1, i), i=1, this%nodesuser)
771 write (iunit) (this%cellxy(2, i), i=1, this%nodesuser)
772 write (iunit) this%iavert
773 write (iunit) this%javert
774 write (iunit) this%con%iausr
775 write (iunit) this%con%jausr
776 write (iunit) this%idomain
777 write (iunit) icelltype
789 integer(I4B),
intent(in) :: nodeu
790 character(len=*),
intent(inout) :: str
792 integer(I4B) :: i, j, k
793 character(len=10) :: jstr
795 call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
796 write (jstr,
'(i10)') j
797 str =
'('//trim(adjustl(jstr))//
')'
806 integer(I4B),
intent(in) :: nodeu
807 integer(I4B),
dimension(:),
intent(inout) :: arr
809 integer(I4B) :: isize
810 integer(I4B) :: i, j, k
814 if (isize /= this%ndim)
then
815 write (
errmsg,
'(a,i0,a,i0,a)') &
816 'Program error: nodeu_to_array size of array (', isize, &
817 ') is not equal to the discretization dimension (', this%ndim,
').'
822 call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
833 integer(I4B) :: nodenumber
836 integer(I4B),
intent(in) :: nodeu
837 integer(I4B),
intent(in) :: icheck
841 if (icheck /= 0)
then
844 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
846 write (
errmsg,
'(a,i0,a,i0,a)') &
847 'Node number (', nodeu,
') is less than 1 or greater than nodes (', &
852 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
856 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
869 integer(I4B),
intent(in) :: noden
870 integer(I4B),
intent(in) :: nodem
871 integer(I4B),
intent(in) :: ihc
872 real(DP),
intent(inout) :: xcomp
873 real(DP),
intent(inout) :: ycomp
874 real(DP),
intent(inout) :: zcomp
875 integer(I4B),
intent(in) :: ipos
877 real(DP) :: angle, dmult
883 if (nodem < noden)
then
896 angle = this%con%anglex(this%con%jas(ipos))
898 if (nodem < noden) dmult = -
done
899 xcomp = cos(angle) * dmult
900 ycomp = sin(angle) * dmult
912 xcomp, ycomp, zcomp, conlen)
915 integer(I4B),
intent(in) :: noden
916 integer(I4B),
intent(in) :: nodem
917 logical,
intent(in) :: nozee
918 real(DP),
intent(in) :: satn
919 real(DP),
intent(in) :: satm
920 integer(I4B),
intent(in) :: ihc
921 real(DP),
intent(inout) :: xcomp
922 real(DP),
intent(inout) :: ycomp
923 real(DP),
intent(inout) :: zcomp
924 real(DP),
intent(inout) :: conlen
926 integer(I4B) :: nodeun, nodeum
927 real(DP) :: xn, xm, yn, ym, zn, zm
938 nodeun = this%get_nodeuser(noden)
939 nodeum = this%get_nodeuser(nodem)
940 xn = this%cellxy(1, nodeun)
941 yn = this%cellxy(2, nodeun)
942 xm = this%cellxy(1, nodeum)
943 ym = this%cellxy(2, nodeum)
954 character(len=*),
intent(out) :: dis_type
965 character(len=*),
intent(in) :: name_model
966 character(len=*),
intent(in) :: input_mempath
969 call this%DisBaseType%allocate_scalars(name_model, input_mempath)
987 call this%DisBaseType%allocate_arrays()
990 if (this%nodes < this%nodesuser)
then
991 call mem_allocate(this%nodeuser, this%nodes,
'NODEUSER', this%memoryPath)
992 call mem_allocate(this%nodereduced, this%nodesuser,
'NODEREDUCED', &
995 call mem_allocate(this%nodeuser, 1,
'NODEUSER', this%memoryPath)
996 call mem_allocate(this%nodereduced, 1,
'NODEREDUCED', this%memoryPath)
1000 this%mshape(1) = this%nodesuser
1014 integer(I4B),
intent(in) :: icell2d
1018 integer(I4B) :: ivert
1019 integer(I4B) :: nvert
1020 integer(I4B) :: icount
1028 nvert = this%iavert(icell2d + 1) - this%iavert(icell2d)
1030 iv1 = this%javert(this%iavert(icell2d))
1031 x1 = this%vertices(1, iv1)
1032 y1 = this%vertices(2, iv1)
1033 do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1034 x = this%vertices(1, this%javert(ivert))
1035 if (icount < nvert)
then
1036 y = this%vertices(2, this%javert(ivert + 1))
1038 y = this%vertices(2, this%javert(this%iavert(icell2d)))
1040 area = area + (x - x1) * (y - y1)
1045 do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1046 y = this%vertices(2, this%javert(ivert))
1047 if (icount < nvert)
then
1048 x = this%vertices(1, this%javert(ivert + 1))
1050 x = this%vertices(1, this%javert(this%iavert(icell2d)))
1052 area = area - (x - x1) * (y - y1)
1067 flag_string, allow_zero)
result(nodeu)
1070 integer(I4B),
intent(inout) :: lloc
1071 integer(I4B),
intent(inout) :: istart
1072 integer(I4B),
intent(inout) :: istop
1073 integer(I4B),
intent(in) :: in
1074 integer(I4B),
intent(in) :: iout
1075 character(len=*),
intent(inout) :: line
1076 logical,
optional,
intent(in) :: flag_string
1077 logical,
optional,
intent(in) :: allow_zero
1078 integer(I4B) :: nodeu
1080 integer(I4B) :: j, nodes
1081 integer(I4B) :: lloclocal, ndum, istat, n
1084 if (
present(flag_string))
then
1085 if (flag_string)
then
1088 call urword(line, lloclocal, istart, istop, 1, ndum, r, iout, in)
1089 read (line(istart:istop), *, iostat=istat) n
1090 if (istat /= 0)
then
1098 nodes = this%mshape(1)
1100 call urword(line, lloc, istart, istop, 2, j, r, iout, in)
1103 if (
present(allow_zero))
then
1104 if (allow_zero)
then
1113 if (j < 1 .or. j > nodes)
then
1114 write (
errmsg,
'(a,1x,a,i0,a)') &
1115 trim(adjustl(
errmsg)),
'Cell number in list (', j, &
1116 ') is outside of the grid.'
1119 nodeu =
get_node(1, 1, j, 1, 1, nodes)
1121 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1122 write (
errmsg,
'(a,1x,a,i0,a)') &
1124 "Node number in list (", nodeu,
") is outside of the grid. "// &
1125 "Cell number cannot be determined in line '"// &
1126 trim(adjustl(line))//
"'."
1129 if (len_trim(adjustl(
errmsg)) > 0)
then
1145 allow_zero)
result(nodeu)
1147 integer(I4B) :: nodeu
1150 character(len=*),
intent(inout) :: cellid
1151 integer(I4B),
intent(in) :: inunit
1152 integer(I4B),
intent(in) :: iout
1153 logical,
optional,
intent(in) :: flag_string
1154 logical,
optional,
intent(in) :: allow_zero
1156 integer(I4B) :: j, nodes
1157 integer(I4B) :: lloclocal, ndum, istat, n
1158 integer(I4B) :: istart, istop
1161 if (
present(flag_string))
then
1162 if (flag_string)
then
1165 call urword(cellid, lloclocal, istart, istop, 1, ndum, r, iout, inunit)
1166 read (cellid(istart:istop), *, iostat=istat) n
1167 if (istat /= 0)
then
1175 nodes = this%mshape(1)
1178 call urword(cellid, lloclocal, istart, istop, 2, j, r, iout, inunit)
1181 if (
present(allow_zero))
then
1182 if (allow_zero)
then
1191 if (j < 1 .or. j > nodes)
then
1192 write (
errmsg,
'(a,1x,a,i0,a)') &
1193 trim(adjustl(
errmsg)),
'Cell2d number in list (', j, &
1194 ') is outside of the grid.'
1197 nodeu =
get_node(1, 1, j, 1, 1, nodes)
1199 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1200 write (
errmsg,
'(a,1x,a,i0,a)') &
1202 "Cell number cannot be determined for cellid ("// &
1203 trim(adjustl(cellid))//
") and results in a user "// &
1204 "node number (", nodeu,
") that is outside of the grid."
1207 if (len_trim(adjustl(
errmsg)) > 0)
then
1220 integer(I4B),
intent(in) :: ic
1221 real(DP),
allocatable,
intent(out) :: polyverts(:, :)
1222 logical(LGP),
intent(in),
optional :: closed
1224 integer(I4B) :: icu, icu2d, iavert, nverts, m, j
1225 logical(LGP) :: lclosed
1228 icu = this%get_nodeuser(ic)
1229 icu2d = icu - ((icu - 1) / this%nodes) * this%nodes
1230 nverts = this%iavert(icu2d + 1) - this%iavert(icu2d) - 1
1231 if (nverts .le. 0) nverts = nverts +
size(this%javert)
1234 if (.not. (
present(closed)))
then
1242 allocate (polyverts(2, nverts + 1))
1244 allocate (polyverts(2, nverts))
1248 iavert = this%iavert(icu2d)
1250 j = this%javert(iavert - 1 + m)
1251 polyverts(:, m) = (/this%vertices(1, j), this%vertices(2, j)/)
1256 polyverts(:, nverts + 1) = polyverts(:, 1)
1266 cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
1269 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1270 integer(I4B),
intent(in) :: iout
1271 integer(I4B),
intent(in) :: iprint
1272 integer(I4B),
intent(in) :: idataun
1273 character(len=*),
intent(in) :: aname
1274 character(len=*),
intent(in) :: cdatafmp
1275 integer(I4B),
intent(in) :: nvaluesp
1276 integer(I4B),
intent(in) :: nwidthp
1277 character(len=*),
intent(in) :: editdesc
1278 real(DP),
intent(in) :: dinact
1280 integer(I4B) :: k, ifirst
1281 integer(I4B) :: nlay
1282 integer(I4B) :: nrow
1283 integer(I4B) :: ncol
1284 integer(I4B) :: nval
1285 integer(I4B) :: nodeu, noder
1286 integer(I4B) :: istart, istop
1287 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1289 character(len=*),
parameter :: fmthsv = &
1290 "(1X,/1X,a,' WILL BE SAVED ON UNIT ',I4, &
1291 &' AT END OF TIME STEP',I5,', STRESS PERIOD ',I4)"
1296 ncol = this%mshape(1)
1300 if (this%nodes < this%nodesuser)
then
1303 do nodeu = 1, this%nodesuser
1304 noder = this%get_nodenumber(nodeu, 0)
1305 if (noder <= 0)
then
1306 dtemp(nodeu) = dinact
1309 dtemp(nodeu) = darray(noder)
1317 if (iprint /= 0)
then
1320 istop = istart + nrow * ncol - 1
1322 aname, cdatafmp, nvaluesp, nwidthp, editdesc)
1328 if (idataun > 0)
then
1333 istop = istart + nrow * ncol - 1
1334 if (ifirst == 1)
write (iout, fmthsv) &
1335 trim(adjustl(aname)), idataun, &
1342 elseif (idataun < 0)
then
1345 call ubdsv1(
kstp,
kper, aname, -idataun, dtemp, ncol, nrow, nlay, &
1354 dstmodel, dstpackage, naux, auxtxt, &
1355 ibdchn, nlist, iout)
1358 character(len=16),
intent(in) :: text
1359 character(len=16),
intent(in) :: textmodel
1360 character(len=16),
intent(in) :: textpackage
1361 character(len=16),
intent(in) :: dstmodel
1362 character(len=16),
intent(in) :: dstpackage
1363 integer(I4B),
intent(in) :: naux
1364 character(len=16),
dimension(:),
intent(in) :: auxtxt
1365 integer(I4B),
intent(in) :: ibdchn
1366 integer(I4B),
intent(in) :: nlist
1367 integer(I4B),
intent(in) :: iout
1369 integer(I4B) :: nlay, nrow, ncol
1373 ncol = this%mshape(1)
1376 call ubdsv06(
kstp,
kper, text, textmodel, textpackage, dstmodel, dstpackage, &
1377 ibdchn, naux, auxtxt, ncol, nrow, nlay, &
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenvarname
maximum length of a variable name
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenmempath
maximum length of the memory path
real(dp), parameter done
real constant 1
subroutine get_dis_type(this, dis_type)
Get the discretization type.
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.
subroutine log_griddata(this, found)
Write griddata found to list file.
subroutine source_vertices(this)
Load grid vertices from IDM into package.
subroutine source_griddata(this)
Copy grid data from IDM into package.
subroutine define_cellverts(this, icell2d, ncvert, icvert)
Build data structures to hold cell vertex info.
integer(i4b) function nodeu_from_string(this, lloc, istart, istop, in, iout, line, flag_string, allow_zero)
Convert a string to a user nodenumber.
subroutine write_grb(this, icelltype)
Write a binary grid file.
subroutine allocate_scalars(this, name_model, input_mempath)
Allocate and initialize scalars.
subroutine nodeu_to_string(this, nodeu, str)
Convert a user nodenumber to a string (nodenumber) or (k,j)
subroutine get_polyverts(this, ic, polyverts, closed)
Get a 2D array of polygon vertices, listed in clockwise order beginning with the lower left corner.
subroutine record_array(this, darray, iout, iprint, idataun, aname, cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
Record a double precision array.
subroutine connect(this)
Build grid connections.
subroutine grid_finalize(this)
Finalize grid (check properties, allocate arrays, compute connections)
subroutine log_options(this, found)
Write user options to list file.
subroutine disv2d_da(this)
subroutine allocate_arrays(this)
Allocate and initialize arrays.
subroutine source_dimensions(this)
Copy dimensions from IDM into package.
integer(i4b) function get_nodenumber_idx1(this, nodeu, icheck)
Get reduced node number from user node number.
subroutine record_srcdst_list_header(this, text, textmodel, textpackage, dstmodel, dstpackage, naux, auxtxt, ibdchn, nlist, iout)
Record list header for imeth=6.
subroutine, public disv2d_cr(dis, name_model, input_mempath, inunit, iout)
Create a new discretization by vertices object.
real(dp) function get_cell2d_area(this, icell2d)
Get the signed area of the cell.
subroutine source_options(this)
Copy options from IDM into package.
integer(i4b) function nodeu_from_cellid(this, cellid, inunit, iout, flag_string, allow_zero)
Convert a cellid string to a user nodenumber.
subroutine source_cell2d(this)
Copy cell2d data from IDM into package.
subroutine disv2d_df(this)
Define the discretization.
subroutine disv2d_load(this)
Transfer IDM data into this discretization object.
subroutine nodeu_to_array(this, nodeu, arr)
Convert a user nodenumber to an array (nodenumber) or (k,j)
subroutine connection_normal(this, noden, nodem, ihc, xcomp, ycomp, zcomp, ipos)
Get normal vector components between the cell and a given neighbor.
subroutine log_dimensions(this, found)
Write dimensions to list file.
subroutine, public line_unit_vector(x0, y0, z0, x1, y1, z1, xcomp, ycomp, zcomp, vmag)
Calculate the vector components (xcomp, ycomp, and zcomp) for a line defined by two points,...
integer(i4b) function, public get_node(ilay, irow, icol, nlay, nrow, ncol)
Get node number, given layer, row, and column indices for a structured grid. If any argument is inval...
subroutine, public get_ijk(nodenumber, nrow, ncol, nlay, irow, icol, ilay)
Get row, column and layer indices from node number and grid dimensions. If nodenumber is invalid,...
subroutine, public get_jk(nodenumber, ncpl, nlay, icpl, ilay)
Get layer index and within-layer node index from node number and grid dimensions. If nodenumber is in...
This module defines variable data types.
subroutine, public memorystore_remove(component, subcomponent, context)
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
real(dp), pointer, public pertim
time relative to start of stress period
real(dp), pointer, public totim
time relative to start of simulation
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
real(dp), pointer, public delt
length of the current time step
Vertex grid discretization.