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%frctrn) 
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       call this%map_neighbor(cell%defn, inface, z)
 
  191     integer(I4B) :: idiag
 
  194     idiag = this%fmi%dis%con%ia(cell%defn%icell)
 
  199     this%flowja(ipos) = this%flowja(ipos) - 
done 
  202     this%flowja(this%fmi%dis%con%isym(ipos)) &
 
  203       = this%flowja(this%fmi%dis%con%isym(ipos)) + 
done 
  216     integer(I4B) :: iface
 
  217     logical(LGP) :: no_neighbors
 
  219     select type (c => this%cell)
 
  223       no_neighbors = cell%defn%facenbr(iface) == 0
 
  226       if (no_neighbors) 
then 
  231       call this%load_particle(cell, particle)
 
  232       call this%update_flowja(cell, particle)
 
  241     integer(I4B), 
intent(inout) :: inface
 
  242     double precision, 
intent(inout) :: z
 
  245     integer(I4B) :: npolyvertsin
 
  247     integer(I4B) :: npolyverts
 
  249     integer(I4B) :: inbrnbr
 
  260     inbr = defn%facenbr(inface)
 
  261     if (inbr .eq. 0) 
then 
  268       j = this%fmi%dis%con%ia(icin)
 
  269       ic = this%fmi%dis%con%ja(j + inbr)
 
  270       call this%load_cell_defn(ic, this%neighbor)
 
  272       npolyvertsin = defn%npolyverts
 
  273       npolyverts = this%neighbor%npolyverts
 
  274       if (inface .eq. npolyvertsin + 2) 
then 
  276         inface = npolyverts + 3
 
  277       else if (inface .eq. npolyvertsin + 3) 
then 
  279         inface = npolyverts + 2
 
  282         j = this%fmi%dis%con%ia(ic)
 
  283         do m = 1, npolyverts + 3
 
  284           inbrnbr = this%neighbor%facenbr(m)
 
  285           if (this%fmi%dis%con%ja(j + inbrnbr) .eq. icin) 
then 
  293         zrel = (z - botfrom) / (topfrom - botfrom)
 
  294         top = this%fmi%dis%top(ic)
 
  295         bot = this%fmi%dis%bot(ic)
 
  296         sat = this%fmi%gwfsat(ic)
 
  297         z = bot + zrel * sat * (top - bot)
 
  306     real(DP), 
intent(in) :: tmax
 
  308     call this%track(particle, 1, tmax)
 
  315     integer(I4B), 
intent(in) :: ic
 
  318     call this%load_cell_properties(ic, defn)
 
  319     call this%load_cell_polygon(defn)
 
  320     call this%load_cell_neighbors(defn)
 
  321     call this%load_cell_saturation_status(defn)
 
  322     call this%load_cell_flags(defn)
 
  323     call this%load_cell_flows(defn)
 
  330     integer(I4B), 
intent(in) :: ic
 
  336     integer(I4B) :: icu, icpl, ilay
 
  339     defn%iatop = 
get_iatop(this%fmi%dis%get_ncpl(), &
 
  340                            this%fmi%dis%get_nodeuser(ic))
 
  341     top = this%fmi%dis%top(ic)
 
  342     bot = this%fmi%dis%bot(ic)
 
  343     sat = this%fmi%gwfsat(ic)
 
  344     top = bot + sat * (top - bot)
 
  348     defn%porosity = this%porosity(ic)
 
  349     defn%retfactor = this%retfactor(ic)
 
  350     defn%izone = this%izone(ic)
 
  351     select type (dis => this%fmi%dis)
 
  353       icu = dis%get_nodeuser(ic)
 
  354       call get_jk(icu, dis%ncpl, dis%nlay, icpl, ilay)
 
  365     call this%fmi%dis%get_polyverts( &
 
  369     defn%npolyverts = 
size(defn%polyvert, dim=2) - 1
 
  389     integer(I4B) :: istart1
 
  390     integer(I4B) :: istart2
 
  391     integer(I4B) :: istop1
 
  392     integer(I4B) :: istop2
 
  393     integer(I4B) :: isharedface
 
  395     integer(I4B) :: nfaces
 
  396     integer(I4B) :: nslots
 
  399     nfaces = defn%npolyverts + 3
 
  400     nslots = 
size(defn%facenbr)
 
  401     if (nslots < nfaces) 
call expandarray(defn%facenbr, nfaces - nslots)
 
  403     select type (dis => this%fmi%dis)
 
  408       icu1 = dis%get_nodeuser(ic1)
 
  409       ncpl = dis%get_ncpl()
 
  410       call get_jk(icu1, ncpl, dis%nlay, j1, k1)
 
  411       istart1 = dis%iavert(j1)
 
  412       istop1 = dis%iavert(j1 + 1) - 1
 
  413       do iloc = 1, dis%con%ia(ic1 + 1) - dis%con%ia(ic1) - 1
 
  414         ipos = dis%con%ia(ic1) + iloc
 
  416         if (dis%con%mask(ipos) == 0) cycle
 
  417         ic2 = dis%con%ja(ipos)
 
  418         icu2 = dis%get_nodeuser(ic2)
 
  419         call get_jk(icu2, ncpl, dis%nlay, j2, k2)
 
  420         istart2 = dis%iavert(j2)
 
  421         istop2 = dis%iavert(j2 + 1) - 1
 
  423                          dis%javert(istart2:istop2), &
 
  425         if (isharedface /= 0) 
then 
  427           defn%facenbr(isharedface) = int(iloc, 1)
 
  431             defn%facenbr(defn%npolyverts + 2) = int(iloc, 1)
 
  432           else if (k2 < k1) 
then 
  434             defn%facenbr(defn%npolyverts + 3) = int(iloc, 1)
 
  436             call pstop(1, 
"k2 should be <> k1, since no shared edge face")
 
  442     defn%facenbr(defn%npolyverts + 1) = defn%facenbr(1)
 
  453     integer(I4B) :: nfaces, nslots
 
  456     nfaces = defn%npolyverts + 3
 
  457     nslots = 
size(defn%faceflow)
 
  458     if (nslots < nfaces) 
call expandarray(defn%faceflow, nfaces - nslots)
 
  464     defn%faceflow = 
dzero 
  465     call this%load_cell_boundary_flows(defn)
 
  466     call this%load_cell_face_flows(defn)
 
  467     call this%cap_cell_wt_flow(defn)
 
  468     call this%load_cell_no_exit_face(defn)
 
  471     defn%distflow = this%fmi%SourceFlows(defn%icell) + &
 
  472                     this%fmi%SinkFlows(defn%icell) + &
 
  473                     this%fmi%StorageFlows(defn%icell)
 
  476     if (this%fmi%SinkFlows(defn%icell) .ne. 
dzero) 
then 
  488     integer(I4B) :: m, n, nfaces
 
  491     nfaces = defn%npolyverts + 3
 
  495         q = this%fmi%gwfflowja(this%fmi%dis%con%ia(defn%icell) + n)
 
  496         defn%faceflow(m) = defn%faceflow(m) + q
 
  509     integer(I4B) :: ic, iv, ioffset, npolyverts, max_faces
 
  512     npolyverts = defn%npolyverts
 
  513     max_faces = this%fmi%max_faces
 
  514     ioffset = (ic - 1) * max_faces
 
  515     do iv = 1, npolyverts
 
  516       defn%faceflow(iv) = &
 
  517         defn%faceflow(iv) + &
 
  518         this%fmi%BoundaryFlows(ioffset + iv)
 
  520     defn%faceflow(npolyverts + 1) = defn%faceflow(1)
 
  521     defn%faceflow(npolyverts + 2) = &
 
  522       defn%faceflow(npolyverts + 2) + &
 
  523       this%fmi%BoundaryFlows(ioffset + max_faces - 1)
 
  524     defn%faceflow(npolyverts + 3) = &
 
  525       defn%faceflow(npolyverts + 3) + &
 
  526       this%fmi%BoundaryFlows(ioffset + max_faces)
 
  539     integer(I4B) :: npolyverts
 
  545     integer(I4B) :: num90
 
  546     integer(I4B) :: num180
 
  557       s0mag, s2x, s2y, s2mag, sinang, cosang, dotprod
 
  561     npolyverts = defn%npolyverts
 
  563     if (
size(defn%ispv180) < npolyverts + 3) &
 
  566     defn%ispv180(1:npolyverts + 1) = .false.
 
  567     defn%can_be_rect = .false.
 
  568     defn%can_be_quad = .false.
 
  580       else if (m1 .eq. npolyverts) 
then 
  587       x0 = defn%polyvert(1, m0)
 
  588       y0 = defn%polyvert(2, m0)
 
  589       x1 = defn%polyvert(1, m1)
 
  590       y1 = defn%polyvert(2, m1)
 
  591       x2 = defn%polyvert(1, m2)
 
  592       y2 = defn%polyvert(2, m2)
 
  595       s0mag = dsqrt(s0x * s0x + s0y * s0y)
 
  598       s2mag = dsqrt(s2x * s2x + s2y * s2y)
 
  599       sinang = (s0x * s2y - s0y * s2x) / (s0mag * s2mag)
 
  600       cosang = dsqrt(dabs(
done - (sinang * sinang)))
 
  601       if (dabs(sinang) .lt. epsang) 
then 
  602         dotprod = s0x * s2x + s0y * s2y
 
  603         if (dotprod .lt. 
dzero) 
then 
  606           defn%ispv180(m) = .true.
 
  609         if (dabs(cosang) .lt. epsang) num90 = num90 + 1
 
  615     defn%ispv180(npolyverts + 1) = defn%ispv180(1)
 
  618     if (num90 .eq. 4) 
then 
  619       if (num180 .eq. 0) 
then 
  620         defn%can_be_rect = .true.
 
  622         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_cell_boundary_flows(this, defn)
Load boundary flows from the grid into a polygonal cell. Assumes cell index and number of vertices ar...
 
subroutine load_cell_polygon(this, defn)
 
subroutine load_cell_flows(this, defn)
Load flows into the cell definition. These include face, boundary and net distributed flows....
 
subroutine load_cell_flags(this, defn)
Load 180-degree vertex indicator array and set flags indicating how cell can be represented....
 
subroutine map_neighbor(this, defn, inface, z)
Map location on cell face to shared cell face of neighbor.
 
subroutine load_cell_properties(this, ic, defn)
Loads cell properties to cell definition from the grid.
 
subroutine update_flowja(this, cell, particle)
 
subroutine load_cell_face_flows(this, defn)
 
subroutine load_cell_neighbors(this, defn)
Loads face neighbors to cell definition from the grid Assumes cell index and number of vertices are a...
 
subroutine load_disv(this, particle, next_level, submethod)
Load the cell and the tracking method.
 
subroutine load_particle(this, cell, particle)
 
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.