26 integer(I4B),
pointer :: nvert => null()
27 real(dp),
dimension(:, :),
pointer,
contiguous :: vertices => null()
28 real(dp),
dimension(:, :),
pointer,
contiguous :: cellxy => null()
29 integer(I4B),
dimension(:),
pointer,
contiguous :: iavert => null()
30 integer(I4B),
dimension(:),
pointer,
contiguous :: javert => null()
31 real(dp),
dimension(:),
pointer,
contiguous :: bottom => null()
32 integer(I4B),
dimension(:),
pointer,
contiguous :: idomain => null()
74 logical :: length_units = .false.
75 logical :: nogrb = .false.
76 logical :: xorigin = .false.
77 logical :: yorigin = .false.
78 logical :: angrot = .false.
79 logical :: nodes = .false.
80 logical :: nvert = .false.
81 logical :: bottom = .false.
82 logical :: idomain = .false.
83 logical :: iv = .false.
84 logical :: xv = .false.
85 logical :: yv = .false.
86 logical :: icell2d = .false.
87 logical :: xc = .false.
88 logical :: yc = .false.
89 logical :: ncvert = .false.
90 logical :: icvert = .false.
97 subroutine disv2d_cr(dis, name_model, input_mempath, inunit, iout)
100 character(len=*),
intent(in) :: name_model
101 character(len=*),
intent(in) :: input_mempath
102 integer(I4B),
intent(in) :: inunit
103 integer(I4B),
intent(in) :: iout
107 character(len=*),
parameter :: fmtheader = &
108 "(1X, /1X, 'DISV -- VERTEX GRID DISCRETIZATION PACKAGE,', &
109 &' VERSION 1 : 12/23/2015 - INPUT READ FROM MEMPATH: ', A, //)"
113 call disnew%allocate_scalars(name_model, input_mempath)
122 write (iout, fmtheader) dis%input_mempath
126 call disnew%disv2d_load()
138 call this%source_options()
139 call this%source_dimensions()
140 call this%source_griddata()
141 call this%source_vertices()
142 call this%source_cell2d()
152 call this%grid_finalize()
184 call this%DisBaseType%dis_da()
222 character(len=LENVARNAME),
dimension(3) :: lenunits = &
223 &[character(len=LENVARNAME) ::
'FEET',
'METERS',
'CENTIMETERS']
227 call mem_set_value(this%lenuni,
'LENGTH_UNITS', this%input_mempath, &
228 lenunits, found%length_units)
229 call mem_set_value(this%nogrb,
'NOGRB', this%input_mempath, found%nogrb)
230 call mem_set_value(this%xorigin,
'XORIGIN', this%input_mempath, found%xorigin)
231 call mem_set_value(this%yorigin,
'YORIGIN', this%input_mempath, found%yorigin)
232 call mem_set_value(this%angrot,
'ANGROT', this%input_mempath, found%angrot)
235 if (this%iout > 0)
then
236 call this%log_options(found)
248 write (this%iout,
'(1x,a)')
'Setting Discretization Options'
250 if (found%length_units)
then
251 write (this%iout,
'(4x,a,i0)')
'Model length unit [0=UND, 1=FEET, &
252 &2=METERS, 3=CENTIMETERS] set as ', this%lenuni
255 if (found%nogrb)
then
256 write (this%iout,
'(4x,a,i0)')
'Binary grid file [0=GRB, 1=NOGRB] &
257 &set as ', this%nogrb
260 if (found%xorigin)
then
261 write (this%iout,
'(4x,a,G0)')
'XORIGIN = ', this%xorigin
264 if (found%yorigin)
then
265 write (this%iout,
'(4x,a,G0)')
'YORIGIN = ', this%yorigin
268 if (found%angrot)
then
269 write (this%iout,
'(4x,a,G0)')
'ANGROT = ', this%angrot
272 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Options'
286 call mem_set_value(this%nodes,
'NODES', this%input_mempath, found%nodes)
287 call mem_set_value(this%nvert,
'NVERT', this%input_mempath, found%nvert)
290 if (this%iout > 0)
then
291 call this%log_dimensions(found)
295 if (this%nodes < 1)
then
297 'NODES was not specified or was specified incorrectly.')
300 if (this%nvert < 1)
then
302 'NVERT was not specified or was specified incorrectly.')
307 this%nodesuser = this%nodes
310 call mem_allocate(this%idomain, this%nodes,
'IDOMAIN', &
316 call mem_allocate(this%vertices, 2, this%nvert,
'VERTICES', this%memoryPath)
317 call mem_allocate(this%cellxy, 2, this%nodesuser,
'CELLXY', this%memoryPath)
320 do j = 1, this%nodesuser
333 write (this%iout,
'(1x,a)')
'Setting Discretization Dimensions'
335 if (found%nodes)
then
336 write (this%iout,
'(4x,a,i0)')
'NODES = ', this%nodesuser
339 if (found%nvert)
then
340 write (this%iout,
'(4x,a,i0)')
'NVERT = ', this%nvert
343 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Dimensions'
356 call mem_set_value(this%bottom,
'BOTTOM', this%input_mempath, found%bottom)
357 call mem_set_value(this%idomain,
'IDOMAIN', this%input_mempath, found%idomain)
360 if (this%iout > 0)
then
361 call this%log_griddata(found)
373 write (this%iout,
'(1x,a)')
'Setting Discretization Griddata'
375 if (found%bottom)
then
376 write (this%iout,
'(4x,a)')
'BOTTOM set from input file'
379 if (found%idomain)
then
380 write (this%iout,
'(4x,a)')
'IDOMAIN set from input file'
383 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Griddata'
393 integer(I4B) :: node, noder, j, ncell_count
395 character(len=*),
parameter :: fmtnr = &
396 "(/1x, 'The specified IDOMAIN results in a reduced number of cells.',&
397 &/1x, 'Number of user nodes: ',I0,&
398 &/1X, 'Number of nodes in solution: ', I0, //)"
402 do j = 1, this%nodesuser
403 if (this%idomain(j) > 0) ncell_count = ncell_count + 1
405 this%nodes = ncell_count
408 if (ncell_count == 0)
then
409 call store_error(
'Model does not have any active nodes. &
410 &Ensure IDOMAIN array has some values greater &
416 if (this%nodes < this%nodesuser)
then
417 write (this%iout, fmtnr) this%nodesuser, this%nodes
421 call this%allocate_arrays()
427 if (this%nodes < this%nodesuser)
then
430 do j = 1, this%nodesuser
431 if (this%idomain(j) > 0)
then
432 this%nodereduced(node) = noder
435 this%nodereduced(node) = 0
442 if (this%nodes < this%nodesuser)
then
445 do j = 1, this%nodesuser
446 if (this%idomain(j) > 0)
then
447 this%nodeuser(noder) = node
457 do j = 1, this%nodesuser
460 if (this%nodes < this%nodesuser) noder = this%nodereduced(node)
461 if (noder <= 0) cycle
462 this%bot(noder) = this%bottom(j)
463 this%xc(noder) = this%cellxy(1, j)
464 this%yc(noder) = this%cellxy(2, j)
479 real(DP),
dimension(:),
contiguous,
pointer :: vert_x => null()
480 real(DP),
dimension(:),
contiguous,
pointer :: vert_y => null()
483 call mem_setptr(vert_x,
'XV', this%input_mempath)
484 call mem_setptr(vert_y,
'YV', this%input_mempath)
487 if (
associated(vert_x) .and.
associated(vert_y))
then
489 this%vertices(1, i) = vert_x(i)
490 this%vertices(2, i) = vert_y(i)
493 call store_error(
'Required Vertex arrays not found.')
497 if (this%iout > 0)
then
498 write (this%iout,
'(1x,a)')
'Discretization Vertex data loaded'
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
517 integer(I4B) :: i, j, ierr
518 integer(I4B) :: icv_idx, startvert, maxnnz = 5
521 call vert_spm%init(this%nodes, this%nvert, maxnnz)
526 if (icell2d(i) /= i)
call store_error(
'ICELL2D input sequence violation.')
528 call vert_spm%addconnection(i, icvert(icv_idx), 0)
530 startvert = icvert(icv_idx)
531 elseif (j == ncvert(i) .and. (icvert(icv_idx) /= startvert))
then
532 call vert_spm%addconnection(i, startvert, 0)
534 icv_idx = icv_idx + 1
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()
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()
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)
565 if (
associated(icell2d) .and.
associated(ncvert) &
566 .and.
associated(icvert))
then
567 call this%define_cellverts(icell2d, ncvert, icvert)
569 call store_error(
'Required cell vertex array(s) [ICELL2D, NCVERT, ICVERT] &
574 call mem_setptr(cell_x,
'XC', this%input_mempath)
575 call mem_setptr(cell_y,
'YC', this%input_mempath)
578 if (
associated(cell_x) .and.
associated(cell_y))
then
579 do i = 1, this%nodesuser
580 this%cellxy(1, i) = cell_x(i)
581 this%cellxy(2, i) = cell_y(i)
584 call store_error(
'Required cell center arrays not found.')
588 if (this%iout > 0)
then
589 write (this%iout,
'(1x,a)')
'Discretization Cell2d data loaded'
606 integer(I4B) :: noder, nrsize
607 integer(I4B) :: narea_eq_zero
608 integer(I4B) :: narea_lt_zero
616 do j = 1, this%nodesuser
617 area = this%get_cell2d_area(j)
618 noder = this%get_nodenumber(j, 0)
619 if (noder > 0) this%area(noder) = area
620 if (area <
dzero)
then
621 narea_lt_zero = narea_lt_zero + 1
622 write (
errmsg,
'(a,i0,a)') &
623 &
'Calculated CELL2D area less than zero for cell ', j,
'.'
626 if (area ==
dzero)
then
627 narea_eq_zero = narea_eq_zero + 1
628 write (
errmsg,
'(a,i0,a)') &
629 'Calculated CELL2D area is zero for cell ', j,
'.'
636 if (narea_lt_zero > 0)
then
637 write (
errmsg,
'(i0,a)') narea_lt_zero, &
638 ' cell(s) have an area less than zero. Calculated cell &
639 &areas must be greater than zero. Negative areas often &
640 &mean vertices are not listed in clockwise order.'
643 if (narea_eq_zero > 0)
then
644 write (
errmsg,
'(i0,a)') narea_eq_zero, &
645 ' cell(s) have an area equal to zero. Calculated cell &
646 &areas must be greater than zero. Calculated cell &
647 &areas equal to zero indicate that the cell is not defined &
648 &by a valid polygon.'
656 if (this%nodes < this%nodesuser) nrsize = this%nodes
658 call this%con%disvconnections(this%name_model, this%nodes, &
659 this%nodesuser, 1, nrsize, &
660 this%nvert, this%vertices, this%iavert, &
661 this%javert, this%cellxy, &
662 this%bot, this%bot, &
663 this%nodereduced, this%nodeuser)
664 this%nja = this%con%nja
665 this%njas = this%con%njas
677 integer(I4B),
dimension(:),
intent(in) :: icelltype
679 integer(I4B) :: iunit, i, ntxt, version
680 integer(I4B),
parameter :: lentxt = 100
681 character(len=50) :: txthdr
682 character(len=lentxt) :: txt
683 character(len=LINELENGTH) :: fname
684 character(len=LENBIGLINE) :: crs
685 logical(LGP) :: found_crs
687 character(len=*),
parameter :: fmtgrdsave = &
688 "(4X,'BINARY GRID INFORMATION WILL BE WRITTEN TO:', &
689 &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
695 call mem_set_value(crs,
'CRS', this%input_mempath, found_crs)
704 fname = trim(this%output_fname)
706 write (this%iout, fmtgrdsave) iunit, trim(adjustl(fname))
707 call openfile(iunit, this%iout, trim(adjustl(fname)),
'DATA(BINARY)', &
711 write (txthdr,
'(a)')
'GRID DISV2D'
712 txthdr(50:50) = new_line(
'a')
714 write (txthdr,
'(a)')
'VERSION 1'
715 txthdr(50:50) = new_line(
'a')
717 write (txthdr,
'(a, i0)')
'NTXT ', ntxt
718 txthdr(50:50) = new_line(
'a')
720 write (txthdr,
'(a, i0)')
'LENTXT ', lentxt
721 txthdr(50:50) = new_line(
'a')
725 write (txt,
'(3a, i0)')
'NCELLS ',
'INTEGER ',
'NDIM 0 # ', this%nodesuser
726 txt(lentxt:lentxt) = new_line(
'a')
728 write (txt,
'(3a, i0)')
'NODES ',
'INTEGER ',
'NDIM 0 # ', this%nodes
729 txt(lentxt:lentxt) = new_line(
'a')
731 write (txt,
'(3a, i0)')
'NVERT ',
'INTEGER ',
'NDIM 0 # ', this%nvert
732 txt(lentxt:lentxt) = new_line(
'a')
734 write (txt,
'(3a, i0)')
'NJAVERT ',
'INTEGER ',
'NDIM 0 # ',
size(this%javert)
735 txt(lentxt:lentxt) = new_line(
'a')
737 write (txt,
'(3a, i0)')
'NJA ',
'INTEGER ',
'NDIM 0 # ', this%con%nja
738 txt(lentxt:lentxt) = new_line(
'a')
740 write (txt,
'(3a, 1pg25.15e3)') &
741 'XORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%xorigin
742 txt(lentxt:lentxt) = new_line(
'a')
744 write (txt,
'(3a, 1pg25.15e3)') &
745 'YORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%yorigin
746 txt(lentxt:lentxt) = new_line(
'a')
748 write (txt,
'(3a, 1pg25.15e3)')
'ANGROT ',
'DOUBLE ',
'NDIM 0 # ', this%angrot
749 txt(lentxt:lentxt) = new_line(
'a')
751 write (txt,
'(3a, i0)')
'BOTM ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
752 txt(lentxt:lentxt) = new_line(
'a')
754 write (txt,
'(3a, i0)')
'VERTICES ',
'DOUBLE ',
'NDIM 2 2 ', this%nvert
755 txt(lentxt:lentxt) = new_line(
'a')
757 write (txt,
'(3a, i0)')
'CELLX ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
758 txt(lentxt:lentxt) = new_line(
'a')
760 write (txt,
'(3a, i0)')
'CELLY ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
761 txt(lentxt:lentxt) = new_line(
'a')
763 write (txt,
'(3a, i0)')
'IAVERT ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
764 txt(lentxt:lentxt) = new_line(
'a')
766 write (txt,
'(3a, i0)')
'JAVERT ',
'INTEGER ',
'NDIM 1 ',
size(this%javert)
767 txt(lentxt:lentxt) = new_line(
'a')
769 write (txt,
'(3a, i0)')
'IA ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
770 txt(lentxt:lentxt) = new_line(
'a')
772 write (txt,
'(3a, i0)')
'JA ',
'INTEGER ',
'NDIM 1 ',
size(this%con%jausr)
773 txt(lentxt:lentxt) = new_line(
'a')
775 write (txt,
'(3a, i0)')
'IDOMAIN ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
776 txt(lentxt:lentxt) = new_line(
'a')
778 write (txt,
'(3a, i0)')
'ICELLTYPE ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
779 txt(lentxt:lentxt) = new_line(
'a')
783 if (version == 2)
then
785 write (txt,
'(3a, i0)')
'CRS ',
'CHARACTER ',
'NDIM 1 ', &
787 txt(lentxt:lentxt) = new_line(
'a')
793 write (iunit) this%nodesuser
794 write (iunit) this%nodes
795 write (iunit) this%nvert
796 write (iunit)
size(this%javert)
797 write (iunit) this%nja
798 write (iunit) this%xorigin
799 write (iunit) this%yorigin
800 write (iunit) this%angrot
801 write (iunit) this%bottom
802 write (iunit) this%vertices
803 write (iunit) (this%cellxy(1, i), i=1, this%nodesuser)
804 write (iunit) (this%cellxy(2, i), i=1, this%nodesuser)
805 write (iunit) this%iavert
806 write (iunit) this%javert
807 write (iunit) this%con%iausr
808 write (iunit) this%con%jausr
809 write (iunit) this%idomain
810 write (iunit) icelltype
813 if (version == 2)
then
814 if (found_crs)
write (iunit) trim(crs)
827 integer(I4B),
intent(in) :: nodeu
828 character(len=*),
intent(inout) :: str
830 integer(I4B) :: i, j, k
831 character(len=10) :: jstr
833 call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
834 write (jstr,
'(i10)') j
835 str =
'('//trim(adjustl(jstr))//
')'
844 integer(I4B),
intent(in) :: nodeu
845 integer(I4B),
dimension(:),
intent(inout) :: arr
847 integer(I4B) :: isize
848 integer(I4B) :: i, j, k
852 if (isize /= this%ndim)
then
853 write (
errmsg,
'(a,i0,a,i0,a)') &
854 'Program error: nodeu_to_array size of array (', isize, &
855 ') is not equal to the discretization dimension (', this%ndim,
').'
860 call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
871 integer(I4B) :: nodenumber
874 integer(I4B),
intent(in) :: nodeu
875 integer(I4B),
intent(in) :: icheck
879 if (icheck /= 0)
then
882 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
884 write (
errmsg,
'(a,i0,a,i0,a)') &
885 'Node number (', nodeu,
') is less than 1 or greater than nodes (', &
890 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
894 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
907 integer(I4B),
intent(in) :: noden
908 integer(I4B),
intent(in) :: nodem
909 integer(I4B),
intent(in) :: ihc
910 real(DP),
intent(inout) :: xcomp
911 real(DP),
intent(inout) :: ycomp
912 real(DP),
intent(inout) :: zcomp
913 integer(I4B),
intent(in) :: ipos
915 real(DP) :: angle, dmult
921 if (nodem < noden)
then
934 angle = this%con%anglex(this%con%jas(ipos))
936 if (nodem < noden) dmult = -
done
937 xcomp = cos(angle) * dmult
938 ycomp = sin(angle) * dmult
950 xcomp, ycomp, zcomp, conlen)
953 integer(I4B),
intent(in) :: noden
954 integer(I4B),
intent(in) :: nodem
955 logical,
intent(in) :: nozee
956 real(DP),
intent(in) :: satn
957 real(DP),
intent(in) :: satm
958 integer(I4B),
intent(in) :: ihc
959 real(DP),
intent(inout) :: xcomp
960 real(DP),
intent(inout) :: ycomp
961 real(DP),
intent(inout) :: zcomp
962 real(DP),
intent(inout) :: conlen
964 integer(I4B) :: nodeun, nodeum
965 real(DP) :: xn, xm, yn, ym, zn, zm
976 nodeun = this%get_nodeuser(noden)
977 nodeum = this%get_nodeuser(nodem)
978 xn = this%cellxy(1, nodeun)
979 yn = this%cellxy(2, nodeun)
980 xm = this%cellxy(1, nodeum)
981 ym = this%cellxy(2, nodeum)
992 character(len=*),
intent(out) :: dis_type
1002 integer(I4B) :: dis_enum
1011 character(len=*),
intent(in) :: name_model
1012 character(len=*),
intent(in) :: input_mempath
1015 call this%DisBaseType%allocate_scalars(name_model, input_mempath)
1018 call mem_allocate(this%nvert,
'NVERT', this%memoryPath)
1033 call this%DisBaseType%allocate_arrays()
1036 if (this%nodes < this%nodesuser)
then
1037 call mem_allocate(this%nodeuser, this%nodes,
'NODEUSER', this%memoryPath)
1038 call mem_allocate(this%nodereduced, this%nodesuser,
'NODEREDUCED', &
1041 call mem_allocate(this%nodeuser, 1,
'NODEUSER', this%memoryPath)
1042 call mem_allocate(this%nodereduced, 1,
'NODEREDUCED', this%memoryPath)
1046 this%mshape(1) = this%nodesuser
1060 integer(I4B),
intent(in) :: icell2d
1064 integer(I4B) :: ivert
1065 integer(I4B) :: nvert
1066 integer(I4B) :: icount
1074 nvert = this%iavert(icell2d + 1) - this%iavert(icell2d)
1076 iv1 = this%javert(this%iavert(icell2d))
1077 x1 = this%vertices(1, iv1)
1078 y1 = this%vertices(2, iv1)
1079 do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1080 x = this%vertices(1, this%javert(ivert))
1081 if (icount < nvert)
then
1082 y = this%vertices(2, this%javert(ivert + 1))
1084 y = this%vertices(2, this%javert(this%iavert(icell2d)))
1086 area = area + (x - x1) * (y - y1)
1091 do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1092 y = this%vertices(2, this%javert(ivert))
1093 if (icount < nvert)
then
1094 x = this%vertices(1, this%javert(ivert + 1))
1096 x = this%vertices(1, this%javert(this%iavert(icell2d)))
1098 area = area - (x - x1) * (y - y1)
1113 flag_string, allow_zero)
result(nodeu)
1116 integer(I4B),
intent(inout) :: lloc
1117 integer(I4B),
intent(inout) :: istart
1118 integer(I4B),
intent(inout) :: istop
1119 integer(I4B),
intent(in) :: in
1120 integer(I4B),
intent(in) :: iout
1121 character(len=*),
intent(inout) :: line
1122 logical,
optional,
intent(in) :: flag_string
1123 logical,
optional,
intent(in) :: allow_zero
1124 integer(I4B) :: nodeu
1126 integer(I4B) :: j, nodes
1127 integer(I4B) :: lloclocal, ndum, istat, n
1130 if (
present(flag_string))
then
1131 if (flag_string)
then
1134 call urword(line, lloclocal, istart, istop, 1, ndum, r, iout, in)
1135 read (line(istart:istop), *, iostat=istat) n
1136 if (istat /= 0)
then
1144 nodes = this%mshape(1)
1146 call urword(line, lloc, istart, istop, 2, j, r, iout, in)
1149 if (
present(allow_zero))
then
1150 if (allow_zero)
then
1159 if (j < 1 .or. j > nodes)
then
1160 write (
errmsg,
'(a,1x,a,i0,a)') &
1161 trim(adjustl(
errmsg)),
'Cell number in list (', j, &
1162 ') is outside of the grid.'
1165 nodeu =
get_node(1, 1, j, 1, 1, nodes)
1167 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1168 write (
errmsg,
'(a,1x,a,i0,a)') &
1170 "Node number in list (", nodeu,
") is outside of the grid. "// &
1171 "Cell number cannot be determined in line '"// &
1172 trim(adjustl(line))//
"'."
1175 if (len_trim(adjustl(
errmsg)) > 0)
then
1191 allow_zero)
result(nodeu)
1193 integer(I4B) :: nodeu
1196 character(len=*),
intent(inout) :: cellid
1197 integer(I4B),
intent(in) :: inunit
1198 integer(I4B),
intent(in) :: iout
1199 logical,
optional,
intent(in) :: flag_string
1200 logical,
optional,
intent(in) :: allow_zero
1202 integer(I4B) :: j, nodes
1203 integer(I4B) :: lloclocal, ndum, istat, n
1204 integer(I4B) :: istart, istop
1207 if (
present(flag_string))
then
1208 if (flag_string)
then
1211 call urword(cellid, lloclocal, istart, istop, 1, ndum, r, iout, inunit)
1212 read (cellid(istart:istop), *, iostat=istat) n
1213 if (istat /= 0)
then
1221 nodes = this%mshape(1)
1224 call urword(cellid, lloclocal, istart, istop, 2, j, r, iout, inunit)
1227 if (
present(allow_zero))
then
1228 if (allow_zero)
then
1237 if (j < 1 .or. j > nodes)
then
1238 write (
errmsg,
'(a,1x,a,i0,a)') &
1239 trim(adjustl(
errmsg)),
'Cell2d number in list (', j, &
1240 ') is outside of the grid.'
1243 nodeu =
get_node(1, 1, j, 1, 1, nodes)
1245 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1246 write (
errmsg,
'(a,1x,a,i0,a)') &
1248 "Cell number cannot be determined for cellid ("// &
1249 trim(adjustl(cellid))//
") and results in a user "// &
1250 "node number (", nodeu,
") that is outside of the grid."
1253 if (len_trim(adjustl(
errmsg)) > 0)
then
1266 integer(I4B),
intent(in) :: ic
1267 real(DP),
allocatable,
intent(out) :: polyverts(:, :)
1268 logical(LGP),
intent(in),
optional :: closed
1270 integer(I4B) :: icu, icu2d, iavert, nverts, m, j
1271 logical(LGP) :: lclosed
1274 icu = this%get_nodeuser(ic)
1275 icu2d = icu - ((icu - 1) / this%nodes) * this%nodes
1276 nverts = this%iavert(icu2d + 1) - this%iavert(icu2d) - 1
1279 if (.not. (
present(closed)))
then
1287 allocate (polyverts(2, nverts + 1))
1289 allocate (polyverts(2, nverts))
1293 iavert = this%iavert(icu2d)
1295 j = this%javert(iavert - 1 + m)
1296 polyverts(:, m) = (/this%vertices(1, j), this%vertices(2, j)/)
1301 polyverts(:, nverts + 1) = polyverts(:, 1)
1308 integer(I4B),
intent(in) :: ic
1309 logical(LGP),
intent(in),
optional :: closed
1310 integer(I4B) :: npolyverts
1312 integer(I4B) :: icu, icu2d, nverts
1315 icu = this%get_nodeuser(ic)
1316 icu2d = icu - ((icu - 1) / this%nodes) * this%nodes
1317 nverts = this%iavert(icu2d + 1) - this%iavert(icu2d) - 1
1318 if (
present(closed))
then
1319 if (closed) npolyverts = npolyverts + 1
1326 logical(LGP),
intent(in),
optional :: closed
1327 integer(I4B) :: max_npolyverts
1332 do ic = 1, this%nodes
1333 max_npolyverts = max(max_npolyverts, this%get_npolyverts(ic, closed))
1343 cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
1346 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1347 integer(I4B),
intent(in) :: iout
1348 integer(I4B),
intent(in) :: iprint
1349 integer(I4B),
intent(in) :: idataun
1350 character(len=*),
intent(in) :: aname
1351 character(len=*),
intent(in) :: cdatafmp
1352 integer(I4B),
intent(in) :: nvaluesp
1353 integer(I4B),
intent(in) :: nwidthp
1354 character(len=*),
intent(in) :: editdesc
1355 real(DP),
intent(in) :: dinact
1357 integer(I4B) :: k, ifirst
1358 integer(I4B) :: nlay
1359 integer(I4B) :: nrow
1360 integer(I4B) :: ncol
1361 integer(I4B) :: nval
1362 integer(I4B) :: nodeu, noder
1363 integer(I4B) :: istart, istop
1364 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1366 character(len=*),
parameter :: fmthsv = &
1367 "(1X,/1X,a,' WILL BE SAVED ON UNIT ',I4, &
1368 &' AT END OF TIME STEP',I5,', STRESS PERIOD ',I4)"
1373 ncol = this%mshape(1)
1377 if (this%nodes < this%nodesuser)
then
1380 do nodeu = 1, this%nodesuser
1381 noder = this%get_nodenumber(nodeu, 0)
1382 if (noder <= 0)
then
1383 dtemp(nodeu) = dinact
1386 dtemp(nodeu) = darray(noder)
1394 if (iprint /= 0)
then
1397 istop = istart + nrow * ncol - 1
1399 aname, cdatafmp, nvaluesp, nwidthp, editdesc)
1405 if (idataun > 0)
then
1410 istop = istart + nrow * ncol - 1
1411 if (ifirst == 1)
write (iout, fmthsv) &
1412 trim(adjustl(aname)), idataun, &
1419 elseif (idataun < 0)
then
1422 call ubdsv1(
kstp,
kper, aname, -idataun, dtemp, ncol, nrow, nlay, &
1431 dstmodel, dstpackage, naux, auxtxt, &
1432 ibdchn, nlist, iout)
1435 character(len=16),
intent(in) :: text
1436 character(len=16),
intent(in) :: textmodel
1437 character(len=16),
intent(in) :: textpackage
1438 character(len=16),
intent(in) :: dstmodel
1439 character(len=16),
intent(in) :: dstpackage
1440 integer(I4B),
intent(in) :: naux
1441 character(len=16),
dimension(:),
intent(in) :: auxtxt
1442 integer(I4B),
intent(in) :: ibdchn
1443 integer(I4B),
intent(in) :: nlist
1444 integer(I4B),
intent(in) :: iout
1446 integer(I4B) :: nlay, nrow, ncol
1450 ncol = this%mshape(1)
1453 call ubdsv06(
kstp,
kper, text, textmodel, textpackage, dstmodel, dstpackage, &
1454 ibdchn, naux, auxtxt, ncol, nrow, nlay, &
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenbigline
maximum length of a big line
@ disv2d
DISV2D6 discretization.
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.
integer(i4b) function get_npolyverts(this, ic, closed)
Get the number of cell polygon vertices.
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.
integer(i4b) function get_max_npolyverts(this, closed)
Get the maximum number of cell polygon vertices.
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.
integer(i4b) function get_dis_enum(this)
Get the discretization type enumeration.
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)
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
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.