MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
timestepselectmodule Module Reference

Time step selection module.

Data Types

type  timestepselecttype
 Time step selection type. More...

Functions/Subroutines

subroutine deallocate (this)
 Deallocate the time step selection object.
subroutine init (this)
 Initialize the time step selection object.
subroutine log (this, iout, verb)
subroutine read (this, line)
 Read a line of input and prepare the selection object.
logical function is_selected (this, kstp, endofperiod)
 Indicates whether the given time step is selected.
logical function any (this)
 Indicates whether any time steps are selected.

Function/Subroutine Documentation

◆ any()

logical function timestepselectmodule::any ( class(timestepselecttype) this)
private
Parameters
thisthis instance

Definition at line 180 of file TimeStepSelect.f90.

181 class(TimeStepSelectType) :: this !< this instance
182 a = (this%all .or. &
183 this%first .or. &
184 this%last .or. &
185 this%freq > 0 .or. &
186 size(this%steps) > 0)

◆ deallocate()

subroutine timestepselectmodule::deallocate ( class(timestepselecttype) this)

Definition at line 58 of file TimeStepSelect.f90.

59 class(TimeSTepSelectType) :: this
60 deallocate (this%steps)

◆ init()

subroutine timestepselectmodule::init ( class(timestepselecttype) this)
private
Parameters
thisthis instance

Definition at line 64 of file TimeStepSelect.f90.

65 class(TimeStepSelectType) :: this !< this instance
66
67 if (allocated(this%steps)) deallocate (this%steps)
68 allocate (this%steps(0))
69 this%freq = 0
70 this%first = .false.
71 this%last = .false.
72 this%all = .false.

◆ is_selected()

logical function timestepselectmodule::is_selected ( class(timestepselecttype) this,
integer(i4b), intent(in) kstp,
logical(lgp), intent(in), optional endofperiod )
private
Parameters
thisthis instance
[in]kstpcurrent time step
[in]endofperiodwhether last step of stress period

Definition at line 146 of file TimeStepSelect.f90.

147 ! dummy
148 class(TimeStepSelectType) :: this !< this instance
149 integer(I4B), intent(in) :: kstp !< current time step
150 logical(LGP), intent(in), optional :: endofperiod !< whether last step of stress period
151 ! local
152 integer(I4B) :: i, n
153 logical(LGP) :: lend
154
155 if (present(endofperiod)) then
156 lend = endofperiod
157 else
158 lend = .false.
159 end if
160
161 is_selected = .false.
162 if (this%all) is_selected = .true.
163 if (kstp == 1 .and. this%first) is_selected = .true.
164 if (lend .and. this%last) is_selected = .true.
165 if (this%freq > 0) then
166 if (mod(kstp, this%freq) == 0) is_selected = .true.
167 end if
168 n = size(this%steps)
169 if (n > 0) then
170 do i = 1, n
171 if (kstp == this%steps(i)) then
172 is_selected = .true.
173 exit
174 end if
175 end do
176 end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ log()

subroutine timestepselectmodule::log ( class(timestepselecttype) this,
integer(i4b), intent(in) iout,
character(len=*), intent(in) verb )
private
Parameters
thisthis instance
[in]ioutoutput unit
[in]verbselection name

Definition at line 75 of file TimeStepSelect.f90.

76 ! dummy
77 class(TimeStepSelectType) :: this !< this instance
78 integer(I4B), intent(in) :: iout !< output unit
79 character(len=*), intent(in) :: verb !< selection name
80 ! formats
81 character(len=*), parameter :: fmt_steps = &
82 &"(6x,'THE FOLLOWING STEPS WILL BE ',A,': ',50(I0,' '))"
83 character(len=*), parameter :: fmt_freq = &
84 &"(6x,'THE FOLLOWING FREQUENCY WILL BE ',A,': ',I0)"
85
86 if (this%all) then
87 write (iout, "(6x,a,a)") 'ALL TIME STEPS WILL BE ', verb
88 end if
89 if (size(this%steps) > 0) then
90 write (iout, fmt_steps) verb, this%steps
91 end if
92 if (this%freq > 0) then
93 write (iout, fmt_freq) verb, this%freq
94 end if
95 if (this%first) then
96 write (iout, "(6x,a,a)") 'THE FIRST TIME STEP WILL BE ', verb
97 end if
98 if (this%last) then
99 write (iout, "(6x,a,a)") 'THE LAST TIME STEP WILL BE ', verb
100 end if

◆ read()

subroutine timestepselectmodule::read ( class(timestepselecttype) this,
character(len=*), intent(in) line )
private
Parameters
thisthis instance
[in]lineinput line

Definition at line 104 of file TimeStepSelect.f90.

105 class(TimeStepSelectType) :: this !< this instance
106 character(len=*), intent(in) :: line !< input line
107
108 character(len=len(line)) :: l
109 integer(I4B) :: n, lloc, istart, istop, ival
110 real(DP) :: rval
111
112 l(:) = line(:)
113 lloc = 1
114
115 call urword(l, lloc, istart, istop, 1, ival, rval, 0, 0)
116 select case (l(istart:istop))
117 case ('ALL')
118 this%all = .true.
119 case ('STEPS')
120 listsearch: do
121 call urword(l, lloc, istart, istop, 2, ival, rval, -1, 0)
122 if (ival > 0) then
123 n = size(this%steps)
124 call expandarray(this%steps)
125 this%steps(n + 1) = ival
126 cycle listsearch
127 end if
128 exit listsearch
129 end do listsearch
130 case ('FREQUENCY')
131 call urword(l, lloc, istart, istop, 2, ival, rval, -1, 0)
132 this%freq = ival
133 case ('FIRST')
134 this%first = .true.
135 case ('LAST')
136 this%last = .true.
137 case default
138 write (errmsg, '(2a)') &
139 'Looking for ALL, STEPS, FIRST, LAST, OR FREQUENCY. Found: ', &
140 trim(adjustl(line))
141 call store_error(errmsg, terminate=.true.)
142 end select
Here is the call graph for this function: