aboutsummaryrefslogtreecommitdiff
path: root/Examples/WaveCaKernel/src/CaKernel__calc_rhs_4.code
blob: c94216d2462cdacfb556f94906d02c3103b2d906 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#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_calc_rhs_4_Begin
  
  /* Include user-supplied include files */
  
  /* Initialise finite differencing variables */
  CCTK_REAL const dx = params.cagh_dx;
  CCTK_REAL const dy = params.cagh_dy;
  CCTK_REAL const dz = params.cagh_dz;
  CCTK_REAL const dt = params.cagh_dt;
  CCTK_REAL const t = params.cagh_time;
  CCTK_REAL const dxi = INV(dx);
  CCTK_REAL const dyi = INV(dy);
  CCTK_REAL const dzi = INV(dz);
  CCTK_REAL const khalf = 0.5;
  CCTK_REAL const kthird = 1/3.0;
  CCTK_REAL const ktwothird = 2.0/3.0;
  CCTK_REAL const kfourthird = 4.0/3.0;
  CCTK_REAL const keightthird = 8.0/3.0;
  CCTK_REAL const hdxi = 0.5 * dxi;
  CCTK_REAL const hdyi = 0.5 * dyi;
  CCTK_REAL const hdzi = 0.5 * dzi;
  
  /* Initialize predefined quantities */
  CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
  CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
  CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
  CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx*dy);
  CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx*dz);
  CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy*dz);
  CCTK_REAL const p1o2dx = 0.5*INV(dx);
  CCTK_REAL const p1o2dy = 0.5*INV(dy);
  CCTK_REAL const p1o2dz = 0.5*INV(dz);
  CCTK_REAL const p1o4dxdy = 0.25*INV(dx*dy);
  CCTK_REAL const p1o4dxdz = 0.25*INV(dx*dz);
  CCTK_REAL const p1o4dydz = 0.25*INV(dy*dz);
  CCTK_REAL const p1odx2 = INV(SQR(dx));
  CCTK_REAL const p1ody2 = INV(SQR(dy));
  CCTK_REAL const p1odz2 = INV(SQR(dz));
  CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
  CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
  CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
  
  /* Assign local copies of arrays functions */
  
  
  
  /* Calculate temporaries and arrays functions */
  
  /* Copy local copies back to grid functions */
  CAKERNEL_calc_rhs_4_Computations_Begin
    
    /* Assign local copies of grid functions */
    
    CCTK_REAL phiL = I3D(phi,0,0,0);
    CCTK_REAL piL = I3D(pi,0,0,0);
    
    
    /* Include user supplied include files */
    
    /* Precompute derivatives */
    CCTK_REAL const PDstandard4th11phi = PDstandard4th11(phi);
    CCTK_REAL const PDstandard4th22phi = PDstandard4th22(phi);
    CCTK_REAL const PDstandard4th33phi = PDstandard4th33(phi);
    
    /* Calculate temporaries and grid functions */
    CCTK_REAL phirhsL = piL;
    
    CCTK_REAL pirhsL = PDstandard4th11phi + PDstandard4th22phi + 
      PDstandard4th33phi;
    
    /* Copy local copies back to grid functions */
    I3D(phirhs,0,0,0) = phirhsL;
    I3D(pirhs,0,0,0) = pirhsL;
    
  CAKERNEL_calc_rhs_4_Computations_End
  
CAKERNEL_calc_rhs_4_End