Chapter C10
Time

Author(s): Gabrielle Allen

Date: Date



C10.1 Abstract

Calculates the timestep used for an evolution

C10.2 Purpose

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

C10.3 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::timestep_method.

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

                        √----
Δt ≤ min (Δxi )∕wave speed∕ dim

C10.4 Examples

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

C10.5 Parameters




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



C10.6 Interfaces

General

Implements:

time

Grid Variables

PRIVATE GROUPS




  Group Names    Variable Names     Details   




couranttemps    compact0
courant_dt    descriptionVariable just for output
   dimensions0
   distributionCONSTANT
   group typeSCALAR
   stagger typeNONE
   timelevels1
  variable typeREAL




PUBLIC GROUPS




  Group Names    Variable Names     Details   




speedvars    compact0
courant_wave_speed    descriptionSpeed to use for Courant condition
courant_min_time    dimensions0
   distributionCONSTANT
   group typeSCALAR
   stagger typeNONE
   timelevels1
  variable typeREAL




C10.7 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

 

Always:  
speedvars  
couranttemps 
   

Scheduled Functions

CCTK_BASEGRID

  time_initialise

  initialise time variables

 

 Before: time_simple
   time_given
 Language:c
 Options: global
 Type: function

CCTK_BASEGRID (conditional)

  time_simple

  set timestep based on courant condition (courant_static)

 

 After: spatialcoordinates
 Language:c
 Options: singlemap
 Type: function

CCTK_BASEGRID (conditional)

  time_courant

  set timestep based on courant condition (courant_speed)

 

 After: spatialcoordinates
 Language:c
 Options: singlemap
 Type: function

CCTK_POSTSTEP (conditional)

  time_courant

  reset timestep each iteration

 

 Language:c
 Options: singlemap
 Type: function

CCTK_BASEGRID (conditional)

  time_simple

  set timestep based on courant condition (courant_time)

 

 After: spatialcoordinates
 Language:c
 Options: singlemap
 Type: function

CCTK_POSTSTEP (conditional)

  time_courant

  reset timestep each iteration

 

 Language:c
 Options: singlemap
 Type: function

CCTK_BASEGRID (conditional)

  time_given

  set fixed timestep

 

 Language:c
 Options: global
 Type: function