Commits

Matthew Turk committed 40abc55 Merge

Comments (0)

Files changed (4)

src/enzo/CommunicationInitialize.C

  
   return SUCCESS;
 }
+
+void CommunicationAbort(int status)
+{
+
+#ifdef USE_MPI
+  MPI_Abort(MPI_COMM_WORLD,status);
+#else
+  abort(status);
+#endif
+
+  return;
+}

src/enzo/calc_rates.src

 c       31) H2I   + p   -> 2HI
 c
 c        sigma31(n) = 0.0
+
+C	 BUG FIX: (n) subscripts below were (i)
+C	 reported by Patrick McDonald, modified in revision 2310
+
         if (nu .ge. e28b .and. nu .lt. e24) THEN
            sigma31(n) = 3.71e-18
         else
 int SetDefaultGlobalValues(TopGridData &MetaData);
 int CommunicationInitialize(Eint32 *argc, char **argv[]);
 int CommunicationFinalize();
+
 int CommunicationPartitionGrid(HierarchyEntry *Grid, int gridnum);
+
+void CommunicationAbort(int);
 int ENZO_OptionsinEffect(void);
 
 #ifdef TASKMAP
  
 }
  
- 
- 
- 
 void my_exit(int status)
 {
-  CommunicationFinalize();
-  exit(status);
+  // Exit gracefully if successful; abort on error
+
+  if (status == EXIT_SUCCESS) {
+
+    if (MyProcessorNumber==0) {
+      fprintf (stdout,"%s:%d Exiting.\n", __FILE__,__LINE__);
+    }
+
+    CommunicationFinalize();
+
+    exit(status);
+
+  } else if (status == EXIT_FAILURE) {
+
+    fprintf (stderr,"%s:%d %"ISYM" ABORT ON EXIT_FAILURE!\n",
+	     __FILE__,__LINE__,MyProcessorNumber);
+
+    CommunicationAbort(status);
+
+  } else {
+
+    fprintf (stderr,"%s:%d %"ISYM" ABORT ON UNKNOWN EXIT VALUE %"ISYM"!\n",
+	     __FILE__,__LINE__,MyProcessorNumber,status);
+
+    CommunicationAbort(status);
+
+  }
 }
+

src/ring/Ring_Decomp.C

   buff[0] = new double[dbuff_size];
   buff[1] = new double[dbuff_size];
  
+  double tiny_shift = 1e-12;
+
   rank = 3;
   ngrids = 1;
  
  
         if ( n == jcpu )
         {
-      // rank to coordinate
-        m = n;
-        i = m/(b*c);
-        m = m%(b*c);
-        j = m/c;
-        m = m%c;
-        k = m;
-      // coordinate to rank check
-        m = ((i*b*c) + j*c) + k;
-        fprintf(log,"Grid %"ISYM"  {%"ISYM" %"ISYM" %"ISYM"}  %"ISYM"\n",n,i,j,k,m);
- 
-        Left[0] =  x0 + dx * (double) ii;
-        Right[0] = x0 + dx * (double) (ii+1);
-        Left[1] =  y0 + dy * (double) jj;
-        Right[1] = y0 + dy * (double) (jj+1);
-        Left[2] =  z0 + dz * (double) kk;
-        Right[2] = z0 + dz * (double) (kk+1);
- 
-        GridLeft[jcpu][0] = Left[0];
-        GridLeft[jcpu][1] = Left[1];
-        GridLeft[jcpu][2] = Left[2];
- 
-        GridRight[jcpu][0] = Right[0];
-        GridRight[jcpu][1] = Right[1];
-        GridRight[jcpu][2] = Right[2];
- 
-        for (m = 0; m < rank; m++)
-          fprintf(log, "Grid %"ISYM"    Left   %16.8"FSYM"   Right  %16.8"FSYM"\n", gridcounter, Left[m], Right[m]);
+	  // rank to coordinate
+	  m = n;
+	  i = m/(b*c);
+	  m = m%(b*c);
+	  j = m/c;
+	  m = m%c;
+	  k = m;
+	  // coordinate to rank check
+	  m = ((i*b*c) + j*c) + k;
+	  fprintf(log,"Grid %"ISYM"  {%"ISYM" %"ISYM" %"ISYM"}  %"ISYM"\n",n,i,j,k,m);
+ 
+	  Left[0] =  x0 + dx * (double) ii;
+	  Right[0] = x0 + dx * (double) (ii+1);
+	  Left[1] =  y0 + dy * (double) jj;
+	  Right[1] = y0 + dy * (double) (jj+1);
+	  Left[2] =  z0 + dz * (double) kk;
+	  Right[2] = z0 + dz * (double) (kk+1);
+ 
+	  GridLeft[jcpu][0] = Left[0];
+	  GridLeft[jcpu][1] = Left[1];
+	  GridLeft[jcpu][2] = Left[2];
+ 
+	  GridRight[jcpu][0] = Right[0];
+	  GridRight[jcpu][1] = Right[1];
+	  GridRight[jcpu][2] = Right[2];
+ 
+	  for (m = 0; m < rank; m++)
+	    fprintf(log, "Grid %"ISYM"    Left   %16.8"FSYM"   Right  %16.8"FSYM"\n", gridcounter, Left[m], Right[m]);
  
         }
  
  
       if ( dpos == Left[dim] )
       {
-         fprintf(stderr, "Particle on left boundary [%"ISYM"] [%"ISYM"] %16.8"FSYM"\n", i, ic, buff[i][ic]);
-         hits = hits + 1;
+	//fprintf(stderr, "Particle on left boundary [%"ISYM"] [%"ISYM"] %16.8"FSYM"\n", i, ic, buff[i][ic]);
+	dpos += tiny_shift;
+	buff[i][ic] = dpos;
+	hits = hits + 1;
       }
  
       if ( dpos == Right[dim] )
       {
-         fprintf(stderr, "Particle on right boundary [%"ISYM"] [%"ISYM"] %16.8"FSYM"\n", i, ic, buff[i][ic]);
-         hits = hits + 1;
+	//fprintf(stderr, "Particle on right boundary [%"ISYM"] [%"ISYM"] %16.8"FSYM"\n", i, ic, buff[i][ic]);
+	if (dpos == SubDomainRightEdge[dim]) {
+	  dpos -= tiny_shift;
+	}
+	else {
+	  dpos += tiny_shift;
+	}
+	buff[i][ic] = dpos;
+	hits = hits + 1;
       }
- 
-      if ( buff[i][ic] < Left[dim] || buff[i][ic] > Right[dim] )
+
+      if ( dpos < Left[dim] || dpos > Right[dim] )
       {
     //  Mask[ipc] = 0;
         MaskAddr = ipc;
 // FAIL here if any particles are on the mesh
 // Do not count the fakes
  
-  assert( hits == 0 );
+  fprintf(stderr,"Proc %"ISYM": Particles shifted from grid boundary %"ISYM" times.\n",jcpu,hits);
+//  assert( hits == 0 );
  
 // CHOP if(0)
 // CHOP {