55 allocate (method%type)
59 method%delegates = .true.
66 deallocate (this%type)
70 subroutine load_disv(this, particle, next_level, submethod)
78 integer(I4B),
intent(in) :: next_level
79 class(
methodtype),
pointer,
intent(inout) :: submethod
86 select type (cell => this%cell)
89 ic = particle%idomain(next_level)
90 call this%load_cell_defn(ic, cell%defn)
91 if (this%fmi%ibdgwfsat0(ic) == 0)
then
97 trackctl=this%trackctl, &
98 tracktimes=this%tracktimes)
102 if (particle%ifrctrn > 0)
then
106 trackctl=this%trackctl, &
107 tracktimes=this%tracktimes)
109 else if (cell%defn%can_be_rect)
then
115 trackctl=this%trackctl, &
116 tracktimes=this%tracktimes)
118 else if (cell%defn%can_be_quad)
then
124 trackctl=this%trackctl, &
125 tracktimes=this%tracktimes)
131 trackctl=this%trackctl, &
132 tracktimes=this%tracktimes)
147 integer(I4B) :: inface
152 integer(I4B) :: idiag
157 select type (dis => this%fmi%dis)
160 inface = particle%iboundary(2)
161 idiag = dis%con%ia(cell%defn%icell)
162 inbr = cell%defn%facenbr(inface)
164 ic = dis%con%ja(ipos)
165 icu = dis%get_nodeuser(ic)
166 call get_jk(icu, dis%ncpl, dis%nlay, icpl, ilay)
167 particle%idomain(2) = ic
173 call this%map_neighbor(cell%defn, inface, z)
174 particle%iboundary(2) = inface
175 particle%idomain(3:) = 0
176 particle%iboundary(3:) = 0
189 integer(I4B) :: idiag
192 idiag = this%fmi%dis%con%ia(cell%defn%icell)
193 inbr = cell%defn%facenbr(particle%iboundary(2))
197 this%flowja(ipos) = this%flowja(ipos) -
done
200 this%flowja(this%fmi%dis%con%isym(ipos)) &
201 = this%flowja(this%fmi%dis%con%isym(ipos)) +
done
213 select type (c => this%cell)
219 if (cell%defn%facenbr(particle%iboundary(2)) .eq. 0)
then
221 particle%advancing = .false.
222 call this%save(particle, reason=3)
226 call this%load_particle(cell, particle)
227 call this%update_flowja(cell, particle)
237 integer(I4B),
intent(inout) :: inface
238 double precision,
intent(inout) :: z
241 integer(I4B) :: npolyvertsin
243 integer(I4B) :: npolyverts
245 integer(I4B) :: inbrnbr
256 inbr = defn%facenbr(inface)
257 if (inbr .eq. 0)
then
264 j = this%fmi%dis%con%ia(icin)
265 ic = this%fmi%dis%con%ja(j + inbr)
266 call this%load_cell_defn(ic, this%neighbor)
268 npolyvertsin = defn%npolyverts
269 npolyverts = this%neighbor%npolyverts
270 if (inface .eq. npolyvertsin + 2)
then
272 inface = npolyverts + 3
273 else if (inface .eq. npolyvertsin + 3)
then
275 inface = npolyverts + 2
278 j = this%fmi%dis%con%ia(ic)
279 do m = 1, npolyverts + 3
280 inbrnbr = this%neighbor%facenbr(m)
281 if (this%fmi%dis%con%ja(j + inbrnbr) .eq. icin)
then
289 zrel = (z - botfrom) / (topfrom - botfrom)
290 top = this%fmi%dis%top(ic)
291 bot = this%fmi%dis%bot(ic)
292 sat = this%fmi%gwfsat(ic)
293 z = bot + zrel * sat * (top - bot)
302 real(DP),
intent(in) :: tmax
303 call this%track(particle, 1, tmax)
310 integer(I4B),
intent(in) :: ic
314 call this%load_properties(ic, defn)
317 call this%load_polygon(defn)
320 call this%load_neighbors(defn)
323 call this%load_indicators(defn)
326 call this%load_flows(defn)
333 integer(I4B),
intent(in) :: ic
341 defn%iatop =
get_iatop(this%fmi%dis%get_ncpl(), &
342 this%fmi%dis%get_nodeuser(ic))
343 top = this%fmi%dis%top(ic)
344 bot = this%fmi%dis%bot(ic)
345 sat = this%fmi%gwfsat(ic)
346 top = bot + sat * (top - bot)
350 defn%porosity = this%porosity(ic)
351 defn%retfactor = this%retfactor(ic)
352 defn%izone = this%izone(ic)
361 call this%fmi%dis%get_polyverts( &
365 defn%npolyverts =
size(defn%polyvert, dim=2) - 1
386 integer(I4B) :: istart1
387 integer(I4B) :: istart2
388 integer(I4B) :: istop1
389 integer(I4B) :: istop2
390 integer(I4B) :: isharedface
392 integer(I4B) :: nfaces
393 integer(I4B) :: nslots
396 nfaces = defn%npolyverts + 3
397 nslots =
size(defn%facenbr)
398 if (nslots < nfaces)
call expandarray(defn%facenbr, nfaces - nslots)
400 select type (dis => this%fmi%dis)
405 icu1 = dis%get_nodeuser(ic1)
406 ncpl = dis%get_ncpl()
407 call get_jk(icu1, ncpl, dis%nlay, j1, k1)
408 istart1 = dis%iavert(j1)
409 istop1 = dis%iavert(j1 + 1) - 1
410 do iloc = 1, dis%con%ia(ic1 + 1) - dis%con%ia(ic1) - 1
411 ipos = dis%con%ia(ic1) + iloc
413 if (dis%con%mask(ipos) == 0) cycle
414 ic2 = dis%con%ja(ipos)
415 icu2 = dis%get_nodeuser(ic2)
416 call get_jk(icu2, ncpl, dis%nlay, j2, k2)
417 istart2 = dis%iavert(j2)
418 istop2 = dis%iavert(j2 + 1) - 1
420 dis%javert(istart2:istop2), &
422 if (isharedface /= 0)
then
424 defn%facenbr(isharedface) = int(iloc, 1)
428 defn%facenbr(defn%npolyverts + 2) = int(iloc, 1)
429 else if (k2 < k1)
then
431 defn%facenbr(defn%npolyverts + 3) = int(iloc, 1)
433 call pstop(1,
"k2 should be <> k1, since no shared edge face")
439 defn%facenbr(defn%npolyverts + 1) = defn%facenbr(1)
451 integer(I4B) :: nfaces
452 integer(I4B) :: nslots
455 nfaces = defn%npolyverts + 3
456 nslots =
size(defn%faceflow)
457 if (nslots < nfaces)
call expandarray(defn%faceflow, nfaces - nslots)
463 defn%faceflow =
dzero
465 call this%load_boundary_flows_to_defn_poly(defn)
466 call this%load_face_flows_to_defn_poly(defn)
469 defn%distflow = this%fmi%SourceFlows(defn%icell) + &
470 this%fmi%SinkFlows(defn%icell) + &
471 this%fmi%StorageFlows(defn%icell)
474 if (this%fmi%SinkFlows(defn%icell) .ne.
dzero)
then
487 integer(I4B) :: m, n, nfaces
490 nfaces = defn%npolyverts + 3
494 q = this%fmi%gwfflowja(this%fmi%dis%con%ia(defn%icell) + n)
495 defn%faceflow(m) = defn%faceflow(m) + q
497 if (defn%faceflow(m) <
dzero) defn%inoexitface = 0
508 integer(I4B) :: ioffset
512 ioffset = (defn%icell - 1) * 10
513 defn%faceflow(1) = defn%faceflow(1) + &
514 this%fmi%BoundaryFlows(ioffset + 4)
515 defn%faceflow(2) = defn%faceflow(2) + &
516 this%fmi%BoundaryFlows(ioffset + 2)
517 defn%faceflow(3) = defn%faceflow(3) + &
518 this%fmi%BoundaryFlows(ioffset + 3)
519 defn%faceflow(4) = defn%faceflow(4) + &
520 this%fmi%BoundaryFlows(ioffset + 1)
521 defn%faceflow(5) = defn%faceflow(1)
522 defn%faceflow(6) = defn%faceflow(6) + &
523 this%fmi%BoundaryFlows(ioffset + 9)
524 defn%faceflow(7) = defn%faceflow(7) + &
525 this%fmi%BoundaryFlows(ioffset + 10)
539 integer(I4B) :: ioffset
543 integer(I4B) :: mdiff
545 integer(I4B) :: irectvert(5)
547 ioffset = (defn%icell - 1) * 10
553 else if (n .eq. 4)
then
558 qbf = this%fmi%BoundaryFlows(ioffset + nbf)
560 do m = 1, defn%npolyverts
561 if (.not. defn%ispv180(m))
then
566 irectvert(5) = irectvert(1)
568 m2 = irectvert(n + 1)
569 if (m2 .lt. m1) m2 = m2 + defn%npolyverts
571 if (mdiff .eq. 1)
then
573 defn%faceflow(m1) = defn%faceflow(m1) + qbf
577 defn%faceflow(m1) = defn%faceflow(m1) + qbf
578 defn%faceflow(m1 + 1) = defn%faceflow(m1 + 1) + qbf
582 m = defn%npolyverts + 1
583 defn%faceflow(m) = defn%faceflow(1)
586 defn%faceflow(m) = defn%faceflow(m) + &
587 this%fmi%BoundaryFlows(ioffset + 9)
590 defn%faceflow(m) = defn%faceflow(m) + &
591 this%fmi%BoundaryFlows(ioffset + 10)
603 integer(I4B) :: npolyverts
604 integer(I4B) :: ioffset
608 npolyverts = defn%npolyverts
611 do iv = 1, npolyverts
612 defn%faceflow(iv) = &
613 defn%faceflow(iv) + &
614 this%fmi%BoundaryFlows(ioffset + iv)
616 defn%faceflow(npolyverts + 1) = defn%faceflow(1)
617 defn%faceflow(npolyverts + 2) = &
618 defn%faceflow(npolyverts + 2) + &
620 defn%faceflow(npolyverts + 3) = &
621 defn%faceflow(npolyverts + 3) + &
634 integer(I4B) :: npolyverts
640 integer(I4B) :: num90
641 integer(I4B) :: num180
652 s0mag, s2x, s2y, s2mag, sinang, cosang, dotprod
656 npolyverts = defn%npolyverts
659 if (
size(defn%ispv180) < npolyverts + 3) &
664 defn%ispv180(1:npolyverts + 1) = .false.
665 defn%can_be_rect = .false.
666 defn%can_be_quad = .false.
677 else if (m1 .eq. npolyverts)
then
684 x0 = defn%polyvert(1, m0)
685 y0 = defn%polyvert(2, m0)
686 x1 = defn%polyvert(1, m1)
687 y1 = defn%polyvert(2, m1)
688 x2 = defn%polyvert(1, m2)
689 y2 = defn%polyvert(2, m2)
692 s0mag = dsqrt(s0x * s0x + s0y * s0y)
695 s2mag = dsqrt(s2x * s2x + s2y * s2y)
696 sinang = (s0x * s2y - s0y * s2x) / (s0mag * s2mag)
697 cosang = dsqrt(dabs(
done - (sinang * sinang)))
698 if (dabs(sinang) .lt. epsang)
then
699 dotprod = s0x * s2x + s0y * s2y
700 if (dotprod .lt.
dzero)
then
703 defn%ispv180(m) = .true.
706 if (dabs(cosang) .lt. epsang) num90 = num90 + 1
712 defn%ispv180(npolyverts + 1) = defn%ispv180(1)
714 if (num90 .eq. 4)
then
715 if (num180 .eq. 0)
then
716 defn%can_be_rect = .true.
718 defn%can_be_quad = .true.
subroutine, public create_defn(cellDefn)
Create a new cell definition object.
integer(i4b) function, public get_iatop(ncpl, icu)
Get the index corresponding to top elevation of a cell in the grid. This is -1 if the cell is in the ...
integer(i4b), parameter, public max_poly_cells
subroutine, public create_cell_poly(cell)
Create a new polygonal cell.
subroutine, public cell_poly_to_rect(poly, rect)
Convert CellPoly representation to CellRect. Assumes the conversion is possible.
subroutine, public cell_poly_to_quad(poly, quad)
Convert CellPoly representation to CellRectQuad. Assumes the conversion is possible.
This module contains simulation constants.
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
subroutine pstop(status, message)
Stop the program, optionally specifying an error status code.
subroutine, public shared_face(iverts1, iverts2, iface)
Find the lateral face shared by two cells.
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.
Cell-level tracking methods.
type(methodcellpollocktype), pointer, public method_cell_plck
type(methodcellpasstobottype), pointer, public method_cell_ptb
type(methodcellpollockquadtype), pointer, public method_cell_quad
type(methodcellternarytype), pointer, public method_cell_tern
subroutine, public create_method_disv(method)
Create a new vertex grid (DISV) tracking method.
subroutine load_boundary_flows_to_defn_rect(this, defn)
Load boundary flows from the grid into a rectangular cell. Assumes cell index and number of vertices ...
subroutine load_neighbors(this, defn)
Loads face neighbors to cell definition from the grid Assumes cell index and number of vertices are a...
subroutine map_neighbor(this, defn, inface, z)
Map location on cell face to shared cell face of neighbor.
subroutine load_indicators(this, defn)
Load 180-degree vertex indicator array and set flags indicating how cell can be represented....
subroutine load_boundary_flows_to_defn_rect_quad(this, defn)
Load boundary flows from the grid into rectangular quadcell. Assumes cell index and number of vertice...
subroutine update_flowja(this, cell, particle)
subroutine load_disv(this, particle, next_level, submethod)
Load the cell and the tracking method.
subroutine load_face_flows_to_defn_poly(this, defn)
subroutine load_polygon(this, defn)
subroutine load_particle(this, cell, particle)
subroutine load_properties(this, ic, defn)
Loads cell properties to cell definition from the grid.
subroutine load_flows(this, defn)
Load flows into the cell definition. These include face, boundary and net distributed flows....
subroutine load_boundary_flows_to_defn_poly(this, defn)
Load boundary flows from the grid into a polygonal cell. Assumes cell index and number of vertices ar...
subroutine load_cell_defn(this, ic, defn)
Load cell definition from the grid.
subroutine apply_disv(this, particle, tmax)
Apply the DISV-grid method.
subroutine pass_disv(this, particle)
Pass a particle to the next cell, if there is one.
Particle tracking strategies.
Base grid cell definition.
Base type for grid cells of a concrete type. Contains a cell-definition which is information shared b...
Vertex grid discretization.
Base type for particle tracking methods.
Particle tracked by the PRT model.