Nathan Goldbaum avatar Nathan Goldbaum committed 5c09efe Merge

Merged in samskillman/enzo-dev (pull request #68)

Comments (0)

Files changed (9)

src/enzo/Grid_FlagCellsToBeRefinedByShockwaves.C

     return -1;
   } 
 
-
+  if (FindShocksOnlyOnOutput == 1){
+    fprintf(stderr, 
+            "FlagCellsToBeRefinedByShockwaves: Refusing to refine when shocks \n"
+            "are only found during output. Please change FindShocksOnlyOnOutput\n"
+            "to 0 or 2.\n");
+    ENZO_FAIL("Error in FlagCellsToBeRefinedByShockwaves.");
+  } 
 
   /* Compute cell volume */
   

src/enzo/Grid_InterpolateBoundaryFromParent.C

   int i, j, k, dim, field, fieldindex, tempindex, interp_error;
   float *TemporaryField, *TemporaryDensityField, *Work,
         *ParentTemp[MAX_NUMBER_OF_BARYON_FIELDS], *FieldPointer;
-  int FieldInterpolationMethod;
+  interpolation_type FieldInterpolationMethod;
 
   if (NumberOfBaryonFields > 0) {
 

src/enzo/Grid_InterpolateFieldValues.C

   int dim, field, interp_error;
   float *TemporaryField, *TemporaryDensityField, *Work,
         *ParentTemp[MAX_NUMBER_OF_BARYON_FIELDS], *FieldPointer;
-  int FieldInterpolationMethod;
+  interpolation_type FieldInterpolationMethod;
  
   if (NumberOfBaryonFields > 0) {
 

src/enzo/Grid_ShocksHandler.C

   if (!ShockMethod) return SUCCESS; 
   int shock_status;
 
+  if (FindShocksOnlyOnOutput == 1) return SUCCESS;
+  
   switch(ShockMethod){
   case 1:
     shock_status = this->FindShocks();

src/enzo/New_Grid_WriteGrid.C

  
     } // if (OutputCoolingTime)
 
+    if (ShockMethod){
+      // Update the shock fields. 
+      // If FindShocksOnlyOnOutput > 1, don't update shock fields.
+      int temp_shocks_var = FindShocksOnlyOnOutput;
+      if (FindShocksOnlyOnOutput <= 1 ){
+        // Set FindShocksOnlyOnOutput temporarily to 0 so that shocks
+        // are found in the ShockHandler routine.
+        FindShocksOnlyOnOutput = 0;
+        this->ShocksHandler();
+        FindShocksOnlyOnOutput = temp_shocks_var;
+      }
+    }
+
     /* Make sure that there is a copy of dark matter field to save
        (and at the right resolution). */
 

src/enzo/ReadParameterFile.C

     ret += sscanf(line, "ShockMethod = %"ISYM, &ShockMethod);
     ret += sscanf(line, "ShockTemperatureFloor = %"FSYM, &ShockTemperatureFloor);
     ret += sscanf(line, "StorePreShockFields = %"ISYM, &StorePreShockFields);
+    ret += sscanf(line, "FindShocksOnlyOnOutput = %"ISYM, &FindShocksOnlyOnOutput);
 
     ret += sscanf(line, "RadiationFieldType = %"ISYM, &RadiationFieldType);
     ret += sscanf(line, "RadiationFieldRedshift = %"FSYM, &RadiationFieldRedshift);

src/enzo/SetDefaultGlobalValues.C

   ShockMethod                 = 0;                 // off
   ShockTemperatureFloor       = 1.0;               // Set to 1K
   StorePreShockFields         = 0;
+  FindShocksOnlyOnOutput      = 0;                 // Find at every cycle and 
+                                                   // during output by default.
   RadiationFieldType          = 0;
   RadiationFieldRedshift      = 0.0;
   TabulatedLWBackground       = 0;

src/enzo/WriteParameterFile.C

   fprintf(fptr, "ShockMethod                    = %"ISYM"\n", ShockMethod);
   fprintf(fptr, "ShockTemperatureFloor          = %"FSYM"\n", ShockTemperatureFloor);
   fprintf(fptr, "StorePreShockFields            = %"ISYM"\n", StorePreShockFields);
+  fprintf(fptr, "FindShocksOnlyOnOutput         = %"ISYM"\n", FindShocksOnlyOnOutput);
   fprintf(fptr, "RadiationFieldType             = %"ISYM"\n", RadiationFieldType);
   fprintf(fptr, "TabulatedLWBackground          = %"ISYM"\n", TabulatedLWBackground);
   fprintf(fptr, "AdjustUVBackground             = %"ISYM"\n", AdjustUVBackground);

src/enzo/global_data.h

 EXTERN int ShockMethod; 
 EXTERN float ShockTemperatureFloor;
 EXTERN int StorePreShockFields;
+EXTERN int FindShocksOnlyOnOutput;
+
 
 /* Type of radiation field. 
    0 - none,                    1 - Haardt & Madau alpha=-1.5
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.