20 character(len=LENMEMPATH) :: memorypath
21 character(len=LENMODELNAME),
pointer :: name_model => null()
22 integer(I4B),
pointer :: nodes => null()
23 integer(I4B),
pointer :: nja => null()
24 integer(I4B),
pointer :: njas => null()
25 integer(I4B),
pointer :: ianglex => null()
26 integer(I4B),
dimension(:),
pointer,
contiguous :: ia => null()
27 integer(I4B),
dimension(:),
pointer,
contiguous :: ja => null()
28 integer(I4B),
dimension(:),
pointer,
contiguous :: mask => null()
29 real(dp),
dimension(:),
pointer,
contiguous :: cl1 => null()
30 real(dp),
dimension(:),
pointer,
contiguous :: cl2 => null()
31 real(dp),
dimension(:),
pointer,
contiguous :: hwva => null()
32 real(dp),
dimension(:),
pointer,
contiguous :: anglex => null()
33 integer(I4B),
dimension(:),
pointer,
contiguous :: isym => null()
34 integer(I4B),
dimension(:),
pointer,
contiguous :: jas => null()
35 integer(I4B),
dimension(:),
pointer,
contiguous :: ihc => null()
36 integer(I4B),
dimension(:),
pointer,
contiguous :: iausr => null()
37 integer(I4B),
dimension(:),
pointer,
contiguous :: jausr => null()
68 deallocate (this%name_model)
77 if (
associated(this%iausr, this%ia))
then
82 if (
associated(this%jausr, this%ja))
then
88 if (
associated(this%mask, this%ja))
then
96 if (
size(this%ja) > 0)
then
116 character(len=*),
intent(in) :: name_model
119 allocate (this%name_model)
125 call mem_allocate(this%ianglex,
'IANGLEX', this%memoryPath)
126 this%name_model = name_model
141 call mem_allocate(this%ia, this%nodes + 1,
'IA', this%memoryPath)
142 call mem_allocate(this%ja, this%nja,
'JA', this%memoryPath)
143 call mem_allocate(this%isym, this%nja,
'ISYM', this%memoryPath)
144 call mem_allocate(this%jas, this%nja,
'JAS', this%memoryPath)
145 call mem_allocate(this%hwva, this%njas,
'HWVA', this%memoryPath)
146 call mem_allocate(this%anglex, this%njas,
'ANGLEX', this%memoryPath)
147 call mem_allocate(this%ihc, this%njas,
'IHC', this%memoryPath)
148 call mem_allocate(this%cl1, this%njas,
'CL1', this%memoryPath)
149 call mem_allocate(this%cl2, this%njas,
'CL2', this%memoryPath)
150 call mem_allocate(this%iausr, 1,
'IAUSR', this%memoryPath)
151 call mem_allocate(this%jausr, 1,
'JAUSR', this%memoryPath)
166 integer(I4B),
dimension(:),
intent(in) :: ihctemp
167 real(DP),
dimension(:),
intent(in) :: cl12temp
168 real(DP),
dimension(:),
intent(in) :: hwvatemp
169 real(DP),
dimension(:),
intent(in) :: angldegx
171 integer(I4B) :: ii, n, m
172 integer(I4B),
parameter :: nname = 6
173 character(len=24),
dimension(nname) :: aname(nname)
175 character(len=*),
parameter :: fmtsymerr = &
176 &
"('Error in array: ',a,'.', &
177 &' Array is not symmetric in positions: ',i0,' and ',i0,'.', &
178 &' Values in these positions are: ',1pg15.6,' and ', 1pg15.6, &
179 &' For node ',i0,' connected to node ',i0)"
180 character(len=*),
parameter :: fmtsymerrja = &
181 &
"('Error in array: ',a,'.', &
182 &' Array does not have symmetric counterpart in position ',i0, &
183 &' for cell ',i0,' connected to cell ',i0)"
184 character(len=*),
parameter :: fmtjanmerr = &
185 &
"('Error in array: ',a,'.', &
186 &' First value for cell : ',i0,' must equal ',i0,'.', &
187 &' Found ',i0,' instead.')"
188 character(len=*),
parameter :: fmtjasorterr = &
189 &
"('Error in array: ',a,'.', &
190 &' Entries not sorted for row: ',i0,'.', &
191 &' Offending entries are: ',i0,' and ',i0)"
192 character(len=*),
parameter :: fmtihcerr = &
193 "('IHC must be 0, 1, or 2. Found: ',i0)"
195 data aname(1)/
' IAC'/
197 data aname(3)/
' IHC'/
198 data aname(4)/
' CL12'/
199 data aname(5)/
' HWVA'/
200 data aname(6)/
' ANGLDEGX'/
204 if (this%ja(ii) < 0) this%ja(ii) = -this%ja(ii)
209 m = this%ja(this%ia(n))
211 write (
errmsg, fmtjanmerr) trim(adjustl(aname(2))), n, n, m
214 do ii = this%ia(n) + 1, this%ia(n + 1) - 2
216 if (m > this%ja(ii + 1))
then
217 write (
errmsg, fmtjasorterr) trim(adjustl(aname(2))), n, &
224 call this%parser%StoreErrorUnit()
228 call fillisym(this%nodes, this%nja, this%ia, this%ja, this%isym)
233 do ii = this%ia(n), this%ia(n + 1) - 1
235 if (this%isym(ii) == 0)
then
236 write (
errmsg, fmtsymerrja) trim(adjustl(aname(2))), ii, n, m
242 call this%parser%StoreErrorUnit()
246 call filljas(this%nodes, this%nja, this%ia, this%ja, this%isym, this%jas)
250 do ii = this%ia(n) + 1, this%ia(n + 1) - 1
252 if (ihctemp(ii) /= ihctemp(this%isym(ii)))
then
253 write (
errmsg, fmtsymerr) trim(adjustl(aname(3))), ii, this%isym(ii), &
254 ihctemp(ii), ihctemp(this%isym(ii)), n, m
257 this%ihc(this%jas(ii)) = ihctemp(ii)
262 call this%parser%StoreErrorUnit()
267 do ii = this%ia(n) + 1, this%ia(n + 1) - 1
270 this%cl1(this%jas(ii)) = cl12temp(ii)
272 this%cl2(this%jas(ii)) = cl12temp(ii)
284 do ii = this%ia(n) + 1, this%ia(n + 1) - 1
286 if (hwvatemp(ii) /= hwvatemp(this%isym(ii)))
then
287 write (
errmsg, fmtsymerr) trim(adjustl(aname(5))), ii, this%isym(ii), &
288 hwvatemp(ii), hwvatemp(this%isym(ii)), n, m
291 if (ihctemp(ii) < 0 .or. ihctemp(ii) > 2)
then
292 write (
errmsg, fmtihcerr) ihctemp(ii)
295 this%hwva(this%jas(ii)) = hwvatemp(ii)
299 call this%parser%StoreErrorUnit()
303 if (this%ianglex /= 0)
then
305 do ii = this%ia(n) + 1, this%ia(n + 1) - 1
308 this%anglex(this%jas(ii)) = angldegx(ii) *
dpio180
312 do n = 1,
size(this%anglex)
327 character(len=*),
intent(in) :: name_model
328 integer(I4B),
intent(in) :: nodes
329 integer(I4B),
intent(in) :: nja
330 integer(I4B),
intent(in) :: iout
332 character(len=LINELENGTH) :: line
333 character(len=LINELENGTH) :: keyword
334 integer(I4B) :: ii, n, m
336 logical :: isfound, endOfBlock
337 integer(I4B),
parameter :: nname = 2
338 logical,
dimension(nname) :: lname
339 character(len=24),
dimension(nname) :: aname(nname)
341 character(len=*),
parameter :: fmtsymerr = &
342 &
"(/,'Error in array: ',(a),/, &
343 &'Array is not symmetric in positions: ',2i9,/, &
344 &'Values in these positions are: ', 2(1pg15.6))"
345 character(len=*),
parameter :: fmtihcerr = &
346 &
"(/,'IHC must be 0, 1, or 2. Found: ',i0)"
348 data aname(1)/
' IAC'/
352 call this%allocate_scalars(name_model)
355 this%njas = (this%nja - this%nodes) / 2
358 call this%allocate_arrays()
361 call this%parser%GetBlock(
'CONNECTIONDATA', isfound, ierr)
364 write (iout,
'(1x,a)')
'PROCESSING CONNECTIONDATA'
366 call this%parser%GetNextLine(endofblock)
368 call this%parser%GetStringCaps(keyword)
369 select case (keyword)
371 call readarray(this%parser%iuactive, this%ia, aname(1), 1, &
375 call readarray(this%parser%iuactive, this%ja, aname(2), 1, &
380 'Unknown CONNECTIONDATA tag: ', trim(keyword)
382 call this%parser%StoreErrorUnit()
385 write (iout,
'(1x,a)')
'END PROCESSING CONNECTIONDATA'
387 call store_error(
'Required CONNECTIONDATA block not found.')
388 call this%parser%StoreErrorUnit()
393 if (.not. lname(n))
then
395 'Required input was not specified: ', aname(n)
400 call this%parser%StoreErrorUnit()
404 do n = 2, this%nodes + 1
405 this%ia(n) = this%ia(n) + this%ia(n - 1)
407 do n = this%nodes + 1, 2, -1
408 this%ia(n) = this%ia(n - 1) + 1
414 if (this%ja(ii) < 0) this%ja(ii) = -this%ja(ii)
418 call fillisym(this%nodes, this%nja, this%ia, this%ja, this%isym)
419 call filljas(this%nodes, this%nja, this%ia, this%ja, this%isym, &
424 do ii = this%ia(n), this%ia(n + 1) - 1
426 if (n /= this%ja(this%isym(ii)))
then
427 write (line, fmtsymerr) aname(2), ii, this%isym(ii)
429 call this%parser%StoreErrorUnit()
435 call this%parser%StoreErrorUnit()
446 real(DP),
dimension(:),
intent(in) :: fleng
448 integer(I4B) :: n, m, ii
452 do ii = this%ia(n) + 1, this%ia(n + 1) - 1
454 this%cl1(this%jas(ii)) = fleng(n) *
dhalf
455 this%cl2(this%jas(ii)) = fleng(m) *
dhalf
464 nrsize, delr, delc, top, bot, nodereduced, &
471 character(len=*),
intent(in) :: name_model
472 integer(I4B),
intent(in) :: nodes
473 integer(I4B),
intent(in) :: ncol
474 integer(I4B),
intent(in) :: nrow
475 integer(I4B),
intent(in) :: nlay
476 integer(I4B),
intent(in) :: nrsize
477 real(DP),
dimension(ncol),
intent(in) :: delr
478 real(DP),
dimension(nrow),
intent(in) :: delc
479 real(DP),
dimension(nodes),
intent(in) :: top
480 real(DP),
dimension(nodes),
intent(in) :: bot
481 integer(I4B),
dimension(:),
target,
intent(in) :: nodereduced
482 integer(I4B),
dimension(:),
intent(in) :: nodeuser
484 integer(I4B),
dimension(:, :, :),
pointer :: nrdcd_ptr => null()
485 integer(I4B),
dimension(:),
allocatable :: rowmaxnnz
487 integer(I4B) :: i, j, k, kk, ierror, isympos, nodesuser
488 integer(I4B) :: nr, mr
491 call this%allocate_scalars(name_model)
498 allocate (rowmaxnnz(this%nodes))
502 call sparse%init(this%nodes, this%nodes, rowmaxnnz)
505 if (nrsize /= 0)
then
506 nrdcd_ptr(1:ncol, 1:nrow, 1:nlay) => nodereduced
516 if (nrsize == 0)
then
517 nr =
get_node(k, i, j, nlay, nrow, ncol)
519 nr = nrdcd_ptr(j, i, k)
524 call sparse%addconnection(nr, nr, 1)
529 if (nrsize == 0)
then
530 mr =
get_node(kk, i, j, nlay, nrow, ncol)
532 mr = nrdcd_ptr(j, i, kk)
537 call sparse%addconnection(nr, mr, 1)
543 if (nrsize == 0)
then
544 mr =
get_node(k, i - 1, j, nlay, nrow, ncol)
546 mr = nrdcd_ptr(j, i - 1, k)
549 call sparse%addconnection(nr, mr, 1)
555 if (nrsize == 0)
then
556 mr =
get_node(k, i, j - 1, nlay, nrow, ncol)
558 mr = nrdcd_ptr(j - 1, i, k)
561 call sparse%addconnection(nr, mr, 1)
567 if (nrsize == 0)
then
568 mr =
get_node(k, i, j + 1, nlay, nrow, ncol)
570 mr = nrdcd_ptr(j + 1, i, k)
573 call sparse%addconnection(nr, mr, 1)
579 if (nrsize == 0)
then
580 mr =
get_node(k, i + 1, j, nlay, nrow, ncol)
582 mr = nrdcd_ptr(j, i + 1, k)
585 call sparse%addconnection(nr, mr, 1)
592 if (nrsize == 0)
then
593 mr =
get_node(kk, i, j, nlay, nrow, ncol)
595 mr = nrdcd_ptr(j, i, kk)
600 call sparse%addconnection(nr, mr, 1)
606 this%nja = sparse%nnz
607 this%njas = (this%nja - this%nodes) / 2
610 call this%allocate_arrays()
613 call sparse%filliaja(this%ia, this%ja, ierror)
614 call sparse%destroy()
617 call fillisym(this%nodes, this%nja, this%ia, this%ja, this%isym)
618 call filljas(this%nodes, this%nja, this%ia, this%ja, this%isym, this%jas)
627 if (nrsize == 0)
then
628 nr =
get_node(k, i, j, nlay, nrow, ncol)
630 nr = nrdcd_ptr(j, i, k)
636 if (nrsize == 0)
then
637 mr =
get_node(k, i, j + 1, nlay, nrow, ncol)
639 mr = nrdcd_ptr(j + 1, i, k)
642 this%ihc(isympos) = 1
643 this%cl1(isympos) =
dhalf * delr(j)
644 this%cl2(isympos) =
dhalf * delr(j + 1)
645 this%hwva(isympos) = delc(i)
646 this%anglex(isympos) =
dzero
647 isympos = isympos + 1
653 if (nrsize == 0)
then
654 mr =
get_node(k, i + 1, j, nlay, nrow, ncol)
656 mr = nrdcd_ptr(j, i + 1, k)
659 this%ihc(isympos) = 1
660 this%cl1(isympos) =
dhalf * delc(i)
661 this%cl2(isympos) =
dhalf * delc(i + 1)
662 this%hwva(isympos) = delr(j)
664 isympos = isympos + 1
671 if (nrsize == 0)
then
672 mr =
get_node(kk, i, j, nlay, nrow, ncol)
674 mr = nrdcd_ptr(j, i, kk)
679 this%ihc(isympos) = 0
680 this%cl1(isympos) =
dhalf * (top(nr) - bot(nr))
681 this%cl2(isympos) =
dhalf * (top(mr) - bot(mr))
682 this%hwva(isympos) = delr(j) * delc(i)
683 this%anglex(isympos) =
dzero
684 isympos = isympos + 1
692 deallocate (rowmaxnnz)
696 nodesuser = nlay * nrow * ncol
697 call this%iajausr(nrsize, nodesuser, nodereduced, nodeuser)
703 nvert, vertex, iavert, javert, cellxy, &
704 top, bot, nodereduced, nodeuser)
712 character(len=*),
intent(in) :: name_model
713 integer(I4B),
intent(in) :: nodes
714 integer(I4B),
intent(in) :: ncpl
715 integer(I4B),
intent(in) :: nlay
716 integer(I4B),
intent(in) :: nrsize
717 integer(I4B),
intent(in) :: nvert
718 real(DP),
dimension(2, nvert),
intent(in) :: vertex
719 integer(I4B),
dimension(:),
intent(in) :: iavert
720 integer(I4B),
dimension(:),
intent(in) :: javert
721 real(DP),
dimension(2, ncpl),
intent(in) :: cellxy
722 real(DP),
dimension(nodes),
intent(in) :: top
723 real(DP),
dimension(nodes),
intent(in) :: bot
724 integer(I4B),
dimension(:),
intent(in) :: nodereduced
725 integer(I4B),
dimension(:),
intent(in) :: nodeuser
727 integer(I4B),
dimension(:),
allocatable :: itemp
729 integer(I4B) :: n, m, ipos, i, j, ierror, nodesuser
733 call this%allocate_scalars(name_model)
740 call cell1%init(nlay, ncpl, nodes, top, bot, iavert, javert, vertex, &
741 cellxy, nodereduced, nodeuser)
742 call cell2%init(nlay, ncpl, nodes, top, bot, iavert, javert, vertex, &
743 cellxy, nodereduced, nodeuser)
748 allocate (itemp(nvert))
752 call vertcellspm%init(nvert, ncpl, itemp)
755 do i = iavert(j), iavert(j + 1) - 1
756 call vertcellspm%addconnection(javert(i), j, 1)
761 call vertexconnect(this%nodes, nrsize, 6, nlay, ncpl, sparse, &
762 vertcellspm, cell1, cell2, nodereduced)
763 this%nja = sparse%nnz
764 this%njas = (this%nja - this%nodes) / 2
767 call this%allocate_arrays()
771 call sparse%filliaja(this%ia, this%ja, ierror)
772 call sparse%destroy()
775 call fillisym(this%nodes, this%nja, this%ia, this%ja, this%isym)
776 call filljas(this%nodes, this%nja, this%ia, this%ja, this%isym, this%jas)
780 call cell1%set_nodered(n)
781 do ipos = this%ia(n) + 1, this%ia(n + 1) - 1
784 call cell2%set_nodered(m)
785 call cell1%cprops(cell2, this%hwva(this%jas(ipos)), &
786 this%cl1(this%jas(ipos)), this%cl2(this%jas(ipos)), &
787 this%anglex(this%jas(ipos)), &
788 this%ihc(this%jas(ipos)))
794 nodesuser = nlay * ncpl
795 call this%iajausr(nrsize, nodesuser, nodereduced, nodeuser)
802 nodereduced, nodeuser, iainp, jainp, &
803 ihcinp, cl12inp, hwvainp, angldegxinp, &
811 character(len=*),
intent(in) :: name_model
812 integer(I4B),
intent(in) :: nodes
813 integer(I4B),
intent(in) :: nodesuser
814 integer(I4B),
intent(in) :: nrsize
815 integer(I4B),
dimension(:),
contiguous,
intent(in) :: nodereduced
816 integer(I4B),
dimension(:),
contiguous,
intent(in) :: nodeuser
817 integer(I4B),
dimension(:),
contiguous,
intent(in) :: iainp
818 integer(I4B),
dimension(:),
contiguous,
intent(in) :: jainp
819 integer(I4B),
dimension(:),
contiguous,
intent(in) :: ihcinp
820 real(DP),
dimension(:),
contiguous,
intent(in) :: cl12inp
821 real(DP),
dimension(:),
contiguous,
intent(in) :: hwvainp
822 real(DP),
dimension(:),
contiguous,
intent(in) :: angldegxinp
823 integer(I4B),
intent(in) :: iangledegx
825 integer(I4B),
dimension(:),
allocatable :: ihctemp
826 real(DP),
dimension(:),
allocatable :: cl12temp
827 real(DP),
dimension(:),
allocatable :: hwvatemp
828 real(DP),
dimension(:),
allocatable :: angldegxtemp
829 integer(I4B) :: nr, nu, mr, mu, ipos, iposr, ierror
830 integer(I4B),
dimension(:),
allocatable :: rowmaxnnz
834 call this%allocate_scalars(name_model)
838 this%ianglex = iangledegx
842 if (nrsize == 0)
then
844 this%nja =
size(jainp)
845 this%njas = (this%nja - this%nodes) / 2
846 call this%allocate_arrays()
848 this%ia(nu) = iainp(nu)
850 do ipos = 1, this%nja
851 this%ja(ipos) = jainp(ipos)
856 call this%con_finalize(ihcinp, cl12inp, hwvainp, angldegxinp)
862 allocate (rowmaxnnz(this%nodes))
863 do nr = 1, this%nodes
865 rowmaxnnz(nr) = iainp(nu + 1) - iainp(nu)
867 call sparse%init(this%nodes, this%nodes, rowmaxnnz)
872 if (nr > 0)
call sparse%addconnection(nr, nr, 1)
873 do ipos = iainp(nu) + 1, iainp(nu + 1) - 1
878 call sparse%addconnection(nr, mr, 1)
881 this%nja = sparse%nnz
882 this%njas = (this%nja - this%nodes) / 2
885 call this%allocate_arrays()
889 call sparse%filliaja(this%ia, this%ja, ierror)
890 call sparse%destroy()
891 deallocate (rowmaxnnz)
894 allocate (ihctemp(this%nja))
895 allocate (cl12temp(this%nja))
896 allocate (hwvatemp(this%nja))
897 allocate (angldegxtemp(this%nja))
903 do ipos = iainp(nu), iainp(nu + 1) - 1
906 if (nr < 1 .or. mr < 1) cycle
907 ihctemp(iposr) = ihcinp(ipos)
908 cl12temp(iposr) = cl12inp(ipos)
909 hwvatemp(iposr) = hwvainp(ipos)
910 angldegxtemp(iposr) = angldegxinp(ipos)
916 call this%con_finalize(ihctemp, cl12temp, hwvatemp, angldegxtemp)
920 deallocate (cl12temp)
921 deallocate (hwvatemp)
922 deallocate (angldegxtemp)
927 call this%iajausr(nrsize, nodesuser, nodereduced, nodeuser)
937 vertices, iavert, javert, &
938 cellxy, cellfdc, nodereduced, nodeuser, &
947 character(len=*),
intent(in) :: name_model
948 integer(I4B),
intent(in) :: nodes
949 integer(I4B),
intent(in) :: nodesuser
950 integer(I4B),
intent(in) :: nrsize
951 integer(I4B),
intent(in) :: nvert
952 real(DP),
dimension(3, nvert),
intent(in) :: vertices
953 integer(I4B),
dimension(:),
intent(in) :: iavert
954 integer(I4B),
dimension(:),
intent(in) :: javert
955 real(DP),
dimension(2, nodesuser),
intent(in) :: cellxy
956 real(DP),
dimension(nodesuser),
intent(in) :: cellfdc
957 integer(I4B),
dimension(:),
intent(in) :: nodereduced
958 integer(I4B),
dimension(:),
intent(in) :: nodeuser
959 real(DP),
dimension(:),
intent(in) :: reach_length
961 integer(I4B),
dimension(:),
allocatable :: itemp
962 integer(I4B),
dimension(:),
allocatable :: iavertcells
963 integer(I4B),
dimension(:),
allocatable :: javertcells
965 integer(I4B) :: i, j, ierror
968 call this%allocate_scalars(name_model)
977 allocate (itemp(nvert))
981 call vertcellspm%init(nvert, nodesuser, itemp)
984 do i = iavert(j), iavert(j + 1) - 1
985 call vertcellspm%addconnection(javert(i), j, 1)
988 call vertcellspm%sort()
989 allocate (iavertcells(nvert + 1))
990 allocate (javertcells(vertcellspm%nnz))
991 call vertcellspm%filliaja(iavertcells, javertcells, ierror)
992 call vertcellspm%destroy()
996 iavertcells, javertcells, nodereduced)
997 this%nja = sparse%nnz
998 this%njas = (this%nja - this%nodes) / 2
1001 call this%allocate_arrays()
1005 call sparse%filliaja(this%ia, this%ja, ierror)
1006 call sparse%destroy()
1009 call fillisym(this%nodes, this%nja, this%ia, this%ja, this%isym)
1010 call filljas(this%nodes, this%nja, this%ia, this%ja, this%isym, this%jas)
1014 this%ihc, this%cl1, this%cl2, &
1015 nrsize, nodereduced, nodeuser, cellfdc, &
1016 iavert, javert, iavertcells, javertcells)
1019 deallocate (iavertcells)
1020 deallocate (javertcells)
1024 call this%iajausr(nrsize, nodesuser, nodereduced, nodeuser)
1031 nrsize, nodereduced, nodeuser, fdc, &
1032 iavert, javert, iavertcells, javertcells)
1034 integer(I4B),
dimension(:),
intent(in) :: ia
1035 integer(I4B),
dimension(:),
intent(in) :: ja
1036 integer(I4B),
dimension(:),
intent(in) :: jas
1037 real(DP),
dimension(:),
intent(in) :: cell_length
1038 integer(I4B),
dimension(:),
intent(out) :: ihc
1039 real(DP),
dimension(:),
intent(out) :: cl1
1040 real(DP),
dimension(:),
intent(out) :: cl2
1041 integer(I4B),
intent(in) :: nrsize
1042 integer(I4B),
dimension(:),
intent(in) :: nodereduced
1043 integer(I4B),
dimension(:),
intent(in) :: nodeuser
1044 real(DP),
dimension(:),
intent(in) :: fdc
1045 integer(I4B),
dimension(:),
intent(in) :: iavert
1046 integer(I4B),
dimension(:),
intent(in) :: javert
1047 integer(I4B),
dimension(:),
intent(in) :: iavertcells
1048 integer(I4B),
dimension(:),
intent(in) :: javertcells
1051 integer(I4B) :: nr, nu
1052 integer(I4B) :: mr, mu
1053 integer(I4B) :: ipos
1054 integer(I4B) :: isympos
1058 do nu = 1,
size(cell_length)
1062 if (nrsize > 0) nr = nodereduced(nu)
1066 do ipos = ia(nr) + 1, ia(nr + 1) - 1
1073 if (nrsize > 0) mu = nodeuser(mr)
1080 if (fdc(nu) ==
dhalf)
then
1085 f = (
done - fdc(nu))
1090 cl1(isympos) = f * cell_length(nu)
1093 if (fdc(mu) ==
dhalf)
then
1098 f = (
done - fdc(mu))
1103 cl2(isympos) = f * cell_length(mu)
1112 subroutine iajausr(this, nrsize, nodesuser, nodereduced, nodeuser)
1117 integer(I4B),
intent(in) :: nrsize
1118 integer(I4B),
intent(in) :: nodesuser
1119 integer(I4B),
dimension(:),
intent(in) :: nodereduced
1120 integer(I4B),
dimension(:),
intent(in) :: nodeuser
1122 integer(I4B) :: n, nr, ipos
1126 if (nrsize > 0)
then
1130 call mem_reallocate(this%iausr, nodesuser + 1,
'IAUSR', this%memoryPath)
1131 this%iausr(nodesuser + 1) = this%ia(this%nodes + 1)
1132 do n = nodesuser, 1, -1
1135 this%iausr(n) = this%iausr(n + 1)
1137 this%iausr(n) = this%ia(nr)
1143 call mem_reallocate(this%jausr, this%nja,
'JAUSR', this%memoryPath)
1144 do ipos = 1, this%nja
1147 this%jausr(ipos) = n
1153 call mem_setptr(this%iausr,
'IA', this%memoryPath)
1154 call mem_setptr(this%jausr,
'JA', this%memoryPath)
1173 integer(I4B),
intent(in) :: node1, node2
1178 if (node1 < 1 .or. node1 > this%nodes .or. node2 < 1 .or. &
1179 node2 > this%nodes)
then
1185 if (node1 == node2)
then
1191 do i = this%ia(node1) + 1, this%ia(node1 + 1) - 1
1192 if (this%ja(i) == node2)
then
1207 integer(I4B),
intent(in) :: neq
1208 integer(I4B),
intent(in) :: nja
1209 integer(I4B),
intent(inout),
dimension(nja) :: isym
1211 integer(I4B),
intent(in),
dimension(neq + 1) :: ia
1212 integer(I4B),
intent(in),
dimension(nja) :: ja
1213 integer(I4B) :: n, m, ii, jj
1216 do ii = ia(n), ia(n + 1) - 1
1220 search:
do jj = ia(m), ia(m + 1) - 1
1221 if (ja(jj) == n)
then
1237 integer(I4B),
intent(in) :: neq
1238 integer(I4B),
intent(in) :: nja
1239 integer(I4B),
intent(in),
dimension(neq + 1) :: ia
1240 integer(I4B),
intent(in),
dimension(nja) :: ja
1241 integer(I4B),
intent(in),
dimension(nja) :: isym
1242 integer(I4B),
intent(inout),
dimension(nja) :: jas
1244 integer(I4B) :: n, m, ii, ipos
1250 do ii = ia(n) + 1, ia(n + 1) - 1
1261 do ii = ia(n), ia(n + 1) - 1
1264 jas(ii) = jas(isym(ii))
1273 vertcellspm, cell1, cell2, nodereduced)
1278 integer(I4B),
intent(in) :: nodes
1279 integer(I4B),
intent(in) :: nrsize
1280 integer(I4B),
intent(in) :: maxnnz
1281 integer(I4B),
intent(in) :: nlay
1282 integer(I4B),
intent(in) :: ncpl
1285 integer(I4B),
dimension(:),
intent(in) :: nodereduced
1288 integer(I4B),
dimension(:),
allocatable :: rowmaxnnz
1289 integer(I4B) :: i, j, k, kk, nr, mr, j1, j2, icol1, icol2, nvert
1292 allocate (rowmaxnnz(nodes))
1294 rowmaxnnz(i) = maxnnz
1296 call sparse%init(nodes, nodes, rowmaxnnz)
1297 deallocate (rowmaxnnz)
1303 nr =
get_node(k, 1, j, nlay, 1, ncpl)
1304 if (nrsize > 0) nr = nodereduced(nr)
1308 call sparse%addconnection(nr, nr, 1)
1312 do kk = k - 1, 1, -1
1313 mr =
get_node(kk, 1, j, nlay, 1, ncpl)
1314 if (nrsize > 0) mr = nodereduced(mr)
1318 call sparse%addconnection(nr, mr, 1)
1325 mr =
get_node(kk, 1, j, nlay, 1, ncpl)
1326 if (nrsize > 0) mr = nodereduced(mr)
1330 call sparse%addconnection(nr, mr, 1)
1338 nvert = vertcellspm%nrow
1340 do icol1 = 1, vertcellspm%row(i)%nnz
1341 j1 = vertcellspm%row(i)%icolarray(icol1)
1343 nr =
get_node(k, 1, j1, nlay, 1, ncpl)
1344 if (nrsize > 0) nr = nodereduced(nr)
1346 call cell1%set_nodered(nr)
1347 do icol2 = 1, vertcellspm%row(i)%nnz
1348 j2 = vertcellspm%row(i)%icolarray(icol2)
1350 mr =
get_node(k, 1, j2, nlay, 1, ncpl)
1351 if (nrsize > 0) mr = nodereduced(mr)
1353 call cell2%set_nodered(mr)
1354 if (cell1%shares_edge(cell2))
then
1355 call sparse%addconnection(nr, mr, 1)
1367 iavertcells, javertcells, &
1373 integer(I4B),
intent(in) :: nodes
1374 integer(I4B),
intent(in) :: nrsize
1375 integer(I4B),
intent(in) :: maxnnz
1376 integer(I4B),
intent(in) :: nodeuser
1378 integer(I4B),
dimension(:),
intent(in) :: nodereduced
1379 integer(I4B),
dimension(:),
intent(in) :: iavertcells
1380 integer(I4B),
dimension(:),
intent(in) :: javertcells
1382 integer(I4B),
dimension(:),
allocatable :: rowmaxnnz
1383 integer(I4B) :: i, k, nr, mr, nvert
1387 allocate (rowmaxnnz(nodes))
1389 rowmaxnnz(i) = maxnnz
1391 call sparse%init(nodes, nodes, rowmaxnnz)
1392 deallocate (rowmaxnnz)
1397 if (nrsize > 0) mr = nodereduced(mr)
1399 call sparse%addconnection(mr, mr, 1)
1404 nvert =
size(iavertcells) - 1
1407 do k = iavertcells(i), iavertcells(i + 1) - 2
1409 do con = k + 1, iavertcells(i + 1) - 1
1411 if (nrsize > 0) nr = nodereduced(nr)
1413 mr = javertcells(con)
1414 if (nrsize > 0) mr = nodereduced(mr)
1416 call sparse%addconnection(nr, mr, 1)
1417 call sparse%addconnection(mr, nr, 1)
1432 integer(I4B),
intent(in) :: ipos
1433 integer(I4B),
intent(in) :: maskval
1438 if (
associated(this%mask, this%ja))
then
1439 call mem_allocate(this%mask, this%nja,
'MASK', this%memoryPath)
1447 this%mask(ipos) = maskval
1454 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: iac
1455 integer(I4B),
dimension(:),
contiguous,
intent(inout) :: ia
1457 integer(I4B) :: n, nodes
1463 if (n <
size(ia))
then
1464 ia(n) = iac(n) + ia(n - 1)
1466 ia(n) = ia(n) + ia(n - 1)
1469 do n = nodes + 1, 2, -1
1470 ia(n) = ia(n - 1) + 1
1478 result(connected_down)
1480 integer(I4B),
intent(in) :: nu
1481 integer(I4B),
intent(in) :: mu
1482 integer(I4B),
dimension(:),
intent(in) :: iavert
1483 integer(I4B),
dimension(:),
intent(in) :: javert
1484 integer(I4B),
dimension(:),
intent(in) :: iavertcells
1485 integer(I4B),
dimension(:),
intent(in) :: javertcells
1487 logical(LGP) :: connected_down
1489 integer(I4B) :: ipos
1490 integer(I4B) :: ivert_down
1494 ivert_down = javert(iavert(nu + 1) - 1)
1498 connected_down = .false.
1499 do ipos = iavertcells(ivert_down), iavertcells(ivert_down + 1) - 1
1500 if (javertcells(ipos) == mu)
then
1501 connected_down = .true.
This module contains block parser methods.
subroutine disvconnections(this, name_model, nodes, ncpl, nlay, nrsize, nvert, vertex, iavert, javert, cellxy, top, bot, nodereduced, nodeuser)
Construct the connectivity arrays using cell disv information.
subroutine iajausr(this, nrsize, nodesuser, nodereduced, nodeuser)
Fill iausr and jausr if reduced grid, otherwise point them to ia and ja.
subroutine set_mask(this, ipos, maskval)
routine to set a value in the mask array (which has the same shape as thisja)
subroutine read_connectivity_from_block(this, name_model, nodes, nja, iout)
Read and process IAC and JA from an an input block called CONNECTIONDATA.
subroutine, public iac_to_ia(iac, ia)
Convert an iac array into an ia array.
subroutine disv1dconnections_verts(this, name_model, nodes, nodesuser, nrsize, nvert, vertices, iavert, javert, cellxy, cellfdc, nodereduced, nodeuser, reach_length)
Fill the connections object for a disv1d package from vertices.
subroutine con_da(this)
Deallocate connection variables.
subroutine set_cl1_cl2_from_fleng(this, fleng)
Using a vector of cell lengths, calculate the cl1 and cl2 arrays.
subroutine vertexconnect(nodes, nrsize, maxnnz, nlay, ncpl, sparse, vertcellspm, cell1, cell2, nodereduced)
Routine to make cell connections from vertices.
subroutine, public fillisym(neq, nja, ia, ja, isym)
Function to fill the isym array.
subroutine allocate_arrays(this)
Allocate arrays for ConnectionsType.
integer(i4b) function getjaindex(this, node1, node2)
Get the index in the JA array corresponding to the connection between two nodes of interest.
subroutine disconnections(this, name_model, nodes, ncol, nrow, nlay, nrsize, delr, delc, top, bot, nodereduced, nodeuser)
Construct the connectivity arrays for a structured three-dimensional grid.
logical(lgp) function connected_down_n(nu, mu, iavert, javert, iavertcells, javertcells)
Is cell m is connected to the downstream end of cell n.
subroutine, public filljas(neq, nja, ia, ja, isym, jas)
Function to fill the jas array.
subroutine vertexconnectl(nodes, nrsize, maxnnz, nodeuser, sparse, iavertcells, javertcells, nodereduced)
Routine to make cell connections from vertices for a linear network.
subroutine con_finalize(this, ihctemp, cl12temp, hwvatemp, angldegx)
Finalize connection data.
subroutine fill_disv1d_symarrays(ia, ja, jas, cell_length, ihc, cl1, cl2, nrsize, nodereduced, nodeuser, fdc, iavert, javert, iavertcells, javertcells)
Fill symmetric connection arrays for disv1d.
subroutine allocate_scalars(this, name_model)
Allocate scalars for ConnectionsType.
subroutine disuconnections(this, name_model, nodes, nodesuser, nrsize, nodereduced, nodeuser, iainp, jainp, ihcinp, cl12inp, hwvainp, angldegxinp, iangledegx)
Construct the connectivity arrays using disu information. Grid may be reduced.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenmodelname
maximum length of the model name
real(dp), parameter dnodata
real no data constant
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dpi
real constant
real(dp), parameter dpio180
real constant
real(dp), parameter dzero
real constant zero
real(dp), parameter dtwo
real constant 2
integer(i4b), parameter lenmempath
maximum length of the memory path
real(dp), parameter dthree
real constant 3
real(dp), parameter done
real constant 1
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...
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
Store and issue logging messages to output units.
subroutine, public write_message(text, iunit, fmt, skipbefore, skipafter, advance)
Write a message to an output unit.
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_unit(iunit, terminate)
Store the file unit number.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string