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()
71 logical :: length_units = .false.
72 logical :: nogrb = .false.
73 logical :: xorigin = .false.
74 logical :: yorigin = .false.
75 logical :: angrot = .false.
76 logical :: nodes = .false.
77 logical :: nvert = .false.
78 logical :: bottom = .false.
79 logical :: idomain = .false.
80 logical :: iv = .false.
81 logical :: xv = .false.
82 logical :: yv = .false.
83 logical :: icell2d = .false.
84 logical :: xc = .false.
85 logical :: yc = .false.
86 logical :: ncvert = .false.
87 logical :: icvert = .false.
94 subroutine disv2d_cr(dis, name_model, input_mempath, inunit, iout)
97 character(len=*),
intent(in) :: name_model
98 character(len=*),
intent(in) :: input_mempath
99 integer(I4B),
intent(in) :: inunit
100 integer(I4B),
intent(in) :: iout
104 character(len=*),
parameter :: fmtheader = &
105 "(1X, /1X, 'DISV -- VERTEX GRID DISCRETIZATION PACKAGE,', &
106 &' VERSION 1 : 12/23/2015 - INPUT READ FROM MEMPATH: ', A, //)"
110 call disnew%allocate_scalars(name_model, input_mempath)
119 write (iout, fmtheader) dis%input_mempath
123 call disnew%disv2d_load()
135 call this%source_options()
136 call this%source_dimensions()
137 call this%source_griddata()
138 call this%source_vertices()
139 call this%source_cell2d()
149 call this%grid_finalize()
181 call this%DisBaseType%dis_da()
219 character(len=LENVARNAME),
dimension(3) :: lenunits = &
220 &[character(len=LENVARNAME) ::
'FEET',
'METERS',
'CENTIMETERS']
224 call mem_set_value(this%lenuni,
'LENGTH_UNITS', this%input_mempath, &
225 lenunits, found%length_units)
226 call mem_set_value(this%nogrb,
'NOGRB', this%input_mempath, found%nogrb)
227 call mem_set_value(this%xorigin,
'XORIGIN', this%input_mempath, found%xorigin)
228 call mem_set_value(this%yorigin,
'YORIGIN', this%input_mempath, found%yorigin)
229 call mem_set_value(this%angrot,
'ANGROT', this%input_mempath, found%angrot)
232 if (this%iout > 0)
then
233 call this%log_options(found)
245 write (this%iout,
'(1x,a)')
'Setting Discretization Options'
247 if (found%length_units)
then
248 write (this%iout,
'(4x,a,i0)')
'Model length unit [0=UND, 1=FEET, &
249 &2=METERS, 3=CENTIMETERS] set as ', this%lenuni
252 if (found%nogrb)
then
253 write (this%iout,
'(4x,a,i0)')
'Binary grid file [0=GRB, 1=NOGRB] &
254 &set as ', this%nogrb
257 if (found%xorigin)
then
258 write (this%iout,
'(4x,a,G0)')
'XORIGIN = ', this%xorigin
261 if (found%yorigin)
then
262 write (this%iout,
'(4x,a,G0)')
'YORIGIN = ', this%yorigin
265 if (found%angrot)
then
266 write (this%iout,
'(4x,a,G0)')
'ANGROT = ', this%angrot
269 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Options'
283 call mem_set_value(this%nodes,
'NODES', this%input_mempath, found%nodes)
284 call mem_set_value(this%nvert,
'NVERT', this%input_mempath, found%nvert)
287 if (this%iout > 0)
then
288 call this%log_dimensions(found)
292 if (this%nodes < 1)
then
294 'NODES was not specified or was specified incorrectly.')
297 if (this%nvert < 1)
then
299 'NVERT was not specified or was specified incorrectly.')
304 this%nodesuser = this%nodes
307 call mem_allocate(this%idomain, this%nodes,
'IDOMAIN', &
313 call mem_allocate(this%vertices, 2, this%nvert,
'VERTICES', this%memoryPath)
314 call mem_allocate(this%cellxy, 2, this%nodesuser,
'CELLXY', this%memoryPath)
317 do j = 1, this%nodesuser
330 write (this%iout,
'(1x,a)')
'Setting Discretization Dimensions'
332 if (found%nodes)
then
333 write (this%iout,
'(4x,a,i0)')
'NODES = ', this%nodesuser
336 if (found%nvert)
then
337 write (this%iout,
'(4x,a,i0)')
'NVERT = ', this%nvert
340 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Dimensions'
353 call mem_set_value(this%bottom,
'BOTTOM', this%input_mempath, found%bottom)
354 call mem_set_value(this%idomain,
'IDOMAIN', this%input_mempath, found%idomain)
357 if (this%iout > 0)
then
358 call this%log_griddata(found)
370 write (this%iout,
'(1x,a)')
'Setting Discretization Griddata'
372 if (found%bottom)
then
373 write (this%iout,
'(4x,a)')
'BOTTOM set from input file'
376 if (found%idomain)
then
377 write (this%iout,
'(4x,a)')
'IDOMAIN set from input file'
380 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Griddata'
390 integer(I4B) :: node, noder, j, ncell_count
392 character(len=*),
parameter :: fmtnr = &
393 "(/1x, 'The specified IDOMAIN results in a reduced number of cells.',&
394 &/1x, 'Number of user nodes: ',I0,&
395 &/1X, 'Number of nodes in solution: ', I0, //)"
399 do j = 1, this%nodesuser
400 if (this%idomain(j) > 0) ncell_count = ncell_count + 1
402 this%nodes = ncell_count
405 if (ncell_count == 0)
then
406 call store_error(
'Model does not have any active nodes. &
407 &Ensure IDOMAIN array has some values greater &
413 if (this%nodes < this%nodesuser)
then
414 write (this%iout, fmtnr) this%nodesuser, this%nodes
418 call this%allocate_arrays()
424 if (this%nodes < this%nodesuser)
then
427 do j = 1, this%nodesuser
428 if (this%idomain(j) > 0)
then
429 this%nodereduced(node) = noder
432 this%nodereduced(node) = 0
439 if (this%nodes < this%nodesuser)
then
442 do j = 1, this%nodesuser
443 if (this%idomain(j) > 0)
then
444 this%nodeuser(noder) = node
454 do j = 1, this%nodesuser
457 if (this%nodes < this%nodesuser) noder = this%nodereduced(node)
458 if (noder <= 0) cycle
459 this%bot(noder) = this%bottom(j)
460 this%xc(noder) = this%cellxy(1, j)
461 this%yc(noder) = this%cellxy(2, j)
476 real(DP),
dimension(:),
contiguous,
pointer :: vert_x => null()
477 real(DP),
dimension(:),
contiguous,
pointer :: vert_y => null()
480 call mem_setptr(vert_x,
'XV', this%input_mempath)
481 call mem_setptr(vert_y,
'YV', this%input_mempath)
484 if (
associated(vert_x) .and.
associated(vert_y))
then
486 this%vertices(1, i) = vert_x(i)
487 this%vertices(2, i) = vert_y(i)
490 call store_error(
'Required Vertex arrays not found.')
494 if (this%iout > 0)
then
495 write (this%iout,
'(1x,a)')
'Discretization Vertex data loaded'
507 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: icell2d
508 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: ncvert
509 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: icvert
512 integer(I4B) :: i, j, ierr
513 integer(I4B) :: icv_idx, startvert, maxnnz = 5
516 call vert_spm%init(this%nodes, this%nvert, maxnnz)
521 if (icell2d(i) /= i)
call store_error(
'ICELL2D input sequence violation.')
523 call vert_spm%addconnection(i, icvert(icv_idx), 0)
525 startvert = icvert(icv_idx)
526 elseif (j == ncvert(i) .and. (icvert(icv_idx) /= startvert))
then
527 call vert_spm%addconnection(i, startvert, 0)
529 icv_idx = icv_idx + 1
534 call mem_allocate(this%iavert, this%nodes + 1,
'IAVERT', this%memoryPath)
535 call mem_allocate(this%javert, vert_spm%nnz,
'JAVERT', this%memoryPath)
536 call vert_spm%filliaja(this%iavert, this%javert, ierr)
537 call vert_spm%destroy()
547 integer(I4B),
dimension(:),
contiguous,
pointer :: icell2d => null()
548 integer(I4B),
dimension(:),
contiguous,
pointer :: ncvert => null()
549 integer(I4B),
dimension(:),
contiguous,
pointer :: icvert => null()
550 real(DP),
dimension(:),
contiguous,
pointer :: cell_x => null()
551 real(DP),
dimension(:),
contiguous,
pointer :: cell_y => null()
555 call mem_setptr(icell2d,
'ICELL2D', this%input_mempath)
556 call mem_setptr(ncvert,
'NCVERT', this%input_mempath)
557 call mem_setptr(icvert,
'ICVERT', this%input_mempath)
560 if (
associated(icell2d) .and.
associated(ncvert) &
561 .and.
associated(icvert))
then
562 call this%define_cellverts(icell2d, ncvert, icvert)
564 call store_error(
'Required cell vertex array(s) [ICELL2D, NCVERT, ICVERT] &
569 call mem_setptr(cell_x,
'XC', this%input_mempath)
570 call mem_setptr(cell_y,
'YC', this%input_mempath)
573 if (
associated(cell_x) .and.
associated(cell_y))
then
574 do i = 1, this%nodesuser
575 this%cellxy(1, i) = cell_x(i)
576 this%cellxy(2, i) = cell_y(i)
579 call store_error(
'Required cell center arrays not found.')
583 if (this%iout > 0)
then
584 write (this%iout,
'(1x,a)')
'Discretization Cell2d data loaded'
596 integer(I4B) :: noder, nrsize
597 integer(I4B) :: narea_eq_zero
598 integer(I4B) :: narea_lt_zero
606 do j = 1, this%nodesuser
607 area = this%get_cell2d_area(j)
608 noder = this%get_nodenumber(j, 0)
609 if (noder > 0) this%area(noder) = area
610 if (area <
dzero)
then
611 narea_lt_zero = narea_lt_zero + 1
612 write (
errmsg,
'(a,i0,a)') &
613 &
'Calculated CELL2D area less than zero for cell ', j,
'.'
616 if (area ==
dzero)
then
617 narea_eq_zero = narea_eq_zero + 1
618 write (
errmsg,
'(a,i0,a)') &
619 'Calculated CELL2D area is zero for cell ', j,
'.'
626 if (narea_lt_zero > 0)
then
627 write (
errmsg,
'(i0,a)') narea_lt_zero, &
628 ' cell(s) have an area less than zero. Calculated cell &
629 &areas must be greater than zero. Negative areas often &
630 &mean vertices are not listed in clockwise order.'
633 if (narea_eq_zero > 0)
then
634 write (
errmsg,
'(i0,a)') narea_eq_zero, &
635 ' cell(s) have an area equal to zero. Calculated cell &
636 &areas must be greater than zero. Calculated cell &
637 &areas equal to zero indicate that the cell is not defined &
638 &by a valid polygon.'
646 if (this%nodes < this%nodesuser) nrsize = this%nodes
648 call this%con%disvconnections(this%name_model, this%nodes, &
649 this%nodesuser, 1, nrsize, &
650 this%nvert, this%vertices, this%iavert, &
651 this%javert, this%cellxy, &
652 this%bot, this%bot, &
653 this%nodereduced, this%nodeuser)
654 this%nja = this%con%nja
655 this%njas = this%con%njas
667 integer(I4B),
dimension(:),
intent(in) :: icelltype
669 integer(I4B) :: iunit, i, ntxt, version
670 integer(I4B),
parameter :: lentxt = 100
671 character(len=50) :: txthdr
672 character(len=lentxt) :: txt
673 character(len=LINELENGTH) :: fname
674 character(len=LENBIGLINE) :: crs
675 logical(LGP) :: found_crs
677 character(len=*),
parameter :: fmtgrdsave = &
678 "(4X,'BINARY GRID INFORMATION WILL BE WRITTEN TO:', &
679 &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
685 call mem_set_value(crs,
'CRS', this%input_mempath, found_crs)
694 fname = trim(this%output_fname)
696 write (this%iout, fmtgrdsave) iunit, trim(adjustl(fname))
697 call openfile(iunit, this%iout, trim(adjustl(fname)),
'DATA(BINARY)', &
701 write (txthdr,
'(a)')
'GRID DISV2D'
702 txthdr(50:50) = new_line(
'a')
704 write (txthdr,
'(a)')
'VERSION 1'
705 txthdr(50:50) = new_line(
'a')
707 write (txthdr,
'(a, i0)')
'NTXT ', ntxt
708 txthdr(50:50) = new_line(
'a')
710 write (txthdr,
'(a, i0)')
'LENTXT ', lentxt
711 txthdr(50:50) = new_line(
'a')
715 write (txt,
'(3a, i0)')
'NCELLS ',
'INTEGER ',
'NDIM 0 # ', this%nodesuser
716 txt(lentxt:lentxt) = new_line(
'a')
718 write (txt,
'(3a, i0)')
'NODES ',
'INTEGER ',
'NDIM 0 # ', this%nodes
719 txt(lentxt:lentxt) = new_line(
'a')
721 write (txt,
'(3a, i0)')
'NVERT ',
'INTEGER ',
'NDIM 0 # ', this%nvert
722 txt(lentxt:lentxt) = new_line(
'a')
724 write (txt,
'(3a, i0)')
'NJAVERT ',
'INTEGER ',
'NDIM 0 # ',
size(this%javert)
725 txt(lentxt:lentxt) = new_line(
'a')
727 write (txt,
'(3a, i0)')
'NJA ',
'INTEGER ',
'NDIM 0 # ', this%con%nja
728 txt(lentxt:lentxt) = new_line(
'a')
730 write (txt,
'(3a, 1pg25.15e3)') &
731 'XORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%xorigin
732 txt(lentxt:lentxt) = new_line(
'a')
734 write (txt,
'(3a, 1pg25.15e3)') &
735 'YORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%yorigin
736 txt(lentxt:lentxt) = new_line(
'a')
738 write (txt,
'(3a, 1pg25.15e3)')
'ANGROT ',
'DOUBLE ',
'NDIM 0 # ', this%angrot
739 txt(lentxt:lentxt) = new_line(
'a')
741 write (txt,
'(3a, i0)')
'BOTM ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
742 txt(lentxt:lentxt) = new_line(
'a')
744 write (txt,
'(3a, i0)')
'VERTICES ',
'DOUBLE ',
'NDIM 2 2 ', this%nvert
745 txt(lentxt:lentxt) = new_line(
'a')
747 write (txt,
'(3a, i0)')
'CELLX ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
748 txt(lentxt:lentxt) = new_line(
'a')
750 write (txt,
'(3a, i0)')
'CELLY ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
751 txt(lentxt:lentxt) = new_line(
'a')
753 write (txt,
'(3a, i0)')
'IAVERT ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
754 txt(lentxt:lentxt) = new_line(
'a')
756 write (txt,
'(3a, i0)')
'JAVERT ',
'INTEGER ',
'NDIM 1 ',
size(this%javert)
757 txt(lentxt:lentxt) = new_line(
'a')
759 write (txt,
'(3a, i0)')
'IA ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
760 txt(lentxt:lentxt) = new_line(
'a')
762 write (txt,
'(3a, i0)')
'JA ',
'INTEGER ',
'NDIM 1 ',
size(this%con%jausr)
763 txt(lentxt:lentxt) = new_line(
'a')
765 write (txt,
'(3a, i0)')
'IDOMAIN ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
766 txt(lentxt:lentxt) = new_line(
'a')
768 write (txt,
'(3a, i0)')
'ICELLTYPE ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
769 txt(lentxt:lentxt) = new_line(
'a')
773 if (version == 2)
then
775 write (txt,
'(3a, i0)')
'CRS ',
'CHARACTER ',
'NDIM 1 ', &
777 txt(lentxt:lentxt) = new_line(
'a')
783 write (iunit) this%nodesuser
784 write (iunit) this%nodes
785 write (iunit) this%nvert
786 write (iunit)
size(this%javert)
787 write (iunit) this%nja
788 write (iunit) this%xorigin
789 write (iunit) this%yorigin
790 write (iunit) this%angrot
791 write (iunit) this%bottom
792 write (iunit) this%vertices
793 write (iunit) (this%cellxy(1, i), i=1, this%nodesuser)
794 write (iunit) (this%cellxy(2, i), i=1, this%nodesuser)
795 write (iunit) this%iavert
796 write (iunit) this%javert
797 write (iunit) this%con%iausr
798 write (iunit) this%con%jausr
799 write (iunit) this%idomain
800 write (iunit) icelltype
803 if (version == 2)
then
804 if (found_crs)
write (iunit) trim(crs)
817 integer(I4B),
intent(in) :: nodeu
818 character(len=*),
intent(inout) :: str
820 integer(I4B) :: i, j, k
821 character(len=10) :: jstr
823 call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
824 write (jstr,
'(i10)') j
825 str =
'('//trim(adjustl(jstr))//
')'
834 integer(I4B),
intent(in) :: nodeu
835 integer(I4B),
dimension(:),
intent(inout) :: arr
837 integer(I4B) :: isize
838 integer(I4B) :: i, j, k
842 if (isize /= this%ndim)
then
843 write (
errmsg,
'(a,i0,a,i0,a)') &
844 'Program error: nodeu_to_array size of array (', isize, &
845 ') is not equal to the discretization dimension (', this%ndim,
').'
850 call get_ijk(nodeu, 1, this%nodes, 1, i, j, k)
861 integer(I4B) :: nodenumber
864 integer(I4B),
intent(in) :: nodeu
865 integer(I4B),
intent(in) :: icheck
869 if (icheck /= 0)
then
872 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
874 write (
errmsg,
'(a,i0,a,i0,a)') &
875 'Node number (', nodeu,
') is less than 1 or greater than nodes (', &
880 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
884 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
897 integer(I4B),
intent(in) :: noden
898 integer(I4B),
intent(in) :: nodem
899 integer(I4B),
intent(in) :: ihc
900 real(DP),
intent(inout) :: xcomp
901 real(DP),
intent(inout) :: ycomp
902 real(DP),
intent(inout) :: zcomp
903 integer(I4B),
intent(in) :: ipos
905 real(DP) :: angle, dmult
911 if (nodem < noden)
then
924 angle = this%con%anglex(this%con%jas(ipos))
926 if (nodem < noden) dmult = -
done
927 xcomp = cos(angle) * dmult
928 ycomp = sin(angle) * dmult
940 xcomp, ycomp, zcomp, conlen)
943 integer(I4B),
intent(in) :: noden
944 integer(I4B),
intent(in) :: nodem
945 logical,
intent(in) :: nozee
946 real(DP),
intent(in) :: satn
947 real(DP),
intent(in) :: satm
948 integer(I4B),
intent(in) :: ihc
949 real(DP),
intent(inout) :: xcomp
950 real(DP),
intent(inout) :: ycomp
951 real(DP),
intent(inout) :: zcomp
952 real(DP),
intent(inout) :: conlen
954 integer(I4B) :: nodeun, nodeum
955 real(DP) :: xn, xm, yn, ym, zn, zm
966 nodeun = this%get_nodeuser(noden)
967 nodeum = this%get_nodeuser(nodem)
968 xn = this%cellxy(1, nodeun)
969 yn = this%cellxy(2, nodeun)
970 xm = this%cellxy(1, nodeum)
971 ym = this%cellxy(2, nodeum)
982 character(len=*),
intent(out) :: dis_type
992 integer(I4B) :: dis_enum
1001 character(len=*),
intent(in) :: name_model
1002 character(len=*),
intent(in) :: input_mempath
1005 call this%DisBaseType%allocate_scalars(name_model, input_mempath)
1008 call mem_allocate(this%nvert,
'NVERT', this%memoryPath)
1023 call this%DisBaseType%allocate_arrays()
1026 if (this%nodes < this%nodesuser)
then
1027 call mem_allocate(this%nodeuser, this%nodes,
'NODEUSER', this%memoryPath)
1028 call mem_allocate(this%nodereduced, this%nodesuser,
'NODEREDUCED', &
1031 call mem_allocate(this%nodeuser, 1,
'NODEUSER', this%memoryPath)
1032 call mem_allocate(this%nodereduced, 1,
'NODEREDUCED', this%memoryPath)
1036 this%mshape(1) = this%nodesuser
1050 integer(I4B),
intent(in) :: icell2d
1054 integer(I4B) :: ivert
1055 integer(I4B) :: nvert
1056 integer(I4B) :: icount
1064 nvert = this%iavert(icell2d + 1) - this%iavert(icell2d)
1066 iv1 = this%javert(this%iavert(icell2d))
1067 x1 = this%vertices(1, iv1)
1068 y1 = this%vertices(2, iv1)
1069 do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1070 x = this%vertices(1, this%javert(ivert))
1071 if (icount < nvert)
then
1072 y = this%vertices(2, this%javert(ivert + 1))
1074 y = this%vertices(2, this%javert(this%iavert(icell2d)))
1076 area = area + (x - x1) * (y - y1)
1081 do ivert = this%iavert(icell2d), this%iavert(icell2d + 1) - 1
1082 y = this%vertices(2, this%javert(ivert))
1083 if (icount < nvert)
then
1084 x = this%vertices(1, this%javert(ivert + 1))
1086 x = this%vertices(1, this%javert(this%iavert(icell2d)))
1088 area = area - (x - x1) * (y - y1)
1103 flag_string, allow_zero)
result(nodeu)
1106 integer(I4B),
intent(inout) :: lloc
1107 integer(I4B),
intent(inout) :: istart
1108 integer(I4B),
intent(inout) :: istop
1109 integer(I4B),
intent(in) :: in
1110 integer(I4B),
intent(in) :: iout
1111 character(len=*),
intent(inout) :: line
1112 logical,
optional,
intent(in) :: flag_string
1113 logical,
optional,
intent(in) :: allow_zero
1114 integer(I4B) :: nodeu
1116 integer(I4B) :: j, nodes
1117 integer(I4B) :: lloclocal, ndum, istat, n
1120 if (
present(flag_string))
then
1121 if (flag_string)
then
1124 call urword(line, lloclocal, istart, istop, 1, ndum, r, iout, in)
1125 read (line(istart:istop), *, iostat=istat) n
1126 if (istat /= 0)
then
1134 nodes = this%mshape(1)
1136 call urword(line, lloc, istart, istop, 2, j, r, iout, in)
1139 if (
present(allow_zero))
then
1140 if (allow_zero)
then
1149 if (j < 1 .or. j > nodes)
then
1150 write (
errmsg,
'(a,1x,a,i0,a)') &
1151 trim(adjustl(
errmsg)),
'Cell number in list (', j, &
1152 ') is outside of the grid.'
1155 nodeu =
get_node(1, 1, j, 1, 1, nodes)
1157 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1158 write (
errmsg,
'(a,1x,a,i0,a)') &
1160 "Node number in list (", nodeu,
") is outside of the grid. "// &
1161 "Cell number cannot be determined in line '"// &
1162 trim(adjustl(line))//
"'."
1165 if (len_trim(adjustl(
errmsg)) > 0)
then
1181 allow_zero)
result(nodeu)
1183 integer(I4B) :: nodeu
1186 character(len=*),
intent(inout) :: cellid
1187 integer(I4B),
intent(in) :: inunit
1188 integer(I4B),
intent(in) :: iout
1189 logical,
optional,
intent(in) :: flag_string
1190 logical,
optional,
intent(in) :: allow_zero
1192 integer(I4B) :: j, nodes
1193 integer(I4B) :: lloclocal, ndum, istat, n
1194 integer(I4B) :: istart, istop
1197 if (
present(flag_string))
then
1198 if (flag_string)
then
1201 call urword(cellid, lloclocal, istart, istop, 1, ndum, r, iout, inunit)
1202 read (cellid(istart:istop), *, iostat=istat) n
1203 if (istat /= 0)
then
1211 nodes = this%mshape(1)
1214 call urword(cellid, lloclocal, istart, istop, 2, j, r, iout, inunit)
1217 if (
present(allow_zero))
then
1218 if (allow_zero)
then
1227 if (j < 1 .or. j > nodes)
then
1228 write (
errmsg,
'(a,1x,a,i0,a)') &
1229 trim(adjustl(
errmsg)),
'Cell2d number in list (', j, &
1230 ') is outside of the grid.'
1233 nodeu =
get_node(1, 1, j, 1, 1, nodes)
1235 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1236 write (
errmsg,
'(a,1x,a,i0,a)') &
1238 "Cell number cannot be determined for cellid ("// &
1239 trim(adjustl(cellid))//
") and results in a user "// &
1240 "node number (", nodeu,
") that is outside of the grid."
1243 if (len_trim(adjustl(
errmsg)) > 0)
then
1256 integer(I4B),
intent(in) :: ic
1257 real(DP),
allocatable,
intent(out) :: polyverts(:, :)
1258 logical(LGP),
intent(in),
optional :: closed
1260 integer(I4B) :: icu, icu2d, iavert, nverts, m, j
1261 logical(LGP) :: lclosed
1264 icu = this%get_nodeuser(ic)
1265 icu2d = icu - ((icu - 1) / this%nodes) * this%nodes
1266 nverts = this%iavert(icu2d + 1) - this%iavert(icu2d) - 1
1267 if (nverts .le. 0) nverts = nverts +
size(this%javert)
1270 if (.not. (
present(closed)))
then
1278 allocate (polyverts(2, nverts + 1))
1280 allocate (polyverts(2, nverts))
1284 iavert = this%iavert(icu2d)
1286 j = this%javert(iavert - 1 + m)
1287 polyverts(:, m) = (/this%vertices(1, j), this%vertices(2, j)/)
1292 polyverts(:, nverts + 1) = polyverts(:, 1)
1302 cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
1305 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1306 integer(I4B),
intent(in) :: iout
1307 integer(I4B),
intent(in) :: iprint
1308 integer(I4B),
intent(in) :: idataun
1309 character(len=*),
intent(in) :: aname
1310 character(len=*),
intent(in) :: cdatafmp
1311 integer(I4B),
intent(in) :: nvaluesp
1312 integer(I4B),
intent(in) :: nwidthp
1313 character(len=*),
intent(in) :: editdesc
1314 real(DP),
intent(in) :: dinact
1316 integer(I4B) :: k, ifirst
1317 integer(I4B) :: nlay
1318 integer(I4B) :: nrow
1319 integer(I4B) :: ncol
1320 integer(I4B) :: nval
1321 integer(I4B) :: nodeu, noder
1322 integer(I4B) :: istart, istop
1323 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1325 character(len=*),
parameter :: fmthsv = &
1326 "(1X,/1X,a,' WILL BE SAVED ON UNIT ',I4, &
1327 &' AT END OF TIME STEP',I5,', STRESS PERIOD ',I4)"
1332 ncol = this%mshape(1)
1336 if (this%nodes < this%nodesuser)
then
1339 do nodeu = 1, this%nodesuser
1340 noder = this%get_nodenumber(nodeu, 0)
1341 if (noder <= 0)
then
1342 dtemp(nodeu) = dinact
1345 dtemp(nodeu) = darray(noder)
1353 if (iprint /= 0)
then
1356 istop = istart + nrow * ncol - 1
1358 aname, cdatafmp, nvaluesp, nwidthp, editdesc)
1364 if (idataun > 0)
then
1369 istop = istart + nrow * ncol - 1
1370 if (ifirst == 1)
write (iout, fmthsv) &
1371 trim(adjustl(aname)), idataun, &
1378 elseif (idataun < 0)
then
1381 call ubdsv1(
kstp,
kper, aname, -idataun, dtemp, ncol, nrow, nlay, &
1390 dstmodel, dstpackage, naux, auxtxt, &
1391 ibdchn, nlist, iout)
1394 character(len=16),
intent(in) :: text
1395 character(len=16),
intent(in) :: textmodel
1396 character(len=16),
intent(in) :: textpackage
1397 character(len=16),
intent(in) :: dstmodel
1398 character(len=16),
intent(in) :: dstpackage
1399 integer(I4B),
intent(in) :: naux
1400 character(len=16),
dimension(:),
intent(in) :: auxtxt
1401 integer(I4B),
intent(in) :: ibdchn
1402 integer(I4B),
intent(in) :: nlist
1403 integer(I4B),
intent(in) :: iout
1405 integer(I4B) :: nlay, nrow, ncol
1409 ncol = this%mshape(1)
1412 call ubdsv06(
kstp,
kper, text, textmodel, textpackage, dstmodel, dstpackage, &
1413 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.
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.
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.