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()
73 logical :: length_units = .false.
74 logical :: nogrb = .false.
75 logical :: xorigin = .false.
76 logical :: yorigin = .false.
77 logical :: angrot = .false.
78 logical :: nodes = .false.
79 logical :: nvert = .false.
80 logical :: bottom = .false.
81 logical :: idomain = .false.
82 logical :: iv = .false.
83 logical :: xv = .false.
84 logical :: yv = .false.
85 logical :: icell2d = .false.
86 logical :: xc = .false.
87 logical :: yc = .false.
88 logical :: ncvert = .false.
89 logical :: icvert = .false.
96 subroutine disv2d_cr(dis, name_model, input_mempath, inunit, iout)
99 character(len=*),
intent(in) :: name_model
100 character(len=*),
intent(in) :: input_mempath
101 integer(I4B),
intent(in) :: inunit
102 integer(I4B),
intent(in) :: iout
106 character(len=*),
parameter :: fmtheader = &
107 "(1X, /1X, 'DISV -- VERTEX GRID DISCRETIZATION PACKAGE,', &
108 &' VERSION 1 : 12/23/2015 - INPUT READ FROM MEMPATH: ', A, //)"
112 call disnew%allocate_scalars(name_model, input_mempath)
121 write (iout, fmtheader) dis%input_mempath
125 call disnew%disv2d_load()
137 call this%source_options()
138 call this%source_dimensions()
139 call this%source_griddata()
140 call this%source_vertices()
141 call this%source_cell2d()
151 call this%grid_finalize()
183 call this%DisBaseType%dis_da()
221 character(len=LENVARNAME),
dimension(3) :: lenunits = &
222 &[character(len=LENVARNAME) ::
'FEET',
'METERS',
'CENTIMETERS']
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)
234 if (this%iout > 0)
then
235 call this%log_options(found)
247 write (this%iout,
'(1x,a)')
'Setting Discretization Options'
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
254 if (found%nogrb)
then
255 write (this%iout,
'(4x,a,i0)')
'Binary grid file [0=GRB, 1=NOGRB] &
256 &set as ', this%nogrb
259 if (found%xorigin)
then
260 write (this%iout,
'(4x,a,G0)')
'XORIGIN = ', this%xorigin
263 if (found%yorigin)
then
264 write (this%iout,
'(4x,a,G0)')
'YORIGIN = ', this%yorigin
267 if (found%angrot)
then
268 write (this%iout,
'(4x,a,G0)')
'ANGROT = ', this%angrot
271 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Options'
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)
289 if (this%iout > 0)
then
290 call this%log_dimensions(found)
294 if (this%nodes < 1)
then
296 'NODES was not specified or was specified incorrectly.')
299 if (this%nvert < 1)
then
301 'NVERT was not specified or was specified incorrectly.')
306 this%nodesuser = this%nodes
309 call mem_allocate(this%idomain, this%nodes,
'IDOMAIN', &
315 call mem_allocate(this%vertices, 2, this%nvert,
'VERTICES', this%memoryPath)
316 call mem_allocate(this%cellxy, 2, this%nodesuser,
'CELLXY', this%memoryPath)
319 do j = 1, this%nodesuser
332 write (this%iout,
'(1x,a)')
'Setting Discretization Dimensions'
334 if (found%nodes)
then
335 write (this%iout,
'(4x,a,i0)')
'NODES = ', this%nodesuser
338 if (found%nvert)
then
339 write (this%iout,
'(4x,a,i0)')
'NVERT = ', this%nvert
342 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Dimensions'
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)
359 if (this%iout > 0)
then
360 call this%log_griddata(found)
372 write (this%iout,
'(1x,a)')
'Setting Discretization Griddata'
374 if (found%bottom)
then
375 write (this%iout,
'(4x,a)')
'BOTTOM set from input file'
378 if (found%idomain)
then
379 write (this%iout,
'(4x,a)')
'IDOMAIN set from input file'
382 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Griddata'
392 integer(I4B) :: node, noder, j, ncell_count
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, //)"
401 do j = 1, this%nodesuser
402 if (this%idomain(j) > 0) ncell_count = ncell_count + 1
404 this%nodes = ncell_count
407 if (ncell_count == 0)
then
408 call store_error(
'Model does not have any active nodes. &
409 &Ensure IDOMAIN array has some values greater &
415 if (this%nodes < this%nodesuser)
then
416 write (this%iout, fmtnr) this%nodesuser, this%nodes
420 call this%allocate_arrays()
426 if (this%nodes < this%nodesuser)
then
429 do j = 1, this%nodesuser
430 if (this%idomain(j) > 0)
then
431 this%nodereduced(node) = noder
434 this%nodereduced(node) = 0
441 if (this%nodes < this%nodesuser)
then
444 do j = 1, this%nodesuser
445 if (this%idomain(j) > 0)
then
446 this%nodeuser(noder) = node
456 do j = 1, this%nodesuser
459 if (this%nodes < this%nodesuser) noder = this%nodereduced(node)
460 if (noder <= 0) cycle
461 this%bot(noder) = this%bottom(j)
462 this%xc(noder) = this%cellxy(1, j)
463 this%yc(noder) = this%cellxy(2, j)
478 real(DP),
dimension(:),
contiguous,
pointer :: vert_x => null()
479 real(DP),
dimension(:),
contiguous,
pointer :: vert_y => null()
482 call mem_setptr(vert_x,
'XV', this%input_mempath)
483 call mem_setptr(vert_y,
'YV', this%input_mempath)
486 if (
associated(vert_x) .and.
associated(vert_y))
then
488 this%vertices(1, i) = vert_x(i)
489 this%vertices(2, i) = vert_y(i)
492 call store_error(
'Required Vertex arrays not found.')
496 if (this%iout > 0)
then
497 write (this%iout,
'(1x,a)')
'Discretization Vertex data loaded'
509 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: icell2d
510 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: ncvert
511 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: icvert
514 integer(I4B) :: i, j, ierr
515 integer(I4B) :: icv_idx, startvert, maxnnz = 5
518 call vert_spm%init(this%nodes, this%nvert, maxnnz)
523 if (icell2d(i) /= i)
call store_error(
'ICELL2D input sequence violation.')
525 call vert_spm%addconnection(i, icvert(icv_idx), 0)
527 startvert = icvert(icv_idx)
528 elseif (j == ncvert(i) .and. (icvert(icv_idx) /= startvert))
then
529 call vert_spm%addconnection(i, startvert, 0)
531 icv_idx = icv_idx + 1
536 call mem_allocate(this%iavert, this%nodes + 1,
'IAVERT', this%memoryPath)
537 call mem_allocate(this%javert, vert_spm%nnz,
'JAVERT', this%memoryPath)
538 call vert_spm%filliaja(this%iavert, this%javert, ierr)
539 call vert_spm%destroy()
549 integer(I4B),
dimension(:),
contiguous,
pointer :: icell2d => null()
550 integer(I4B),
dimension(:),
contiguous,
pointer :: ncvert => null()
551 integer(I4B),
dimension(:),
contiguous,
pointer :: icvert => null()
552 real(DP),
dimension(:),
contiguous,
pointer :: cell_x => null()
553 real(DP),
dimension(:),
contiguous,
pointer :: cell_y => null()
557 call mem_setptr(icell2d,
'ICELL2D', this%input_mempath)
558 call mem_setptr(ncvert,
'NCVERT', this%input_mempath)
559 call mem_setptr(icvert,
'ICVERT', this%input_mempath)
562 if (
associated(icell2d) .and.
associated(ncvert) &
563 .and.
associated(icvert))
then
564 call this%define_cellverts(icell2d, ncvert, icvert)
566 call store_error(
'Required cell vertex array(s) [ICELL2D, NCVERT, ICVERT] &
571 call mem_setptr(cell_x,
'XC', this%input_mempath)
572 call mem_setptr(cell_y,
'YC', this%input_mempath)
575 if (
associated(cell_x) .and.
associated(cell_y))
then
576 do i = 1, this%nodesuser
577 this%cellxy(1, i) = cell_x(i)
578 this%cellxy(2, i) = cell_y(i)
581 call store_error(
'Required cell center arrays not found.')
585 if (this%iout > 0)
then
586 write (this%iout,
'(1x,a)')
'Discretization Cell2d data loaded'
598 integer(I4B) :: noder, nrsize
599 integer(I4B) :: narea_eq_zero
600 integer(I4B) :: narea_lt_zero
608 do j = 1, this%nodesuser
609 area = this%get_cell2d_area(j)
610 noder = this%get_nodenumber(j, 0)
611 if (noder > 0) this%area(noder) = area
612 if (area <
dzero)
then
613 narea_lt_zero = narea_lt_zero + 1
614 write (
errmsg,
'(a,i0,a)') &
615 &
'Calculated CELL2D area less than zero for cell ', j,
'.'
618 if (area ==
dzero)
then
619 narea_eq_zero = narea_eq_zero + 1
620 write (
errmsg,
'(a,i0,a)') &
621 'Calculated CELL2D area is zero for cell ', j,
'.'
628 if (narea_lt_zero > 0)
then
629 write (
errmsg,
'(i0,a)') narea_lt_zero, &
630 ' cell(s) have an area less than zero. Calculated cell &
631 &areas must be greater than zero. Negative areas often &
632 &mean vertices are not listed in clockwise order.'
635 if (narea_eq_zero > 0)
then
636 write (
errmsg,
'(i0,a)') narea_eq_zero, &
637 ' cell(s) have an area equal to zero. Calculated cell &
638 &areas must be greater than zero. Calculated cell &
639 &areas equal to zero indicate that the cell is not defined &
640 &by a valid polygon.'
648 if (this%nodes < this%nodesuser) nrsize = this%nodes
650 call this%con%disvconnections(this%name_model, this%nodes, &
651 this%nodesuser, 1, nrsize, &
652 this%nvert, this%vertices, this%iavert, &
653 this%javert, this%cellxy, &
654 this%bot, this%bot, &
655 this%nodereduced, this%nodeuser)
656 this%nja = this%con%nja
657 this%njas = this%con%njas
669 integer(I4B),
dimension(:),
intent(in) :: icelltype
671 integer(I4B) :: iunit, i, ntxt, version
672 integer(I4B),
parameter :: lentxt = 100
673 character(len=50) :: txthdr
674 character(len=lentxt) :: txt
675 character(len=LINELENGTH) :: fname
676 character(len=LENBIGLINE) :: crs
677 logical(LGP) :: found_crs
679 character(len=*),
parameter :: fmtgrdsave = &
680 "(4X,'BINARY GRID INFORMATION WILL BE WRITTEN TO:', &
681 &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
687 call mem_set_value(crs,
'CRS', this%input_mempath, found_crs)
696 fname = trim(this%output_fname)
698 write (this%iout, fmtgrdsave) iunit, trim(adjustl(fname))
699 call openfile(iunit, this%iout, trim(adjustl(fname)),
'DATA(BINARY)', &
703 write (txthdr,
'(a)')
'GRID DISV2D'
704 txthdr(50:50) = new_line(
'a')
706 write (txthdr,
'(a)')
'VERSION 1'
707 txthdr(50:50) = new_line(
'a')
709 write (txthdr,
'(a, i0)')
'NTXT ', ntxt
710 txthdr(50:50) = new_line(
'a')
712 write (txthdr,
'(a, i0)')
'LENTXT ', lentxt
713 txthdr(50:50) = new_line(
'a')
717 write (txt,
'(3a, i0)')
'NCELLS ',
'INTEGER ',
'NDIM 0 # ', this%nodesuser
718 txt(lentxt:lentxt) = new_line(
'a')
720 write (txt,
'(3a, i0)')
'NODES ',
'INTEGER ',
'NDIM 0 # ', this%nodes
721 txt(lentxt:lentxt) = new_line(
'a')
723 write (txt,
'(3a, i0)')
'NVERT ',
'INTEGER ',
'NDIM 0 # ', this%nvert
724 txt(lentxt:lentxt) = new_line(
'a')
726 write (txt,
'(3a, i0)')
'NJAVERT ',
'INTEGER ',
'NDIM 0 # ',
size(this%javert)
727 txt(lentxt:lentxt) = new_line(
'a')
729 write (txt,
'(3a, i0)')
'NJA ',
'INTEGER ',
'NDIM 0 # ', this%con%nja
730 txt(lentxt:lentxt) = new_line(
'a')
732 write (txt,
'(3a, 1pg25.15e3)') &
733 'XORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%xorigin
734 txt(lentxt:lentxt) = new_line(
'a')
736 write (txt,
'(3a, 1pg25.15e3)') &
737 'YORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%yorigin
738 txt(lentxt:lentxt) = new_line(
'a')
740 write (txt,
'(3a, 1pg25.15e3)')
'ANGROT ',
'DOUBLE ',
'NDIM 0 # ', this%angrot
741 txt(lentxt:lentxt) = new_line(
'a')
743 write (txt,
'(3a, i0)')
'BOTM ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
744 txt(lentxt:lentxt) = new_line(
'a')
746 write (txt,
'(3a, i0)')
'VERTICES ',
'DOUBLE ',
'NDIM 2 2 ', this%nvert
747 txt(lentxt:lentxt) = new_line(
'a')
749 write (txt,
'(3a, i0)')
'CELLX ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
750 txt(lentxt:lentxt) = new_line(
'a')
752 write (txt,
'(3a, i0)')
'CELLY ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
753 txt(lentxt:lentxt) = new_line(
'a')
755 write (txt,
'(3a, i0)')
'IAVERT ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
756 txt(lentxt:lentxt) = new_line(
'a')
758 write (txt,
'(3a, i0)')
'JAVERT ',
'INTEGER ',
'NDIM 1 ',
size(this%javert)
759 txt(lentxt:lentxt) = new_line(
'a')
761 write (txt,
'(3a, i0)')
'IA ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
762 txt(lentxt:lentxt) = new_line(
'a')
764 write (txt,
'(3a, i0)')
'JA ',
'INTEGER ',
'NDIM 1 ',
size(this%con%jausr)
765 txt(lentxt:lentxt) = new_line(
'a')
767 write (txt,
'(3a, i0)')
'IDOMAIN ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
768 txt(lentxt:lentxt) = new_line(
'a')
770 write (txt,
'(3a, i0)')
'ICELLTYPE ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
771 txt(lentxt:lentxt) = new_line(
'a')
775 if (version == 2)
then
777 write (txt,
'(3a, i0)')
'CRS ',
'CHARACTER ',
'NDIM 1 ', &
779 txt(lentxt:lentxt) = new_line(
'a')
785 write (iunit) this%nodesuser
786 write (iunit) this%nodes
787 write (iunit) this%nvert
788 write (iunit)
size(this%javert)
789 write (iunit) this%nja
790 write (iunit) this%xorigin
791 write (iunit) this%yorigin
792 write (iunit) this%angrot
793 write (iunit) this%bottom
794 write (iunit) this%vertices
795 write (iunit) (this%cellxy(1, i), i=1, this%nodesuser)
796 write (iunit) (this%cellxy(2, i), i=1, this%nodesuser)
797 write (iunit) this%iavert
798 write (iunit) this%javert
799 write (iunit) this%con%iausr
800 write (iunit) this%con%jausr
801 write (iunit) this%idomain
802 write (iunit) icelltype
805 if (version == 2)
then
806 if (found_crs)
write (iunit) trim(crs)
819 integer(I4B),
intent(in) :: nodeu
820 character(len=*),
intent(inout) :: str
822 integer(I4B) :: i, j, k
823 character(len=10) :: jstr
825 call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
826 write (jstr,
'(i10)') j
827 str =
'('//trim(adjustl(jstr))//
')'
836 integer(I4B),
intent(in) :: nodeu
837 integer(I4B),
dimension(:),
intent(inout) :: arr
839 integer(I4B) :: isize
840 integer(I4B) :: i, j, k
844 if (isize /= this%ndim)
then
845 write (
errmsg,
'(a,i0,a,i0,a)') &
846 'Program error: nodeu_to_array size of array (', isize, &
847 ') is not equal to the discretization dimension (', this%ndim,
').'
852 call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
863 integer(I4B) :: nodenumber
866 integer(I4B),
intent(in) :: nodeu
867 integer(I4B),
intent(in) :: icheck
871 if (icheck /= 0)
then
874 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
876 write (
errmsg,
'(a,i0,a,i0,a)') &
877 'Node number (', nodeu,
') is less than 1 or greater than nodes (', &
882 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
886 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
899 integer(I4B),
intent(in) :: noden
900 integer(I4B),
intent(in) :: nodem
901 integer(I4B),
intent(in) :: ihc
902 real(DP),
intent(inout) :: xcomp
903 real(DP),
intent(inout) :: ycomp
904 real(DP),
intent(inout) :: zcomp
905 integer(I4B),
intent(in) :: ipos
907 real(DP) :: angle, dmult
913 if (nodem < noden)
then
926 angle = this%con%anglex(this%con%jas(ipos))
928 if (nodem < noden) dmult = -
done
929 xcomp = cos(angle) * dmult
930 ycomp = sin(angle) * dmult
942 xcomp, ycomp, zcomp, conlen)
945 integer(I4B),
intent(in) :: noden
946 integer(I4B),
intent(in) :: nodem
947 logical,
intent(in) :: nozee
948 real(DP),
intent(in) :: satn
949 real(DP),
intent(in) :: satm
950 integer(I4B),
intent(in) :: ihc
951 real(DP),
intent(inout) :: xcomp
952 real(DP),
intent(inout) :: ycomp
953 real(DP),
intent(inout) :: zcomp
954 real(DP),
intent(inout) :: conlen
956 integer(I4B) :: nodeun, nodeum
957 real(DP) :: xn, xm, yn, ym, zn, zm
968 nodeun = this%get_nodeuser(noden)
969 nodeum = this%get_nodeuser(nodem)
970 xn = this%cellxy(1, nodeun)
971 yn = this%cellxy(2, nodeun)
972 xm = this%cellxy(1, nodeum)
973 ym = this%cellxy(2, nodeum)
984 character(len=*),
intent(out) :: dis_type
994 integer(I4B) :: dis_enum
1003 character(len=*),
intent(in) :: name_model
1004 character(len=*),
intent(in) :: input_mempath
1007 call this%DisBaseType%allocate_scalars(name_model, input_mempath)
1010 call mem_allocate(this%nvert,
'NVERT', this%memoryPath)
1025 call this%DisBaseType%allocate_arrays()
1028 if (this%nodes < this%nodesuser)
then
1029 call mem_allocate(this%nodeuser, this%nodes,
'NODEUSER', this%memoryPath)
1030 call mem_allocate(this%nodereduced, this%nodesuser,
'NODEREDUCED', &
1033 call mem_allocate(this%nodeuser, 1,
'NODEUSER', this%memoryPath)
1034 call mem_allocate(this%nodereduced, 1,
'NODEREDUCED', this%memoryPath)
1038 this%mshape(1) = this%nodesuser
1052 integer(I4B),
intent(in) :: icell2d
1056 integer(I4B) :: ivert
1057 integer(I4B) :: nvert
1058 integer(I4B) :: icount
1066 nvert = this%iavert(icell2d + 1) - this%iavert(icell2d)
1068 iv1 = this%javert(this%iavert(icell2d))
1069 x1 = this%vertices(1, iv1)
1070 y1 = this%vertices(2, iv1)
1071 do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1072 x = this%vertices(1, this%javert(ivert))
1073 if (icount < nvert)
then
1074 y = this%vertices(2, this%javert(ivert + 1))
1076 y = this%vertices(2, this%javert(this%iavert(icell2d)))
1078 area = area + (x - x1) * (y - y1)
1083 do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1084 y = this%vertices(2, this%javert(ivert))
1085 if (icount < nvert)
then
1086 x = this%vertices(1, this%javert(ivert + 1))
1088 x = this%vertices(1, this%javert(this%iavert(icell2d)))
1090 area = area - (x - x1) * (y - y1)
1105 flag_string, allow_zero)
result(nodeu)
1108 integer(I4B),
intent(inout) :: lloc
1109 integer(I4B),
intent(inout) :: istart
1110 integer(I4B),
intent(inout) :: istop
1111 integer(I4B),
intent(in) :: in
1112 integer(I4B),
intent(in) :: iout
1113 character(len=*),
intent(inout) :: line
1114 logical,
optional,
intent(in) :: flag_string
1115 logical,
optional,
intent(in) :: allow_zero
1116 integer(I4B) :: nodeu
1118 integer(I4B) :: j, nodes
1119 integer(I4B) :: lloclocal, ndum, istat, n
1122 if (
present(flag_string))
then
1123 if (flag_string)
then
1126 call urword(line, lloclocal, istart, istop, 1, ndum, r, iout, in)
1127 read (line(istart:istop), *, iostat=istat) n
1128 if (istat /= 0)
then
1136 nodes = this%mshape(1)
1138 call urword(line, lloc, istart, istop, 2, j, r, iout, in)
1141 if (
present(allow_zero))
then
1142 if (allow_zero)
then
1151 if (j < 1 .or. j > nodes)
then
1152 write (
errmsg,
'(a,1x,a,i0,a)') &
1153 trim(adjustl(
errmsg)),
'Cell number in list (', j, &
1154 ') is outside of the grid.'
1157 nodeu =
get_node(1, 1, j, 1, 1, nodes)
1159 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1160 write (
errmsg,
'(a,1x,a,i0,a)') &
1162 "Node number in list (", nodeu,
") is outside of the grid. "// &
1163 "Cell number cannot be determined in line '"// &
1164 trim(adjustl(line))//
"'."
1167 if (len_trim(adjustl(
errmsg)) > 0)
then
1183 allow_zero)
result(nodeu)
1185 integer(I4B) :: nodeu
1188 character(len=*),
intent(inout) :: cellid
1189 integer(I4B),
intent(in) :: inunit
1190 integer(I4B),
intent(in) :: iout
1191 logical,
optional,
intent(in) :: flag_string
1192 logical,
optional,
intent(in) :: allow_zero
1194 integer(I4B) :: j, nodes
1195 integer(I4B) :: lloclocal, ndum, istat, n
1196 integer(I4B) :: istart, istop
1199 if (
present(flag_string))
then
1200 if (flag_string)
then
1203 call urword(cellid, lloclocal, istart, istop, 1, ndum, r, iout, inunit)
1204 read (cellid(istart:istop), *, iostat=istat) n
1205 if (istat /= 0)
then
1213 nodes = this%mshape(1)
1216 call urword(cellid, lloclocal, istart, istop, 2, j, r, iout, inunit)
1219 if (
present(allow_zero))
then
1220 if (allow_zero)
then
1229 if (j < 1 .or. j > nodes)
then
1230 write (
errmsg,
'(a,1x,a,i0,a)') &
1231 trim(adjustl(
errmsg)),
'Cell2d number in list (', j, &
1232 ') is outside of the grid.'
1235 nodeu =
get_node(1, 1, j, 1, 1, nodes)
1237 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1238 write (
errmsg,
'(a,1x,a,i0,a)') &
1240 "Cell number cannot be determined for cellid ("// &
1241 trim(adjustl(cellid))//
") and results in a user "// &
1242 "node number (", nodeu,
") that is outside of the grid."
1245 if (len_trim(adjustl(
errmsg)) > 0)
then
1258 integer(I4B),
intent(in) :: ic
1259 real(DP),
allocatable,
intent(out) :: polyverts(:, :)
1260 logical(LGP),
intent(in),
optional :: closed
1262 integer(I4B) :: icu, icu2d, iavert, nverts, m, j
1263 logical(LGP) :: lclosed
1266 icu = this%get_nodeuser(ic)
1267 icu2d = icu - ((icu - 1) / this%nodes) * this%nodes
1268 nverts = this%iavert(icu2d + 1) - this%iavert(icu2d) - 1
1271 if (.not. (
present(closed)))
then
1279 allocate (polyverts(2, nverts + 1))
1281 allocate (polyverts(2, nverts))
1285 iavert = this%iavert(icu2d)
1287 j = this%javert(iavert - 1 + m)
1288 polyverts(:, m) = (/this%vertices(1, j), this%vertices(2, j)/)
1293 polyverts(:, nverts + 1) = polyverts(:, 1)
1300 integer(I4B),
intent(in) :: ic
1301 logical(LGP),
intent(in),
optional :: closed
1302 integer(I4B) :: npolyverts
1304 integer(I4B) :: icu, icu2d, nverts
1307 icu = this%get_nodeuser(ic)
1308 icu2d = icu - ((icu - 1) / this%nodes) * this%nodes
1309 nverts = this%iavert(icu2d + 1) - this%iavert(icu2d) - 1
1310 if (
present(closed))
then
1311 if (closed) npolyverts = npolyverts + 1
1318 logical(LGP),
intent(in),
optional :: closed
1319 integer(I4B) :: max_npolyverts
1324 do ic = 1, this%nodes
1325 max_npolyverts = max(max_npolyverts, this%get_npolyverts(ic, closed))
1335 cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
1338 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1339 integer(I4B),
intent(in) :: iout
1340 integer(I4B),
intent(in) :: iprint
1341 integer(I4B),
intent(in) :: idataun
1342 character(len=*),
intent(in) :: aname
1343 character(len=*),
intent(in) :: cdatafmp
1344 integer(I4B),
intent(in) :: nvaluesp
1345 integer(I4B),
intent(in) :: nwidthp
1346 character(len=*),
intent(in) :: editdesc
1347 real(DP),
intent(in) :: dinact
1349 integer(I4B) :: k, ifirst
1350 integer(I4B) :: nlay
1351 integer(I4B) :: nrow
1352 integer(I4B) :: ncol
1353 integer(I4B) :: nval
1354 integer(I4B) :: nodeu, noder
1355 integer(I4B) :: istart, istop
1356 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1358 character(len=*),
parameter :: fmthsv = &
1359 "(1X,/1X,a,' WILL BE SAVED ON UNIT ',I4, &
1360 &' AT END OF TIME STEP',I5,', STRESS PERIOD ',I4)"
1365 ncol = this%mshape(1)
1369 if (this%nodes < this%nodesuser)
then
1372 do nodeu = 1, this%nodesuser
1373 noder = this%get_nodenumber(nodeu, 0)
1374 if (noder <= 0)
then
1375 dtemp(nodeu) = dinact
1378 dtemp(nodeu) = darray(noder)
1386 if (iprint /= 0)
then
1389 istop = istart + nrow * ncol - 1
1391 aname, cdatafmp, nvaluesp, nwidthp, editdesc)
1397 if (idataun > 0)
then
1402 istop = istart + nrow * ncol - 1
1403 if (ifirst == 1)
write (iout, fmthsv) &
1404 trim(adjustl(aname)), idataun, &
1411 elseif (idataun < 0)
then
1414 call ubdsv1(
kstp,
kper, aname, -idataun, dtemp, ncol, nrow, nlay, &
1423 dstmodel, dstpackage, naux, auxtxt, &
1424 ibdchn, nlist, iout)
1427 character(len=16),
intent(in) :: text
1428 character(len=16),
intent(in) :: textmodel
1429 character(len=16),
intent(in) :: textpackage
1430 character(len=16),
intent(in) :: dstmodel
1431 character(len=16),
intent(in) :: dstpackage
1432 integer(I4B),
intent(in) :: naux
1433 character(len=16),
dimension(:),
intent(in) :: auxtxt
1434 integer(I4B),
intent(in) :: ibdchn
1435 integer(I4B),
intent(in) :: nlist
1436 integer(I4B),
intent(in) :: iout
1438 integer(I4B) :: nlay, nrow, ncol
1442 ncol = this%mshape(1)
1445 call ubdsv06(
kstp,
kper, text, textmodel, textpackage, dstmodel, dstpackage, &
1446 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)
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.