55 allocate (method%name)
59 method%delegates = .true.
66 deallocate (this%name)
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)
88 ic = particle%idomain(next_level)
89 call this%load_cell_defn(ic, cell%defn)
90 if (this%fmi%ibdgwfsat0(ic) == 0)
then
96 trackctl=this%trackctl, &
97 tracktimes=this%tracktimes)
99 else if (particle%ifrctrn > 0)
then
104 trackctl=this%trackctl, &
105 tracktimes=this%tracktimes)
107 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
126 trackctl=this%trackctl, &
127 tracktimes=this%tracktimes)
134 trackctl=this%trackctl, &
135 tracktimes=this%tracktimes)
149 integer(I4B) :: inface
154 integer(I4B) :: idiag
159 select type (dis => this%fmi%dis)
161 inface = particle%iboundary(2)
162 idiag = dis%con%ia(cell%defn%icell)
163 inbr = cell%defn%facenbr(inface)
165 ic = dis%con%ja(ipos)
166 icu = dis%get_nodeuser(ic)
167 call get_jk(icu, dis%ncpl, dis%nlay, icpl, ilay)
174 if (ic == particle%icp .and. inface == 7 .and. ilay < particle%ilay)
then
175 particle%advancing = .false.
176 particle%idomain(2) = particle%icp
178 particle%izone = particle%izp
179 call this%save(particle, reason=3)
182 particle%icp = particle%idomain(2)
183 particle%izp = particle%izone
186 particle%idomain(2) = ic
191 call this%map_neighbor(cell%defn, inface, z)
193 particle%iboundary(2) = inface
194 particle%idomain(3:) = 0
195 particle%iboundary(3:) = 0
208 integer(I4B) :: idiag
211 idiag = this%fmi%dis%con%ia(cell%defn%icell)
212 inbr = cell%defn%facenbr(particle%iboundary(2))
216 this%flowja(ipos) = this%flowja(ipos) -
done
219 this%flowja(this%fmi%dis%con%isym(ipos)) &
220 = this%flowja(this%fmi%dis%con%isym(ipos)) +
done
232 select type (c => this%cell)
238 if (cell%defn%facenbr(particle%iboundary(2)) .eq. 0)
then
240 particle%advancing = .false.
241 call this%save(particle, reason=3)
245 call this%load_particle(cell, particle)
246 if (.not. particle%advancing)
return
249 call this%update_flowja(cell, particle)
259 integer(I4B),
intent(inout) :: inface
260 double precision,
intent(inout) :: z
263 integer(I4B) :: npolyvertsin
265 integer(I4B) :: npolyverts
267 integer(I4B) :: inbrnbr
278 inbr = defn%facenbr(inface)
279 if (inbr .eq. 0)
then
286 j = this%fmi%dis%con%ia(icin)
287 ic = this%fmi%dis%con%ja(j + inbr)
288 call this%load_cell_defn(ic, this%neighbor)
290 npolyvertsin = defn%npolyverts
291 npolyverts = this%neighbor%npolyverts
292 if (inface .eq. npolyvertsin + 2)
then
294 inface = npolyverts + 3
295 else if (inface .eq. npolyvertsin + 3)
then
297 inface = npolyverts + 2
300 j = this%fmi%dis%con%ia(ic)
301 do m = 1, npolyverts + 3
302 inbrnbr = this%neighbor%facenbr(m)
303 if (this%fmi%dis%con%ja(j + inbrnbr) .eq. icin)
then
311 zrel = (z - botfrom) / (topfrom - botfrom)
312 top = this%fmi%dis%top(ic)
313 bot = this%fmi%dis%bot(ic)
314 sat = this%fmi%gwfsat(ic)
315 z = bot + zrel * sat * (top - bot)
324 real(DP),
intent(in) :: tmax
326 call this%track(particle, 1, tmax)
333 integer(I4B),
intent(in) :: ic
336 call this%load_properties(ic, defn)
337 call this%load_polygon(defn)
338 call this%load_neighbors(defn)
339 call this%load_indicators(defn)
340 call this%load_flows(defn)
347 integer(I4B),
intent(in) :: ic
353 integer(I4B) :: icu, icpl, ilay
356 defn%iatop =
get_iatop(this%fmi%dis%get_ncpl(), &
357 this%fmi%dis%get_nodeuser(ic))
358 top = this%fmi%dis%top(ic)
359 bot = this%fmi%dis%bot(ic)
360 sat = this%fmi%gwfsat(ic)
361 top = bot + sat * (top - bot)
365 defn%porosity = this%porosity(ic)
366 defn%retfactor = this%retfactor(ic)
367 defn%izone = this%izone(ic)
368 select type (dis => this%fmi%dis)
370 icu = dis%get_nodeuser(ic)
371 call get_jk(icu, dis%ncpl, dis%nlay, icpl, ilay)
381 call this%fmi%dis%get_polyverts( &
385 defn%npolyverts =
size(defn%polyvert, dim=2) - 1
405 integer(I4B) :: istart1
406 integer(I4B) :: istart2
407 integer(I4B) :: istop1
408 integer(I4B) :: istop2
409 integer(I4B) :: isharedface
411 integer(I4B) :: nfaces
412 integer(I4B) :: nslots
415 nfaces = defn%npolyverts + 3
416 nslots =
size(defn%facenbr)
417 if (nslots < nfaces)
call expandarray(defn%facenbr, nfaces - nslots)
419 select type (dis => this%fmi%dis)
424 icu1 = dis%get_nodeuser(ic1)
425 ncpl = dis%get_ncpl()
426 call get_jk(icu1, ncpl, dis%nlay, j1, k1)
427 istart1 = dis%iavert(j1)
428 istop1 = dis%iavert(j1 + 1) - 1
429 do iloc = 1, dis%con%ia(ic1 + 1) - dis%con%ia(ic1) - 1
430 ipos = dis%con%ia(ic1) + iloc
432 if (dis%con%mask(ipos) == 0) cycle
433 ic2 = dis%con%ja(ipos)
434 icu2 = dis%get_nodeuser(ic2)
435 call get_jk(icu2, ncpl, dis%nlay, j2, k2)
436 istart2 = dis%iavert(j2)
437 istop2 = dis%iavert(j2 + 1) - 1
439 dis%javert(istart2:istop2), &
441 if (isharedface /= 0)
then
443 defn%facenbr(isharedface) = int(iloc, 1)
447 defn%facenbr(defn%npolyverts + 2) = int(iloc, 1)
448 else if (k2 < k1)
then
450 defn%facenbr(defn%npolyverts + 3) = int(iloc, 1)
452 call pstop(1,
"k2 should be <> k1, since no shared edge face")
458 defn%facenbr(defn%npolyverts + 1) = defn%facenbr(1)
469 integer(I4B) :: nfaces
470 integer(I4B) :: nslots
473 nfaces = defn%npolyverts + 3
474 nslots =
size(defn%faceflow)
475 if (nslots < nfaces)
call expandarray(defn%faceflow, nfaces - nslots)
481 defn%faceflow =
dzero
483 call this%load_boundary_flows_to_defn_poly(defn)
484 call this%load_face_flows_to_defn_poly(defn)
487 defn%distflow = this%fmi%SourceFlows(defn%icell) + &
488 this%fmi%SinkFlows(defn%icell) + &
489 this%fmi%StorageFlows(defn%icell)
492 if (this%fmi%SinkFlows(defn%icell) .ne.
dzero)
then
504 integer(I4B) :: m, n, nfaces
507 nfaces = defn%npolyverts + 3
511 q = this%fmi%gwfflowja(this%fmi%dis%con%ia(defn%icell) + n)
512 defn%faceflow(m) = defn%faceflow(m) + q
514 if (defn%faceflow(m) <
dzero) defn%inoexitface = 0
525 integer(I4B) :: ioffset
529 ioffset = (defn%icell - 1) * 10
530 defn%faceflow(1) = defn%faceflow(1) + &
531 this%fmi%BoundaryFlows(ioffset + 4)
532 defn%faceflow(2) = defn%faceflow(2) + &
533 this%fmi%BoundaryFlows(ioffset + 2)
534 defn%faceflow(3) = defn%faceflow(3) + &
535 this%fmi%BoundaryFlows(ioffset + 3)
536 defn%faceflow(4) = defn%faceflow(4) + &
537 this%fmi%BoundaryFlows(ioffset + 1)
538 defn%faceflow(5) = defn%faceflow(1)
539 defn%faceflow(6) = defn%faceflow(6) + &
540 this%fmi%BoundaryFlows(ioffset + 9)
541 defn%faceflow(7) = defn%faceflow(7) + &
542 this%fmi%BoundaryFlows(ioffset + 10)
555 integer(I4B) :: ioffset
559 integer(I4B) :: mdiff
561 integer(I4B) :: irectvert(5)
563 ioffset = (defn%icell - 1) * 10
569 else if (n .eq. 4)
then
574 qbf = this%fmi%BoundaryFlows(ioffset + nbf)
576 do m = 1, defn%npolyverts
577 if (.not. defn%ispv180(m))
then
582 irectvert(5) = irectvert(1)
584 m2 = irectvert(n + 1)
585 if (m2 .lt. m1) m2 = m2 + defn%npolyverts
587 if (mdiff .eq. 1)
then
589 defn%faceflow(m1) = defn%faceflow(m1) + qbf
593 defn%faceflow(m1) = defn%faceflow(m1) + qbf
594 defn%faceflow(m1 + 1) = defn%faceflow(m1 + 1) + qbf
598 m = defn%npolyverts + 1
599 defn%faceflow(m) = defn%faceflow(1)
602 defn%faceflow(m) = defn%faceflow(m) + &
603 this%fmi%BoundaryFlows(ioffset + 9)
606 defn%faceflow(m) = defn%faceflow(m) + &
607 this%fmi%BoundaryFlows(ioffset + 10)
619 integer(I4B) :: npolyverts
620 integer(I4B) :: ioffset
624 npolyverts = defn%npolyverts
627 do iv = 1, npolyverts
628 defn%faceflow(iv) = &
629 defn%faceflow(iv) + &
630 this%fmi%BoundaryFlows(ioffset + iv)
632 defn%faceflow(npolyverts + 1) = defn%faceflow(1)
633 defn%faceflow(npolyverts + 2) = &
634 defn%faceflow(npolyverts + 2) + &
636 defn%faceflow(npolyverts + 3) = &
637 defn%faceflow(npolyverts + 3) + &
651 integer(I4B) :: npolyverts
657 integer(I4B) :: num90
658 integer(I4B) :: num180
669 s0mag, s2x, s2y, s2mag, sinang, cosang, dotprod
673 npolyverts = defn%npolyverts
675 if (
size(defn%ispv180) < npolyverts + 3) &
678 defn%ispv180(1:npolyverts + 1) = .false.
679 defn%can_be_rect = .false.
680 defn%can_be_quad = .false.
692 else if (m1 .eq. npolyverts)
then
699 x0 = defn%polyvert(1, m0)
700 y0 = defn%polyvert(2, m0)
701 x1 = defn%polyvert(1, m1)
702 y1 = defn%polyvert(2, m1)
703 x2 = defn%polyvert(1, m2)
704 y2 = defn%polyvert(2, m2)
707 s0mag = dsqrt(s0x * s0x + s0y * s0y)
710 s2mag = dsqrt(s2x * s2x + s2y * s2y)
711 sinang = (s0x * s2y - s0y * s2x) / (s0mag * s2mag)
712 cosang = dsqrt(dabs(
done - (sinang * sinang)))
713 if (dabs(sinang) .lt. epsang)
then
714 dotprod = s0x * s2x + s0y * s2y
715 if (dotprod .lt.
dzero)
then
718 defn%ispv180(m) = .true.
721 if (dabs(cosang) .lt. epsang) num90 = num90 + 1
727 defn%ispv180(npolyverts + 1) = defn%ispv180(1)
730 if (num90 .eq. 4)
then
731 if (num180 .eq. 0)
then
732 defn%can_be_rect = .true.
734 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 tracking method to a particle.
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.