[cig-commits] r7989 - mc/3D/CitcomS/trunk/lib
tan2 at geodynamics.org
tan2 at geodynamics.org
Wed Sep 19 13:30:45 PDT 2007
Author: tan2
Date: 2007-09-19 13:30:44 -0700 (Wed, 19 Sep 2007)
New Revision: 7989
Modified:
mc/3D/CitcomS/trunk/lib/Output.c
mc/3D/CitcomS/trunk/lib/Output_gzdir.c
mc/3D/CitcomS/trunk/lib/Output_h5.c
mc/3D/CitcomS/trunk/lib/Topo_gravity.c
Log:
Fixed uninit'd heat flux and geoid arrays bugs, as reported by valgrind
Modified: mc/3D/CitcomS/trunk/lib/Output.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Output.c 2007-09-19 00:28:00 UTC (rev 7988)
+++ mc/3D/CitcomS/trunk/lib/Output.c 2007-09-19 20:30:44 UTC (rev 7989)
@@ -226,9 +226,11 @@
FILE* fp2;
float *topo;
- if(E->output.write_q_files == 0) /* else, the heat flux will have
- been computed already */
- heat_flux(E);
+ if((E->output.write_q_files == 0) || (cycles == 0) ||
+ (cycles % E->output.write_q_files)!=0)
+ heat_flux(E);
+ /* else, the heat flux will have been computed already */
+
get_STD_topo(E,E->slice.tpg,E->slice.tpgb,E->slice.divg,E->slice.vort,cycles);
if (E->output.surf && (E->parallel.me_loc[3]==E->parallel.nprocz-1)) {
Modified: mc/3D/CitcomS/trunk/lib/Output_gzdir.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Output_gzdir.c 2007-09-19 00:28:00 UTC (rev 7988)
+++ mc/3D/CitcomS/trunk/lib/Output_gzdir.c 2007-09-19 20:30:44 UTC (rev 7989)
@@ -741,9 +741,12 @@
char output_file[255];
gzFile *fp2;
float *topo;
- if(E->output.write_q_files == 0) /* else, the heat flux will have
- been computed already */
- heat_flux(E);
+
+ if((E->output.write_q_files == 0) || (cycles == 0) ||
+ (cycles % E->output.write_q_files)!=0)
+ heat_flux(E);
+ /* else, the heat flux will have been computed already */
+
get_STD_topo(E,E->slice.tpg,E->slice.tpgb,E->slice.divg,E->slice.vort,cycles);
if (E->output.surf && (E->parallel.me_loc[3]==E->parallel.nprocz-1)) {
Modified: mc/3D/CitcomS/trunk/lib/Output_h5.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Output_h5.c 2007-09-19 00:28:00 UTC (rev 7988)
+++ mc/3D/CitcomS/trunk/lib/Output_h5.c 2007-09-19 20:30:44 UTC (rev 7989)
@@ -796,9 +796,10 @@
mx = scalar->block[1];
my = scalar->block[2];
- if(E->output.write_q_files == 0) /* else, the heat flux will have
- been computed already */
- heat_flux(E);
+ if((E->output.write_q_files == 0) || (cycles == 0) ||
+ (cycles % E->output.write_q_files)!=0)
+ heat_flux(E);
+ /* else, the heat flux will have been computed already */
get_STD_topo(E, E->slice.tpg, E->slice.tpgb, E->slice.divg, E->slice.vort, cycles);
Modified: mc/3D/CitcomS/trunk/lib/Topo_gravity.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Topo_gravity.c 2007-09-19 00:28:00 UTC (rev 7988)
+++ mc/3D/CitcomS/trunk/lib/Topo_gravity.c 2007-09-19 20:30:44 UTC (rev 7989)
@@ -561,6 +561,15 @@
scaling = 1.0e3 * 4.0 * M_PI * E->data.radius_km * E->data.grav_const
/ E->data.grav_acc;
+ /* zero degree-0 and 1 term */
+ geoid_tpgt[0][E->sphere.hindex[0][0]]
+ = geoid_tpgt[0][E->sphere.hindex[1][0]]
+ = geoid_tpgt[0][E->sphere.hindex[1][1]]
+ = geoid_tpgt[1][E->sphere.hindex[0][0]]
+ = geoid_tpgt[1][E->sphere.hindex[1][0]]
+ = geoid_tpgt[1][E->sphere.hindex[1][1]]
+ = 0.0;
+
/* compute geoid due to surface topo, skip degree-0 and 1 term */
for (j=0; j<2; j++)
for (ll=2; ll<=E->output.llmax; ll++) {
@@ -587,6 +596,15 @@
scaling = 1.0e3 * 4.0 * M_PI * E->data.radius_km * E->data.grav_const
/ (E->data.grav_acc * E->refstate.gravity[1]);
+ /* zero degree-0 and 1 term */
+ geoid_tpgb[0][E->sphere.hindex[0][0]]
+ = geoid_tpgb[0][E->sphere.hindex[1][0]]
+ = geoid_tpgb[0][E->sphere.hindex[1][1]]
+ = geoid_tpgb[1][E->sphere.hindex[0][0]]
+ = geoid_tpgb[1][E->sphere.hindex[1][0]]
+ = geoid_tpgb[1][E->sphere.hindex[1][1]]
+ = 0.0;
+
/* compute geoid due to bottom topo, skip degree-0 and 1 term */
for (j=0; j<2; j++)
for (ll=2; ll<=E->output.llmax; ll++) {
More information about the cig-commits
mailing list