53 allocate (method%name)
57 method%delegates = .true.
64 deallocate (this%name)
68 subroutine load_disv(this, particle, next_level, submethod)
76 integer(I4B),
intent(in) :: next_level
77 class(
methodtype),
pointer,
intent(inout) :: submethod
84 select type (cell => this%cell)
86 ic = particle%itrdomain(next_level)
87 call this%load_cell_defn(ic, cell%defn)
88 if (this%fmi%ibdgwfsat0(ic) == 0)
then
95 tracktimes=this%tracktimes)
97 else if (particle%ifrctrn > 0)
then
102 events=this%events, &
103 tracktimes=this%tracktimes)
105 else if (cell%defn%can_be_rect)
then
113 events=this%events, &
114 tracktimes=this%tracktimes)
116 else if (cell%defn%can_be_quad)
then
124 events=this%events, &
125 tracktimes=this%tracktimes)
132 events=this%events, &
133 tracktimes=this%tracktimes)
149 integer(I4B) :: inface
154 integer(I4B) :: idiag
159 select type (dis => this%fmi%dis)
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
176 particle%izone = particle%izp
177 call this%terminate(particle, &
182 particle%izp = particle%izone
190 call this%map_neighbor(cell%defn, inface, z)
207 integer(I4B) :: idiag
210 idiag = this%fmi%dis%con%ia(cell%defn%icell)
215 this%flowja(ipos) = this%flowja(ipos) -
done
218 this%flowja(this%fmi%dis%con%isym(ipos)) &
219 = this%flowja(this%fmi%dis%con%isym(ipos)) +
done
233 select type (c => this%cell)
239 if (cell%defn%facenbr(particle%iboundary(
level_feature)) .eq. 0)
then
240 call this%terminate(particle, &
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, nslots
472 nfaces = defn%npolyverts + 3
473 nslots =
size(defn%faceflow)
474 if (nslots < nfaces)
call expandarray(defn%faceflow, nfaces - nslots)
480 defn%faceflow =
dzero
482 call this%load_boundary_flows_to_defn_poly(defn)
483 call this%load_face_flows_to_defn_poly(defn)
486 defn%distflow = this%fmi%SourceFlows(defn%icell) + &
487 this%fmi%SinkFlows(defn%icell) + &
488 this%fmi%StorageFlows(defn%icell)
491 if (this%fmi%SinkFlows(defn%icell) .ne.
dzero)
then
503 integer(I4B) :: m, n, nfaces
506 nfaces = defn%npolyverts + 3
510 q = this%fmi%gwfflowja(this%fmi%dis%con%ia(defn%icell) + n)
511 defn%faceflow(m) = defn%faceflow(m) + q
513 if (defn%faceflow(m) <
dzero) defn%inoexitface = 0
525 integer(I4B) :: ic, iv, ioffset, npolyverts, max_faces
528 npolyverts = defn%npolyverts
529 max_faces = this%fmi%max_faces
530 ioffset = (ic - 1) * max_faces
531 do iv = 1, npolyverts
532 defn%faceflow(iv) = &
533 defn%faceflow(iv) + &
534 this%fmi%BoundaryFlows(ioffset + iv)
536 defn%faceflow(npolyverts + 1) = defn%faceflow(1)
537 defn%faceflow(npolyverts + 2) = &
538 defn%faceflow(npolyverts + 2) + &
539 this%fmi%BoundaryFlows(ioffset + max_faces - 1)
540 defn%faceflow(npolyverts + 3) = &
541 defn%faceflow(npolyverts + 3) + &
542 this%fmi%BoundaryFlows(ioffset + max_faces)
555 integer(I4B) :: npolyverts
561 integer(I4B) :: num90
562 integer(I4B) :: num180
573 s0mag, s2x, s2y, s2mag, sinang, cosang, dotprod
577 npolyverts = defn%npolyverts
579 if (
size(defn%ispv180) < npolyverts + 3) &
582 defn%ispv180(1:npolyverts + 1) = .false.
583 defn%can_be_rect = .false.
584 defn%can_be_quad = .false.
596 else if (m1 .eq. npolyverts)
then
603 x0 = defn%polyvert(1, m0)
604 y0 = defn%polyvert(2, m0)
605 x1 = defn%polyvert(1, m1)
606 y1 = defn%polyvert(2, m1)
607 x2 = defn%polyvert(1, m2)
608 y2 = defn%polyvert(2, m2)
611 s0mag = dsqrt(s0x * s0x + s0y * s0y)
614 s2mag = dsqrt(s2x * s2x + s2y * s2y)
615 sinang = (s0x * s2y - s0y * s2x) / (s0mag * s2mag)
616 cosang = dsqrt(dabs(
done - (sinang * sinang)))
617 if (dabs(sinang) .lt. epsang)
then
618 dotprod = s0x * s2x + s0y * s2y
619 if (dotprod .lt.
dzero)
then
622 defn%ispv180(m) = .true.
625 if (dabs(cosang) .lt. epsang) num90 = num90 + 1
631 defn%ispv180(npolyverts + 1) = defn%ispv180(1)
634 if (num90 .eq. 4)
then
635 if (num180 .eq. 0)
then
636 defn%can_be_rect = .true.
638 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 ...
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_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 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.
@, public level_subfeature
@, public terminate
particle terminated
@ term_boundary
terminated at a boundary face
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.