[cig-commits] [commit] rajesh-petsc-schur: Changed the shape of E->sx as part of caps_per_proc removal (f18c4ed)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Nov 5 19:11:26 PST 2014


Repository : https://github.com/geodynamics/citcoms

On branch  : rajesh-petsc-schur
Link       : https://github.com/geodynamics/citcoms/compare/464e1b32299b15819f93efd98d969cddb84dfe51...f97ae655a50bdbd6dac1923a3471ee4dae178fbd

>---------------------------------------------------------------

commit f18c4ed121f8af3c78d80f3fca65f029104355e3
Author: Rajesh Kommu <rajesh.kommu at gmail.com>
Date:   Tue Sep 23 12:48:14 2014 -0700

    Changed the shape of E->sx as part of caps_per_proc removal


>---------------------------------------------------------------

f18c4ed121f8af3c78d80f3fca65f029104355e3
 lib/Construct_arrays.c          |  2 +-
 lib/Determine_net_rotation.c    |  6 +++---
 lib/Full_tracer_advection.c     | 46 ++++++++++++++++++++---------------------
 lib/Global_operations.c         |  8 +++----
 lib/Initial_temperature.c       | 34 +++++++++++++++---------------
 lib/Instructions.c              |  2 +-
 lib/Lith_age.c                  | 34 +++++++++++++++---------------
 lib/Material_properties.c       |  8 +++----
 lib/Mineral_physics_models.c    |  8 +++----
 lib/Output.c                    | 24 ++++++++++-----------
 lib/Output_gzdir.c              | 10 ++++-----
 lib/Output_h5.c                 | 16 +++++++-------
 lib/Phase_change.c              |  6 +++---
 lib/Regional_tracer_advection.c | 10 ++++-----
 lib/Size_does_matter.c          |  2 +-
 lib/Sphere_harmonics.c          |  4 ++--
 lib/Sphere_util.c               |  6 +++---
 lib/Topo_gravity.c              |  4 ++--
 lib/Tracer_setup.c              | 10 ++++-----
 lib/Viscosity_structures.c      | 42 ++++++++++++++++++-------------------
 lib/global_defs.h               |  2 +-
 21 files changed, 141 insertions(+), 143 deletions(-)

diff --git a/lib/Construct_arrays.c b/lib/Construct_arrays.c
index c174b65..92e0d2a 100644
--- a/lib/Construct_arrays.c
+++ b/lib/Construct_arrays.c
@@ -746,7 +746,7 @@ int layers_r(struct All_variables *E,float r)
 /* determine layer number of node "node" of cap "m" */
 int layers(struct All_variables *E,int node)
 {
-  return(layers_r(E,E->sx[CPPR][3][node]));
+  return(layers_r(E,E->sx[3][node]));
 }
 
 
diff --git a/lib/Determine_net_rotation.c b/lib/Determine_net_rotation.c
index 972fbe0..833bcf4 100644
--- a/lib/Determine_net_rotation.c
+++ b/lib/Determine_net_rotation.c
@@ -154,20 +154,20 @@ double determine_model_net_rotation(struct All_variables *E,double *omega)
   omega[0]=omega[1]=omega[2]=0.0;
 
   /* depth range */
-  rr = E->sx[CPPR][3][E->ien[elz].node[5]] - E->sx[CPPR][3][E->ien[1].node[1]];
+  rr = E->sx[3][E->ien[elz].node[5]] - E->sx[3][E->ien[1].node[1]];
   if(rr < 1e-7)
     myerror(E,"rr error in net r determine");
   vw = 0.0;
   for (i=0;i < elz;i++) {	/* regular 0..n-1 loop */
     /* solve layer NR */
     lamp = determine_netr_tp(ddummy,ddummy,ddummy,ddummy,ddummy,2,(acoef+i*9),(lomega+i*3));
-    r1 = E->sx[CPPR][3][E->ien[i+1].node[1]]; /* nodal radii for the
+    r1 = E->sx[3][E->ien[i+1].node[1]]; /* nodal radii for the
 						 i-th element, this
 						 assumes that there
 						 are no lateral
 						 variations in radii!
 					      */
-    r2 = E->sx[CPPR][3][E->ien[i+1].node[5]];
+    r2 = E->sx[3][E->ien[i+1].node[5]];
     vtmp = (r2-r1)/rr;		/* weight for this layer */
     //if(E->parallel.me == 0)
     //  fprintf(stderr,"NR layer %5i (%11g - %11g, %11g): |%11g %11g %11g| = %11g\n",
diff --git a/lib/Full_tracer_advection.c b/lib/Full_tracer_advection.c
index 8e9198c..16e2857 100644
--- a/lib/Full_tracer_advection.c
+++ b/lib/Full_tracer_advection.c
@@ -320,7 +320,7 @@ void full_lost_souls(struct All_variables *E)
                 E->trace.rlater[CPPR][2][kk]);
     }
     fflush(E->trace.fpt);
-    /**/
+    */
 
 
 
@@ -352,7 +352,7 @@ void full_lost_souls(struct All_variables *E)
 
     }
     fflush(E->trace.fpt);
-    /**/
+    */
 
 
     /* Pre communication */
@@ -401,7 +401,7 @@ void full_lost_souls(struct All_variables *E)
 	fprintf(E->trace.fpt,"%d recv %d from proc %d\n",
 		E->parallel.me,ireceive[CPPR][kk],isource_proc);
     }
-    /**/
+    */
 
     /* Allocate memory in receive arrays */
 
@@ -618,7 +618,7 @@ void full_lost_souls(struct All_variables *E)
                     isend_z[CPPR][kk],ireceive_z[CPPR][kk]);
         }
         fflush(E->trace.fpt);
-        /**/
+        */
 
 
         /* Allocate memory to receive_z arrays */
@@ -939,7 +939,7 @@ void full_get_shape_functions(struct All_variables *E,
                     fprintf(E->trace.fpt,"theta: %f phi: %f rad: %f\n",theta,phi,rad);
                     fprintf(E->trace.fpt,"Element theta-phi boundaries: \n");
                     for(kk=1;kk<=4;kk++)
-                        fprintf(E->trace.fpt,"%d: Theta: %f Phi:%f\n",kk,E->sx[CPPR][1][E->ien[nelem].node[kk]],E->sx[CPPR][2][E->ien[nelem].node[kk]]);
+                        fprintf(E->trace.fpt,"%d: Theta: %f Phi:%f\n",kk,E->sx[1][E->ien[nelem].node[kk]],E->sx[2][E->ien[nelem].node[kk]]);
                     sphere_to_cart(E,theta,phi,rad,&x,&y,&z);
                     ival=icheck_element(E,nelem,x,y,z,rad);
                     fprintf(E->trace.fpt,"ICHECK?: %d\n",ival);
@@ -983,9 +983,7 @@ void full_get_shape_functions(struct All_variables *E,
     /** debug **
     fprintf(E->trace.fpt, "shp: %e %e %e %e %e %e\n",
             shp[1], shp[2], shp[3], shp[4], shp[5], shp[6]);
-    /**/
-
-    return;
+    */
 }
 
 
@@ -1164,8 +1162,8 @@ static void get_radial_shape(struct All_variables *E,
     node1=E->ien[nelem].node[1];
     node5=E->ien[nelem].node[5];
 
-    rad1=E->sx[CPPR][3][node1];
-    rad5=E->sx[CPPR][3][node5];
+    rad1=E->sx[3][node1];
+    rad5=E->sx[3][node5];
 
     delrad=rad5-rad1;
 
@@ -1325,8 +1323,8 @@ static void make_regular_grid(struct All_variables *E)
             for (kk=1;kk<=E->lmesh.nno;kk=kk+E->lmesh.noz)
                 {
 
-                    theta=E->sx[CPPR][1][kk];
-                    phi=E->sx[CPPR][2][kk];
+                    theta=E->sx[1][kk];
+                    phi=E->sx[2][kk];
 
                     thetamax=max(thetamax,theta);
                     thetamin=min(thetamin,theta);
@@ -1470,8 +1468,8 @@ static void make_regular_grid(struct All_variables *E)
                     for (pp=1;pp<=4;pp++)
                         {
                             node=E->ien[mm].node[pp];
-                            theta=E->sx[CPPR][1][node];
-                            phi=E->sx[CPPR][2][node];
+                            theta=E->sx[1][node];
+                            phi=E->sx[2][node];
 
                             theta_min=min(theta_min,theta);
                             theta_max=max(theta_max,theta);
@@ -2099,8 +2097,8 @@ static int icheck_shell(struct All_variables *E,
     ibottom_node=E->ien[nel].node[1];
     itop_node=E->ien[nel].node[5];
 
-    bottom_rad=E->sx[CPPR][3][ibottom_node];
-    top_rad=E->sx[CPPR][3][itop_node];
+    bottom_rad=E->sx[3][ibottom_node];
+    top_rad=E->sx[3][itop_node];
 
     ival=0;
     if ((rad>=bottom_rad)&&(rad<top_rad)) ival=1;
@@ -2141,8 +2139,8 @@ static int icheck_element_column(struct All_variables *E,
             rnode[kk][2]=E->x[CPPR][2][node];
             rnode[kk][3]=E->x[CPPR][3][node];
 
-            rnode[kk][4]=E->sx[CPPR][1][node];
-            rnode[kk][5]=E->sx[CPPR][2][node];
+            rnode[kk][4]=E->sx[1][node];
+            rnode[kk][5]=E->sx[2][node];
 
             rnode[kk][6]=E->SinCos[lev][CPPR][2][node]; /* cos(theta) */
             rnode[kk][7]=E->SinCos[lev][CPPR][0][node]; /* sin(theta) */
@@ -2710,7 +2708,7 @@ static int iget_radial_element(struct All_variables *E,
         {
 
             node=E->ien[iradial_element].node[8];
-            top_rad=E->sx[CPPR][3][node];
+            top_rad=E->sx[3][node];
 
             if (rad<top_rad) goto found_it;
 
@@ -2808,7 +2806,7 @@ static void define_uv_space(struct All_variables *E)
     /* use the point at middle of the cap */
     refnode = 1 + E->lmesh.noz * ((E->lmesh.noy / 2) * E->lmesh.nox
                                   + E->lmesh.nox / 2);
-    phi_f = E->gnomonic_reference_phi = E->sx[CPPR][2][refnode];
+    phi_f = E->gnomonic_reference_phi = E->sx[2][refnode];
 
     /** debug **
     theta_f = E->sx[j][1][refnode];
@@ -2818,7 +2816,7 @@ static void define_uv_space(struct All_variables *E)
     }
     fprintf(E->trace.fpt, "%d %d %d ref=(%e %e)\n",
             E->lmesh.noz, E->lmesh.nsf, refnode, theta_f, phi_f);
-    /**/
+    */
 
     /* store cos(theta_f) and sin(theta_f) */
     E->gnomonic[0].u = cost[refnode];
@@ -2828,7 +2826,7 @@ static void define_uv_space(struct All_variables *E)
     /* convert each nodal point to u and v */
 
     for (i=1, n=1; i<=E->lmesh.nsf; i++, n+=E->lmesh.noz) {
-        dphi = E->sx[CPPR][2][n] - phi_f;
+        dphi = E->sx[2][n] - phi_f;
         cosd = cos(dphi);
         cosc = cost[refnode] * cost[n] + sint[refnode] * sint[n] * cosd;
         u = sint[n] * sin(dphi) / cosc;
@@ -2841,7 +2839,7 @@ static void define_uv_space(struct All_variables *E)
         /** debug **
         fprintf(E->trace.fpt, "n=%d ns=%d cosc=%e (%e %e) -> (%e %e)\n",
                 n, i, cosc, E->sx[j][1][n], E->sx[j][2][n], u, v);
-        /**/
+        */
     }
 
     return;
@@ -2961,7 +2959,7 @@ static void determine_shape_coefficients(struct All_variables *E)
                     E->trace.shape_coefs[j][iwedge][7][i],
                     E->trace.shape_coefs[j][iwedge][8][i],
                     E->trace.shape_coefs[j][iwedge][9][i]);
-            /**/
+            */
 
         } /* end wedge */
     } /* end elem */
diff --git a/lib/Global_operations.c b/lib/Global_operations.c
index 0f9b53a..cebd576 100644
--- a/lib/Global_operations.c
+++ b/lib/Global_operations.c
@@ -876,7 +876,7 @@ void remove_rigid_rot(struct All_variables *E)
         for (i=1;i<=E->lmesh.elz;i++)
             tmp += (8.0*M_PI/15.0)*
                 0.5*(E->refstate.rho[i] + E->refstate.rho[i+1])*
-                (pow(E->sx[1][3][i+1],5.0) - pow(E->sx[1][3][i],5.0));
+                (pow(E->sx[3][i+1],5.0) - pow(E->sx[3][i],5.0));
 
         MPI_Allreduce(&tmp, &moment_of_inertia, 1, MPI_DOUBLE,
                       MPI_SUM, E->parallel.vertical_comm);
@@ -969,9 +969,9 @@ void remove_rigid_rot(struct All_variables *E)
     sin_t = sin(tr) * rot;
     cos_t = cos(tr) * rot;
       for (node=1;node<=nno;node++)   {
-	frd = fr - E->sx[CPPR][2][node];
-	v_theta = E->sx[CPPR][3][node] * sin_t * sin(frd);
-	v_phi =   E->sx[CPPR][3][node] * 
+	frd = fr - E->sx[2][node];
+	v_theta = E->sx[3][node] * sin_t * sin(frd);
+	v_phi =   E->sx[3][node] * 
 	  (  E->SinCos[lev][CPPR][0][node] * cos_t - E->SinCos[lev][CPPR][2][node]  * sin_t * cos(frd) );
 	
 	E->sphere.cap[CPPR].V[1][node] -= v_theta;
diff --git a/lib/Initial_temperature.c b/lib/Initial_temperature.c
index 2c78b78..eb165d7 100644
--- a/lib/Initial_temperature.c
+++ b/lib/Initial_temperature.c
@@ -245,7 +245,7 @@ static void debug_tic(struct All_variables *E)
   fprintf(E->fp_out,"output_temperature\n");
     fprintf(E->fp_out,"for cap %d\n",E->sphere.capid[CPPR]);
     for (j=1;j<=E->lmesh.nno;j++)
-      fprintf(E->fp_out,"X = %.6e Z = %.6e Y = %.6e T[%06d] = %.6e \n",E->sx[CPPR][1][j],E->sx[CPPR][2][j],E->sx[CPPR][3][j],j,E->T[j]);
+      fprintf(E->fp_out,"X = %.6e Z = %.6e Y = %.6e T[%06d] = %.6e \n",E->sx[1][j],E->sx[2][j],E->sx[3][j],j,E->T[j]);
   fflush(E->fp_out);
 }
 
@@ -307,7 +307,7 @@ static void linear_temperature_profile(struct All_variables *E)
             for(j=1; j<=nox;j ++)
                 for(k=1; k<=noz; k++) {
                     node = k + (j-1)*noz + (i-1)*nox*noz;
-                    r1 = E->sx[CPPR][3][node];
+                    r1 = E->sx[3][node];
                     E->T[node] = E->control.TBCbotval - (E->control.TBCtopval + E->control.TBCbotval)*(r1 - E->sphere.ri)/(E->sphere.ro - E->sphere.ri);
                 }
 }
@@ -327,7 +327,7 @@ static void conductive_temperature_profile(struct All_variables *E)
         for(j=1; j<=nox;j ++)
             for(k=1; k<=noz; k++) {
                 node = k + (j-1)*noz + (i-1)*nox*noz;
-                r1 = E->sx[CPPR][3][node];
+                r1 = E->sx[3][node];
                 E->T[node] = (E->control.TBCtopval*E->sphere.ro
                                  - E->control.TBCbotval*E->sphere.ri)
                     / (E->sphere.ro - E->sphere.ri)
@@ -365,7 +365,7 @@ static void add_top_tbl(struct All_variables *E, double age_in_myrs, double mant
         for(j=1; j<=nox;j ++)
             for(k=1; k<=noz; k++) {
                 node = k + (j-1)*noz + (i-1)*nox*noz;
-                r1 = E->sx[CPPR][3][node];
+                r1 = E->sx[3][node];
                 E->T[node] -= dT * erfc(tmp * (E->sphere.ro - r1));
             }
 }
@@ -388,7 +388,7 @@ static void add_bottom_tbl(struct All_variables *E, double age_in_myrs, double m
         for(j=1; j<=nox;j ++)
             for(k=1; k<=noz; k++) {
                 node = k + (j-1)*noz + (i-1)*nox*noz;
-                r1 = E->sx[CPPR][3][node];
+                r1 = E->sx[3][node];
                 E->T[node] += dT * erfc(tmp * (r1 - E->sphere.ri));
             }
 }
@@ -434,8 +434,8 @@ static void add_perturbations_at_layers(struct All_variables *E)
                 for(i=1; i<=noy; i++)
                     for(j=1; j<=nox;j ++) {
                         node = k + (j-1)*noz + (i-1)*nox*noz;
-                        t1 = (E->sx[CPPR][1][node] - E->control.theta_min) * tlen;
-                        f1 = (E->sx[CPPR][2][node] - E->control.fi_min) * flen;
+                        t1 = (E->sx[1][node] - E->control.theta_min) * tlen;
+                        f1 = (E->sx[2][node] - E->control.fi_min) * flen;
 
                         E->T[node] += con * cos(ll*t1) * cos(mm*f1);
                     }
@@ -446,8 +446,8 @@ static void add_perturbations_at_layers(struct All_variables *E)
                 for(i=1; i<=noy; i++)
                     for(j=1; j<=nox;j ++) {
                         node = k + (j-1)*noz + (i-1)*nox*noz;
-                        t1 = E->sx[CPPR][1][node];
-                        f1 = E->sx[CPPR][2][node];
+                        t1 = E->sx[1][node];
+                        f1 = E->sx[2][node];
 
                         E->T[node] += con * modified_plgndr_a(ll,mm,t1) * cos(mm*f1);
                     }
@@ -494,9 +494,9 @@ static void add_perturbations_at_all_layers(struct All_variables *E)
                     for(j=1; j<=nox;j ++)
                         for(k=1; k<=noz; k++) {
                             node = k + (j-1)*noz + (i-1)*nox*noz;
-                            t1 = (E->sx[CPPR][1][node] - E->control.theta_min) * tlen;
-                            f1 = (E->sx[CPPR][2][node] - E->control.fi_min) * flen;
-                            r1 = E->sx[CPPR][3][node];
+                            t1 = (E->sx[1][node] - E->control.theta_min) * tlen;
+                            f1 = (E->sx[2][node] - E->control.fi_min) * flen;
+                            r1 = E->sx[3][node];
 
                             E->T[node] += con * cos(ll*t1) * cos(mm*f1)
                                 * sin((r1-E->sphere.ri) * rlen);
@@ -509,9 +509,9 @@ static void add_perturbations_at_all_layers(struct All_variables *E)
                     for(j=1; j<=nox;j ++)
                         for(k=1; k<=noz; k++) {
                             node = k + (j-1)*noz + (i-1)*nox*noz;
-                            t1 = E->sx[CPPR][1][node];
-                            f1 = E->sx[CPPR][2][node];
-                            r1 = E->sx[CPPR][3][node];
+                            t1 = E->sx[1][node];
+                            f1 = E->sx[2][node];
+                            r1 = E->sx[3][node];
 
                             E->T[node] += con * modified_plgndr_a(ll,mm,t1)
                                 * (cos(mm*f1) + sin(mm*f1))
@@ -566,7 +566,7 @@ static void add_spherical_anomaly(struct All_variables *E)
 		      E->T[node] += amp * exp(-1.0*distance/radius);
 
 		      if(E->convection.blob_bc_persist){
-			r1 = E->sx[CPPR][3][node];
+			r1 = E->sx[3][node];
 			if((fabs(r1 - rout) < e_4) || (fabs(r1 - rin) < e_4)){
 			  /* at bottom or top of box, assign as TBC */
 			  E->sphere.cap[CPPR].TB[1][node]=E->T[node];
@@ -682,7 +682,7 @@ static void construct_tic_from_input(struct All_variables *E)
             E->convection.perturb_mag[0] = 0;
             if ( (k > 1) && (k < E->lmesh.noz) ) {
                 /* layer k is inside this proc. */
-                E->convection.perturb_mag[0] = 2 / (E->sx[1][3][k+1] - E->sx[1][3][k-1]);
+                E->convection.perturb_mag[0] = 2 / (E->sx[3][k+1] - E->sx[3][k-1]);
             }
 
         }
diff --git a/lib/Instructions.c b/lib/Instructions.c
index fca6211..d48e6f7 100644
--- a/lib/Instructions.c
+++ b/lib/Instructions.c
@@ -1365,7 +1365,7 @@ void set_up_nonmg_aliases(struct All_variables *E)
 
   for (i=1;i<=E->mesh.nsd;i++)    {
     E->x[CPPR][i] = E->X[E->mesh.levmax][CPPR][i];
-    E->sx[CPPR][i] = E->SX[E->mesh.levmax][CPPR][i];
+    E->sx[i] = E->SX[E->mesh.levmax][CPPR][i];
     }
 }
 
diff --git a/lib/Lith_age.c b/lib/Lith_age.c
index 942a5cd..671c8ae 100644
--- a/lib/Lith_age.c
+++ b/lib/Lith_age.c
@@ -132,7 +132,7 @@ void lith_age_construct_tic(struct All_variables *E)
 	for(k=1;k<=noz;k++)  {
 	  nodeg=E->lmesh.nxs-1+j+(E->lmesh.nys+i-2)*gnox;
 	  node=k+(j-1)*noz+(i-1)*nox*noz;
-	  r1=E->sx[CPPR][3][node];
+	  r1=E->sx[3][node];
 	  E->T[node] = E->control.mantle_temp;
 	  if( r1 >= E->sphere.ro-E->control.lith_age_depth )
 	    { /* if closer than (lith_age_depth) from top */
@@ -165,7 +165,7 @@ void lith_age_update_tbc(struct All_variables *E)
       for(j=1;j<=nox;j++)
 	for(k=1;k<=noz;k++)  {
 	  node=k+(j-1)*noz+(i-1)*nox*noz;
-	  r1=E->sx[CPPR][3][node];
+	  r1=E->sx[3][node];
 
 	  if(fabs(r1-rout)>=e_4 && fabs(r1-rin)>=e_4)  {
 	    E->sphere.cap[CPPR].TB[1][node]=E->T[node];
@@ -196,7 +196,7 @@ all three get set to true. CPC 6/20/00 */
 
     if(lv==E->mesh.gridmax)
 	for(node=1;node<=E->lmesh.nno;node++)  {
-	  if( ((E->sx[CPPR][1][node]<=ttt2) && (E->sx[CPPR][3][node]>=E->sphere.ro-E->control.depth_bound_adj)) || ((E->sx[CPPR][1][node]>=ttt3) && (E->sx[CPPR][3][node]>=E->sphere.ro-E->control.depth_bound_adj)) )
+	  if( ((E->sx[1][node]<=ttt2) && (E->sx[3][node]>=E->sphere.ro-E->control.depth_bound_adj)) || ((E->sx[1][node]>=ttt3) && (E->sx[3][node]>=E->sphere.ro-E->control.depth_bound_adj)) )
 	    /* if < (width) from x bounds AND (depth) from top */
 	    {
 	      E->node[CPPR][node]=E->node[CPPR][node] | TBX;
@@ -207,7 +207,7 @@ all three get set to true. CPC 6/20/00 */
 	      E->node[CPPR][node]=E->node[CPPR][node] & (~FBZ);
 	    }
 
-	  if( ((E->sx[CPPR][2][node]<=fff2) && (E->sx[CPPR][3][node]>=E->sphere.ro-E->control.depth_bound_adj)) )
+	  if( ((E->sx[2][node]<=fff2) && (E->sx[3][node]>=E->sphere.ro-E->control.depth_bound_adj)) )
 	    /* if fi is < (width) from side AND z is < (depth) from top */
 	    {
 	      E->node[CPPR][node]=E->node[CPPR][node] | TBX;
@@ -218,7 +218,7 @@ all three get set to true. CPC 6/20/00 */
 	      E->node[CPPR][node]=E->node[CPPR][node] & (~FBZ);
 	    }
 
-	  if( ((E->sx[CPPR][2][node]>=fff3) && (E->sx[CPPR][3][node]>=E->sphere.ro-E->control.depth_bound_adj)) )
+	  if( ((E->sx[2][node]>=fff3) && (E->sx[3][node]>=E->sphere.ro-E->control.depth_bound_adj)) )
 	    /* if fi is < (width) from side AND z is < (depth) from top */
 	    {
 	      E->node[CPPR][node]=E->node[CPPR][node] | TBX;
@@ -235,7 +235,7 @@ all three get set to true. CPC 6/20/00 */
   if (E->control.lith_age_time) {
     if(lv==E->mesh.gridmax)
 	for(node=1;node<=E->lmesh.nno;node++)  {
-	  if(E->sx[CPPR][3][node]>=E->sphere.ro-E->control.lith_age_depth)
+	  if(E->sx[3][node]>=E->sphere.ro-E->control.lith_age_depth)
 	    { /* if closer than (lith_age_depth) from top */
 	      E->node[CPPR][node]=E->node[CPPR][node] | TBX;
 	      E->node[CPPR][node]=E->node[CPPR][node] & (~FBX);
@@ -295,12 +295,12 @@ void lith_age_conform_tbc(struct All_variables *E)
 	  for(k=1;k<=noz;k++)  {
 	    nodeg=E->lmesh.nxs-1+j+(E->lmesh.nys+i-2)*gnox;
 	    node=k+(j-1)*noz+(i-1)*nox*noz;
-	    t1=E->sx[CPPR][1][node];
-	    f1=E->sx[CPPR][2][node];
-	    r1=E->sx[CPPR][3][node];
+	    t1=E->sx[1][node];
+	    f1=E->sx[2][node];
+	    r1=E->sx[3][node];
 
 	    if(fabs(r1-E->sphere.ro)>=e_4 && fabs(r1-E->sphere.ri)>=e_4)  { /* if NOT right on the boundary */
-	      if( ((E->sx[CPPR][1][node]<=ttt2) && (E->sx[CPPR][3][node]>=E->sphere.ro-E->control.depth_bound_adj)) || ((E->sx[CPPR][1][node]>=ttt3) && (E->sx[CPPR][3][node]>=E->sphere.ro-E->control.depth_bound_adj)) ) {
+	      if( ((E->sx[1][node]<=ttt2) && (E->sx[3][node]>=E->sphere.ro-E->control.depth_bound_adj)) || ((E->sx[1][node]>=ttt3) && (E->sx[3][node]>=E->sphere.ro-E->control.depth_bound_adj)) ) {
 		/* if < (width) from x bounds AND (depth) from top */
 		temp = (E->sphere.ro-r1) *0.5 /sqrt(E->age_t[nodeg]);
 		t0 = E->control.mantle_temp * erf(temp);
@@ -311,7 +311,7 @@ void lith_age_conform_tbc(struct All_variables *E)
 		E->sphere.cap[CPPR].TB[3][node]=t0;
 	      }
 
-	      if( ((E->sx[CPPR][2][node]<=fff2) || (E->sx[CPPR][2][node]>=fff3)) && (E->sx[CPPR][3][node]>=E->sphere.ro-E->control.depth_bound_adj) ) {
+	      if( ((E->sx[2][node]<=fff2) || (E->sx[2][node]>=fff3)) && (E->sx[3][node]>=E->sphere.ro-E->control.depth_bound_adj) ) {
 		/* if < (width) from y bounds AND (depth) from top */
 
 
@@ -339,15 +339,15 @@ void lith_age_conform_tbc(struct All_variables *E)
 	  for(k=1;k<=noz;k++)  {
 	    nodeg=E->lmesh.nxs-1+j+(E->lmesh.nys+i-2)*gnox;
 	    node=k+(j-1)*noz+(i-1)*nox*noz;
-	    t1=E->sx[CPPR][1][node];
-	    f1=E->sx[CPPR][2][node];
-	    r1=E->sx[CPPR][3][node];
+	    t1=E->sx[1][node];
+	    f1=E->sx[2][node];
+	    r1=E->sx[3][node];
 
 	    if(fabs(r1-E->sphere.ro)>=e_4 && fabs(r1-E->sphere.ri)>=e_4)  { /* if NOT right on the boundary */
-	      if(  E->sx[CPPR][3][node]>=E->sphere.ro-E->control.lith_age_depth ) {
+	      if(  E->sx[3][node]>=E->sphere.ro-E->control.lith_age_depth ) {
 		/* if closer than (lith_age_depth) from top */
 
-                depth=E->sphere.ro - E->sx[CPPR][3][node];
+                depth=E->sphere.ro - E->sx[3][node];
 
 		/* set a new age from the file */
 		temp = (E->sphere.ro-r1) *0.5 /sqrt(E->age_t[nodeg]);
@@ -408,7 +408,7 @@ void assimilate_lith_conform_bcs(struct All_variables *E)
             break;
         } /* end switch */
 
-        depth = E->sphere.ro - E->sx[CPPR][3][node];
+        depth = E->sphere.ro - E->sx[3][node];
 
         switch (type) {
         case 0:  /* no match, next node */
diff --git a/lib/Material_properties.c b/lib/Material_properties.c
index f11d47e..faebb32 100644
--- a/lib/Material_properties.c
+++ b/lib/Material_properties.c
@@ -106,8 +106,8 @@ void reference_state(struct All_variables *E)
     if(E->parallel.me < E->parallel.nprocz)
         for(i=1; i<=E->lmesh.noz; i++) {
             fprintf(stderr, "%6d %11f %11f %11e %5i\n",
-                    i+E->lmesh.nzs-1, E->sx[1][3][i], 1-E->sx[1][3][i],
-                    E->refstate.rho[i],layers_r(E,E->sx[1][3][i]));
+                    i+E->lmesh.nzs-1, E->sx[3][i], 1-E->sx[3][i],
+                    E->refstate.rho[i],layers_r(E,E->sx[3][i]));
         }
 
 }
@@ -152,7 +152,7 @@ static void read_refstate(struct All_variables *E)
                 E->refstate.gravity[i],
                 E->refstate.thermal_expansivity[i],
                 E->refstate.heat_capacity[i]);
-        /* end of debug */
+        end of debug */
     }
 
     fclose(fp);
@@ -167,7 +167,7 @@ static void adams_williamson_eos(struct All_variables *E)
     beta = E->control.disptn_number * E->control.inv_gruneisen;
 
     for(i=1; i<=E->lmesh.noz; i++) {
-	r = E->sx[1][3][i];
+	r = E->sx[3][i];
 	z = 1 - r;
 	E->refstate.rho[i] = exp(beta*z);
 	E->refstate.gravity[i] = 1;
diff --git a/lib/Mineral_physics_models.c b/lib/Mineral_physics_models.c
index b40b145..61bda2f 100644
--- a/lib/Mineral_physics_models.c
+++ b/lib/Mineral_physics_models.c
@@ -144,7 +144,7 @@ void get_prem(double r, double *vp, double *vs, double *rho)
 
     /** debug **
     fprintf(stderr, "%e %d %f %f %f\n", r, j, *rho, *vp, *vs);
-    /**/
+    */
 
 #undef NUM_PREM_LAYERS
 #undef SUPPRESS_CRUSTAL_MESH
@@ -181,8 +181,8 @@ static void modified_Trampert_Vacher_Vlaar_PEPI2001(struct All_variables *E,
     depthkm = malloc((E->lmesh.noz+1) * sizeof(double));
 
     for(nz=1; nz<=E->lmesh.noz; nz++) {
-        get_prem(E->sx[CPPR][3][nz], &vpr[nz], &vsr[nz], &rhor[nz]);
-        depthkm[nz] = (1.0 - E->sx[CPPR][3][nz]) * E->data.radius_km;
+        get_prem(E->sx[3][nz], &vpr[nz], &vsr[nz], &rhor[nz]);
+        depthkm[nz] = (1.0 - E->sx[3][nz]) * E->data.radius_km;
     }
 
     /* deviation from the reference */
@@ -217,7 +217,7 @@ static void modified_Trampert_Vacher_Vlaar_PEPI2001(struct All_variables *E,
         /** debug **
         fprintf(stderr, "node=%d dT=%f K, dC=%f, %e %e %e\n",
                 i, dT, dC, drho, dvp, dvs);
-        /**/
+        */
     }
 
 
diff --git a/lib/Output.c b/lib/Output.c
index 1eb7690..cc867e7 100644
--- a/lib/Output.c
+++ b/lib/Output.c
@@ -196,7 +196,7 @@ void output_coord(struct All_variables *E)
 
   fprintf(fp1,"%3d %7d\n",CPPR,E->lmesh.nno);
   for(i=1;i<=E->lmesh.nno;i++)
-    fprintf(fp1,"%.6e %.6e %.6e\n",E->sx[CPPR][1][i],E->sx[CPPR][2][i],E->sx[CPPR][3][i]);
+    fprintf(fp1,"%.6e %.6e %.6e\n",E->sx[1][i],E->sx[2][i],E->sx[3][i]);
   fclose(fp1);
 }
 
@@ -226,16 +226,16 @@ void output_domain(struct All_variables *E)
 
     double buffer[ncolumns];
 
-    buffer[0] = E->sx[CPPR][3][1];
-    buffer[1] = E->sx[CPPR][3][noz];
-    buffer[2] = E->sx[CPPR][1][corner_nodes[0]];
-    buffer[3] = E->sx[CPPR][2][corner_nodes[0]];
-    buffer[4] = E->sx[CPPR][1][corner_nodes[1]];
-    buffer[5] = E->sx[CPPR][2][corner_nodes[1]];
-    buffer[6] = E->sx[CPPR][1][corner_nodes[2]];
-    buffer[7] = E->sx[CPPR][2][corner_nodes[2]];
-    buffer[8] = E->sx[CPPR][1][corner_nodes[3]];
-    buffer[9] = E->sx[CPPR][2][corner_nodes[3]];
+    buffer[0] = E->sx[3][1];
+    buffer[1] = E->sx[3][noz];
+    buffer[2] = E->sx[1][corner_nodes[0]];
+    buffer[3] = E->sx[2][corner_nodes[0]];
+    buffer[4] = E->sx[1][corner_nodes[1]];
+    buffer[5] = E->sx[2][corner_nodes[1]];
+    buffer[6] = E->sx[1][corner_nodes[2]];
+    buffer[7] = E->sx[2][corner_nodes[2]];
+    buffer[8] = E->sx[1][corner_nodes[3]];
+    buffer[9] = E->sx[2][corner_nodes[3]];
 
     if(E->parallel.me == 0) {
         int i, rank;
@@ -510,7 +510,7 @@ void output_horiz_avg(struct All_variables *E, int cycles)
             E->parallel.me, cycles);
     fp1=fopen(output_file,"w");
     for(j=1;j<=E->lmesh.noz;j++)  {
-        fprintf(fp1,"%.4e %.4e %.4e %.4e",E->sx[CPPR][3][j],
+        fprintf(fp1,"%.4e %.4e %.4e %.4e",E->sx[3][j],
 		E->Have.T[j],E->Have.V[1][j],E->Have.V[2][j]);
 
         if (E->composition.on) {
diff --git a/lib/Output_gzdir.c b/lib/Output_gzdir.c
index fcf7274..e1fdde6 100644
--- a/lib/Output_gzdir.c
+++ b/lib/Output_gzdir.c
@@ -383,7 +383,7 @@ void gzdir_output_coord(struct All_variables *E)
       gzprintf(gz1,"%3d %7d\n",CPPR,E->lmesh.nno);
       for(i=1;i<=E->lmesh.nno;i++)
 	gzprintf(gz1,"%.6e %.6e %.6e\n",
-		 E->sx[CPPR][1][i],E->sx[CPPR][2][i],E->sx[CPPR][3][i]);
+		 E->sx[1][i],E->sx[2][i],E->sx[3][i]);
 
     gzclose(gz1);
     if(E->output.gzdir.vtk_io == 1){
@@ -554,7 +554,7 @@ void gzdir_output_velo_temp(struct All_variables *E, int cycles)
 	  /* remove the velocity that corresponds to a net rotation of omega[0..2] at location
 	     r,t,p from the t,p velocities in vcorr[0..1]
 	  */
-	  sub_netr(E->sx[CPPR][3][i],E->sx[CPPR][1][i],E->sx[CPPR][2][i],(vcorr+0),(vcorr+1),omega);
+	  sub_netr(E->sx[3][i],E->sx[1][i],E->sx[2][i],(vcorr+0),(vcorr+1),omega);
 
 	  convert_pvec_to_cvec(E->sphere.cap[CPPR].V[3][i],vcorr[0],vcorr[1],
 			       (E->output.gzdir.vtk_base+k),cvec);
@@ -624,7 +624,7 @@ void gzdir_output_velo_temp(struct All_variables *E, int cycles)
 	  for(i=1;i<=E->lmesh.nno;i++){
 	    vcorr[0] = E->sphere.cap[CPPR].V[1][i]; /* vt */
 	    vcorr[1] = E->sphere.cap[CPPR].V[2][i]; /* vphi */
-	    sub_netr(E->sx[CPPR][3][i],E->sx[CPPR][1][i],E->sx[CPPR][2][i],(vcorr+0),(vcorr+1),omega);
+	    sub_netr(E->sx[3][i],E->sx[1][i],E->sx[2][i],(vcorr+0),(vcorr+1),omega);
 	    gzprintf(gzout,"%.6e %.6e %.6e %.6e\n",
 		     vcorr[0],vcorr[1],
 		     E->sphere.cap[CPPR].V[3][i],E->T[i]);
@@ -651,7 +651,7 @@ void gzdir_output_velo_temp(struct All_variables *E, int cycles)
 	  for(i=1,k=0;i<=E->lmesh.nno;i++,k += 9) {
 	    vcorr[0] = E->sphere.cap[CPPR].V[1][i];
 	    vcorr[1] = E->sphere.cap[CPPR].V[2][i];
-	    sub_netr(E->sx[CPPR][3][i],E->sx[CPPR][1][i],E->sx[CPPR][2][i],(vcorr+0),(vcorr+1),omega);
+	    sub_netr(E->sx[3][i],E->sx[1][i],E->sx[2][i],(vcorr+0),(vcorr+1),omega);
 	    convert_pvec_to_cvec(E->sphere.cap[CPPR].V[3][i],vcorr[0],vcorr[1],
 				 (E->output.gzdir.vtk_base+k),cvec);
 	    gzprintf(gzout,"%10.4e %10.4e %10.4e\n",cvec[0],cvec[1],cvec[2]);
@@ -948,7 +948,7 @@ void gzdir_output_horiz_avg(struct All_variables *E, int cycles)
 	    cycles,E->parallel.me, cycles);
     fp1=gzdir_output_open(output_file,"w");
     for(j=1;j<=E->lmesh.noz;j++)  { /* format: r <T> <vh> <vr> (<C>) */
-        gzprintf(fp1,"%.4e %.4e %.4e %.4e",E->sx[1][3][j],E->Have.T[j],E->Have.V[1][j],E->Have.V[2][j]);
+        gzprintf(fp1,"%.4e %.4e %.4e %.4e",E->sx[3][j],E->Have.T[j],E->Have.V[1][j],E->Have.V[2][j]);
 
         if (E->composition.on) {
             int n;
diff --git a/lib/Output_h5.c b/lib/Output_h5.c
index 3b01e56..a973b99 100644
--- a/lib/Output_h5.c
+++ b/lib/Output_h5.c
@@ -451,9 +451,9 @@ void h5output_coord(struct All_variables *E)
             {
                 n = k + i*nz + j*nz*nx;
                 m = k + j*mz + i*mz*my;
-                field->data[3*m+0] = E->sx[CPPR][1][n+1];
-                field->data[3*m+1] = E->sx[CPPR][2][n+1];
-                field->data[3*m+2] = E->sx[CPPR][3][n+1];
+                field->data[3*m+0] = E->sx[1][n+1];
+                field->data[3*m+1] = E->sx[2][n+1];
+                field->data[3*m+2] = E->sx[3][n+1];
             }
         }
     }
@@ -754,8 +754,8 @@ void h5output_surf_botm_coord(struct All_variables *E)
             {
                 n = k + i*nz + j*nz*nx;
                 m = j + i*my;
-                field->data[2*m+0] = E->sx[CPPR][1][n+1];
-                field->data[2*m+1] = E->sx[CPPR][2][n+1];
+                field->data[2*m+0] = E->sx[1][n+1];
+                field->data[2*m+1] = E->sx[2][n+1];
             }
         }
         dataset = H5Dopen(E->hdf5.file_id, "/surf/coord");
@@ -772,8 +772,8 @@ void h5output_surf_botm_coord(struct All_variables *E)
             {
                 n = k + i*nz + j*nz*nx;
                 m = j + i*my;
-                field->data[2*m+0] = E->sx[CPPR][1][n+1];
-                field->data[2*m+1] = E->sx[CPPR][2][n+1];
+                field->data[2*m+0] = E->sx[1][n+1];
+                field->data[2*m+1] = E->sx[2][n+1];
             }
         }
         dataset = H5Dopen(E->hdf5.file_id, "/botm/coord");
@@ -986,7 +986,7 @@ void h5output_have_coord(struct All_variables *E)
     if (E->output.horiz_avg == 1)
     {
         for(k = 0; k < mz; k++)
-            field->data[k] = E->sx[CPPR][3][k+1];
+            field->data[k] = E->sx[3][k+1];
         dataset = H5Dopen(E->hdf5.file_id, "/horiz_avg/coord");
         status = h5write_field(dataset, field, 0, (px == 0 && py == 0));
         status = H5Dclose(dataset);
diff --git a/lib/Phase_change.c b/lib/Phase_change.c
index 1bd54cd..e736a4f 100644
--- a/lib/Phase_change.c
+++ b/lib/Phase_change.c
@@ -161,7 +161,7 @@ static void calc_phase_change(struct All_variables *E,
      * phase. B is between 0 and 1. */
     for(i=1;i<=E->lmesh.nno;i++)  {
         nz = ((i-1) % E->lmesh.noz) + 1;
-        dz = (E->sphere.ro-E->sx[CPPR][3][i]) - depth;
+        dz = (E->sphere.ro-E->sx[3][i]) - depth;
         /*XXX: dz*rho[nz]*g[nz] is only a approximation for the reduced
          * pressure, a more accurate formula is:
          *   integral(rho(z)*g(z)*dz) from depth_ph to current depth   */
@@ -180,7 +180,7 @@ static void calc_phase_change(struct All_variables *E,
         for (i=1;i<E->lmesh.noz;i++)   {
           n = (k-1)*E->lmesh.noz*E->lmesh.nox + (j-1)*E->lmesh.noz + i;
           if (B[CPPR][n]>=pt5 && B[CPPR][n+1]<=pt5)
-            B_b[CPPR][ns]=(E->sx[CPPR][3][n+1]-E->sx[CPPR][3][n])*(pt5-B[CPPR][n])/(B[CPPR][n+1]-B[CPPR][n])+E->sx[CPPR][3][n];
+            B_b[CPPR][ns]=(E->sx[3][n+1]-E->sx[3][n])*(pt5-B[CPPR][n])/(B[CPPR][n+1]-B[CPPR][n])+E->sx[3][n];
 	}
       }
 }
@@ -193,6 +193,6 @@ static void debug_phase_change(struct All_variables *E, float **B)
   fprintf(E->fp_out,"output_phase_change_buoyancy\n");
     fprintf(E->fp_out,"for cap %d\n",E->sphere.capid[CPPR]);
     for (j=1;j<=E->lmesh.nno;j++)
-      fprintf(E->fp_out,"Z = %.6e T = %.6e B[%06d] = %.6e \n",E->sx[CPPR][3][j],E->T[j],j,B[CPPR][j]);
+      fprintf(E->fp_out,"Z = %.6e T = %.6e B[%06d] = %.6e \n",E->sx[3][j],E->T[j],j,B[CPPR][j]);
   fflush(E->fp_out);
 }
diff --git a/lib/Regional_tracer_advection.c b/lib/Regional_tracer_advection.c
index 98eea3e..a7cdbe7 100644
--- a/lib/Regional_tracer_advection.c
+++ b/lib/Regional_tracer_advection.c
@@ -235,13 +235,13 @@ static void make_mesh_ijk(struct All_variables *E)
     ***/
 
         for(i=0;i<nox;i++)
-	    E->trace.x_space[i]=E->sx[CPPR][1][i*noz+1];
+	    E->trace.x_space[i]=E->sx[1][i*noz+1];
 
         for(j=0;j<noy;j++)
-	    E->trace.y_space[j]=E->sx[CPPR][2][j*nox*noz+1];
+	    E->trace.y_space[j]=E->sx[2][j*nox*noz+1];
 
         for(k=0;k<noz;k++)
-	    E->trace.z_space[k]=E->sx[CPPR][3][k+1];
+	    E->trace.z_space[k]=E->sx[3][k+1];
 }
 
 
@@ -554,8 +554,8 @@ void regional_lost_souls(struct All_variables *E)
 
     /* the bounding box */
     for (d=0; d<E->mesh.nsd; d++) {
-        bounds[d][0] = E->sx[CPPR][d+1][1];
-        bounds[d][1] = E->sx[CPPR][d+1][E->lmesh.nno];
+        bounds[d][0] = E->sx[d+1][1];
+        bounds[d][1] = E->sx[d+1][E->lmesh.nno];
     }
 
     /* set up ranks for neighboring procs */
diff --git a/lib/Size_does_matter.c b/lib/Size_does_matter.c
index 63e2f48..6e7a72f 100644
--- a/lib/Size_does_matter.c
+++ b/lib/Size_does_matter.c
@@ -301,7 +301,7 @@ void construct_surf_det (E)
       E->surf_det[CPPR][k] = (double *)malloc((1+E->lmesh.snel)*sizeof(double));
     }
 
-  r2 = 1.0 / (E->sx[CPPR][3][E->lmesh.elz+1] * E->sx[CPPR][3][E->lmesh.elz+1]);
+  r2 = 1.0 / (E->sx[3][E->lmesh.elz+1] * E->sx[3][E->lmesh.elz+1]);
 
   for (es=1;es<=E->lmesh.snel;es++)   {
     el = es * E->lmesh.elz;
diff --git a/lib/Sphere_harmonics.c b/lib/Sphere_harmonics.c
index 63e6858..b798f14 100644
--- a/lib/Sphere_harmonics.c
+++ b/lib/Sphere_harmonics.c
@@ -205,8 +205,8 @@ static void  compute_sphereh_table(E)
 
         for (j=1;j<=E->lmesh.nsf;j++)  {
             node = j*E->lmesh.noz;
-            f=E->sx[CPPR][2][node];
-            t=E->sx[CPPR][1][node];
+            f=E->sx[2][node];
+            t=E->sx[1][node];
             for (mm=0;mm<=E->output.llmax;mm++)   {
 	      mmf = (double)(mm)*f;
                 E->sphere.tablescosf[CPPR][j][mm] = cos( mmf );
diff --git a/lib/Sphere_util.c b/lib/Sphere_util.c
index b035952..10dbf6f 100644
--- a/lib/Sphere_util.c
+++ b/lib/Sphere_util.c
@@ -78,9 +78,9 @@ void compute_angle_surf_area (E)
         ia[4] = ia[3]-E->lmesh.noz*(E->lmesh.nox-1);
 
         for (i=1;i<=4;i++)  {
-            xx[1][i] = E->x[CPPR][1][ia[i]]/E->sx[CPPR][3][ia[1]];
-            xx[2][i] = E->x[CPPR][2][ia[i]]/E->sx[CPPR][3][ia[1]];
-            xx[3][i] = E->x[CPPR][3][ia[i]]/E->sx[CPPR][3][ia[1]];
+            xx[1][i] = E->x[CPPR][1][ia[i]]/E->sx[3][ia[1]];
+            xx[2][i] = E->x[CPPR][2][ia[i]]/E->sx[3][ia[1]];
+            xx[3][i] = E->x[CPPR][3][ia[i]]/E->sx[3][ia[1]];
         }
 
         get_angle_sphere_cap(xx,angle);
diff --git a/lib/Topo_gravity.c b/lib/Topo_gravity.c
index 6ac69ca..9f91a26 100644
--- a/lib/Topo_gravity.c
+++ b/lib/Topo_gravity.c
@@ -579,10 +579,10 @@ static void geoid_from_buoyancy(struct All_variables *E,
         sphere_expansion(E,TT,geoid[0],geoid[1]);
 
         /* thickness of the layer */
-        dlayer = (E->sx[CPPR][3][k+1]-E->sx[CPPR][3][k])*radius_m;
+        dlayer = (E->sx[3][k+1]-E->sx[3][k])*radius_m;
 
         /* mean radius of the layer */
-        radius = (E->sx[CPPR][3][k+1]+E->sx[CPPR][3][k])*0.5;
+        radius = (E->sx[3][k+1]+E->sx[3][k])*0.5;
 
         /* geoid contribution of density at this layer, ignore degree-0 term */
         for (ll=1;ll<=E->output.llmax;ll++) {
diff --git a/lib/Tracer_setup.c b/lib/Tracer_setup.c
index 3efc69d..3ba702b 100644
--- a/lib/Tracer_setup.c
+++ b/lib/Tracer_setup.c
@@ -813,8 +813,8 @@ static void generate_random_tracers(struct All_variables *E, int tracers_cap)
 
         cart_to_sphere(E,x,y,z,&theta,&phi,&rad);
 
-        if (rad>=E->sx[CPPR][3][E->lmesh.noz]) continue;
-        if (rad<E->sx[CPPR][3][1]) continue;
+        if (rad>=E->sx[3][E->lmesh.noz]) continue;
+        if (rad<E->sx[3][1]) continue;
 
 
         /* check if in current cap */
@@ -1283,7 +1283,7 @@ void get_neighboring_caps(struct All_variables *E)
         n = 0;
         for (i=0; i<ncorners; i++) {
             for (d=0; d<2; d++) {
-                xx[n] = E->sx[CPPR][d+1][node[i]];
+                xx[n] = E->sx[d+1][node[i]];
                 n++;
             }
         }
@@ -1628,8 +1628,8 @@ int icheck_processor_shell(struct All_variables *E, double rad)
 
     if (nprocz==1) return 1;
 
-    top_r = E->sx[CPPR][3][noz];
-    bottom_r = E->sx[CPPR][3][1];
+    top_r = E->sx[3][noz];
+    bottom_r = E->sx[3][1];
 
     /* First check bottom */
 
diff --git a/lib/Viscosity_structures.c b/lib/Viscosity_structures.c
index d7d201e..2340ec1 100644
--- a/lib/Viscosity_structures.c
+++ b/lib/Viscosity_structures.c
@@ -576,7 +576,7 @@ void visc_from_T(E,EEta,propogate)
 
                 for(kk=1;kk<=ends;kk++) {
                     TT[kk] = E->T[E->ien[i].node[kk]];
-                    zz[kk] = (1.-E->sx[CPPR][3][E->ien[i].node[kk]]);
+                    zz[kk] = (1.-E->sx[3][E->ien[i].node[kk]]);
                 }
 
                 for(jj=1;jj<=vpts;jj++) {
@@ -657,7 +657,7 @@ void visc_from_T(E,EEta,propogate)
 
 	    for(kk=1;kk<=ends;kk++) {
 	      TT[kk] = E->T[E->ien[i].node[kk]];
-	      zz[kk] = (1.0 - E->sx[CPPR][3][E->ien[i].node[kk]]);
+	      zz[kk] = (1.0 - E->sx[3][E->ien[i].node[kk]]);
 	    }
 
 	    for(jj=1;jj <= vpts;jj++) {
@@ -712,7 +712,7 @@ void visc_from_T(E,EEta,propogate)
 
                 for(kk=1;kk<=ends;kk++) {
                     TT[kk] = E->T[E->ien[i].node[kk]];
-                    zz[kk] = (1.-E->sx[CPPR][3][E->ien[i].node[kk]]);
+                    zz[kk] = (1.-E->sx[3][E->ien[i].node[kk]]);
                 }
 
                 for(jj=1;jj<=vpts;jj++) {
@@ -760,7 +760,7 @@ void visc_from_T(E,EEta,propogate)
 
                 for(kk=1;kk<=ends;kk++) {
 		  TT[kk] = E->T[E->ien[i].node[kk]];
-		  zz[kk] = E->sx[CPPR][3][E->ien[i].node[kk]]; /* radius */
+		  zz[kk] = E->sx[3][E->ien[i].node[kk]]; /* radius */
                 }
 
                 for(jj=1;jj<=vpts;jj++) {
@@ -828,7 +828,7 @@ void visc_from_T(E,EEta,propogate)
 
                 for(kk=1;kk<=ends;kk++) {
 		  TT[kk] = E->T[E->ien[i].node[kk]];
-		  zz[kk] = E->sx[CPPR][3][E->ien[i].node[kk]]; /* radius */
+		  zz[kk] = E->sx[3][E->ien[i].node[kk]]; /* radius */
                 }
 
                 for(jj=1;jj<=vpts;jj++) {
@@ -993,7 +993,7 @@ void visc_from_P(E,EEta) /* "plasticity" implementation
 	l = E->mat[CPPR][e] -1 ;	/* material of this element */
 	
 	for(kk=1;kk <= ends;kk++) /* nodal depths */
-	  zz[kk] = (1.0 - E->sx[CPPR][3][E->ien[e].node[kk]]); /* for depth, zz = 1 - r */
+	  zz[kk] = (1.0 - E->sx[3][E->ien[e].node[kk]]); /* for depth, zz = 1 - r */
 	
 	for(jj=1;jj <= vpts;jj++){ /* loop through integration points */
 	  
@@ -1025,7 +1025,7 @@ void visc_from_P(E,EEta) /* "plasticity" implementation
 	
 	l = E->mat[CPPR][e] -1 ;	
 	for(kk=1;kk <= ends;kk++)
-	  zz[kk] = (1.0 - E->sx[CPPR][3][E->ien[e].node[kk]]); 
+	  zz[kk] = (1.0 - E->sx[3][E->ien[e].node[kk]]); 
 	for(jj=1;jj <= vpts;jj++){ 
 	  zzz = 0.0;
 	  for(kk=1;kk<=ends;kk++)
@@ -1305,16 +1305,16 @@ static void low_viscosity_channel_factor(struct All_variables *E, float *F)
 
         /* find index of radius corresponding to lv_min_radius */
         for(e=1; e<=E->lmesh.elz; e++) {
-            rad_mean = 0.5 * (E->sx[CPPR][3][E->ien[e].node[1]] +
-                              E->sx[CPPR][3][E->ien[e].node[8]]);
+            rad_mean = 0.5 * (E->sx[3][E->ien[e].node[1]] +
+                              E->sx[3][E->ien[e].node[8]]);
             if(rad_mean >= E->viscosity.lv_min_radius) break;
         }
         nz_min[CPPR] = e;
 
         /* find index of radius corresponding to lv_max_radius */
         for(e=E->lmesh.elz; e>=1; e--) {
-            rad_mean = 0.5 * (E->sx[CPPR][3][E->ien[e].node[1]] +
-                              E->sx[CPPR][3][E->ien[e].node[8]]);
+            rad_mean = 0.5 * (E->sx[3][E->ien[e].node[1]] +
+                              E->sx[3][E->ien[e].node[8]]);
             if(rad_mean <= E->viscosity.lv_max_radius) break;
         }
         nz_max[CPPR] = e;
@@ -1325,15 +1325,15 @@ static void low_viscosity_channel_factor(struct All_variables *E, float *F)
             for(i=nz_min[CPPR]; i<=nz_max[CPPR]; i++) {
                 e = (k-1)*E->lmesh.elz + i;
 
-                rad_mean = 0.5 * (E->sx[CPPR][3][E->ien[e].node[1]] +
-                                  E->sx[CPPR][3][E->ien[e].node[8]]);
+                rad_mean = 0.5 * (E->sx[3][E->ien[e].node[1]] +
+                                  E->sx[3][E->ien[e].node[8]]);
 
                 /* loop over elements below e */
                 for(ii=i; ii>=nz_min[CPPR]; ii--) {
                     ee = (k-1)*E->lmesh.elz + ii;
 
-                    rr = 0.5 * (E->sx[CPPR][3][E->ien[ee].node[1]] +
-                                E->sx[CPPR][3][E->ien[ee].node[8]]);
+                    rr = 0.5 * (E->sx[3][E->ien[ee].node[1]] +
+                                E->sx[3][E->ien[ee].node[8]]);
 
                     /* if ee has tracers in it and is within the channel */
                     if((E->trace.ntracer_flavor[CPPR][flavor][ee] > 0) &&
@@ -1356,16 +1356,16 @@ static void low_viscosity_wedge_factor(struct All_variables *E, float *F)
 
         /* find index of radius corresponding to lv_min_radius */
         for(e=1; e<=E->lmesh.elz; e++) {
-            rad_mean = 0.5 * (E->sx[CPPR][3][E->ien[e].node[1]] +
-                              E->sx[CPPR][3][E->ien[e].node[8]]);
+            rad_mean = 0.5 * (E->sx[3][E->ien[e].node[1]] +
+                              E->sx[3][E->ien[e].node[8]]);
             if(rad_mean >= E->viscosity.lv_min_radius) break;
         }
         nz_min[CPPR] = e;
 
         /* find index of radius corresponding to lv_max_radius */
         for(e=E->lmesh.elz; e>=1; e--) {
-            rad_mean = 0.5 * (E->sx[CPPR][3][E->ien[e].node[1]] +
-                              E->sx[CPPR][3][E->ien[e].node[8]]);
+            rad_mean = 0.5 * (E->sx[3][E->ien[e].node[1]] +
+                              E->sx[3][E->ien[e].node[8]]);
             if(rad_mean <= E->viscosity.lv_max_radius) break;
         }
         nz_max[CPPR] = e;
@@ -1376,8 +1376,8 @@ static void low_viscosity_wedge_factor(struct All_variables *E, float *F)
             for(i=nz_min[CPPR]; i<=nz_max[CPPR]; i++) {
                 e = (k-1)*E->lmesh.elz + i;
 
-                rad_mean = 0.5 * (E->sx[CPPR][3][E->ien[e].node[1]] +
-                                  E->sx[CPPR][3][E->ien[e].node[8]]);
+                rad_mean = 0.5 * (E->sx[3][E->ien[e].node[1]] +
+                                  E->sx[3][E->ien[e].node[8]]);
 
                 /* loop over elements below e */
                 for(ii=i; ii>=nz_min[CPPR]; ii--) {
diff --git a/lib/global_defs.h b/lib/global_defs.h
index 580e470..279f838 100644
--- a/lib/global_defs.h
+++ b/lib/global_defs.h
@@ -836,7 +836,7 @@ struct All_variables {
     double *Mass, *MASS[MAX_LEVELS];
     double *TMass, *NMass;
     double *SX[MAX_LEVELS][NCS][4],*X[MAX_LEVELS][NCS][4];
-    double *sx[NCS][4],*x[NCS][4];
+    double *sx[4],*x[NCS][4];
     double *surf_det[NCS][5];
     double *SinCos[MAX_LEVELS][NCS][4];
 



More information about the CIG-COMMITS mailing list