MODFLOW 6  version 6.7.0.dev2
USGS Modular Hydrologic Model
particleeventsmodule Module Reference

Data Types

type  particleeventconsumertype
 
type  particleeventdispatchertype
 
interface  handle_event
 

Functions/Subroutines

subroutine subscribe (this, consumer)
 Subscribe a consumer to the dispatcher. More...
 
subroutine unsubscribe (this)
 Unsubscribe the consumer from the dispatcher. More...
 
subroutine dispatch (this, particle, event)
 Dispatch an event. Internal use only. More...
 
subroutine destroy (this)
 Destroy the dispatcher. More...
 
subroutine release (this, particle)
 Particle is released. More...
 
subroutine cellexit (this, particle)
 Particle exits a cell. More...
 
subroutine terminate (this, particle, status)
 Particle terminates. More...
 
subroutine timestep (this, particle)
 Time step ends. More...
 
subroutine weaksink (this, particle)
 Particle leaves a weak sink. More...
 
subroutine usertime (this, particle)
 User-defined tracking time occurs. More...
 

Function/Subroutine Documentation

◆ cellexit()

subroutine particleeventsmodule::cellexit ( class(particleeventdispatchertype), intent(inout)  this,
type(particletype), intent(inout), pointer  particle 
)
private

Definition at line 115 of file ParticleEvents.f90.

116  class(ParticleEventDispatcherType), intent(inout) :: this
117  type(ParticleType), pointer, intent(inout) :: particle
118  class(ParticleEventType), pointer :: event
119 
120  allocate (cellexiteventtype :: event)
121  call this%dispatch(particle, event)

◆ destroy()

subroutine particleeventsmodule::destroy ( class(particleeventdispatchertype), intent(inout)  this)

Definition at line 98 of file ParticleEvents.f90.

99  class(ParticleEventDispatcherType), intent(inout) :: this
100  if (associated(this%consumer)) &
101  deallocate (this%consumer)

◆ dispatch()

subroutine particleeventsmodule::dispatch ( class(particleeventdispatchertype), intent(inout)  this,
type(particletype), intent(inout), pointer  particle,
class(particleeventtype), intent(inout), pointer  event 
)
private

Definition at line 63 of file ParticleEvents.f90.

64  use tdismodule, only: kper, kstp, totimc
65  ! dummy
66  class(ParticleEventDispatcherType), intent(inout) :: this
67  type(ParticleType), pointer, intent(inout) :: particle
68  class(ParticleEventType), pointer, intent(inout) :: event
69  ! local
70  integer(I4B) :: per, stp
71 
72  per = kper
73  stp = kstp
74 
75  ! If tracking time falls exactly on a boundary between time steps,
76  ! report the previous time step for this datum. This is to follow
77  ! MP7's behavior, and because the particle will have been tracked
78  ! up to this instant under the previous time step's conditions, so
79  ! the time step we're about to start shouldn't get "credit" for it.
80  if (particle%ttrack == totimc .and. (per > 1 .or. stp > 1)) then
81  if (stp > 1) then
82  stp = stp - 1
83  else if (per > 1) then
84  per = per - 1
85  stp = 1
86  end if
87  end if
88 
89  event%particle => particle
90  event%time = particle%ttrack
91  event%kper = per
92  event%kstp = stp
93  call this%consumer%handle_event(particle, event)
94  deallocate (event)
real(dp), pointer, public totimc
simulation time at start of time step
Definition: tdis.f90:33
integer(i4b), pointer, public kstp
current time step number
Definition: tdis.f90:24
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:23

◆ release()

subroutine particleeventsmodule::release ( class(particleeventdispatchertype), intent(inout)  this,
type(particletype), intent(inout), pointer  particle 
)
private

Definition at line 105 of file ParticleEvents.f90.

106  class(ParticleEventDispatcherType), intent(inout) :: this
107  type(ParticleType), pointer, intent(inout) :: particle
108  class(ParticleEventType), pointer :: event
109 
110  allocate (releaseeventtype :: event)
111  call this%dispatch(particle, event)

◆ subscribe()

subroutine particleeventsmodule::subscribe ( class(particleeventdispatchertype), intent(inout)  this,
class(particleeventconsumertype), intent(inout), target  consumer 
)
private

Definition at line 47 of file ParticleEvents.f90.

48  class(ParticleEventDispatcherType), intent(inout) :: this
49  class(ParticleEventConsumerType), target, intent(inout) :: consumer
50  this%consumer => consumer

◆ terminate()

subroutine particleeventsmodule::terminate ( class(particleeventdispatchertype), intent(inout)  this,
type(particletype), intent(inout), pointer  particle,
integer(i4b), intent(in), optional  status 
)
private

Definition at line 125 of file ParticleEvents.f90.

126  class(ParticleEventDispatcherType), intent(inout) :: this
127  type(ParticleType), pointer, intent(inout) :: particle
128  integer(I4B), intent(in), optional :: status
129  class(ParticleEventType), pointer :: event
130 
131  particle%advancing = .false.
132  if (present(status)) particle%istatus = status
133  allocate (terminationeventtype :: event)
134  call this%dispatch(particle, event)

◆ timestep()

subroutine particleeventsmodule::timestep ( class(particleeventdispatchertype), intent(inout)  this,
type(particletype), intent(inout), pointer  particle 
)
private

Definition at line 138 of file ParticleEvents.f90.

139  class(ParticleEventDispatcherType), intent(inout) :: this
140  type(ParticleType), pointer, intent(inout) :: particle
141  class(ParticleEventType), pointer :: event
142 
143  allocate (timestepeventtype :: event)
144  call this%dispatch(particle, event)

◆ unsubscribe()

subroutine particleeventsmodule::unsubscribe ( class(particleeventdispatchertype), intent(inout)  this)
private

Definition at line 54 of file ParticleEvents.f90.

55  class(ParticleEventDispatcherType), intent(inout) :: this
56  if (associated(this%consumer)) then
57  deallocate (this%consumer)
58  this%consumer => null()
59  end if

◆ usertime()

subroutine particleeventsmodule::usertime ( class(particleeventdispatchertype), intent(inout)  this,
type(particletype), intent(inout), pointer  particle 
)
private

Definition at line 158 of file ParticleEvents.f90.

159  class(ParticleEventDispatcherType), intent(inout) :: this
160  type(ParticleType), pointer, intent(inout) :: particle
161  class(ParticleEventType), pointer :: event
162 
163  allocate (usertimeeventtype :: event)
164  call this%dispatch(particle, event)

◆ weaksink()

subroutine particleeventsmodule::weaksink ( class(particleeventdispatchertype), intent(inout)  this,
type(particletype), intent(inout), pointer  particle 
)
private

Definition at line 148 of file ParticleEvents.f90.

149  class(ParticleEventDispatcherType), intent(inout) :: this
150  type(ParticleType), pointer, intent(inout) :: particle
151  class(ParticleEventType), pointer :: event
152 
153  allocate (weaksinkeventtype :: event)
154  call this%dispatch(particle, event)