aboutsummaryrefslogtreecommitdiff
path: root/Examples/AdvectCaKernel/src/CaKernel__initial_gaussian.code
blob: 0b78570152374873f956f84a13453e1ee1284c1b (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#undef KRANC_DIFF_FUNCTIONS
#define KRANC_C
#include "Differencing.h"
#include "GenericFD.h"

#undef KRANC_GFOFFSET3D
#define KRANC_GFOFFSET3D(u,i,j,k) I3D(u,i,j,k)


/* Define macros used in calculations */
#define INITVALUE (42)
#define INV(x) ((CCTK_REAL)1.0 / (x))
#define SQR(x) ((x) * (x))
#define CUB(x) ((x) * SQR(x))
#define QAD(x) (SQR(SQR(x)))

CAKERNEL_initial_gaussian_Begin
  
  /* Include user-supplied include files */
  
  /* Initialise finite differencing variables */
  CCTK_REAL /*const*/ dx CCTK_ATTRIBUTE_UNUSED  = params.cagh_dx;
  CCTK_REAL /*const*/ dy CCTK_ATTRIBUTE_UNUSED  = params.cagh_dy;
  CCTK_REAL /*const*/ dz CCTK_ATTRIBUTE_UNUSED  = params.cagh_dz;
  CCTK_REAL /*const*/ dt CCTK_ATTRIBUTE_UNUSED  = params.cagh_dt;
  CCTK_REAL /*const*/ t CCTK_ATTRIBUTE_UNUSED  = params.cagh_time;
  CCTK_REAL /*const*/ dxi CCTK_ATTRIBUTE_UNUSED  = INV(dx);
  CCTK_REAL /*const*/ dyi CCTK_ATTRIBUTE_UNUSED  = INV(dy);
  CCTK_REAL /*const*/ dzi CCTK_ATTRIBUTE_UNUSED  = INV(dz);
  CCTK_REAL /*const*/ khalf CCTK_ATTRIBUTE_UNUSED  = 0.5;
  CCTK_REAL /*const*/ kthird CCTK_ATTRIBUTE_UNUSED  = 1/3.0;
  CCTK_REAL /*const*/ ktwothird CCTK_ATTRIBUTE_UNUSED  = 2.0/3.0;
  CCTK_REAL /*const*/ kfourthird CCTK_ATTRIBUTE_UNUSED  = 4.0/3.0;
  CCTK_REAL /*const*/ keightthird CCTK_ATTRIBUTE_UNUSED  = 8.0/3.0;
  CCTK_REAL /*const*/ hdxi CCTK_ATTRIBUTE_UNUSED  = 0.5 * dxi;
  CCTK_REAL /*const*/ hdyi CCTK_ATTRIBUTE_UNUSED  = 0.5 * dyi;
  CCTK_REAL /*const*/ hdzi CCTK_ATTRIBUTE_UNUSED  = 0.5 * dzi;
  
  /* Initialize predefined quantities */
  CCTK_REAL /*const*/ p1odx CCTK_ATTRIBUTE_UNUSED  = INV(dx);
  
  /* Assign local copies of arrays functions */
  
  
  
  /* Calculate temporaries and arrays functions */
  
  /* Copy local copies back to grid functions */
  CAKERNEL_initial_gaussian_Computations_Begin
    
    /* Assign local copies of grid functions */
    
    CCTK_REAL xL CCTK_ATTRIBUTE_UNUSED = I3D(x,0,0,0);
    
    
    /* Include user supplied include files */
    
    /* Precompute derivatives */
    
    /* Calculate temporaries and grid functions */
    CCTK_REAL CCTK_ATTRIBUTE_UNUSED phiL = exp(-100.*SQR(xL + t));
    
    /* Copy local copies back to grid functions */
    I3D(phi,0,0,0) = phiL;
    
  CAKERNEL_initial_gaussian_Computations_End
  
CAKERNEL_initial_gaussian_End