aboutsummaryrefslogtreecommitdiff
path: root/CarpetExtra/CarpetRegridTest/src/TestGaussian.c
blob: debab5abaa920f45d23f6d3e9c10eab7c1d9e9b9 (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
#include <math.h>

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


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

CCTK_FILEVERSION(CarpetExtra_CarpetRegridTest_TestGaussian_c);

void CarpetRegrid_TestGaussian(CCTK_ARGUMENTS)
{
  DECLARE_CCTK_PARAMETERS;
  DECLARE_CCTK_ARGUMENTS;

  int i,j,k;

  int index;
  CCTK_REAL X, Y, Z, R;


  for(k=0; k<cctk_lsh[2]; k++)
    {
      for(j=0; j<cctk_lsh[1]; j++)
	{
	  for(i=0; i<cctk_lsh[0]; i++)
	    {
	      index =  CCTK_GFINDEX3D(cctkGH,i,j,k);

	      X = x[index];
	      Y = y[index];
	      Z = z[index];

	      R = sqrt(X*X + Y*Y + Z*Z);

	      phi_error[index] = phi[index] - amplitude*exp( - pow( (R - radius) / sigma, 2.0 ) );
	      phi_relerror[index] = phi_error[index]  / (amplitude*exp( - pow( (R - radius) / sigma, 2.0 ) ) );
	    }
	}
    }

  /*  CCTK_VInfo(CCTK_THORNSTRING,"Performed CarpetRegridTest"); */

}