MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
MethodSubcell.f90
Go to the documentation of this file.
2  use kindmodule, only: dp, i4b
3  use errorutilmodule, only: pstop
10 
11  private
12  public :: methodsubcelltype
13 
14  !> @brief Abstract base type for subcell tracking methods
15  type, abstract, extends(methodcelltype) :: methodsubcelltype
16  contains
17  procedure, public :: assess
18  procedure, public :: subcellexit
19  procedure, public :: get_level
20  end type methodsubcelltype
21 
22 contains
23 
24  !> @brief Assess conditions before tracking
25  subroutine assess(this, particle, cell_defn, tmax)
26  ! dummy
27  class(methodsubcelltype), intent(inout) :: this
28  type(particletype), pointer, intent(inout) :: particle
29  type(celldefntype), pointer, intent(inout) :: cell_defn
30  real(DP), intent(in) :: tmax
31  ! noop
32  end subroutine assess
33 
34  !> @brief Particle exits a subcell.
35  subroutine subcellexit(this, particle)
36  class(methodsubcelltype), intent(inout) :: this
37  type(particletype), pointer, intent(inout) :: particle
38  class(particleeventtype), pointer :: event
39  ! local
40  integer(I4B) :: i, nhist
41  class(*), pointer :: prev
42 
43  allocate (subcellexiteventtype :: event)
44  select type (event)
45  type is (subcellexiteventtype)
46  event%isc = particle%itrdomain(level_subfeature)
47  event%exit_face = particle%iboundary(level_subfeature)
48  end select
49  call this%events%broadcast(particle, event)
50  if (particle%icycwin == 0) then
51  deallocate (event)
52  return
53  end if
54  if (this%forms_cycle(particle, event)) then
55  print *, "Cyclic subcell pathline detected"
56  nhist = particle%history%Count()
57  do i = 1, nhist
58  prev => particle%history%GetItem(i)
59  select type (prev)
60  class is (particleeventtype)
61  print *, "Back ", nhist - i + 1, ": ", prev%get_text()
62  end select
63  end do
64  print *, "Current :", event%get_text()
65  call pstop(1, 'Cyclic subcell pathline detected, aborting')
66  else
67  call this%store_event(particle, event)
68  end if
69  end subroutine subcellexit
70 
71  !> @brief Get the subcell method's level.
72  function get_level(this) result(level)
73  class(methodsubcelltype), intent(in) :: this
74  integer(I4B) :: level
75  level = level_subfeature
76  end function get_level
77 
78 end module methodsubcellmodule
subroutine pstop(status, message)
Stop the program, optionally specifying an error status code.
Definition: ErrorUtil.f90:24
This module defines variable data types.
Definition: kind.f90:8
Particle tracking strategies.
Definition: Method.f90:2
@, public level_subfeature
Definition: Method.f90:42
subroutine subcellexit(this, particle)
Particle exits a subcell.
integer(i4b) function get_level(this)
Get the subcell method's level.
Base grid cell definition.
Definition: CellDefn.f90:25
Abstract base type for subcell tracking methods.
Base type for particle events.
Particle tracked by the PRT model.
Definition: Particle.f90:62