Calculates the timestep used for an evolution
This thorn provides routines for calculating the timestep for an evolution based on the spatial Cartesian grid spacing and a wave speed.
Thorn Time uses one of four methods to decide on the timestep to be used for the simulation. The method is chosen using the keyword parameter time::timestep_method.
time::timestep_method = "given"
The timestep is fixed to the value of the parameter time::timestep.
time::timestep_method = "courant_static"
This is the default method, which calculates the timestep once at the start of the simulation, based on a simple courant type condition using the spatial gridsizes and the parameter time::dtfac.
Note that it is up to the user to custom dtfac to take into account the dimension of the space being used, and the wave speed.
time::timestep_method = "courant_speed"
This choice implements a dynamic courant type condition, the timestep being set before each iteration using the spatial dimension of the grid, the spatial grid sizes, the parameter courant_fac and the grid variable courant_wave_speed. The algorithm used is
For this algorithm to be successful, the variable courant_wave_speed must have been set by some thorn to the maximum propagation speed on the grid before this thorn sets the timestep, that is AT POSTSTEP BEFORE Time_Courant (or earlier in the evolution loop). [Note: The name courant_wave_speed was poorly chosen here, the required speed is the maximum propagation speed on the grid which may be larger than the maximum wave speed (for example with a shock wave in hydrodynamics, also it is possible to have propagation without waves as with a pure advection equation).
time::timestep_method = "courant_time"
This choice is similar to the method courant_speed above, in implementing a dynamic timestep. However the timestep is chosen using
where the grid variable courant_min_time must be set by some thorn to the minimum time for a wave to cross a gridzone before this thorn sets the timestep, that is AT POSTSTEP BEFORE Time_Courant (or earlier in the evolution loop).
In all cases, Thorn Time sets the Cactus variable cctk_delta_time which is passed as part of the macro CCTK_ARGUMENTS to thorns called by the scheduler.
Note that for hyperbolic problems, the Courant condition gives a minimum requirement for stability, namely that the numerical domain of dependency must encompass the physical domain of dependency, or
Fixed Value Timestep
time::timestep_method = "given" time::timestep = 0.1
Calculate Static Timestep Based on Grid Spacings
The following parameters set the timestep to be 0.25
grid::dx = 0.5 grid::dy = 1.0 grid::dz = 1.0 time::timestep_method = "courant_static" time::dtfac = 0.5
courant_fac | Scope: private | REAL |
Description: The courant timestep condition dt = courant_fac*max(delta_space)/speed/sqrt(dim)
| ||
Range | Default: 0.9 | |
0:* | For positive timestep
| |
*:0 | For negative timestep
| |
dtfac | Scope: private | REAL |
Description: The standard timestep condition dt = dtfac*max(delta_space)
| ||
Range | Default: 0.5 | |
0:* | For positive timestep
| |
*:0 | For negative timestep
| |
timestep | Scope: private | REAL |
Description: Absolute value for timestep
| ||
Range | Default: 0.0 | |
*:* | Could be anything
| |
timestep_outevery | Scope: private | INT |
Description: How often to output courant timestep
| ||
Range | Default: 1 | |
1:* | Zero means no output
| |
verbose | Scope: private | BOOLEAN |
Description: Give selective information about timestep setting
| ||
Default: no | ||
timestep_method | Scope: restricted | KEYWORD |
Description: Method for calculating timestep
| ||
Range | Default: courant_static | |
given | Use given timestep
| |
courant_static | Courant condition at BASEGRID (using dtfac)
| |
courant_speed | Courant condition at POSTSTEP (using wavespeed and courant_fac)
| |
courant_time | Courant condition at POSTSTEP (using min time and courant_fac)
| |
timestep_outonly | Scope: restricted | BOOLEAN |
Description: Don’t set a dynamic timestep, just output what it would be
| ||
Default: no | ||
cctk_final_time | Scope: shared from CACTUS | REAL |
terminate | Scope: shared from CACTUS | KEYWORD |
Implements:
time
Group Names | Variable Names | Details | |
couranttemps | compact | 0 | |
courant_dt | description | Variable just for output | |
dimensions | 0 | ||
distribution | CONSTANT | ||
group type | SCALAR | ||
timelevels | 1 | ||
variable type | REAL | ||
Group Names | Variable Names | Details | |
speedvars | compact | 0 | |
courant_wave_speed | description | Speed to use for Courant condition | |
courant_min_time | dimensions | 0 | |
distribution | CONSTANT | ||
group type | SCALAR | ||
timelevels | 1 | ||
variable type | REAL | ||
This section lists all the variables which are assigned storage by thorn CactusBase/Time. Storage can either last for the duration of the run (Always means that if this thorn is activated storage will be assigned, Conditional means that if this thorn is activated storage will be assigned for the duration of the run if some condition is met), or can be turned on for the duration of a schedule function.
Always: | |
speedvars couranttemps | |
CCTK_BASEGRID
time_initialise
initialise time variables
Before: | time_simple | |
Language: | c | |
Options: | global | |
Type: | function | |
Writes: | time::speedvars | |
time::courant_dt(everywhere) | ||
CCTK_BASEGRID (conditional)
time_simple
set timestep based on courant condition (courant_static)
After: | spatialspacings | |
Language: | c | |
Options: | singlemap | |
Type: | function | |
CCTK_BASEGRID (conditional)
time_courant
set timestep based on courant condition (courant_speed)
After: | spatialspacings | |
Language: | c | |
Options: | singlemap | |
Reads: | time::speedvars | |
Type: | function | |
Writes: | time::courant_dt(everywhere) | |
CCTK_POSTSTEP (conditional)
time_courant
reset timestep each iteration
After: | spatialspacings | |
Language: | c | |
Options: | singlemap | |
Reads: | time::speedvars | |
Type: | function | |
Writes: | time::courant_dt(everywhere) | |
CCTK_BASEGRID (conditional)
time_simple
set timestep based on courant condition (courant_time)
After: | spatialspacings | |
Language: | c | |
Options: | singlemap | |
Type: | function | |
CCTK_POSTSTEP (conditional)
time_courant
reset timestep each iteration
After: | spatialspacings | |
Language: | c | |
Options: | singlemap | |
Reads: | time::speedvars | |
Type: | function | |
Writes: | time::courant_dt(everywhere) | |
CCTK_BASEGRID (conditional)
time_given
set fixed timestep
After: | spatialspacings | |
Language: | c | |
Options: | singlemap | |
Type: | function | |
Alias Name: | Function Name: |
Time_Courant | TemporalSpacings |
Time_Given | TemporalSpacings |
Time_Simple | TemporalSpacings |