[cig-commits] r6293 - mc/3D/CitcomS/trunk/lib
tan2 at geodynamics.org
tan2 at geodynamics.org
Mon Mar 19 15:45:41 PDT 2007
Author: tan2
Date: 2007-03-19 15:45:38 -0700 (Mon, 19 Mar 2007)
New Revision: 6293
Modified:
mc/3D/CitcomS/trunk/lib/Full_tracer_advection.c
mc/3D/CitcomS/trunk/lib/Regional_tracer_advection.c
mc/3D/CitcomS/trunk/lib/Size_does_matter.c
mc/3D/CitcomS/trunk/lib/Tracer_setup.c
mc/3D/CitcomS/trunk/lib/global_defs.h
Log:
Compute the volume of the mesh, use it to estimate the # of tracers in the proc. make_tracer_array() now works for both versions
Modified: mc/3D/CitcomS/trunk/lib/Full_tracer_advection.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Full_tracer_advection.c 2007-03-19 20:10:00 UTC (rev 6292)
+++ mc/3D/CitcomS/trunk/lib/Full_tracer_advection.c 2007-03-19 22:45:38 UTC (rev 6293)
@@ -41,7 +41,6 @@
double *x, double *y, double *z);
static void fix_theta_phi(double *theta, double *phi);
static void fix_phi(double *phi);
-static void make_tracer_array(struct All_variables *E);
void init_tracer_flavors(struct All_variables *E);
@@ -98,6 +97,7 @@
void initialize_old_composition();
void find_tracers();
void make_regular_grid();
+ void make_tracer_array();
void initialize_tracer_elements();
void define_uv_space();
void determine_shape_coefficients();
@@ -1475,54 +1475,6 @@
}
-/************** MAKE TRACER ARRAY ********************************/
-/* Here, each cap will generate tracers somewhere */
-/* in the sphere - check if its in this cap - then check radial */
-
-static void make_tracer_array(struct All_variables *E)
-{
-
- int tracers_cap;
- int j;
- double processor_fraction;
-
- void generate_random_tracers();
-
- if (E->parallel.me==0) fprintf(stderr,"Making Tracer Array\n");
- fflush(stderr);
-
-
- for (j=1;j<=E->sphere.caps_per_proc;j++) {
-
- processor_fraction=( ( pow(E->sx[j][3][E->lmesh.noz],3.0)-pow(E->sx[j][3][1],3.0))/
- (pow(E->sphere.ro,3.0)-pow(E->sphere.ri,3.0)));
- tracers_cap=E->mesh.nel*E->trace.itperel*processor_fraction;
- /*
- fprintf(stderr,"AA: proc frac: %f (%d) %d %d %f %f\n",processor_fraction,tracers_cap,E->lmesh.nel,E->parallel.nprocz, E->sx[j][3][E->lmesh.noz],E->sx[j][3][1]);
- */
-
- fprintf(E->trace.fpt,"\nGenerating %d Tracers\n",tracers_cap);
-
- generate_random_tracers(E, tracers_cap, j);
-
-
-
- }/* end j */
-
-
- /* Initialize tracer flavors */
- if (E->trace.nflavors) init_tracer_flavors(E);
-
-
- fprintf(stderr,"DONE Making Tracer Array (%d)\n",E->parallel.me);
- fflush(stderr);
-
- return;
-}
-
-
-
-
/********* ICHECK COLUMN NEIGHBORS ***************************/
/* */
/* This function check whether a point is in a neighboring */
Modified: mc/3D/CitcomS/trunk/lib/Regional_tracer_advection.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Regional_tracer_advection.c 2007-03-19 20:10:00 UTC (rev 6292)
+++ mc/3D/CitcomS/trunk/lib/Regional_tracer_advection.c 2007-03-19 22:45:38 UTC (rev 6293)
@@ -124,11 +124,8 @@
get_neighboring_caps(E);
- if (E->trace.ic_method==0) {
- fprintf(E->trace.fpt,"Not ready for this inputs yet, tracer_ic_method=%d\n", E->trace.ic_method);
- fflush(E->trace.fpt);
- parallel_process_termination();
- }
+ if (E->trace.ic_method==0)
+ make_tracer_array(E);
else if (E->trace.ic_method==1)
read_tracer_file(E);
else if (E->trace.ic_method==2)
Modified: mc/3D/CitcomS/trunk/lib/Size_does_matter.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Size_does_matter.c 2007-03-19 20:10:00 UTC (rev 6292)
+++ mc/3D/CitcomS/trunk/lib/Size_does_matter.c 2007-03-19 22:45:38 UTC (rev 6293)
@@ -972,7 +972,22 @@
} /* lev */
+ /* compute volume of this processor mesh and the whole mesh */
+ E->lmesh.volume = 0;
+ E->mesh.volume = 0;
+
+ for (m=1;m<=E->sphere.caps_per_proc;m++)
+ for(e=1;e<=E->lmesh.nel;e++)
+ E->lmesh.volume += E->eco[m][e].area;
+
+ MPI_Allreduce(&E->lmesh.volume, &E->mesh.volume, 1, MPI_DOUBLE, MPI_SUM, E->parallel.world);
+
+
+
if (E->control.verbose) {
+ fprintf(E->fp_out, "rank=%d my_volume=%e total_volume=%e\n",
+ E->parallel.me, E->lmesh.volume, E->mesh.volume);
+
for(lev=E->mesh.levmin;lev<=E->mesh.levmax;lev++) {
fprintf(E->fp_out,"output_mass lev=%d\n",lev);
for (m=1;m<=E->sphere.caps_per_proc;m++) {
Modified: mc/3D/CitcomS/trunk/lib/Tracer_setup.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Tracer_setup.c 2007-03-19 20:10:00 UTC (rev 6292)
+++ mc/3D/CitcomS/trunk/lib/Tracer_setup.c 2007-03-19 22:45:38 UTC (rev 6293)
@@ -1250,6 +1250,53 @@
+/************** MAKE TRACER ARRAY ********************************/
+/* Here, each processor will generate tracers somewhere */
+/* in the sphere - check if its in this cap - then check radial */
+
+void make_tracer_array(struct All_variables *E)
+{
+
+ int tracers_cap;
+ int j;
+ double processor_fraction;
+
+ void generate_random_tracers();
+ void init_tracer_flavors();
+
+ if (E->parallel.me==0) fprintf(stderr,"Making Tracer Array\n");
+ fflush(stderr);
+
+
+ for (j=1;j<=E->sphere.caps_per_proc;j++) {
+
+ processor_fraction=E->lmesh.volume/E->mesh.volume;
+ tracers_cap=E->mesh.nel*E->trace.itperel*processor_fraction;
+ /*
+ fprintf(stderr,"AA: proc frac: %f (%d) %d %d %f %f\n",processor_fraction,tracers_cap,E->lmesh.nel,E->parallel.nprocz, E->sx[j][3][E->lmesh.noz],E->sx[j][3][1]);
+ */
+
+ fprintf(E->trace.fpt,"\nGenerating %d Tracers\n",tracers_cap);
+
+ generate_random_tracers(E, tracers_cap, j);
+
+
+
+ }/* end j */
+
+
+ /* Initialize tracer flavors */
+ if (E->trace.nflavors) init_tracer_flavors(E);
+
+
+ fprintf(stderr,"DONE Making Tracer Array (%d)\n",E->parallel.me);
+ fflush(stderr);
+
+ return;
+}
+
+
+
void generate_random_tracers(struct All_variables *E,
int tracers_cap, int j)
{
Modified: mc/3D/CitcomS/trunk/lib/global_defs.h
===================================================================
--- mc/3D/CitcomS/trunk/lib/global_defs.h 2007-03-19 20:10:00 UTC (rev 6292)
+++ mc/3D/CitcomS/trunk/lib/global_defs.h 2007-03-19 22:45:38 UTC (rev 6293)
@@ -351,6 +351,7 @@
float lidz;
float bl1width[4],bl2width[4],bl1mag[4],bl2mag[4];
float hwidth[4],magnitude[4],offset[4],width[4]; /* grid compression information */
+ double volume;
int fnodal_malloc_size;
int dnodal_malloc_size;
int feqn_malloc_size;
More information about the cig-commits
mailing list