[Commits] [svn:einsteintoolkit] Workshop_Spring_2012/example_wavetoy/Cactus/arrangements/Introduction/WaveToy/ (Rev. 56)

roland.haas at physics.gatech.edu roland.haas at physics.gatech.edu
Wed Apr 4 13:22:04 CDT 2012


User: rhaas
Date: 2012/04/04 01:22 PM

Modified:
 /example_wavetoy/Cactus/arrangements/Introduction/WaveToy/
  interface.ccl, schedule.ccl
 /example_wavetoy/Cactus/arrangements/Introduction/WaveToy/src/
  WaveToy.c

Log:
 add routines to compute wave energy to wavetoy example

File Changes:

Directory: /example_wavetoy/Cactus/arrangements/Introduction/WaveToy/
=====================================================================

File [modified]: interface.ccl
Delta lines: +2 -0
===================================================================
--- example_wavetoy/Cactus/arrangements/Introduction/WaveToy/interface.ccl	2012-04-04 18:04:36 UTC (rev 55)
+++ example_wavetoy/Cactus/arrangements/Introduction/WaveToy/interface.ccl	2012-04-04 18:22:04 UTC (rev 56)
@@ -8,7 +8,9 @@
   phi
 } "The evolved scalar field"
 
+CCTK_REAL energy TYPE=gf TIMELEVELS=3 "Energy in wave"
 
+
 CCTK_INT FUNCTION Boundary_SelectVarForBC(CCTK_POINTER_TO_CONST IN GH, \
   CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, \
   CCTK_STRING IN var_name, CCTK_STRING IN bc_name)

File [modified]: schedule.ccl
Delta lines: +6 -1
===================================================================
--- example_wavetoy/Cactus/arrangements/Introduction/WaveToy/schedule.ccl	2012-04-04 18:04:36 UTC (rev 55)
+++ example_wavetoy/Cactus/arrangements/Introduction/WaveToy/schedule.ccl	2012-04-04 18:22:04 UTC (rev 56)
@@ -1,4 +1,4 @@
-STORAGE: scalarevolve[3]
+STORAGE: scalarevolve[3] energy[3]
 
 SCHEDULE WaveToy_InitialData AT CCTK_INITIAL
 {
@@ -11,6 +11,11 @@
   SYNC: scalarevolve
 } "Evolution of 3D wave equation"
 
+SCHEDULE WaveToy_Energy AT CCTK_EVOL AFTER WaveToy_Evolution
+{
+  LANG: C
+} "Compute wave energy"
+
 SCHEDULE WaveToy_Boundaries AT CCTK_EVOL AFTER WaveToy_Evolution
 {
   LANG: C

Directory: /example_wavetoy/Cactus/arrangements/Introduction/WaveToy/src/
=========================================================================

File [modified]: WaveToy.c
Delta lines: +19 -0
===================================================================
--- example_wavetoy/Cactus/arrangements/Introduction/WaveToy/src/WaveToy.c	2012-04-04 18:04:36 UTC (rev 55)
+++ example_wavetoy/Cactus/arrangements/Introduction/WaveToy/src/WaveToy.c	2012-04-04 18:22:04 UTC (rev 56)
@@ -70,7 +70,26 @@
   }
 }
 
+/* 
+ * Routine to compute energy
+ */
+void  WaveToy_Energy(CCTK_ARGUMENTS) {
+  DECLARE_CCTK_ARGUMENTS;
 
+  /* Energy density is just square of wave */
+  for (int k=1; k<cctk_lsh[2]-1; k++) {
+    for (int j=1; j<cctk_lsh[1]-1; j++) {
+      for (int i=1; i<cctk_lsh[0]-1; i++) {
+        energy[CCTK_GFINDEX3D(cctkGH,i,j,k)] = 
+		SQ(phi[CCTK_GFINDEX3D(cctkGH,i,j,k)]) *
+                CCTK_DELTA_SPACE(0) * CCTK_DELTA_SPACE(1) *
+                CCTK_DELTA_SPACE(2);
+      }
+    }
+  }
+}
+
+
 /*
  * Select boundary condition
  */



More information about the Commits mailing list