aboutsummaryrefslogtreecommitdiff
path: root/src/Simple.c
blob: 15ac2cf3eeb15334d6f740f51efc9a555e4cb6bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 /*@@
   @file      Simple.c
   @date      September 4 1999
   @author    Gabrielle Allen
   @desc 
   Standard specification of timestep
   @enddesc 
 @@*/

#include <stdlib.h>

#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"

static const char *rcsid = "$Header$";

CCTK_FILEVERSION(CactusBase_Time_Simple_c)

void Time_Simple(CCTK_ARGUMENTS);

void Time_Simple(CCTK_ARGUMENTS)
{
  DECLARE_CCTK_ARGUMENTS;
  DECLARE_CCTK_PARAMETERS;

  CCTK_REAL min_spacing;
  int d;

  /* Calculate the minimum grid spacing */
  min_spacing = cctk_delta_space[0];
  for (d=1; d<cctk_dim; ++d)
  {
    min_spacing = (min_spacing<cctk_delta_space[d]
                   ? min_spacing : cctk_delta_space[d]);
  }

  /* Calculate the timestep */
  cctkGH->cctk_delta_time = dtfac*min_spacing;

  if (verbose)
  {
    CCTK_VInfo(CCTK_THORNSTRING,
               "Using a simple Courant condition to set then timestep");
    CCTK_VInfo(CCTK_THORNSTRING,
               "  ... using a dtfac of %g", (double)dtfac);
    CCTK_VInfo(CCTK_THORNSTRING,
               "  ... using a minimum spacing of %g", (double)min_spacing);
  }

  CCTK_VInfo(CCTK_THORNSTRING,
             "Timestep set to %g (courant_static)",
             (double)(cctkGH->cctk_delta_time/cctkGH->cctk_timefac));
}