24 integer(I4B),
pointer :: nlay => null()
25 integer(I4B),
pointer :: nrow => null()
26 integer(I4B),
pointer :: ncol => null()
27 real(dp),
dimension(:),
pointer,
contiguous :: delr => null()
28 real(dp),
dimension(:),
pointer,
contiguous :: delc => null()
29 real(dp),
dimension(:, :),
pointer,
contiguous :: top2d => null()
30 real(dp),
dimension(:, :, :),
pointer,
contiguous :: bot3d => null()
31 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: idomain => null()
32 real(dp),
dimension(:, :, :),
pointer :: botm => null()
33 real(dp),
dimension(:),
pointer,
contiguous :: cellx => null()
34 real(dp),
dimension(:),
pointer,
contiguous :: celly => null()
79 logical :: length_units = .false.
80 logical :: nogrb = .false.
81 logical :: xorigin = .false.
82 logical :: yorigin = .false.
83 logical :: angrot = .false.
84 logical :: nlay = .false.
85 logical :: nrow = .false.
86 logical :: ncol = .false.
87 logical :: delr = .false.
88 logical :: delc = .false.
89 logical :: top = .false.
90 logical :: botm = .false.
91 logical :: idomain = .false.
98 subroutine dis_cr(dis, name_model, input_mempath, inunit, iout)
101 character(len=*),
intent(in) :: name_model
102 character(len=*),
intent(in) :: input_mempath
103 integer(I4B),
intent(in) :: inunit
104 integer(I4B),
intent(in) :: iout
106 type(
distype),
pointer :: disnew
108 character(len=*),
parameter :: fmtheader = &
109 "(1X, /1X, 'DIS -- STRUCTURED GRID DISCRETIZATION PACKAGE,', &
110 &' VERSION 2 : 3/27/2014 - INPUT READ FROM MEMPATH: ', A, /)"
114 call disnew%allocate_scalars(name_model, input_mempath)
123 write (iout, fmtheader) dis%input_mempath
136 if (this%inunit /= 0)
then
139 call this%source_options()
142 call this%source_dimensions()
145 call this%source_griddata()
149 call this%grid_finalize()
163 call this%DisBaseType%dis_da()
189 character(len=LENVARNAME),
dimension(3) :: lenunits = &
190 &[character(len=LENVARNAME) ::
'FEET',
'METERS',
'CENTIMETERS']
194 call mem_set_value(this%lenuni,
'LENGTH_UNITS', this%input_mempath, &
195 lenunits, found%length_units)
196 call mem_set_value(this%nogrb,
'NOGRB', this%input_mempath, found%nogrb)
197 call mem_set_value(this%xorigin,
'XORIGIN', this%input_mempath, found%xorigin)
198 call mem_set_value(this%yorigin,
'YORIGIN', this%input_mempath, found%yorigin)
199 call mem_set_value(this%angrot,
'ANGROT', this%input_mempath, found%angrot)
202 if (this%iout > 0)
then
203 call this%log_options(found)
215 write (this%iout,
'(1x,a)')
'Setting Discretization Options'
217 if (found%length_units)
then
218 write (this%iout,
'(4x,a,i0)')
'Model length unit [0=UND, 1=FEET, &
219 &2=METERS, 3=CENTIMETERS] set as ', this%lenuni
222 if (found%nogrb)
then
223 write (this%iout,
'(4x,a,i0)')
'Binary grid file [0=GRB, 1=NOGRB] &
224 &set as ', this%nogrb
227 if (found%xorigin)
then
228 write (this%iout,
'(4x,a,G0)')
'XORIGIN = ', this%xorigin
231 if (found%yorigin)
then
232 write (this%iout,
'(4x,a,G0)')
'YORIGIN = ', this%yorigin
235 if (found%angrot)
then
236 write (this%iout,
'(4x,a,G0)')
'ANGROT = ', this%angrot
239 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Options'
249 integer(I4B) :: i, j, k
253 call mem_set_value(this%nlay,
'NLAY', this%input_mempath, found%nlay)
254 call mem_set_value(this%nrow,
'NROW', this%input_mempath, found%nrow)
255 call mem_set_value(this%ncol,
'NCOL', this%input_mempath, found%ncol)
258 if (this%iout > 0)
then
259 call this%log_dimensions(found)
263 if (this%nlay < 1)
then
265 'NLAY was not specified or was specified incorrectly.')
268 if (this%nrow < 1)
then
270 'NROW was not specified or was specified incorrectly.')
273 if (this%ncol < 1)
then
275 'NCOL was not specified or was specified incorrectly.')
280 this%nodesuser = this%nlay * this%nrow * this%ncol
283 call mem_allocate(this%delr, this%ncol,
'DELR', this%memoryPath)
284 call mem_allocate(this%delc, this%nrow,
'DELC', this%memoryPath)
285 call mem_allocate(this%idomain, this%ncol, this%nrow, this%nlay,
'IDOMAIN', &
287 call mem_allocate(this%top2d, this%ncol, this%nrow,
'TOP2D', this%memoryPath)
288 call mem_allocate(this%bot3d, this%ncol, this%nrow, this%nlay,
'BOT3D', &
290 call mem_allocate(this%cellx, this%ncol,
'CELLX', this%memoryPath)
291 call mem_allocate(this%celly, this%nrow,
'CELLY', this%memoryPath)
297 this%idomain(j, i, k) = 1
311 write (this%iout,
'(1x,a)')
'Setting Discretization Dimensions'
314 write (this%iout,
'(4x,a,i0)')
'NLAY = ', this%nlay
318 write (this%iout,
'(4x,a,i0)')
'NROW = ', this%nrow
322 write (this%iout,
'(4x,a,i0)')
'NCOL = ', this%ncol
325 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Dimensions'
337 call mem_set_value(this%delr,
'DELR', this%input_mempath, found%delr)
338 call mem_set_value(this%delc,
'DELC', this%input_mempath, found%delc)
339 call mem_set_value(this%top2d,
'TOP', this%input_mempath, found%top)
340 call mem_set_value(this%bot3d,
'BOTM', this%input_mempath, found%botm)
341 call mem_set_value(this%idomain,
'IDOMAIN', this%input_mempath, found%idomain)
344 if (this%iout > 0)
then
345 call this%log_griddata(found)
357 write (this%iout,
'(1x,a)')
'Setting Discretization Griddata'
360 write (this%iout,
'(4x,a)')
'DELR set from input file'
364 write (this%iout,
'(4x,a)')
'DELC set from input file'
368 write (this%iout,
'(4x,a)')
'TOP set from input file'
372 write (this%iout,
'(4x,a)')
'BOTM 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'
391 integer(I4B) :: n, i, j, k
393 integer(I4B) :: noder
394 integer(I4B) :: nrsize
398 character(len=*),
parameter :: fmtdz = &
399 "('CELL (',i0,',',i0,',',i0,') THICKNESS <= 0. ', &
400 &'TOP, BOT: ',2(1pg24.15))"
401 character(len=*),
parameter :: fmtnr = &
402 "(/1x, 'The specified IDOMAIN results in a reduced number of cells.',&
403 &/1x, 'Number of user nodes: ',I0,&
404 &/1X, 'Number of nodes in solution: ', I0, //)"
411 if (this%idomain(j, i, k) > 0) this%nodes = this%nodes + 1
417 if (this%nodes == 0)
then
418 call store_error(
'Model does not have any active nodes. &
419 &Ensure IDOMAIN array has some values greater &
429 if (this%idomain(j, i, k) < 1) cycle
431 top = this%bot3d(j, i, k - 1)
433 top = this%top2d(j, i)
435 dz = top - this%bot3d(j, i, k)
436 if (dz <=
dzero)
then
438 write (
errmsg, fmt=fmtdz) k, i, j, top, this%bot3d(j, i, k)
449 if (this%nodes < this%nodesuser)
then
450 write (this%iout, fmtnr) this%nodesuser, this%nodes
454 call this%allocate_arrays()
460 if (this%nodes < this%nodesuser)
then
466 if (this%idomain(j, i, k) > 0)
then
467 this%nodereduced(node) = noder
469 elseif (this%idomain(j, i, k) < 0)
then
470 this%nodereduced(node) = -1
472 this%nodereduced(node) = 0
481 if (this%nodes < this%nodesuser)
then
487 if (this%idomain(j, i, k) > 0)
then
488 this%nodeuser(noder) = node
498 this%cellx(1) =
dhalf * this%delr(1)
499 this%celly(this%nrow) =
dhalf * this%delc(this%nrow)
501 this%cellx(j) = this%cellx(j - 1) +
dhalf * this%delr(j - 1) + &
505 do i = this%nrow - 1, 1, -1
506 this%celly(i) = this%celly(i + 1) +
dhalf * this%delc(i + 1) + &
517 if (this%nodes < this%nodesuser) noder = this%nodereduced(node)
518 if (noder <= 0) cycle
520 top = this%bot3d(j, i, k - 1)
522 top = this%top2d(j, i)
524 this%top(noder) = top
525 this%bot(noder) = this%bot3d(j, i, k)
526 this%area(noder) = this%delr(j) * this%delc(i)
527 this%xc(noder) = this%cellx(j)
528 this%yc(noder) = this%celly(i)
535 if (this%nodes < this%nodesuser) nrsize = this%nodes
537 call this%con%disconnections(this%name_model, this%nodes, &
538 this%ncol, this%nrow, this%nlay, &
539 nrsize, this%delr, this%delc, &
540 this%top, this%bot, this%nodereduced, &
542 this%nja = this%con%nja
543 this%njas = this%con%njas
555 integer(I4B),
dimension(:),
intent(in) :: icelltype
557 integer(I4B) :: iunit, ntxt, ncpl, version
558 integer(I4B),
parameter :: lentxt = 100
559 character(len=50) :: txthdr
560 character(len=lentxt) :: txt
561 character(len=LINELENGTH) :: fname
562 character(len=LENBIGLINE) :: crs
563 logical(LGP) :: found_crs
564 character(len=*),
parameter :: fmtgrdsave = &
565 "(4X,'BINARY GRID INFORMATION WILL BE WRITTEN TO:', &
566 &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
571 ncpl = this%nrow * this%ncol
573 call mem_set_value(crs,
'CRS', this%input_mempath, found_crs)
582 fname = trim(this%output_fname)
584 write (this%iout, fmtgrdsave) iunit, trim(adjustl(fname))
585 call openfile(iunit, this%iout, trim(adjustl(fname)),
'DATA(BINARY)', &
589 write (txthdr,
'(a)')
'GRID DIS'
590 txthdr(50:50) = new_line(
'a')
592 write (txthdr,
'(a, i0)')
'VERSION ', version
593 txthdr(50:50) = new_line(
'a')
595 write (txthdr,
'(a, i0)')
'NTXT ', ntxt
596 txthdr(50:50) = new_line(
'a')
598 write (txthdr,
'(a, i0)')
'LENTXT ', lentxt
599 txthdr(50:50) = new_line(
'a')
603 write (txt,
'(3a, i0)')
'NCELLS ',
'INTEGER ',
'NDIM 0 # ', this%nodesuser
604 txt(lentxt:lentxt) = new_line(
'a')
606 write (txt,
'(3a, i0)')
'NLAY ',
'INTEGER ',
'NDIM 0 # ', this%nlay
607 txt(lentxt:lentxt) = new_line(
'a')
609 write (txt,
'(3a, i0)')
'NROW ',
'INTEGER ',
'NDIM 0 # ', this%nrow
610 txt(lentxt:lentxt) = new_line(
'a')
612 write (txt,
'(3a, i0)')
'NCOL ',
'INTEGER ',
'NDIM 0 # ', this%ncol
613 txt(lentxt:lentxt) = new_line(
'a')
615 write (txt,
'(3a, i0)')
'NJA ',
'INTEGER ',
'NDIM 0 # ', this%nja
616 txt(lentxt:lentxt) = new_line(
'a')
618 write (txt,
'(3a, 1pg24.15)')
'XORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%xorigin
619 txt(lentxt:lentxt) = new_line(
'a')
621 write (txt,
'(3a, 1pg24.15)')
'YORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%yorigin
622 txt(lentxt:lentxt) = new_line(
'a')
624 write (txt,
'(3a, 1pg24.15)')
'ANGROT ',
'DOUBLE ',
'NDIM 0 # ', this%angrot
625 txt(lentxt:lentxt) = new_line(
'a')
627 write (txt,
'(3a, i0)')
'DELR ',
'DOUBLE ',
'NDIM 1 ', this%ncol
628 txt(lentxt:lentxt) = new_line(
'a')
630 write (txt,
'(3a, i0)')
'DELC ',
'DOUBLE ',
'NDIM 1 ', this%nrow
631 txt(lentxt:lentxt) = new_line(
'a')
633 write (txt,
'(3a, i0)')
'TOP ',
'DOUBLE ',
'NDIM 1 ', ncpl
634 txt(lentxt:lentxt) = new_line(
'a')
636 write (txt,
'(3a, i0)')
'BOTM ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
637 txt(lentxt:lentxt) = new_line(
'a')
639 write (txt,
'(3a, i0)')
'IA ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
640 txt(lentxt:lentxt) = new_line(
'a')
642 write (txt,
'(3a, i0)')
'JA ',
'INTEGER ',
'NDIM 1 ',
size(this%con%jausr)
643 txt(lentxt:lentxt) = new_line(
'a')
645 write (txt,
'(3a, i0)')
'IDOMAIN ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
646 txt(lentxt:lentxt) = new_line(
'a')
648 write (txt,
'(3a, i0)')
'ICELLTYPE ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
649 txt(lentxt:lentxt) = new_line(
'a')
653 if (version == 2)
then
655 write (txt,
'(3a, i0)')
'CRS ',
'CHARACTER ',
'NDIM 1 ', &
657 txt(lentxt:lentxt) = new_line(
'a')
663 write (iunit) this%nodesuser
664 write (iunit) this%nlay
665 write (iunit) this%nrow
666 write (iunit) this%ncol
667 write (iunit) this%nja
668 write (iunit) this%xorigin
669 write (iunit) this%yorigin
670 write (iunit) this%angrot
671 write (iunit) this%delr
672 write (iunit) this%delc
673 write (iunit) this%top2d
674 write (iunit) this%bot3d
675 write (iunit) this%con%iausr
676 write (iunit) this%con%jausr
677 write (iunit) this%idomain
678 write (iunit) icelltype
681 if (version == 2)
then
682 if (found_crs)
write (iunit) trim(crs)
695 integer(I4B),
intent(in) :: nodeu
696 character(len=*),
intent(inout) :: str
698 integer(I4B) :: i, j, k
699 character(len=10) :: kstr, istr, jstr
701 call get_ijk(nodeu, this%nrow, this%ncol, this%nlay, i, j, k)
702 write (kstr,
'(i10)') k
703 write (istr,
'(i10)') i
704 write (jstr,
'(i10)') j
705 str =
'('//trim(adjustl(kstr))//
','// &
706 trim(adjustl(istr))//
','// &
707 trim(adjustl(jstr))//
')'
716 integer(I4B),
intent(in) :: nodeu
717 integer(I4B),
dimension(:),
intent(inout) :: arr
719 integer(I4B) :: isize
720 integer(I4B) :: i, j, k
724 if (isize /= this%ndim)
then
725 write (
errmsg,
'(a,i0,a,i0,a)') &
726 'Program error: nodeu_to_array size of array (', isize, &
727 ') is not equal to the discretization dimension (', this%ndim,
')'
732 call get_ijk(nodeu, this%nrow, this%ncol, this%nlay, i, j, k)
745 integer(I4B) :: nodenumber
747 class(
distype),
intent(in) :: this
748 integer(I4B),
intent(in) :: nodeu
749 integer(I4B),
intent(in) :: icheck
752 if (icheck /= 0)
then
755 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
756 write (
errmsg,
'(a,i0,a)') &
757 'Node number (', nodeu, &
758 ') less than 1 or greater than the number of nodes.'
763 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
767 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
776 integer(I4B) :: nodenumber
778 class(
distype),
intent(in) :: this
779 integer(I4B),
intent(in) :: k, i, j
780 integer(I4B),
intent(in) :: icheck
782 integer(I4B) :: nodeu
784 character(len=*),
parameter :: fmterr = &
785 "('Error in structured-grid cell indices: layer = ',i0,', &
786 &row = ',i0,', column = ',i0)"
788 nodeu =
get_node(k, i, j, this%nlay, this%nrow, this%ncol)
790 write (
errmsg, fmterr) k, i, j
794 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
797 if (icheck /= 0)
then
799 if (k < 1 .or. k > this%nlay) &
800 call store_error(
'Layer less than one or greater than nlay')
801 if (i < 1 .or. i > this%nrow) &
802 call store_error(
'Row less than one or greater than nrow')
803 if (j < 1 .or. j > this%ncol) &
804 call store_error(
'Column less than one or greater than ncol')
807 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
808 write (
errmsg,
'(a,i0,a)') &
809 'Node number (', nodeu,
')less than 1 or greater than nodes.'
821 character(len=*),
intent(in) :: name_model
822 character(len=*),
intent(in) :: input_mempath
825 call this%DisBaseType%allocate_scalars(name_model, input_mempath)
847 call this%DisBaseType%allocate_arrays()
850 if (this%nodes < this%nodesuser)
then
851 call mem_allocate(this%nodeuser, this%nodes,
'NODEUSER', this%memoryPath)
852 call mem_allocate(this%nodereduced, this%nodesuser,
'NODEREDUCED', &
855 call mem_allocate(this%nodeuser, 1,
'NODEUSER', this%memoryPath)
856 call mem_allocate(this%nodereduced, 1,
'NODEREDUCED', this%memoryPath)
860 this%mshape(1) = this%nlay
861 this%mshape(2) = this%nrow
862 this%mshape(3) = this%ncol
873 flag_string, allow_zero)
result(nodeu)
876 integer(I4B),
intent(inout) :: lloc
877 integer(I4B),
intent(inout) :: istart
878 integer(I4B),
intent(inout) :: istop
879 integer(I4B),
intent(in) :: in
880 integer(I4B),
intent(in) :: iout
881 character(len=*),
intent(inout) :: line
882 logical,
optional,
intent(in) :: flag_string
883 logical,
optional,
intent(in) :: allow_zero
884 integer(I4B) :: nodeu
886 integer(I4B) :: k, i, j, nlay, nrow, ncol
887 integer(I4B) :: lloclocal, ndum, istat, n
890 if (
present(flag_string))
then
891 if (flag_string)
then
894 call urword(line, lloclocal, istart, istop, 1, ndum, r, iout, in)
895 read (line(istart:istop), *, iostat=istat) n
904 nlay = this%mshape(1)
905 nrow = this%mshape(2)
906 ncol = this%mshape(3)
908 call urword(line, lloc, istart, istop, 2, k, r, iout, in)
909 call urword(line, lloc, istart, istop, 2, i, r, iout, in)
910 call urword(line, lloc, istart, istop, 2, j, r, iout, in)
912 if (k == 0 .and. i == 0 .and. j == 0)
then
913 if (
present(allow_zero))
then
923 if (k < 1 .or. k > nlay)
then
924 write (
errmsg,
'(a,i0,a)') &
925 'Layer number in list (', k,
') is outside of the grid.'
927 if (i < 1 .or. i > nrow)
then
928 write (
errmsg,
'(a,1x,a,i0,a)') &
929 trim(adjustl(
errmsg)),
'Row number in list (', i, &
930 ') is outside of the grid.'
932 if (j < 1 .or. j > ncol)
then
933 write (
errmsg,
'(a,1x,a,i0,a)') &
934 trim(adjustl(
errmsg)),
'Column number in list (', j, &
935 ') is outside of the grid.'
938 nodeu =
get_node(k, i, j, nlay, nrow, ncol)
940 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
941 write (
errmsg,
'(a,1x,a,i0,a)') &
943 "Node number in list (", nodeu,
") is outside of the grid. "// &
944 "Cell number cannot be determined in line '"// &
945 trim(adjustl(line))//
"'."
948 if (len_trim(adjustl(
errmsg)) > 0)
then
964 allow_zero)
result(nodeu)
966 integer(I4B) :: nodeu
969 character(len=*),
intent(inout) :: cellid
970 integer(I4B),
intent(in) :: inunit
971 integer(I4B),
intent(in) :: iout
972 logical,
optional,
intent(in) :: flag_string
973 logical,
optional,
intent(in) :: allow_zero
975 integer(I4B) :: lloclocal, istart, istop, ndum, n
976 integer(I4B) :: k, i, j, nlay, nrow, ncol
977 integer(I4B) :: istat
980 if (
present(flag_string))
then
981 if (flag_string)
then
984 call urword(cellid, lloclocal, istart, istop, 1, ndum, r, iout, inunit)
985 read (cellid(istart:istop), *, iostat=istat) n
994 nlay = this%mshape(1)
995 nrow = this%mshape(2)
996 ncol = this%mshape(3)
999 call urword(cellid, lloclocal, istart, istop, 2, k, r, iout, inunit)
1000 call urword(cellid, lloclocal, istart, istop, 2, i, r, iout, inunit)
1001 call urword(cellid, lloclocal, istart, istop, 2, j, r, iout, inunit)
1003 if (k == 0 .and. i == 0 .and. j == 0)
then
1004 if (
present(allow_zero))
then
1005 if (allow_zero)
then
1014 if (k < 1 .or. k > nlay)
then
1015 write (
errmsg,
'(a,i0,a)') &
1016 'Layer number in list (', k,
') is outside of the grid.'
1018 if (i < 1 .or. i > nrow)
then
1019 write (
errmsg,
'(a,1x,a,i0,a)') &
1020 trim(adjustl(
errmsg)),
'Row number in list (', i, &
1021 ') is outside of the grid.'
1023 if (j < 1 .or. j > ncol)
then
1024 write (
errmsg,
'(a,1x,a,i0,a)') &
1025 trim(adjustl(
errmsg)),
'Column number in list (', j, &
1026 ') is outside of the grid.'
1029 nodeu =
get_node(k, i, j, nlay, nrow, ncol)
1031 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1032 write (
errmsg,
'(a,1x,a,i0,a)') &
1034 "Cell number cannot be determined for cellid ("// &
1035 trim(adjustl(cellid))//
") and results in a user "// &
1036 "node number (", nodeu,
") that is outside of the grid."
1039 if (len_trim(adjustl(
errmsg)) > 0)
then
1072 integer(I4B),
intent(in) :: noden
1073 integer(I4B),
intent(in) :: nodem
1074 integer(I4B),
intent(in) :: ihc
1075 real(DP),
intent(inout) :: xcomp
1076 real(DP),
intent(inout) :: ycomp
1077 real(DP),
intent(inout) :: zcomp
1078 integer(I4B),
intent(in) :: ipos
1080 integer(I4B) :: nodeu1, i1, j1, k1
1081 integer(I4B) :: nodeu2, i2, j2, k2
1087 if (nodem < noden)
then
1100 nodeu1 = this%get_nodeuser(noden)
1101 nodeu2 = this%get_nodeuser(nodem)
1102 call get_ijk(nodeu1, this%nrow, this%ncol, this%nlay, i1, j1, k1)
1103 call get_ijk(nodeu2, this%nrow, this%ncol, this%nlay, i2, j2, k2)
1106 elseif (j2 < j1)
then
1108 elseif (j2 > j1)
then
1124 xcomp, ycomp, zcomp, conlen)
1129 integer(I4B),
intent(in) :: noden
1130 integer(I4B),
intent(in) :: nodem
1131 logical,
intent(in) :: nozee
1132 real(DP),
intent(in) :: satn
1133 real(DP),
intent(in) :: satm
1134 integer(I4B),
intent(in) :: ihc
1135 real(DP),
intent(inout) :: xcomp
1136 real(DP),
intent(inout) :: ycomp
1137 real(DP),
intent(inout) :: zcomp
1138 real(DP),
intent(inout) :: conlen
1141 real(DP) :: x1, y1, x2, y2
1143 integer(I4B) :: i1, i2, j1, j2, k1, k2
1144 integer(I4B) :: nodeu1, nodeu2, ipos
1152 if (nodem < noden)
then
1157 z1 = this%bot(noden) +
dhalf * (this%top(noden) - this%bot(noden))
1158 z2 = this%bot(nodem) +
dhalf * (this%top(nodem) - this%bot(nodem))
1159 conlen = abs(z2 - z1)
1166 z1 = this%bot(noden) +
dhalf * satn * (this%top(noden) - this%bot(noden))
1167 z2 = this%bot(nodem) +
dhalf * satm * (this%top(nodem) - this%bot(nodem))
1169 ipos = this%con%getjaindex(noden, nodem)
1170 ds = this%con%cl1(this%con%jas(ipos)) + this%con%cl2(this%con%jas(ipos))
1171 nodeu1 = this%get_nodeuser(noden)
1172 nodeu2 = this%get_nodeuser(nodem)
1173 call get_ijk(nodeu1, this%nrow, this%ncol, this%nlay, i1, j1, k1)
1174 call get_ijk(nodeu2, this%nrow, this%ncol, this%nlay, i2, j2, k2)
1181 elseif (j2 < j1)
then
1183 elseif (j2 > j1)
then
1197 class(
distype),
intent(in) :: this
1198 character(len=*),
intent(out) :: dis_type
1207 class(
distype),
intent(in) :: this
1208 integer(I4B) :: dis_enum
1218 class(
distype),
intent(inout) :: this
1219 integer(I4B),
intent(in) :: ic
1220 real(DP),
allocatable,
intent(out) :: polyverts(:, :)
1221 logical(LGP),
intent(in),
optional :: closed
1223 integer(I4B) :: icu, nverts, irow, jcol, klay
1224 real(DP) :: cellx, celly, dxhalf, dyhalf
1225 logical(LGP) :: lclosed
1230 if (.not. (
present(closed)))
then
1238 allocate (polyverts(2, nverts + 1))
1240 allocate (polyverts(2, nverts))
1244 icu = this%get_nodeuser(ic)
1245 call get_ijk(icu, this%nrow, this%ncol, this%nlay, irow, jcol, klay)
1246 cellx = this%cellx(jcol)
1247 celly = this%celly(irow)
1248 dxhalf =
dhalf * this%delr(jcol)
1249 dyhalf =
dhalf * this%delc(irow)
1250 polyverts(:, 1) = (/cellx - dxhalf, celly - dyhalf/)
1251 polyverts(:, 2) = (/cellx - dxhalf, celly + dyhalf/)
1252 polyverts(:, 3) = (/cellx + dxhalf, celly + dyhalf/)
1253 polyverts(:, 4) = (/cellx + dxhalf, celly - dyhalf/)
1257 polyverts(:, nverts + 1) = polyverts(:, 1)
1263 class(
distype),
intent(inout) :: this
1264 integer(I4B),
intent(in) :: ic
1265 logical(LGP),
intent(in),
optional :: closed
1266 integer(I4B) :: npolyverts
1268 if (
present(closed))
then
1269 if (closed) npolyverts = 5
1275 class(
distype),
intent(inout) :: this
1276 logical(LGP),
intent(in),
optional :: closed
1277 integer(I4B) :: max_npolyverts
1279 if (
present(closed))
then
1280 if (closed) max_npolyverts = 5
1289 class(
distype),
intent(inout) :: this
1290 character(len=*),
intent(inout) :: line
1291 integer(I4B),
intent(inout) :: lloc
1292 integer(I4B),
intent(inout) :: istart
1293 integer(I4B),
intent(inout) :: istop
1294 integer(I4B),
intent(in) :: in
1295 integer(I4B),
intent(in) :: iout
1296 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(inout) :: iarray
1297 character(len=*),
intent(in) :: aname
1299 integer(I4B) :: ival
1301 integer(I4B) :: nlay
1302 integer(I4B) :: nrow
1303 integer(I4B) :: ncol
1304 integer(I4B) :: nval
1305 integer(I4B),
dimension(:),
pointer,
contiguous :: itemp
1311 nlay = this%mshape(1)
1312 nrow = this%mshape(2)
1313 ncol = this%mshape(3)
1315 if (this%nodes < this%nodesuser)
then
1316 nval = this%nodesuser
1324 call urword(line, lloc, istart, istop, 1, ival, rval, iout, in)
1325 if (line(istart:istop) .EQ.
'LAYERED')
then
1328 call readarray(in, itemp, aname, this%ndim, ncol, nrow, nlay, nval, &
1333 call readarray(in, itemp, aname, this%ndim, nval, iout, 0)
1337 if (this%nodes < this%nodesuser)
then
1338 call this%fill_grid_array(itemp, iarray)
1348 class(
distype),
intent(inout) :: this
1349 character(len=*),
intent(inout) :: line
1350 integer(I4B),
intent(inout) :: lloc
1351 integer(I4B),
intent(inout) :: istart
1352 integer(I4B),
intent(inout) :: istop
1353 integer(I4B),
intent(in) :: in
1354 integer(I4B),
intent(in) :: iout
1355 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1356 character(len=*),
intent(in) :: aname
1358 integer(I4B) :: ival
1360 integer(I4B) :: nlay
1361 integer(I4B) :: nrow
1362 integer(I4B) :: ncol
1363 integer(I4B) :: nval
1364 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1370 nlay = this%mshape(1)
1371 nrow = this%mshape(2)
1372 ncol = this%mshape(3)
1374 if (this%nodes < this%nodesuser)
then
1375 nval = this%nodesuser
1383 call urword(line, lloc, istart, istop, 1, ival, rval, iout, in)
1384 if (line(istart:istop) .EQ.
'LAYERED')
then
1387 call readarray(in, dtemp, aname, this%ndim, ncol, nrow, nlay, nval, &
1392 call readarray(in, dtemp, aname, this%ndim, nval, iout, 0)
1396 if (this%nodes < this%nodesuser)
then
1397 call this%fill_grid_array(dtemp, darray)
1408 icolbnd, aname, inunit, iout)
1411 integer(I4B),
intent(in) :: maxbnd
1412 integer(I4B),
dimension(maxbnd) :: nodelist
1413 integer(I4B),
intent(in) :: ncolbnd
1414 real(DP),
dimension(ncolbnd, maxbnd),
intent(inout) :: darray
1415 integer(I4B),
intent(in) :: icolbnd
1416 character(len=*),
intent(in) :: aname
1417 integer(I4B),
intent(in) :: inunit
1418 integer(I4B),
intent(in) :: iout
1420 integer(I4B) :: ir, ic, ncol, nrow, nlay, nval, ipos, nodeu
1423 nlay = this%mshape(1)
1424 nrow = this%mshape(2)
1425 ncol = this%mshape(3)
1429 call readarray(inunit, this%dbuff, aname, this%ndim, ncol, nrow, nlay, &
1439 nodeu =
get_node(1, ir, ic, nlay, nrow, ncol)
1440 darray(icolbnd, ipos) = this%dbuff(nodeu)
1454 cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
1456 class(
distype),
intent(inout) :: this
1457 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1458 integer(I4B),
intent(in) :: iout
1459 integer(I4B),
intent(in) :: iprint
1460 integer(I4B),
intent(in) :: idataun
1461 character(len=*),
intent(in) :: aname
1462 character(len=*),
intent(in) :: cdatafmp
1463 integer(I4B),
intent(in) :: nvaluesp
1464 integer(I4B),
intent(in) :: nwidthp
1465 character(len=*),
intent(in) :: editdesc
1466 real(DP),
intent(in) :: dinact
1468 integer(I4B) :: k, ifirst
1469 integer(I4B) :: nlay
1470 integer(I4B) :: nrow
1471 integer(I4B) :: ncol
1472 integer(I4B) :: nval
1473 integer(I4B) :: nodeu, noder
1474 integer(I4B) :: istart, istop
1475 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1477 character(len=*),
parameter :: fmthsv = &
1478 "(1X,/1X,a,' WILL BE SAVED ON UNIT ',I4, &
1479 &' AT END OF TIME STEP',I5,', STRESS PERIOD ',I4)"
1482 nlay = this%mshape(1)
1483 nrow = this%mshape(2)
1484 ncol = this%mshape(3)
1488 if (this%nodes < this%nodesuser)
then
1491 do nodeu = 1, this%nodesuser
1492 noder = this%get_nodenumber(nodeu, 0)
1493 if (noder <= 0)
then
1494 dtemp(nodeu) = dinact
1497 dtemp(nodeu) = darray(noder)
1505 if (iprint /= 0)
then
1508 istop = istart + nrow * ncol - 1
1510 aname, cdatafmp, nvaluesp, nwidthp, editdesc)
1516 if (idataun > 0)
then
1521 istop = istart + nrow * ncol - 1
1522 if (ifirst == 1)
write (iout, fmthsv) &
1523 trim(adjustl(aname)), idataun, &
1530 elseif (idataun < 0)
then
1533 call ubdsv1(
kstp,
kper, aname, -idataun, dtemp, ncol, nrow, nlay, &
1542 dstmodel, dstpackage, naux, auxtxt, &
1543 ibdchn, nlist, iout)
1546 character(len=16),
intent(in) :: text
1547 character(len=16),
intent(in) :: textmodel
1548 character(len=16),
intent(in) :: textpackage
1549 character(len=16),
intent(in) :: dstmodel
1550 character(len=16),
intent(in) :: dstpackage
1551 integer(I4B),
intent(in) :: naux
1552 character(len=16),
dimension(:),
intent(in) :: auxtxt
1553 integer(I4B),
intent(in) :: ibdchn
1554 integer(I4B),
intent(in) :: nlist
1555 integer(I4B),
intent(in) :: iout
1557 integer(I4B) :: nlay, nrow, ncol
1559 nlay = this%mshape(1)
1560 nrow = this%mshape(2)
1561 ncol = this%mshape(3)
1564 call ubdsv06(
kstp,
kper, text, textmodel, textpackage, dstmodel, dstpackage, &
1565 ibdchn, naux, auxtxt, ncol, nrow, nlay, &
1575 integer(I4B),
intent(in) :: maxbnd
1576 integer(I4B),
dimension(:),
pointer,
contiguous :: darray
1577 integer(I4B),
dimension(maxbnd),
intent(inout) :: nodelist
1578 integer(I4B),
intent(inout) :: nbound
1579 character(len=*),
intent(in) :: aname
1581 integer(I4B) :: il, ir, ic, ncol, nrow, nlay, nval, nodeu, noder, ipos, ierr
1584 nlay = this%mshape(1)
1585 nrow = this%mshape(2)
1586 ncol = this%mshape(3)
1588 if (this%ndim > 1)
then
1597 nodeu =
get_node(1, ir, ic, nlay, nrow, ncol)
1599 if (il < 1 .or. il > nlay)
then
1600 write (
errmsg,
'(a,1x,i0)')
'Invalid layer number:', il
1603 nodeu =
get_node(il, ir, ic, nlay, nrow, ncol)
1604 noder = this%get_nodenumber(nodeu, 0)
1605 if (ipos > maxbnd)
then
1608 nodelist(ipos) = noder
1617 write (
errmsg,
'(a,1x,i0)') &
1618 'MAXBOUND dimension is too small.'// &
1619 'INCREASE MAXBOUND TO:', ierr
1624 if (nbound < maxbnd)
then
1625 do ipos = nbound + 1, maxbnd
1634 do noder = 1, maxbnd
1635 if (noder < 1 .or. noder > this%nodes)
then
1636 write (
errmsg,
'(a,1x,i0)')
'Invalid node number:', noder
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
@ dis
DIS6 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 dis3d_df(this)
Define the discretization.
integer(i4b) function get_ncpl(this)
Return number of cells per layer (nrow * ncol)
subroutine nodeu_to_array(this, nodeu, arr)
Convert a user nodenumber to an array (nodenumber) or (k,i,j)
subroutine dis3d_da(this)
Deallocate variables.
integer(i4b) function get_dis_enum(this)
Get the discretization type enumeration.
subroutine nlarray_to_nodelist(this, darray, nodelist, maxbnd, nbound, aname)
Convert an integer array (layer numbers) to nodelist.
subroutine record_array(this, darray, iout, iprint, idataun, aname, cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
Record a double precision array.
subroutine log_options(this, found)
Write user options to list file.
integer(i4b) function get_npolyverts(this, ic, closed)
Get the number of cell polygon vertices.
integer(i4b) function nodeu_from_cellid(this, cellid, inunit, iout, flag_string, allow_zero)
Convert a cellid string to a user nodenumber.
subroutine allocate_scalars(this, name_model, input_mempath)
Allocate and initialize scalar variables.
subroutine write_grb(this, icelltype)
Write a binary grid file.
subroutine log_griddata(this, found)
Write dimensions to list file.
subroutine, public dis_cr(dis, name_model, input_mempath, inunit, iout)
Create a new structured discretization object.
integer(i4b) function get_nodenumber_idx3(this, k, i, j, icheck)
Get reduced node number from layer, row and column indices.
logical function supports_layers(this)
Indicates whether the grid discretization supports layers.
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.
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 get_dis_type(this, dis_type)
Get the discretization type.
subroutine nodeu_to_string(this, nodeu, str)
Convert a user nodenumber to a string (nodenumber) or (k,i,j)
subroutine read_layer_array(this, nodelist, darray, ncolbnd, maxbnd, icolbnd, aname, inunit, iout)
Read a 2d double array into col icolbnd of darray.
subroutine allocate_arrays(this)
Allocate and initialize arrays.
subroutine source_dimensions(this)
Copy dimensions from IDM into package.
subroutine connection_normal(this, noden, nodem, ihc, xcomp, ycomp, zcomp, ipos)
Get normal vector components between the cell and a given neighbor.
integer(i4b) function get_nodenumber_idx1(this, nodeu, icheck)
Get reduced node number from user node number.
subroutine grid_finalize(this)
Finalize grid (check properties, allocate arrays, compute connections)
subroutine source_options(this)
Copy options from IDM into package.
subroutine read_int_array(this, line, lloc, istart, istop, iout, in, iarray, aname)
Read an integer array.
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 get_polyverts(this, ic, polyverts, closed)
Get a 2D array of polygon vertices, listed in.
subroutine read_dbl_array(this, line, lloc, istart, istop, iout, in, darray, aname)
Read a double precision array.
subroutine record_srcdst_list_header(this, text, textmodel, textpackage, dstmodel, dstpackage, naux, auxtxt, ibdchn, nlist, iout)
Record list header for imeth=6.
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,...
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
Simplifies tracking parameters sourced from the input context.
Structured grid discretization.