Sam Skillman avatar Sam Skillman committed d75320b Merge

Merging in Interpolation bugfix.

Comments (0)

Files changed (2)

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;
+
   if (NumberOfBaryonFields > 0) {
 
     interp_error = FALSE;
 
     if (InterpolationMethod == SecondOrderB)
       for (field = 0; field < NumberOfBaryonFields; field++) {
-	if (FieldType[field] == TotalEnergy || FieldType[field] == Pressure ||
-	    FieldType[field] == InternalEnergy)
-	  SecondOrderBFlag[field] = 2;   // enforce monotonicity
-	else
-	  SecondOrderBFlag[field] = 2;   // enforce only positivity
-	if (FieldType[field] >= Velocity1 && FieldType[field] <= Velocity3)
-	  SecondOrderBFlag[field] = 2;   //  no positivity for velocity
+        if (FieldType[field] == TotalEnergy || FieldType[field] == Pressure ||
+            FieldType[field] == InternalEnergy)
+          SecondOrderBFlag[field] = 2;   // enforce monotonicity
+        else
+          SecondOrderBFlag[field] = 2;   // enforce only positivity
+        if (FieldType[field] >= Velocity1 && FieldType[field] <= Velocity3)
+          SecondOrderBFlag[field] = 2;   //  no positivity for velocity
       }
     if (HydroMethod == Zeus_Hydro)
       for (field = 0; field < NumberOfBaryonFields; field++)
-	if (FieldType[field] >= Velocity1 && FieldType[field] <= Velocity3)
-	  SecondOrderBFlag[field] = FieldType[field] - Velocity1 + 1;
-	else
-	  SecondOrderBFlag[field] = 0;
- 
+        if (FieldType[field] >= Velocity1 && FieldType[field] <= Velocity3)
+          SecondOrderBFlag[field] = FieldType[field] - Velocity1 + 1;
+        else
+          SecondOrderBFlag[field] = 0;
+
  
     /* Compute coefficient factors for linear interpolation in time.
        Note: interp = coef1*Old + coef2*New. */
     for (field = 0; field < NumberOfBaryonFields; field++) {
  
       if (HydroMethod == Zeus_Hydro)
-	InterpolationMethod = (SecondOrderBFlag[field] == 0) ?
-	  SecondOrderA : SecondOrderC;
+        InterpolationMethod = (SecondOrderBFlag[field] == 0) ?
+            SecondOrderA : SecondOrderC;
+      
+      // Set FieldInterpolationMethod to be FirstOrderA for 
+      // fields that shouldn't be interpolated.'
+      FieldInterpolationMethod = InterpolationMethod;
+      if (FieldTypeNoInterpolate(FieldType[field]) == TRUE)
+        FieldInterpolationMethod = FirstOrderA; 
  
       /* Interpolating from the ParentTemp field to a Temporary field.  This
 	 is done for the entire current grid, not just it's boundaries.
 				  ParentTempStartIndex, ParentTempEndIndex,
                                      Refinement,
 				  TemporaryField, TempDim, ZeroVector, Work,
-				  &InterpolationMethod,
+				  &FieldInterpolationMethod,
 				  &SecondOrderBFlag[field], &interp_error);
 	if (interp_error) {
 	  printf("P%d: Error interpolating field %d (%s).\n"

src/enzo/Grid_InterpolateFieldValues.C

   int dim, field, interp_error;
   float *TemporaryField, *TemporaryDensityField, *Work,
         *ParentTemp[MAX_NUMBER_OF_BARYON_FIELDS], *FieldPointer;
+  int FieldInterpolationMethod;
  
   if (NumberOfBaryonFields > 0) {
 
     int SecondOrderBFlag[MAX_NUMBER_OF_BARYON_FIELDS];
     if (InterpolationMethod == SecondOrderB)
       for (field = 0; field < NumberOfBaryonFields; field++) {
-	if (FieldType[field] == TotalEnergy || FieldType[field] == Pressure ||
-	    FieldType[field] == InternalEnergy)
-	  SecondOrderBFlag[field] = 2;   // enforce monotonicity
-	else
-	  SecondOrderBFlag[field] = 2;   // enforce only positivity
-	if (FieldType[field] >= Velocity1 && FieldType[field] <= Velocity3)
-	  SecondOrderBFlag[field] = 2;   //  no positivity for velocity
+        if (FieldType[field] == TotalEnergy || FieldType[field] == Pressure ||
+            FieldType[field] == InternalEnergy)
+          SecondOrderBFlag[field] = 2;   // enforce monotonicity
+        else
+          SecondOrderBFlag[field] = 2;   // enforce only positivity
+        if (FieldType[field] >= Velocity1 && FieldType[field] <= Velocity3)
+          SecondOrderBFlag[field] = 2;   //  no positivity for velocity
       }
     if (HydroMethod == Zeus_Hydro)
       for (field = 0; field < NumberOfBaryonFields; field++)
-	if (FieldType[field] >= Velocity1 && FieldType[field] <= Velocity3)
-	  SecondOrderBFlag[field] = FieldType[field] - Velocity1 + 1;
-	else
-	  SecondOrderBFlag[field] = 0;
- 
+        if (FieldType[field] >= Velocity1 && FieldType[field] <= Velocity3)
+          SecondOrderBFlag[field] = FieldType[field] - Velocity1 + 1;
+        else
+          SecondOrderBFlag[field] = 0;
+
     /* Compute the start and end indicies (in this grid units) of this grid
        within it's parent */
     /* StartIndex = cells from left edge of parent active region
        (skip density since we did it already) */
  
       if (HydroMethod == Zeus_Hydro){
-	InterpolationMethod = (SecondOrderBFlag[field] == 0) ?
-	  SecondOrderA : SecondOrderC;
+        InterpolationMethod = (SecondOrderBFlag[field] == 0) ?
+            SecondOrderA : SecondOrderC;
       }
+      
+      // Set FieldInterpolationMethod to be FirstOrderA for 
+      // fields that shouldn't be interpolated.'
+      FieldInterpolationMethod = InterpolationMethod;
+      if (FieldTypeNoInterpolate(FieldType[field]) == TRUE)
+        FieldInterpolationMethod = FirstOrderA; 
+      
       //      fprintf(stdout, "grid:: InterpolateBoundaryFromParent[4], field = %d\n", field); 
 
       if (FieldType[field] != Density && FieldType[field] != DebugField) {
 				  ParentTempStartIndex, ParentTempEndIndex,
                                      Refinement,
 				  TemporaryField, TempDim, ZeroVector, Work,
-				  &InterpolationMethod,
+				  &FieldInterpolationMethod,
 				  &SecondOrderBFlag[field], &interp_error);
 	if (interp_error) {
 	  printf("P%d: Error interpolating field %d (%s).\n"
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.