The module contains the time definition of treelm.
It is useful to describe the progress in time of an explicit solver with respect to different measurements. Currently accounted are:
iter
)sim
)clock
)Thus, the time definition takes the following general form:
{sim = 1.0, iter = 12, clock = 60.0}
Any of these definitions may be left out. If the time definition is not a table the given value is interpreted as simultion time, equivalent to
{sim = 1.0}
For the handling of time evolution in an explicit solver, a time definition is needed to keep track of the current time. This should be initialized with tem_time_reset, and then advanced in each iteration by tem_time_advance. Time definitions in relation to this main time evolution object can then be defined in the Lua configuration by tem_time_load. For an explicit time stepping solver this would at least require one definition of time, when to stop the simulation. A comparison of such points in time to the current time can be done by tem_time_ge_trigger.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | tem_time_n_ids | = | 3 | Number of available different time definitions. |
integer, | public, | parameter | :: | tem_time_sim_id | = | 1 | Index for the simulation time. |
integer, | public, | parameter | :: | tem_time_iter_id | = | 2 | Index for the number of iterations. |
integer, | public, | parameter | :: | tem_time_clock_id | = | 3 | Index for the clock time. |
Add two time definitions to each other (provides the plus operator).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | left | First operant in the addition of times. |
||
type(tem_time_type), | intent(in) | :: | right | Second operant in the addition of times. |
Resulting sum of left and right.
Subtract right time definition from left (provides the minus operator).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | left | First operant in the addition of times. |
||
type(tem_time_type), | intent(in) | :: | right | Second operant in the addition of times. |
Resulting sum of left and right.
Get the maximum of two time definitions.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | left | First time operant to compare. |
||
type(tem_time_type), | intent(in) | :: | right | Second time operant to compare. |
Resulting maximum time of left and right.
Description of time
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | private | :: | iter | Time in iterations. |
|||
real(kind=rk), | private | :: | sim | Time in terms of simulated time. |
|||
real(kind=rk), | private | :: | clock | Time passed in seconds of running time. |
|||
real(kind=rk), | private | :: | clock_start | Wtime of the last reset. |
Function to find a default for time, if it is not defined already.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | time | The time to find a default 0 for, if not define, but dependency is. |
||
type(tem_time_type), | intent(in) | :: | dependency | A time definition where we set a 0 default in time for, if the corresponding component is defined, but the time component is not. |
Resulting time, with zeroed components where dependency is defined, but time not.
Return the (>=) comparison of each time measurement between the two arguments.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | time | A fully defined time definition (all components should have meaningful settings). |
||
type(tem_time_type), | intent(in) | :: | trigger | A comparison time definition, where some entries might be set to never. If any of the time components is larger, the result will be true. |
Result of the comparison for each of the time specifications.
Compare (>=) a complete time defintion against a trigger.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | time | A fully defined time definition (all components should have meaningful settings). |
||
type(tem_time_type), | intent(in) | :: | trigger | A comparison time definition, where some entries might be set to never. If any of the time components is larger, the result will be true. |
Result of the comparison, true if any of the time specifications in time is larger or equal to the ones in trigger.
Compare (>) a complete time defintion against a trigger.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | time | A fully defined time definition (all components should have meaningful settings). |
||
type(tem_time_type), | intent(in) | :: | trigger | A comparison time definition, where some entries might be set to never. If any of the time components is larger, the result will be true. |
Result of the comparison, true if any of the time specifications in time is larger or equal to the ones in trigger.
Returns the last full interval before now.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | now | |||
type(tem_time_type), | intent(in) | :: | interval |
Representation of a point in time, that should never happen.
A time that represents never in all definitions.
This function returns, if the given time definition requires a reduction operation if used as a trigger.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | me | Time definition to check of its need of a reduction. |
Flag indicating, if this time setting requires a reduction.
This function returns true if tem_time_type is defined either as iter, sim or clock.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | me |
Generate a time stamp from the simulation time in the given time definition.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | time | Time definition to create the stamp off. |
String representation of the given simulation time.
Generate a time stamp from the iteration in the given time definition.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | time | Time definition to create the stamp off. |
String representation of the given simulation time.
Add two time definitions to each other (provides the plus operator).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | left | First operant in the addition of times. |
||
type(tem_time_type), | intent(in) | :: | right | Second operant in the addition of times. |
Resulting sum of left and right.
Subtract right time definition from left (provides the minus operator).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | left | First operant in the addition of times. |
||
type(tem_time_type), | intent(in) | :: | right | Second operant in the addition of times. |
Resulting sum of left and right.
Get the maximum of two time definitions.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | left | First time operant to compare. |
||
type(tem_time_type), | intent(in) | :: | right | Second time operant to compare. |
Resulting maximum time of left and right.
Reading a time description from a Lua script given by conf.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(out) | :: | me | Time to be read from the Lua script |
||
type(flu_state), | intent(inout) | :: | conf | Handle to the Lua script. |
||
character(len=*), | intent(in), | optional | :: | key | Name of the table containing the time definition. Default: 'time'. |
|
integer, | intent(in), | optional | :: | parent | Handle to the parent table. |
|
real(kind=rk), | intent(in), | optional | :: | clock_start | Reference MPI_Wtime mark to use for computation of wallclock This is basically only useful to update the time object for a read in restart without distorting the clock measurement. |
Write the time into a Lua table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | me | The time descritpion to write out as Lua table. |
||
type(aot_out_type), | intent(inout) | :: | conf | Output handle for the script to write to. |
||
character(len=*), | intent(in), | optional | :: | key | Name for the tabel to write this time description to. |
Dump the given time to outUnit.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(inout) | :: | me | The time that should be written to outunit. |
||
integer, | intent(in) | :: | outUnit | The unit to write to. |
Reset the time definition.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(out) | :: | me | Time type to reset |
Update the clock measurement in the time description.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(inout) | :: | me | Time setting to update. |
Advance the time definition.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(inout) | :: | me | Time definition to advance |
||
real(kind=rk) | :: | sim_dt | Increment in simulation time to add |
|||
integer, | optional | :: | iter | If the number of iterations should not be increased by one, this optional parameter can be used to define the increment for the iterations. Default: 1. |