[cig-commits] [commit] kommu/aspect-citcom-benchmarks: Fixed bugs in compute_volume_avg due to incompatible pointer types (0c00129)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Tue Apr 1 16:35:31 PDT 2014
Repository : ssh://shell.geodynamics.org/citcoms
On branch : kommu/aspect-citcom-benchmarks
Link : https://github.com/geodynamics/citcoms/compare/aa1bd87b30a2391d23a167342505e285fa6c1643...0c001297a6f0f0c96c470ab0f68295769becbf7c
>---------------------------------------------------------------
commit 0c001297a6f0f0c96c470ab0f68295769becbf7c
Author: Rajesh Kommu <rajesh.kommu at gmail.com>
Date: Tue Apr 1 16:27:52 2014 -0700
Fixed bugs in compute_volume_avg due to incompatible pointer types
>---------------------------------------------------------------
0c001297a6f0f0c96c470ab0f68295769becbf7c
lib/Output.c | 4 ++--
lib/Process_buoyancy.c | 18 ++++++++++++------
lib/prototypes.h | 2 +-
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/lib/Output.c b/lib/Output.c
index aae7abb..ad15d87 100644
--- a/lib/Output.c
+++ b/lib/Output.c
@@ -571,7 +571,7 @@ void output_volume_avg(struct All_variables *E, int cycles)
int j;
char output_file[255];
FILE *fp1;
- float T_avg=0.0, V_rms_avg=0.0;
+ double T_avg=0.0, V_rms_avg=0.0;
/* compute horizontal average here.... */
compute_volume_avg(E, &T_avg, &V_rms_avg);
@@ -579,7 +579,7 @@ void output_volume_avg(struct All_variables *E, int cycles)
if (E->parallel.me == 0)
{
sprintf(output_file,"%s.volume_avg", E->control.data_file);
- fp1=fopen(output_file,"a");
+ fp1=fopen(output_file,"a+");
fprintf(fp1,"%d %.4e %.4e %.4e\n",
cycles, E->monitor.elapsed_time, T_avg, V_rms_avg);
fclose(fp1);
diff --git a/lib/Process_buoyancy.c b/lib/Process_buoyancy.c
index 86607d2..6d6a580 100644
--- a/lib/Process_buoyancy.c
+++ b/lib/Process_buoyancy.c
@@ -200,16 +200,16 @@ void heat_flux(E)
/*
* compute the volume average of temperature and RMS velocity
*/
-void compute_volume_avg(struct All_variables *E, float *T_avg, float *Vrms_avg)
+void compute_volume_avg(struct All_variables *E, double *T_avg, double *Vrms_avg)
{
/* float return_bulk_value(struct All_variables *, float **, int); */
int m, n, i;
- float *S1[NCS], *S2[NCS];
+ double *S1[NCS], *S2[NCS];
for(m=1; m<=E->sphere.caps_per_proc; m++)
{
- S1[m] = (float *)malloc((E->lmesh.nno+1)*sizeof(float));
- S2[m] = (float *)malloc((E->lmesh.nno+1)*sizeof(float));
+ S1[1] = (double *)malloc((E->lmesh.nno+1)*sizeof(double));
+ S2[1] = (double *)malloc((E->lmesh.nno+1)*sizeof(double));
}
for(m=1; m<=E->sphere.caps_per_proc; m++)
@@ -223,8 +223,14 @@ void compute_volume_avg(struct All_variables *E, float *T_avg, float *Vrms_avg)
E->sphere.cap[m].V[3][i]*E->sphere.cap[m].V[3][i];
}
}
- *T_avg = return_bulk_value(E, S1, 1); /* 1 => need volume average */
- *Vrms_avg = sqrt(return_bulk_value(E, S2, 1)); /* 1 => need volume average */
+
+ *T_avg = return_bulk_value_d(E, S1, 1); /* 1 => need volume average */
+ *Vrms_avg = sqrt(return_bulk_value_d(E, S2, 1)); /* 1 => need volume average */
+
+ for(m=1;m<=E->sphere.caps_per_proc;m++) {
+ free((void *)S1[m]);
+ free((void *)S2[m]);
+ }
}
/*
diff --git a/lib/prototypes.h b/lib/prototypes.h
index 5b6c8b8..8a9800e 100644
--- a/lib/prototypes.h
+++ b/lib/prototypes.h
@@ -397,7 +397,7 @@ float find_age_in_MY(struct All_variables *);
void post_processing(struct All_variables *);
void heat_flux(struct All_variables *);
void compute_horiz_avg(struct All_variables *);
-void compute_volume_avg(struct All_variables *, float *, float *);
+void compute_volume_avg(struct All_variables *, double *, double *);
/* Regional_boundary_conditions.c */
void regional_velocity_boundary_conditions(struct All_variables *);
void regional_temperature_boundary_conditions(struct All_variables *);
More information about the CIG-COMMITS
mailing list