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
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 
17  !> @brief Particle event enumeration.
18  !!
19  !! A number of events may occur to particles, each of which may (or may
20  !! not) be of interest to the user. The user selects events to report.
21  !<
22  enum, bind(C)
23  enumerator :: release = 0 !< particle was released
24  enumerator :: featexit = 1 !< particle exited a grid feature
25  enumerator :: timestep = 2 !< time step ended
26  enumerator :: terminate = 3 !< particle terminated
27  enumerator :: weaksink = 4 !< particle entered a weak sink
28  enumerator :: usertime = 5 !< user-specified tracking time
29  end enum
30 
31  !> @brief Base type for particle events.
32  !!
33  !! Events may be identical except for their type/code, reflecting the
34  !! fact that several events of interest may occur at a given moment.
35  type, abstract :: particleeventtype
36  integer(I4B) :: imdl, iprp, irpt ! release model, package, and point
37  real(dp) :: trelease = 0.0_dp ! release time
38  integer(I4B) :: kper = 0, kstp = 0 ! period and step
39  integer(I4B) :: ilay, icu, izone = 0
40  real(dp) :: ttrack = 0.0_dp ! simulation time
41  real(dp) :: x = 0.0_dp, y = 0.0_dp, z = 0.0_dp ! particle position
42  integer(I4B) :: istatus = -1 ! status code
43  contains
44  procedure(get_int), deferred :: get_code
45  procedure(get_str), deferred :: get_verb
46  procedure(get_str), deferred :: get_text
47  procedure :: log
48  end type particleeventtype
49 
50  abstract interface
51  function get_int(this) result(int)
52  IMPORT i4b
53  IMPORT particleeventtype
54  class(particleeventtype), intent(in) :: this
55  integer(I4B) :: int
56  end function get_int
57 
58  function get_str(this) result(str)
59  IMPORT particleeventtype
60  class(particleeventtype), intent(in) :: this
61  character(len=:), allocatable :: str
62  end function get_str
63  end interface
64 
65 contains
66 
67  subroutine log(this, iun)
68  class(particleeventtype), intent(inout) :: this
69  integer(I4B), intent(in) :: iun
70  if (iun >= 0) write (iun, '(*(G0))') this%get_text()
71  end subroutine log
72 
73 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 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