[Commits] [svn:einsteintoolkit] Workshop_Spring_2012/handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/ (Rev. 78)

roland.haas at physics.gatech.edu roland.haas at physics.gatech.edu
Thu Apr 5 13:46:42 CDT 2012


User: rhaas
Date: 2012/04/05 01:46 PM

Removed:
 /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v9/

Modified:
 /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v4/
  schedule.ccl
 /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v5/
  schedule.ccl
 /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v6/src/
  coretracker.c
 /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/
  interface.ccl, param.ccl, schedule.ccl
 /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/src/
  make.code.defn

Log:
 remove duplicate stage in CoreTracker

File Changes:

Directory: /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v4/
================================================================================================

File [modified]: schedule.ccl
Delta lines: +0 -7
===================================================================
--- handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v4/schedule.ccl	2012-04-05 18:16:46 UTC (rev 77)
+++ handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v4/schedule.ccl	2012-04-05 18:46:42 UTC (rev 78)
@@ -6,27 +6,20 @@
 {
     LANG: C
     OPTIONS: global
-    WRITES: CoreTracker::core_location
 } "Import initial location from parameters"
 
 schedule CoreTracker_SetGridFunction AT POSTINITIAL
 {
     LANG: C
-    READS: HydroBase::rho Grid::coordinates CoreTracker::core_location
-    WRITES: CoreTracker::density_weighted_core_location
 } "Set initial grid functions"
 
 schedule CoreTracker_SetGridFunction in MoL_PseudoEvolution
 {
     LANG: C
-    READS: HydroBase::rho Grid::coordinates CoreTracker::core_location
-    WRITES: CoreTracker::density_weighted_core_location
 } "Compute rho*x^i"
 
 schedule CoreTracker_Reduce at ANALYSIS
 {
     LANG: C
     OPTIONS: global
-    READS: CoreTracker::density_weighted_core_location
-    WRITES: core_location
 } "compute center of mass of core region"

Directory: /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v5/
================================================================================================

File [modified]: schedule.ccl
Delta lines: +0 -7
===================================================================
--- handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v5/schedule.ccl	2012-04-05 18:16:46 UTC (rev 77)
+++ handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v5/schedule.ccl	2012-04-05 18:46:42 UTC (rev 78)
@@ -6,27 +6,20 @@
 {
     LANG: C
     OPTIONS: global
-    WRITES: CoreTracker::core_location
 } "Import initial location from parameters"
 
 schedule CoreTracker_SetGridFunction AT POSTINITIAL
 {
     LANG: C
-    READS: HydroBase::rho Grid::coordinates CoreTracker::core_location
-    WRITES: CoreTracker::density_weighted_core_location
 } "Set initial grid functions"
 
 schedule CoreTracker_SetGridFunction in MoL_PseudoEvolution
 {
     LANG: C
-    READS: HydroBase::rho Grid::coordinates CoreTracker::core_location
-    WRITES: CoreTracker::density_weighted_core_location
 } "Compute rho*x^i"
 
 schedule CoreTracker_Reduce at ANALYSIS
 {
     LANG: C
     OPTIONS: global
-    READS: CoreTracker::density_weighted_core_location
-    WRITES: core_location
 } "compute center of mass of core region"

Directory: /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/
================================================================================================

File [modified]: interface.ccl
Delta lines: +6 -0
===================================================================
--- handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/interface.ccl	2012-04-05 18:16:46 UTC (rev 77)
+++ handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/interface.ccl	2012-04-05 18:46:42 UTC (rev 78)
@@ -11,3 +11,9 @@
 {
   core_density_x, core_density_y, core_density_z, core_density
 } "rho*x^i in core region"
+
+# only used for debugging
+CCTK_REAL moving_blob_location type=scalar
+{
+    blob_x, blob_y, blob_z
+} "location of target blob"

File [modified]: param.ccl
Delta lines: +40 -0
===================================================================
--- handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/param.ccl	2012-04-05 18:16:46 UTC (rev 77)
+++ handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/param.ccl	2012-04-05 18:46:42 UTC (rev 78)
@@ -29,3 +29,43 @@
 {
   0:* ::  "any positive value"
 } 1e10
+
+# parameters used only for the made up moving blobs
+CCTK_BOOLEAN add_moving_blobs "put fake data onto the grid to test the code"
+{
+} "no"
+
+CCTK_REAL maximum_separation "how far apart are the blobs at maximum distance"
+{
+    0:* :: "any positive number"
+} 8.
+
+CCTK_REAL minimum_separation "how far apart are the blobs at minimum distance"
+{
+    0:* :: "any positive number"
+} 6.
+
+CCTK_REAL radial_period "period of radial motion"
+{
+    *:* :: "sign determines direction of motion"
+} 100.
+
+CCTK_REAL angular_period "period of motion in phi angle"
+{
+    *:* :: "positive if counterclockwise, negative is clockwise motion"
+} 42.
+
+CCTK_REAL initial_phi "initial phi location of blobs"
+{
+    *:* :: "any angle, in radians"
+} 0.
+
+CCTK_REAL A "amplitude of blob"
+{
+    0:* :: "any positive value"
+} 1e-3
+
+CCTK_REAL sigma "sigma parameter of Gaussian blob"
+{
+    (0:* :: "any positive value"
+} 1.5

File [modified]: schedule.ccl
Delta lines: +16 -0
===================================================================
--- handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/schedule.ccl	2012-04-05 18:16:46 UTC (rev 77)
+++ handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/schedule.ccl	2012-04-05 18:46:42 UTC (rev 78)
@@ -23,3 +23,19 @@
     LANG: C
     OPTIONS: global
 } "compute center of mass of core region"
+
+# only used for debugging
+if (add_moving_blobs) {
+STORAGE: moving_blob_location
+schedule CoreTracker_AddBlob IN HydroBase_Initial after HydroBase_Zero
+{
+    LANG: C
+    OPTIONS: local
+} "add moving blobs to grid"
+
+schedule CoreTracker_AddBlob in MoL_PseudoEvolution BEFORE CoreTracker_SetGridFunction
+{
+    LANG: C
+    OPTIONS: local
+} "add moving blobs to grid"
+}

Directory: /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v6/src/
====================================================================================================

File [modified]: coretracker.c
Delta lines: +41 -1
===================================================================
--- handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v6/src/coretracker.c	2012-04-05 18:16:46 UTC (rev 77)
+++ handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v6/src/coretracker.c	2012-04-05 18:46:42 UTC (rev 78)
@@ -90,5 +90,45 @@
     DECLARE_CCTK_PARAMETERS;
     DECLARE_CCTK_ARGUMENTS;
 
-    /* do something here */
+    CCTK_REAL rho_sum = -1; // \sum \rho over the grid, used to normalise center of mass coordinates
+    struct {                // keeps track of which variables to sum over
+        const char *variable;
+        CCTK_REAL *target;
+    } reductions[] = {
+        {"CoreTracker::core_density", &rho_sum},
+        {"CoreTracker::core_density_x", core_x},
+        {"CoreTracker::core_density_y", core_y},
+        {"CoreTracker::core_density_z", core_z}
+    };
+
+    CCTK_INT handle_sum = CCTK_ReductionHandle("sum");
+    if(handle_sum < 0)
+        CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
+                   "Unable to get reduction handle 'sum': %d", handle_sum);
+
+    /* compute \sum \rho and \sum \rho x^i over core region */
+    for(unsigned int red = 0 ; red < DIM(reductions) ; ++red) {
+        const int varindex = CCTK_VarIndex(reductions[red].variable);
+        if(varindex < 0)
+            CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
+                       "Error while reducing %s, could not obtain variable index: %d",
+                       reductions[red].variable, varindex);
+        const int ierr = CCTK_Reduce(cctkGH, -1, handle_sum, 1, CCTK_VARIABLE_REAL,
+                                     reductions[red].target, 1,
+                                     varindex);
+        if(ierr != 0)
+            CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
+                       "Error while reducing %s: %d", reductions[red].variable, ierr);
+    }
+
+    if(rho_sum != 0.) {
+        /* normalise center of mass coordinates */
+        *core_x /= rho_sum;
+        *core_y /= rho_sum;
+        *core_z /= rho_sum;
+    } else {
+        CCTK_VWarn(CCTK_WARN_ALERT, __LINE__, __FILE__, CCTK_THORNSTRING,
+                   "Did not find any mass in core region, using old core location (%g,%g,%g).", 
+                   *core_x, *core_y, *core_z);
+    }
 }

Directory: /handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/src/
====================================================================================================

File [modified]: make.code.defn
Delta lines: +1 -1
===================================================================
--- handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/src/make.code.defn	2012-04-05 18:16:46 UTC (rev 77)
+++ handson_analysis/Cactus/arrangements/Introduction/CoreTracker_stages/CoreTracker_v7/src/make.code.defn	2012-04-05 18:46:42 UTC (rev 78)
@@ -1,7 +1,7 @@
 # Main make.code.defn file for thorn CoreTracker
 
 # Source files in this directory
-SRCS = coretracker.c
+SRCS = coretracker.c movingblob.c
 
 # Subdirectories containing source files
 SUBDIRS = 



More information about the Commits mailing list