xx Time

Time

Gabrielle Allen

Date

Abstract

Calculates the timestep used for an evolution

1 Purpose This thorn provides routines for calculating the timestep for an evolution based on the spatial Cartesian grid spacing and a wave speed.

2 Description

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::timestepxmethod.

 time::timestepxmethod = "given"

The timestep is fixed to the value of the parameter time::timestep.

 time::timestepxmethod = "courantxstatic"

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.

. Δt = dtfac ∗ min(Δx^{i})

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::timestepxmethod = "courantxspeed"

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 courantxfac and the grid variable courantxwavexspeed. The algorithm used is

.  Δt = courantfac ∗ min(Δx^{i})/courantwavespeed/\sqrt{dim}

For this algorithm to be successful, the variable courantxwavexspeed 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 TimexCourant (or earlier in the evolution loop). [Note: The name courantxwavexspeed 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::timestepxmethod = "courantxtime"

This choice is similar to the method courantxspeed above, in implementing a dynamic timestep. However the timestep is chosen using

.  Δt = courantfac ∗ courantmintime/\sqrt{dim}

where the grid variable courantxminxtime 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 TimexCourant (or earlier in the evolution loop).

In all cases, Thorn Time sets the Cactus variable cctkxdeltaxtime which is passed as part of the macro CCTKxARGUMENTS 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

. Δt ≤ min(Δx^{i})/wave speed/\sqrt{dim} 3 Examples Fixed Value Timestep

time::timestep_methodx=x"given"
time::timestepxxxxxxxx=x0.1

Calculate Static Timestep Based on Grid Spacings

The following parameters set the timestep to be 0.25

grid::dxxxxx=x0.5
grid::dyxxxx=x1.0
grid::dzxxxx=x1.0
time::timestep_methodx=x"courant_static"
time::dtfacx=x0.5

4 Parameters

11courantxfac 10Scope: privatex01 REAL

11Description: The courant timestep condition dt = courantxfac*max(deltaxspace)/speed/sqrt(dim)

11 Range 10 x01 Default: 0.9
110:*  10For positive timestep
11*:0  10For negative timestep

11

11dtfac  10Scope: privatex01  REAL

11Description: The standard timestep condition dt = dtfac*max(deltaxspace)

11 Range 10 x01 Default: 0.5
110:*  10For positive timestep
11*:0  10For negative timestep

11

11timestep  10Scope: privatex01  REAL

11Description: Absolute value for timestep

11 Range 10 x01 Default: 0.0
11*:*  10Could be anything

11

11timestepxoutevery 10Scope: privatex01  INT

11Description: How often to output courant timestep

11 Range 10 x01 Default: 1
111:*  10Zero means no output

11

11verbose  10Scope: privatex01  BOOLEAN

11Description: Give selective information about timestep setting

11               10  x01  Default: no

11timestepxmethod10Scope: restrictedx01  KEYWORD

11Description: Method for calculating timestep

11 Range 10 x01 Default: courantxstatic
11given  10Use given timestep
11courantxstatic 10Courant condition at BASEGRID (using dtfac)
11courantxspeed 10Courant condition at POSTSTEP (using wavespeed and courantxfac)
11courantxtime  10Courant condition at POSTSTEP (using min time and courantxfac)

11

11timestepxoutonly10Scope: restrictedx01  BOOLEAN

11Description: Don’t set a dynamic timestep, just output what it would be

11               10  x01  Default: no

11

11cctkxfinalxtime 10Scope: shared from CACTUSx01REAL

11

11terminate  10Scope: shared from CACTUSx01KEYWORD

11

5 Interfaces

General Implements: time

Grid Variables

5.0.1 PRIVATE GROUPS

11x Group Names x10x Variable Names xx01 Details x11x
11 couranttemps 10  x01  compact110
11                 10  courantxdt  x01 description11Variable just for output
11                 10  x01 dimensions110
11                 10  x01 distribution11CONSTANT
11                 10  x01 group type11SCALAR
11                 10  x01 timelevels111
11                 10  x01variable type11REAL

5.0.2 PUBLIC GROUPS

11x Group Names x10x Variable Names xx01 Details x11x
11 speedvars 10 x01 compact110
11                 10 courantxwavexspeed x01 description11Speed to use for Courant condition
11                 10 courantxminxtime x01 dimensions110
11                 10  x01 distribution11CONSTANT
11                 10  x01 group type11SCALAR
11                 10  x01 timelevels111
11                 10  x01variable type11REAL

11

6 Schedule 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.

Storage x

11Always:  11x
11speedvars couranttemps11x

11x  11x

11

Scheduled Functions

CCTKxBASEGRID x timexinitialise x initialise time variables

11x11Before: 11timexsimple
11 x 11Language:11c
11 x 11Options: 11global
11 x 11Type: 11function
11 x 11Writes: 11time::speedvars
11 x 11x  11time::courantxdt(everywhere)

11

CCTKxBASEGRID (conditional) x timexsimple x set timestep based on courant condition (courantxstatic) x

11x11After: 11spatialspacings
11 x 11Language:11c
11 x 11Options: 11singlemap
11 x 11Type: 11function

11

CCTKxBASEGRID (conditional) x timexcourant x set timestep based on courant condition (courantxspeed) x

11x11After: 11spatialspacings
11 x 11Language:11c
11 x 11Options: 11singlemap
11 x 11Reads: 11time::speedvars
11 x 11Type: 11function
11 x 11Writes: 11time::courantxdt(everywhere)

11

CCTKxPOSTSTEP (conditional) x timexcourant x reset timestep each iteration x

11x11After: 11spatialspacings
11 x 11Language:11c
11 x 11Options: 11singlemap
11 x 11Reads: 11time::speedvars
11 x 11Type: 11function
11 x 11Writes: 11time::courantxdt(everywhere)

11

CCTKxBASEGRID (conditional) x timexsimple x set timestep based on courant condition (courantxtime) x

11x11After: 11spatialspacings
11 x 11Language:11c
11 x 11Options: 11singlemap
11 x 11Type: 11function

11

CCTKxPOSTSTEP (conditional) x timexcourant x reset timestep each iteration

11x11After: 11spatialspacings
11 x 11Language:11c
11 x 11Options: 11singlemap
11 x 11Reads: 11time::speedvars
11 x 11Type: 11function
11 x 11Writes: 11time::courantxdt(everywhere)

11

CCTKxBASEGRID (conditional) x timexgiven x set fixed timestep x

11x11After: 11spatialspacings
11 x 11Language:11c
11 x 11Options: 11singlemap
11 x 11Type: 11function

11

Aliased Functions x

11Alias Name: xxxxxxx11Function Name:
11TimexCourant  11TemporalSpacings
11TimexGiven  11TemporalSpacings
11TimexSimple  11TemporalSpacings