aboutsummaryrefslogtreecommitdiff
path: root/CarpetExtra/CarpetRegridTest/src/TestGaussian.c
diff options
context:
space:
mode:
Diffstat (limited to 'CarpetExtra/CarpetRegridTest/src/TestGaussian.c')
-rw-r--r--CarpetExtra/CarpetRegridTest/src/TestGaussian.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/CarpetExtra/CarpetRegridTest/src/TestGaussian.c b/CarpetExtra/CarpetRegridTest/src/TestGaussian.c
new file mode 100644
index 000000000..be786c245
--- /dev/null
+++ b/CarpetExtra/CarpetRegridTest/src/TestGaussian.c
@@ -0,0 +1,45 @@
+#include <math.h>
+
+#include "cctk.h"
+#include "cctk_Parameters.h"
+#include "cctk_Arguments.h"
+
+
+static const char *rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetExtra/CarpetRegridTest/src/TestGaussian.c,v 1.3 2004/05/27 13:22:49 schnetter Exp $";
+
+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");
+
+}