MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
ParticleEvent.f90
Go to the documentation of this file.
2  use kindmodule, only: dp, i4b, lgp
4  use errorutilmodule, only: pstop
6  implicit none
7 
8  private
9  public :: particleeventtype
10  public :: release
11  public :: featexit
12  public :: timestep
13  public :: terminate
14  public :: weaksink
15  public :: usertime
16  public :: dropped
17 
18  !> @brief Particle event enumeration.
19  !!
20  !! A number of events may occur to particles, each of which may (or may
21  !! not) be of interest to the user. The user selects events to report.
22  !<
23  enum, bind(C)
24  enumerator :: release = 0 !< particle was released
25  enumerator :: featexit = 1 !< particle exited a grid feature
26  enumerator :: timestep = 2 !< time step ended
27  enumerator :: terminate = 3 !< particle terminated
28  enumerator :: weaksink = 4 !< particle entered a weak sink
29  enumerator :: usertime = 5 !< user-specified tracking time
30  enumerator :: dropped = 6 !< particle dropped to the water table
31  end enum
32 
33  !> @brief Base type for particle events.
34  !!
35  !! Events may be identical except for their type/code, reflecting the
36  !! fact that several events of interest may occur at a given moment.
37  type, abstract :: particleeventtype
38  integer(I4B) :: imdl, iprp, irpt ! release model, package, and point
39  real(dp) :: trelease = 0.0_dp ! release time
40  integer(I4B) :: kper = 0, kstp = 0 ! period and step
41  integer(I4B) :: ilay, icu, izone = 0
42  real(dp) :: ttrack = 0.0_dp ! simulation time
43  real(dp) :: x = 0.0_dp, y = 0.0_dp, z = 0.0_dp ! particle position
44  integer(I4B) :: istatus = -1 ! status code
45  contains
46  procedure(get_int), deferred :: get_code
47  procedure(get_str), deferred :: get_verb
48  procedure(get_str), deferred :: get_text
49  procedure :: log
50  end type particleeventtype
51 
52  abstract interface
53  function get_int(this) result(int)
54  IMPORT i4b
55  IMPORT particleeventtype
56  class(particleeventtype), intent(in) :: this
57  integer(I4B) :: int
58  end function get_int
59 
60  function get_str(this) result(str)
61  IMPORT particleeventtype
62  class(particleeventtype), intent(in) :: this
63  character(len=:), allocatable :: str
64  end function get_str
65  end interface
66 
67 contains
68 
69  subroutine log(this, iun)
70  class(particleeventtype), intent(inout) :: this
71  integer(I4B), intent(in) :: iun
72  if (iun >= 0) write (iun, '(*(G0))') this%get_text()
73  end subroutine log
74 
75 end module particleeventmodule
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter lenhugeline
maximum length of a huge line
Definition: Constants.f90:16
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
@, public featexit
particle exited a grid feature
@, public dropped
particle dropped to the water table
@, public weaksink
particle entered a weak sink
@, public usertime
user-specified tracking time
subroutine log(this, iun)
@, public release
particle was released
@, public terminate
particle terminated
@, public timestep
time step ended
Base type for particle events.
Particle tracked by the PRT model.
Definition: Particle.f90:56