aboutsummaryrefslogtreecommitdiff
path: root/src/Ricci.c
blob: 3c517d7ed9042c1f160ddfd7ba6a4519b84884c3 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
 /*@@
   @file      Ricci.c
   @date      Tue May 14 04:38:49 2002
   @author    Ian Hawke
   @desc 
   Routine to calculate the Ricci tensor and scalar. These are taken 
   straight from ADMMacros. 
   @enddesc 
   @version $Header$
 @@*/

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

#include "ADMAnalysis.h"

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

CCTK_FILEVERSION(CactusEinstein_ADMAnalysis_Ricci_c)

/********************************************************************
 *********************     Local Data Types   ***********************
 ********************************************************************/

/********************************************************************
 ********************* Local Routine Prototypes *********************
 ********************************************************************/

/********************************************************************
 ***************** Scheduled Routine Prototypes *********************
 ********************************************************************/

void ADMAnalysis_Ricci(CCTK_ARGUMENTS);

/********************************************************************
 ********************* Other Routine Prototypes *********************
 ********************************************************************/

/********************************************************************
 *********************     Local Data   *****************************
 ********************************************************************/

/********************************************************************
 *********************     External Routines   **********************
 ********************************************************************/

 /*@@
   @routine    ADMAnalysis_Ricci
   @date       Tue May 14 21:17:26 2002
   @author     Ian Hawke
   @desc 
   Uses the macros to calculate the Ricci tensor and scalar.
   Unfortunately at the moment it calculates the scalar even
   when you don't want it to.
   @enddesc 
   @calls     ADMAnalysis_Trace
              ADMMacros/src/macro/RICCI_*.h
   @calledby   
   @history 
 
   @endhistory 

@@*/

void ADMAnalysis_Ricci(CCTK_ARGUMENTS)
{

  DECLARE_CCTK_ARGUMENTS;

  CCTK_INT i,j,k, ijk, di, dj, dk, err;

#include "CactusEinstein/ADMMacros/src/macro/RICCI_declare.h"

  for (k = 1; k < cctk_lsh[2]-1; k++) 
  {
    for (j = 1; j < cctk_lsh[1]-1; j++) 
    {
      for (i = 1; i < cctk_lsh[0]-1; i++) 
      {
    
        ijk = CCTK_GFINDEX3D(cctkGH,i,j,k);
        di = ijk - CCTK_GFINDEX3D(cctkGH,i-1,j,k);
        dj = ijk - CCTK_GFINDEX3D(cctkGH,i,j-1,k);
        dk = ijk - CCTK_GFINDEX3D(cctkGH,i,j,k-1);

#include "CactusEinstein/ADMMacros/src/macro/RICCI_guts.h"
  
        Ricci11[ijk] = RICCI_RXX;
        Ricci12[ijk] = RICCI_RXY;
        Ricci13[ijk] = RICCI_RXZ;
        Ricci22[ijk] = RICCI_RYY;
        Ricci23[ijk] = RICCI_RYZ;
        Ricci33[ijk] = RICCI_RZZ;
        
      }
    }
  }

#include "CactusEinstein/ADMMacros/src/macro/RICCI_undefine.h"

  ADMAnalysis_Trace(cctk_lsh, gxx, gxy, gxz, gyy, gyz, gzz, 
                    Ricci11, Ricci12, Ricci13, Ricci22, Ricci23, Ricci33,
                    Ricci, detg);

  /* Apply Flat Boundary Condition */
  err = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, 
                                  "ADMAnalysis::ricci_scalar", "Flat");
  err += Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, 
                                  "ADMAnalysis::ricci_tensor", "Flat");
  if (err < 0)
  {
    CCTK_WARN(2,"Error in applying flat boundary condition to Ricci tensor");
  }

  /* WARNING:  Only flat boundary conditions are used here.  If the
   *  value of the Ricci tensor is going to be used for something other
   *  than output, then the boundaries should be handled more properly.
   */

  return;
  
}

/********************************************************************
 *********************     Local Routines   *************************
 ********************************************************************/