[cig-commits] r16014 - mc/3D/CitcomS/trunk/lib

tan2 at geodynamics.org tan2 at geodynamics.org
Thu Nov 19 15:11:05 PST 2009


Author: tan2
Date: 2009-11-19 15:11:05 -0800 (Thu, 19 Nov 2009)
New Revision: 16014

Modified:
   mc/3D/CitcomS/trunk/lib/Full_version_dependent.c
   mc/3D/CitcomS/trunk/lib/Global_operations.c
   mc/3D/CitcomS/trunk/lib/Instructions.c
   mc/3D/CitcomS/trunk/lib/Material_properties.c
   mc/3D/CitcomS/trunk/lib/Regional_version_dependent.c
   mc/3D/CitcomS/trunk/lib/global_defs.h
Log:
Created a new array E->sphere.gr for the radii of all layers. This makes gather_r() obsolete.


Modified: mc/3D/CitcomS/trunk/lib/Full_version_dependent.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Full_version_dependent.c	2009-11-19 23:09:04 UTC (rev 16013)
+++ mc/3D/CitcomS/trunk/lib/Full_version_dependent.c	2009-11-19 23:11:05 UTC (rev 16014)
@@ -135,6 +135,11 @@
     break;
   }
 
+  for (i=1;i<=E->mesh.noz;i++)  {
+      E->sphere.gr[i] = rr[i];
+      /* if(E->parallel.me==0) fprintf(stderr, "%d %f\n", i, E->sphere.gr[i]); */
+  }
+
   for (i=1;i<=E->lmesh.noz;i++)  {
     k = E->lmesh.nzs+i-1;
     RR[i] = rr[k];

Modified: mc/3D/CitcomS/trunk/lib/Global_operations.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Global_operations.c	2009-11-19 23:09:04 UTC (rev 16013)
+++ mc/3D/CitcomS/trunk/lib/Global_operations.c	2009-11-19 23:11:05 UTC (rev 16014)
@@ -1026,22 +1026,3 @@
 }
 
 
-void gather_r(struct All_variables *E, double *r)
-{
-    /* Gather the radial coordinate and concatnate
-     * them together as a 1d array. */
-
-    const int m = 1;
-    int n = E->parallel.nprocz;
-
-    /* send all r coordiante except the top node, which is the
-       same as the bottom node of the next processor. */
-    MPI_Allgather(&(E->sx[m][3][1]), E->lmesh.noz-1, MPI_DOUBLE,
-                  &(r[1]), E->lmesh.noz-1, MPI_DOUBLE,
-                  E->parallel.vertical_comm);
-
-    /* add the top most nodes of all processors */
-    r[E->mesh.noz] = E->sphere.ro;
-
-    return;
-}

Modified: mc/3D/CitcomS/trunk/lib/Instructions.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Instructions.c	2009-11-19 23:09:04 UTC (rev 16013)
+++ mc/3D/CitcomS/trunk/lib/Instructions.c	2009-11-19 23:11:05 UTC (rev 16014)
@@ -932,6 +932,8 @@
   E->Have.V[1]      = (float *)malloc((E->lmesh.noz+2)*sizeof(float));
   E->Have.V[2]      = (float *)malloc((E->lmesh.noz+2)*sizeof(float));
 
+  E->sphere.gr = (double *)malloc((E->mesh.noz+1)*sizeof(double));
+
  for(i=E->mesh.levmin;i<=E->mesh.levmax;i++) {
   E->sphere.R[i] = (double *)  malloc((E->lmesh.NOZ[i]+1)*sizeof(double));
   for (j=1;j<=E->sphere.caps_per_proc;j++)  {

Modified: mc/3D/CitcomS/trunk/lib/Material_properties.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Material_properties.c	2009-11-19 23:09:04 UTC (rev 16013)
+++ mc/3D/CitcomS/trunk/lib/Material_properties.c	2009-11-19 23:11:05 UTC (rev 16014)
@@ -217,22 +217,19 @@
     const acc = 1e-8;
 
 
-    r = (double *) malloc((gnoz+1)*sizeof(double));
     rho = (double *) malloc((gnoz+1)*sizeof(double));
     p = (double *) malloc((gnoz+1)*sizeof(double));
 
-    if(r == NULL || rho == NULL || p == NULL) {
+    if(rho == NULL || p == NULL) {
         myerror(E, "allocating memory in murnaghan_eos()");
     }
 
-    /* r[1 ... gnoz] will hold the global radial coordinates */
-    gather_r(E, r);
-
     for(i=1; i<=gnoz; i++) {
 	rho[i] = 1;
         p[i] = 0;
     }
 
+    r = E->sphere.gr;
     old_rho_cmb = 0;
     do {
         /* integrate downward from surface to CMB */

Modified: mc/3D/CitcomS/trunk/lib/Regional_version_dependent.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Regional_version_dependent.c	2009-11-19 23:09:04 UTC (rev 16013)
+++ mc/3D/CitcomS/trunk/lib/Regional_version_dependent.c	2009-11-19 23:11:05 UTC (rev 16014)
@@ -119,6 +119,10 @@
   }
 
 
+  for (i=1;i<=E->mesh.noz;i++)  {
+      E->sphere.gr[i] = rr[i];
+      /* if(E->parallel.me==0) fprintf(stderr, "%d %f\n", i, E->sphere.gr[i]); */
+  }
 
   for (i=1;i<=E->lmesh.noz;i++)  {
       k = E->lmesh.nzs+i-1;

Modified: mc/3D/CitcomS/trunk/lib/global_defs.h
===================================================================
--- mc/3D/CitcomS/trunk/lib/global_defs.h	2009-11-19 23:09:04 UTC (rev 16013)
+++ mc/3D/CitcomS/trunk/lib/global_defs.h	2009-11-19 23:11:05 UTC (rev 16014)
@@ -285,6 +285,7 @@
   double *angle1[MAX_LEVELS][NCS][5];
 
   double *R[MAX_LEVELS];
+  double *gr;
   double ro,ri;
   struct CAP cap[NCS];
 



More information about the CIG-COMMITS mailing list