[cig-commits] [commit] rajesh-petsc-schur: Changed the shapes of E->buoyancy as part of caps_per_proc_removal, changed the signatures of many functions to support this (5c57572)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Nov 5 19:14:21 PST 2014


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

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

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

commit 5c57572e5b4b1260d790922a6e53d257205fe73b
Author: Rajesh Kommu <rajesh.kommu at gmail.com>
Date:   Wed Sep 24 14:57:38 2014 -0700

    Changed the shapes of E->buoyancy as part of caps_per_proc_removal, changed the signatures of many functions to support this


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

5c57572e5b4b1260d790922a6e53d257205fe73b
 lib/Element_calculations.c       |  2 +-
 lib/Ggrd_handling.c              |  7 +++----
 lib/Global_operations.c          | 14 +++++++-------
 lib/Instructions.c               |  2 +-
 lib/Pan_problem_misc_functions.c | 14 +++++++-------
 lib/Phase_change.c               | 12 ++++++------
 lib/Topo_gravity.c               |  2 +-
 lib/global_defs.h                |  2 +-
 lib/phase_change.h               |  6 +++---
 lib/prototypes.h                 | 16 ++++++++--------
 10 files changed, 38 insertions(+), 39 deletions(-)

diff --git a/lib/Element_calculations.c b/lib/Element_calculations.c
index 43c3f52..6e4d9cf 100644
--- a/lib/Element_calculations.c
+++ b/lib/Element_calculations.c
@@ -992,7 +992,7 @@ void get_elt_f(E,el,elt_f,bcs)
   for(p=0;p<n;p++) elt_f[p] = 0.0;
 
   for(p=1;p<=ends;p++)
-    force[p] = E->buoyancy[CPPR][E->ien[el].node[p]];
+    force[p] = E->buoyancy[E->ien[el].node[p]];
 
   for(j=1;j<=vpts;j++)       {   /*compute force at each int point */
     force_at_gs[j] = 0.0;
diff --git a/lib/Ggrd_handling.c b/lib/Ggrd_handling.c
index deadcd0..a8c42c1 100644
--- a/lib/Ggrd_handling.c
+++ b/lib/Ggrd_handling.c
@@ -1434,8 +1434,7 @@ void ggrd_read_age_from_file(struct All_variables *E, int is_geographic)
 } /* end age control */
 
 /* adjust Ra in top boundary layer  */
-void ggrd_adjust_tbl_rayleigh(struct All_variables *E,
-			      double **buoy)
+void ggrd_adjust_tbl_rayleigh(struct All_variables *E, double *buoy)
 {
   int m,snode,node,i;
   double xloc,fac,bnew;
@@ -1467,13 +1466,13 @@ void ggrd_adjust_tbl_rayleigh(struct All_variables *E,
 							1 at surface
 							to zero at
 							boundary */
-	    bnew = buoy[CPPR][node] * E->control.surface_rayleigh[snode]; /* modified rayleigh */
+	    bnew = buoy[node] * E->control.surface_rayleigh[snode]; /* modified rayleigh */
 	    /* debugging */
 	    /*   fprintf(stderr,"z: %11g tl: %i zm: %11g fac: %11g sra: %11g bnew: %11g bold: %11g\n", */
 	    /* 	    	    (1 - E->sx[m][3][node])*E->data.radius_km,E->control.ggrd.ray_control, */
 	    /* 	    	    E->viscosity.zbase_layer[E->control.ggrd.ray_control-1]*E->data.radius_km, */
 	    /* 	    	    fac,E->control.surface_rayleigh[snode],(fac * bnew + (1-fac)*buoy[m][node]),buoy[m][node]); */
-	    buoy[CPPR][node] = fac * bnew + (1-fac)*buoy[CPPR][node];
+	    buoy[node] = fac * bnew + (1-fac)*buoy[node];
 	  }
 	}
       }
diff --git a/lib/Global_operations.c b/lib/Global_operations.c
index a3824cc..534a5d1 100644
--- a/lib/Global_operations.c
+++ b/lib/Global_operations.c
@@ -46,7 +46,7 @@ void myerror(struct All_variables *E,char *message);
 
 void remove_horiz_ave(E,X,H,store_or_not)
      struct All_variables *E;
-     double **X, *H;
+     double *X, *H;
      int store_or_not;
 
 {
@@ -64,13 +64,13 @@ void remove_horiz_ave(E,X,H,store_or_not)
     for(k=1;k<=noy;k++)
       for(j=1;j<=nox;j++)
 	for(i=1;i<=noz;i++) {
-            n = i+(j-1)*noz+(k-1)*noz*nox;
-            X[CPPR][n] -= H[i];
+      n = i+(j-1)*noz+(k-1)*noz*nox;
+      X[n] -= H[i];
 	}
 }
 
 
-void remove_horiz_ave2(struct All_variables *E, double **X)
+void remove_horiz_ave2(struct All_variables *E, double *X)
 {
     double *H;
 
@@ -82,7 +82,7 @@ void remove_horiz_ave2(struct All_variables *E, double **X)
 
 void return_horiz_ave(E,X,H)
      struct All_variables *E;
-     double **X, *H;
+     double *X, *H;
 {
   const int dims = E->mesh.nsd;
   int m,i,j,k,d,nint,noz,nox,noy,el,elz,elx,ely,j1,j2,i1,i2,k1,k2,nproc;
@@ -121,7 +121,7 @@ void return_horiz_ave(E,X,H)
 
           for(nint=1;nint<=onedvpoints[E->mesh.nsd];nint++)   {
             for(d=1;d<=onedvpoints[E->mesh.nsd];d++)
-              temp[i] += X[CPPR][lnode[d]] * E->M.vpt[GMVINDEX(d,nint)]
+              temp[i] += X[lnode[d]] * E->M.vpt[GMVINDEX(d,nint)]
                           * dGamma.vpt[GMVGAMMA(0,nint)];
             temp[i+noz] += dGamma.vpt[GMVGAMMA(0,nint)];
             }
@@ -134,7 +134,7 @@ void return_horiz_ave(E,X,H)
 
             for(nint=1;nint<=onedvpoints[E->mesh.nsd];nint++)   {
               for(d=1;d<=onedvpoints[E->mesh.nsd];d++)
-                temp[i+1] += X[CPPR][lnode[d]] * E->M.vpt[GMVINDEX(d,nint)]
+                temp[i+1] += X[lnode[d]] * E->M.vpt[GMVINDEX(d,nint)]
                           * dGamma.vpt[GMVGAMMA(1,nint)];
               temp[i+1+noz] += dGamma.vpt[GMVGAMMA(1,nint)];
               }
diff --git a/lib/Instructions.c b/lib/Instructions.c
index 62387e7..3b406b6 100644
--- a/lib/Instructions.c
+++ b/lib/Instructions.c
@@ -954,7 +954,7 @@ void allocate_common_vars(E)
   E->P        = (double *) malloc(npno*sizeof(double));
   E->T        = (double *) malloc((nno+1)*sizeof(double));
   E->NP       = (float *) malloc((nno+1)*sizeof(float));
-  E->buoyancy[CPPR] = (double *) malloc((nno+1)*sizeof(double));
+  E->buoyancy = (double *) malloc((nno+1)*sizeof(double));
 
   E->gstress = (float *) malloc((6*nno+1)*sizeof(float));
   // TWB do we need this anymore XXX
diff --git a/lib/Pan_problem_misc_functions.c b/lib/Pan_problem_misc_functions.c
index 320f6de..26593e9 100644
--- a/lib/Pan_problem_misc_functions.c
+++ b/lib/Pan_problem_misc_functions.c
@@ -146,12 +146,12 @@ void apply_side_sbc(struct All_variables *E)
 }
 
 
-void get_buoyancy(struct All_variables *E, double **buoy)
+void get_buoyancy(struct All_variables *E, double *buoy)
 {
     int i,j,m,n,nz,nxny;
     int lev = E->mesh.levmax;
     double temp,temp2,rfac,cost2;
-    void remove_horiz_ave2(struct All_variables*, double**);
+    void remove_horiz_ave2(struct All_variables*, double*);
     //char filename[100];FILE *out;
 
     nxny = E->lmesh.nox*E->lmesh.noy;
@@ -164,7 +164,7 @@ void get_buoyancy(struct All_variables *E, double **buoy)
         /* We don't need to substract adiabatic T profile from T here,
          * since the horizontal average of buoy will be removed.
          */
-        buoy[CPPR][i] =  temp * E->refstate.rho[nz]
+        buoy[i] =  temp * E->refstate.rho[nz]
 	  * E->refstate.thermal_expansivity[nz] * E->T[i];
       }
     
@@ -175,7 +175,7 @@ void get_buoyancy(struct All_variables *E, double **buoy)
 	/* TODO: how to scale chemical buoyancy wrt reference density? */
 	temp2 = E->composition.buoyancy_ratio[j] * temp;
 	      for(i=1;i<=E->lmesh.nno;i++)
-		buoy[CPPR][i] -= temp2 * E->composition.comp_node[j][i];
+		buoy[i] -= temp2 * E->composition.comp_node[j][i];
       }
     }
 #ifdef USE_GGRD
@@ -207,9 +207,9 @@ void get_buoyancy(struct All_variables *E, double **buoy)
 	    n = j*E->lmesh.noz + i; /* this could be improved by only
 				       computing the cos as a function
 				       of lat, but leave for now  */
-	    cost2 = cos(E->sx[CPPR][1][n]);cost2 = cost2*cost2;	    /* cos^2(theta) */
+	    cost2 = cos(E->sx[1][n]);cost2 = cost2*cost2;	    /* cos^2(theta) */
 	    /* correct gravity for rotation */
-	    buoy[CPPR][n] *= E->refstate.gravity[i] * (E->data.ge+rfac*cost2);
+	    buoy[n] *= E->refstate.gravity[i] * (E->data.ge+rfac*cost2);
 	  }
     }else{
 #endif
@@ -218,7 +218,7 @@ void get_buoyancy(struct All_variables *E, double **buoy)
 	for(j=0;j < nxny;j++) {
 	  for(i=1;i<=E->lmesh.noz;i++){
 	    n = j*E->lmesh.noz + i;
-	    buoy[CPPR][n] *= E->refstate.gravity[i];
+	    buoy[n] *= E->refstate.gravity[i];
 	  }
 	}
 #ifdef ALLOW_ELLIPTICAL
diff --git a/lib/Phase_change.c b/lib/Phase_change.c
index 99c3577..9a0535f 100644
--- a/lib/Phase_change.c
+++ b/lib/Phase_change.c
@@ -33,7 +33,7 @@
 #include "parsing.h"
 #include "phase_change.h"
 
-static void phase_change_apply(struct All_variables *E, double **buoy,
+static void phase_change_apply(struct All_variables *E, double *buoy,
 			       float *B, float *B_b,
 			       float Ra, float clapeyron,
 			       float depth, float transT, float inv_width);
@@ -96,7 +96,7 @@ void phase_change_input(struct All_variables *E)
 }
 
 
-void phase_change_apply_410(struct All_variables *E, double **buoy)
+void phase_change_apply_410(struct All_variables *E, double *buoy)
 {
   if (E->control.Ra_410 != 0.0)
     phase_change_apply(E, buoy, E->Fas410, E->Fas410_b, E->control.Ra_410,
@@ -106,7 +106,7 @@ void phase_change_apply_410(struct All_variables *E, double **buoy)
 }
 
 
-void phase_change_apply_670(struct All_variables *E, double **buoy)
+void phase_change_apply_670(struct All_variables *E, double *buoy)
 {
   if (E->control.Ra_670 != 0.0)
     phase_change_apply(E, buoy, E->Fas670, E->Fas670_b, E->control.Ra_670,
@@ -116,7 +116,7 @@ void phase_change_apply_670(struct All_variables *E, double **buoy)
 }
 
 
-void phase_change_apply_cmb(struct All_variables *E, double **buoy)
+void phase_change_apply_cmb(struct All_variables *E, double *buoy)
 {
   if (E->control.Ra_cmb != 0.0)
     phase_change_apply(E, buoy, E->Fascmb, E->Fascmb_b, E->control.Ra_cmb,
@@ -126,7 +126,7 @@ void phase_change_apply_cmb(struct All_variables *E, double **buoy)
 }
 
 
-static void phase_change_apply(struct All_variables *E, double **buoy,
+static void phase_change_apply(struct All_variables *E, double *buoy,
 			       float *B, float *B_b,
 			       float Ra, float clapeyron,
 			       float depth, float transT, float inv_width)
@@ -135,7 +135,7 @@ static void phase_change_apply(struct All_variables *E, double **buoy,
 
   calc_phase_change(E, B, B_b, Ra, clapeyron, depth, transT, inv_width);
     for(i=1;i<=E->lmesh.nno;i++)
-      buoy[CPPR][i] -= Ra * B[i];
+      buoy[i] -= Ra * B[i];
 
   if (E->control.verbose) {
     fprintf(E->fp_out, "Ra=%f, clapeyron=%f, depth=%f, transT=%f, inv_width=%f\n",
diff --git a/lib/Topo_gravity.c b/lib/Topo_gravity.c
index f90a187..bb8d82d 100644
--- a/lib/Topo_gravity.c
+++ b/lib/Topo_gravity.c
@@ -571,7 +571,7 @@ static void geoid_from_buoyancy(struct All_variables *E,
                     p = j + (i-1)*E->lmesh.nox;
                     /* convert non-dimensional buoyancy to */
                     /* dimensional density */
-                    TT[p] = (E->buoyancy[CPPR][node]+E->buoyancy[CPPR][node+1])
+                    TT[p] = (E->buoyancy[node]+E->buoyancy[node+1])
                         * 0.5 * buoy2rho;
                 }
 
diff --git a/lib/global_defs.h b/lib/global_defs.h
index 71b62d0..d2d0ace 100644
--- a/lib/global_defs.h
+++ b/lib/global_defs.h
@@ -830,7 +830,7 @@ struct All_variables {
     double *heating_latent;
 
     double *P,*F,*U;
-    double *T,*Tdot,*buoyancy[NCS];
+    double *T,*Tdot,*buoyancy;
     double *u1;
     double *temp,*temp1;
     double *Mass, *MASS[MAX_LEVELS];
diff --git a/lib/phase_change.h b/lib/phase_change.h
index c17eb88..31f3eb9 100644
--- a/lib/phase_change.h
+++ b/lib/phase_change.h
@@ -28,6 +28,6 @@
 void phase_change_input(struct All_variables *E);
 void phase_change_allocate(struct All_variables *E);
 
-void phase_change_apply_410(struct All_variables *E, double **buoy);
-void phase_change_apply_670(struct All_variables *E, double **buoy);
-void phase_change_apply_cmb(struct All_variables *E, double **buoy);
+void phase_change_apply_410(struct All_variables *E, double *buoy);
+void phase_change_apply_670(struct All_variables *E, double *buoy);
+void phase_change_apply_cmb(struct All_variables *E, double *buoy);
diff --git a/lib/prototypes.h b/lib/prototypes.h
index 39cff61..d5d7dc4 100644
--- a/lib/prototypes.h
+++ b/lib/prototypes.h
@@ -185,14 +185,14 @@ void ggrd_read_ray_from_file(struct All_variables *, int);
 void ggrd_read_vtop_from_file(struct All_variables *, int);
 void ggrd_vtop_helper_decide_on_internal_nodes(struct All_variables *, int, int, int, int, int *, int *, int *);
 void ggrd_read_age_from_file(struct All_variables *, int);
-void ggrd_adjust_tbl_rayleigh(struct All_variables *, double **);
+void ggrd_adjust_tbl_rayleigh(struct All_variables *, double *);
 void ggrd_solve_eigen3x3(double [3][3], double [3], double [3][3], struct All_variables *);
 void ggrd_read_anivisc_from_file(struct All_variables *, int);
 #endif
 /* Global_operations.c */
-void remove_horiz_ave(struct All_variables *, double **, double *, int);
-void remove_horiz_ave2(struct All_variables *, double **);
-void return_horiz_ave(struct All_variables *, double **, double *);
+void remove_horiz_ave(struct All_variables *, double *, double *, int);
+void remove_horiz_ave2(struct All_variables *, double *);
+void return_horiz_ave(struct All_variables *, double *, double *);
 void return_horiz_ave_f(struct All_variables *, float **, float *);
 void return_elementwise_horiz_ave(struct All_variables *, double **, double *);
 float return_bulk_value(struct All_variables *, float **, int);
@@ -337,7 +337,7 @@ void vtk_output(struct All_variables *, int);
 int get_process_identifier(void);
 void unique_copy_file(struct All_variables *, char *, char *);
 void apply_side_sbc(struct All_variables *);
-void get_buoyancy(struct All_variables *, double **);
+void get_buoyancy(struct All_variables *, double *);
 int read_double_vector(FILE *, int, double *);
 void read_visc_param_from_file(struct All_variables *, const char *, float *, FILE *);
 double myatan(double, double);
@@ -384,9 +384,9 @@ int interpret_control_string(char *, int *, double *, double *, double *);
 /* Phase_change.c */
 void phase_change_allocate(struct All_variables *);
 void phase_change_input(struct All_variables *);
-void phase_change_apply_410(struct All_variables *, double **);
-void phase_change_apply_670(struct All_variables *, double **);
-void phase_change_apply_cmb(struct All_variables *, double **);
+void phase_change_apply_410(struct All_variables *, double *);
+void phase_change_apply_670(struct All_variables *, double *);
+void phase_change_apply_cmb(struct All_variables *, double *);
 /* Problem_related.c */
 void read_velocity_boundary_from_file(struct All_variables *);
 void read_rayleigh_from_file(struct All_variables *);



More information about the CIG-COMMITS mailing list