MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
timeselectmodule::timeselecttype Type Reference

Represents a series of instants at which some event should occur. More...

Collaboration diagram for timeselectmodule::timeselecttype:
Collaboration graph

Public Member Functions

procedure deallocate (this)
 Deallocate the time selection object.
procedure expand (this, increment)
 Expand capacity by the given amount. Resets the current slice.
procedure init (this)
 Initialize or clear the time selection object.
procedure increasing (this)
 Determine if times strictly increase.
procedure log (this, iout, verb)
 Show the current time selection, if any.
procedure select (this, t0, t1, changed)
 Select times in the interval (t0, t1] (exclusive lower, inclusive upper).
procedure advance (this)
 Update the selection to the current time step.
procedure any (this)
 Check if any times are currently selected.
procedure count (this)
 Return the number of times currently selected.
procedure sort (this)
 Sort the time selection in increasing order.
procedure extend (this, a)
 Extend the time selection with the given array.
procedure contains_close (this, t, tolerance)
 Check whether any configured time is within tolerance of t.

Public Attributes

real(dp), dimension(:), allocatable times
integer(i4b), dimension(2) selection

Detailed Description

Maintains an array of configured times which can be sliced to match e.g. the current period & time step. Slicing can be performed manually, with the select() routine, or automatically, with the advance() routine, for a convenient view onto the applicable subset of the complete time array.

Time selection uses the interval convention (t0, t1] (exclusive lower bound, inclusive upper bound). This ensures times at exact time step boundaries are captured by the earlier time step without duplication.

Array storage can be expanded manually. Note: array expansion must take place before selection; when expand() is called the selection is wiped. Alternatively, the extend() routine will automatically expand the array and sort it.

Most use cases likely assume a strictly increasing time selection; this can be checked with increasing(). Note that the sort() routine does not check for duplicates, and should usually be followed by an increasing() check before the time selection is used.

Definition at line 35 of file TimeSelect.f90.

Member Function/Subroutine Documentation

◆ advance()

procedure timeselectmodule::timeselecttype::advance ( class(timeselecttype) this)

Definition at line 45 of file TimeSelect.f90.

◆ any()

procedure timeselectmodule::timeselecttype::any ( class(timeselecttype) this)

Indicates whether any times are selected for the current time step.

Note that this routine does NOT indicate whether the times array has nonzero size; use the size intrinsic for that.

Definition at line 46 of file TimeSelect.f90.

◆ contains_close()

procedure timeselectmodule::timeselecttype::contains_close ( class(timeselecttype) this,
real(dp), intent(in) t,
real(dp), intent(in) tolerance )

Unlike any()/select(), this checks the full array of times, not just the current time step's slice. Useful for deduplicating: times may come from multiple sources (e.g. period block configuration and an explicitly specified set of release times).

Definition at line 50 of file TimeSelect.f90.

◆ count()

procedure timeselectmodule::timeselecttype::count ( class(timeselecttype) this)

Returns the number of times selected for the current time step.

Note that this routine does NOT return the total size of the times array; use the size intrinsic for that.

Definition at line 47 of file TimeSelect.f90.

◆ deallocate()

procedure timeselectmodule::timeselecttype::deallocate ( class(timeselecttype) this)

Definition at line 39 of file TimeSelect.f90.

◆ expand()

procedure timeselectmodule::timeselecttype::expand ( class(timeselecttype) this,
integer(i4b), intent(in), optional increment )

Definition at line 40 of file TimeSelect.f90.

◆ extend()

procedure timeselectmodule::timeselecttype::extend ( class(timeselecttype) this,
real(dp), dimension(:) a )

This routine sorts the selection after appending the elements of the given array, but users should likely still call increasing() to check for duplicate times.

Definition at line 49 of file TimeSelect.f90.

◆ increasing()

procedure timeselectmodule::timeselecttype::increasing ( class(timeselecttype) this)

Returns true if the times array strictly increases, as well as if the times array is empty, or not yet allocated. Note that this function operates on the entire times array, not the current selection. Note also that this function conducts exact comparisons; deduplication with tolerance must be done manually.

Definition at line 42 of file TimeSelect.f90.

◆ init()

procedure timeselectmodule::timeselecttype::init ( class(timeselecttype) this)

Definition at line 41 of file TimeSelect.f90.

◆ log()

procedure timeselectmodule::timeselecttype::log ( class(timeselecttype) this,
integer(i4b), intent(in) iout,
character(len=*), intent(in) verb )
Parameters
thisthis instance
[in]ioutoutput unit
[in]verbselection name

Definition at line 43 of file TimeSelect.f90.

◆ select()

procedure timeselectmodule::timeselecttype::select ( class(timeselecttype) this,
real(dp), intent(in) t0,
real(dp), intent(in) t1,
logical(lgp), intent(inout), optional changed )

Finds and stores the index of the first time strictly after the start time, and of the last time at or before the end time. This interval convention ensures that times at exact time step boundaries are captured by the later (earlier in simulation time) step without duplication.

Allows filtering the times for e.g. a particular stress period and time step. Array indices are assumed to start at 1. If no times are found to fall within the selection (i.e. the interval falls entirely between two consecutive times or beyond the time range), indices are set to [-1, -1].

The given start and end times are first checked against currently stored indices to avoid recalculating them if possible, allowing multiple consuming components (e.g., subdomain particle tracking solutions) to share the object efficiently, provided all proceed through stress periods and time steps in lockstep, i.e. they all solve any given period/step before any will proceed to the next.

Definition at line 44 of file TimeSelect.f90.

◆ sort()

procedure timeselectmodule::timeselecttype::sort ( class(timeselecttype) this)

Note that this routine does NOT remove duplicate times. Call increasing() to check for duplicates in the array.

Definition at line 48 of file TimeSelect.f90.

Member Data Documentation

◆ selection

integer(i4b), dimension(2) timeselectmodule::timeselecttype::selection

Definition at line 37 of file TimeSelect.f90.

37 integer(I4B) :: selection(2)

◆ times

real(dp), dimension(:), allocatable timeselectmodule::timeselecttype::times

Definition at line 36 of file TimeSelect.f90.

36 real(DP), allocatable :: times(:)

The documentation for this type was generated from the following file:
  • /home/runner/work/modflow6/modflow6/src/Model/ModelUtilities/TimeSelect.f90