[cig-commits] [commit] kommu/aspect-citcom-benchmarks: Added the compute_volume_avg method to compute <T> and <V_rms> (1a47b80)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Tue Apr 8 03:01:01 PDT 2014
Repository : ssh://geoshell/citcoms
On branch : kommu/aspect-citcom-benchmarks
Link : https://github.com/geodynamics/citcoms/compare/3ebabdc12f5b4e8d7db6edbc2cc578201d4477bf...fb1839e7e93bc56eb542afd64b3db70f2df6a5d8
>---------------------------------------------------------------
commit 1a47b8074208c52f4fdcdc7edd932c4acea740a7
Author: Rajesh Kommu <rajesh.kommu at gmail.com>
Date: Mon Mar 31 12:29:34 2014 -0700
Added the compute_volume_avg method to compute <T> and <V_rms>
>---------------------------------------------------------------
1a47b8074208c52f4fdcdc7edd932c4acea740a7
lib/Process_buoyancy.c | 28 ++++++++++++++++++++++++++++
lib/prototypes.h | 1 +
2 files changed, 29 insertions(+)
diff --git a/lib/Process_buoyancy.c b/lib/Process_buoyancy.c
index 4dd8c09..86607d2 100644
--- a/lib/Process_buoyancy.c
+++ b/lib/Process_buoyancy.c
@@ -197,7 +197,35 @@ void heat_flux(E)
return;
}
+/*
+ * compute the volume average of temperature and RMS velocity
+ */
+void compute_volume_avg(struct All_variables *E, float *T_avg, float *Vrms_avg)
+{
+ /* float return_bulk_value(struct All_variables *, float **, int); */
+ int m, n, i;
+ float *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));
+ }
+ for(m=1; m<=E->sphere.caps_per_proc; m++)
+ {
+ for(i=1; i<=E->lmesh.nno+1; i++)
+ {
+ S1[m][i] = E->T[m][i];
+ S2[m][i] =
+ E->sphere.cap[m].V[1][i]*E->sphere.cap[m].V[1][i] +
+ E->sphere.cap[m].V[2][i]*E->sphere.cap[m].V[2][i] +
+ 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 */
+}
/*
compute horizontal average of temperature, composition and rms velocity
diff --git a/lib/prototypes.h b/lib/prototypes.h
index 5420a47..148762b 100644
--- a/lib/prototypes.h
+++ b/lib/prototypes.h
@@ -396,6 +396,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 *);
/* 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