MODFLOW 6  version 6.7.0.dev2
USGS Modular Hydrologic Model
ParticleEvent.f90
Go to the documentation of this file.
2  use kindmodule, only: dp, i4b, lgp
3  use errorutilmodule, only: pstop
5  implicit none
6 
7  private
8  public :: particleeventtype
12 
13  !> @brief Particle event enumeration.
14  !!
15  !! A number of events may occur to particles, each of which may (or may
16  !! not) be of interest to the user. The user selects events to report.
17  !<
18  enum, bind(C)
19  enumerator :: release = 0 !< particle was released
20  enumerator :: cellexit = 1 !< particle exited a cell
21  enumerator :: timestep = 2 !< time step ended
22  enumerator :: terminate = 3 !< particle terminated
23  enumerator :: weaksink = 4 !< particle exited a weak sink
24  enumerator :: usertime = 5 !< user-specified tracking time
25  end enum
26 
27  !> @brief Base type for particle events.
28  !!
29  !! Events may be identical except for their type/code, reflecting the
30  !! fact that several events of interest may occur at a given moment.
31  type, abstract :: particleeventtype
32  type(particletype), pointer :: particle => null() ! particle causing the event
33  integer(I4B) :: code = -1 ! event code
34  integer(I4B) :: kper = 0, kstp = 0 ! period and step
35  real(dp) :: time = 0.0_dp ! simulation time
36  contains
37  procedure :: get_code
38  procedure :: get_str
39  end type particleeventtype
40 
42  end type cellexiteventtype
43 
45  end type terminationeventtype
46 
48  end type releaseeventtype
49 
51  end type timestepeventtype
52 
54  end type weaksinkeventtype
55 
57  end type usertimeeventtype
58 
59 contains
60  integer function get_code(this) result(code)
61  class(particleeventtype), intent(in) :: this
62 
63  select type (this)
64  type is (releaseeventtype); code = 0
65  type is (cellexiteventtype); code = 1
66  type is (timestepeventtype); code = 2
67  type is (terminationeventtype); code = 3
68  type is (weaksinkeventtype); code = 4
69  type is (usertimeeventtype); code = 5
70  class default; call pstop(1, "unknown event type")
71  end select
72  end function get_code
73 
74  function get_str(this) result(str)
75  class(particleeventtype), intent(in) :: this
76  character(len=:), allocatable :: str
77 
78  select type (this)
79  type is (releaseeventtype); str = "released"
80  type is (cellexiteventtype); str = "exited cell"
81  type is (timestepeventtype); str = "completed timestep"
82  type is (terminationeventtype); str = "terminated"
83  type is (weaksinkeventtype); str = "exited weak sink"
84  type is (usertimeeventtype); str = "user-specified tracking time"
85  class default; call pstop(1, "unknown event type")
86  end select
87  end function get_str
88 
89 end module particleeventmodule
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
integer function get_code(this)
@, public weaksink
particle exited a weak sink
@, public usertime
user-specified tracking time
@, public release
particle was released
@, public cellexit
particle exited a cell
@, public terminate
particle terminated
@, public timestep
time step ended
character(len=:) function, allocatable get_str(this)
Base type for particle events.
Particle tracked by the PRT model.
Definition: Particle.f90:59