[cig-commits] r5754 - mc/3D/CitcomS/branches/compressible/lib
tan2 at geodynamics.org
tan2 at geodynamics.org
Wed Jan 10 13:59:33 PST 2007
Author: tan2
Date: 2007-01-10 13:59:32 -0800 (Wed, 10 Jan 2007)
New Revision: 5754
Modified:
mc/3D/CitcomS/branches/compressible/lib/Global_operations.c
mc/3D/CitcomS/branches/compressible/lib/Obsolete.c
mc/3D/CitcomS/branches/compressible/lib/Pan_problem_misc_functions.c
mc/3D/CitcomS/branches/compressible/lib/Phase_change.c
Log:
Minor refactoring
Modified: mc/3D/CitcomS/branches/compressible/lib/Global_operations.c
===================================================================
--- mc/3D/CitcomS/branches/compressible/lib/Global_operations.c 2007-01-10 17:57:28 UTC (rev 5753)
+++ mc/3D/CitcomS/branches/compressible/lib/Global_operations.c 2007-01-10 21:59:32 UTC (rev 5754)
@@ -64,9 +64,19 @@
}
return;
- }
+}
+void remove_horiz_ave2(struct All_variables *E, double **X)
+{
+ double *H;
+
+ H = (double *)malloc( (E->lmesh.noz+1)*sizeof(double));
+ remove_horiz_ave(E, X, H, 0);
+ free ((void *) H);
+}
+
+
void return_horiz_ave(E,X,H)
struct All_variables *E;
double **X, *H;
Modified: mc/3D/CitcomS/branches/compressible/lib/Obsolete.c
===================================================================
--- mc/3D/CitcomS/branches/compressible/lib/Obsolete.c 2007-01-10 17:57:28 UTC (rev 5753)
+++ mc/3D/CitcomS/branches/compressible/lib/Obsolete.c 2007-01-10 21:59:32 UTC (rev 5754)
@@ -703,6 +703,114 @@
+/* ========================================================== */
+/* From Phase_change.c */
+/* =========================================================== */
+
+
+void phase_change_410(E,B,B_b)
+ struct All_variables *E;
+ float **B,**B_b;
+{
+ int i,j,k,n,ns,m;
+ float e_pressure,pt5,one;
+
+ pt5 = 0.5; one=1.0;
+
+ for(m=1;m<=E->sphere.caps_per_proc;m++) {
+ for(i=1;i<=E->lmesh.nno;i++) {
+ e_pressure = (E->sphere.ro-E->sx[m][3][i])-E->viscosity.z410-
+ E->control.clapeyron410*(E->T[m][i]-E->control.transT410);
+
+ B[m][i] = pt5*(one+tanh(E->control.width410*e_pressure));
+ }
+
+ ns = 0;
+ for (k=1;k<=E->lmesh.noy;k++)
+ for (j=1;j<=E->lmesh.nox;j++) {
+ ns = ns + 1;
+ B_b[m][ns]=0.0;
+ for (i=1;i<E->lmesh.noz;i++) {
+ n = (k-1)*E->lmesh.noz*E->lmesh.nox + (j-1)*E->lmesh.noz + i;
+ if (B[m][n]>=pt5&&B[m][n+1]<=pt5)
+ B_b[m][ns]=(E->sx[m][3][n+1]-E->sx[m][3][n])*(pt5-B[m][n])/(B[m][n+1]-B[m][n])+E->sx[m][3][n];
+ }
+ }
+ }
+
+
+ return;
+ }
+
+
+void phase_change_670(E,B,B_b)
+ struct All_variables *E;
+ float **B,**B_b;
+{
+ int i,j,k,n,ns,m;
+ float e_pressure,pt5,one;
+
+ pt5 = 0.5; one=1.0;
+
+ for(m=1;m<=E->sphere.caps_per_proc;m++) {
+ for(i=1;i<=E->lmesh.nno;i++) {
+ e_pressure = (E->sphere.ro-E->sx[m][3][i])-E->viscosity.zlm-
+ E->control.clapeyron670*(E->T[m][i]-E->control.transT670);
+
+ B[m][i] = pt5*(one+tanh(E->control.width670*e_pressure));
+ }
+
+ ns = 0;
+ for (k=1;k<=E->lmesh.noy;k++)
+ for (j=1;j<=E->lmesh.nox;j++) {
+ ns = ns + 1;
+ B_b[m][ns]=0.0;
+ for (i=1;i<E->lmesh.noz;i++) {
+ n = (k-1)*E->lmesh.noz*E->lmesh.nox + (j-1)*E->lmesh.noz + i;
+ if (B[m][n]>=pt5&&B[m][n+1]<=pt5)
+ B_b[m][ns]=(E->sx[m][3][n+1]-E->sx[m][3][n])*(pt5-B[m][n])/(B[m][n+1]-B[m][n])+E->sx[m][3][n];
+ }
+ }
+ }
+
+
+ return;
+ }
+
+
+void phase_change_cmb(E,B,B_b)
+ struct All_variables *E;
+ float **B,**B_b;
+{
+ int i,j,k,n,ns,m;
+ float e_pressure,pt5,one;
+
+ pt5 = 0.5; one=1.0;
+
+ for(m=1;m<=E->sphere.caps_per_proc;m++) {
+ for(i=1;i<=E->lmesh.nno;i++) {
+ e_pressure = (E->sphere.ro-E->sx[m][3][i])-E->viscosity.zcmb-
+ E->control.clapeyroncmb*(E->T[m][i]-E->control.transTcmb);
+
+ B[m][i] = pt5*(one+tanh(E->control.widthcmb*e_pressure));
+ }
+
+ ns = 0;
+ for (k=1;k<=E->lmesh.noy;k++)
+ for (j=1;j<=E->lmesh.nox;j++) {
+ ns = ns + 1;
+ B_b[m][ns]=0.0;
+ for (i=1;i<E->lmesh.noz;i++) {
+ n = (k-1)*E->lmesh.noz*E->lmesh.nox + (j-1)*E->lmesh.noz + i;
+ if (B[m][n]>=pt5&&B[m][n+1]<=pt5)
+ B_b[m][ns]=(E->sx[m][3][n+1]-E->sx[m][3][n])*(pt5-B[m][n])/(B[m][n+1]-B[m][n])+E->sx[m][3][n];
+ }
+ }
+ }
+
+ return;
+}
+
/* version */
/* $Id$ */
Modified: mc/3D/CitcomS/branches/compressible/lib/Pan_problem_misc_functions.c
===================================================================
--- mc/3D/CitcomS/branches/compressible/lib/Pan_problem_misc_functions.c 2007-01-10 17:57:28 UTC (rev 5753)
+++ mc/3D/CitcomS/branches/compressible/lib/Pan_problem_misc_functions.c 2007-01-10 21:59:32 UTC (rev 5754)
@@ -1,6 +1,6 @@
/*
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
+ *
*<LicenseText>
*
* CitcomS by Louis Moresi, Shijie Zhong, Lijie Han, Eh Tan,
@@ -22,7 +22,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*</LicenseText>
- *
+ *
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
@@ -129,11 +129,9 @@
void thermal_buoyancy(struct All_variables *E, double **buoy)
{
int i,m;
- double temp,*H;
- void remove_horiz_ave();
+ double temp;
+ void remove_horiz_ave2(struct All_variables*, double**);
- H = (double *)malloc( (E->lmesh.noz+1)*sizeof(double));
-
temp = E->control.Atemp;
for(m=1;m<=E->sphere.caps_per_proc;m++)
@@ -144,9 +142,7 @@
phase_change_apply_670(E, buoy);
phase_change_apply_cmb(E, buoy);
- remove_horiz_ave(E,buoy,H,0);
- free ((void *) H);
-
+ remove_horiz_ave2(E, buoy);
return;
}
Modified: mc/3D/CitcomS/branches/compressible/lib/Phase_change.c
===================================================================
--- mc/3D/CitcomS/branches/compressible/lib/Phase_change.c 2007-01-10 17:57:28 UTC (rev 5753)
+++ mc/3D/CitcomS/branches/compressible/lib/Phase_change.c 2007-01-10 21:59:32 UTC (rev 5754)
@@ -32,17 +32,18 @@
#include "parsing.h"
#include "phase_change.h"
-void phase_change_apply(struct All_variables *E, double **buoy,
- float **B, float **B_b,
- float Ra, float clapeyron,
- float depth, float transT, float width);
-void calc_phase_change(struct All_variables *E,
- float **B, float **B_b,
- float Ra, float clapeyron,
- float depth, float transT, float width);
-void debug_phase_change(struct All_variables *E, float **B);
+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 width);
+static void calc_phase_change(struct All_variables *E,
+ float **B, float **B_b,
+ float Ra, float clapeyron,
+ float depth, float transT, float width);
+static void debug_phase_change(struct All_variables *E, float **B);
+
void phase_change_allocate(struct All_variables *E)
{
int j;
@@ -129,10 +130,10 @@
}
-void phase_change_apply(struct All_variables *E, double **buoy,
- float **B, float **B_b,
- float Ra, float clapeyron,
- float depth, float transT, float width)
+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 width)
{
int m, i;
@@ -152,10 +153,10 @@
}
-void calc_phase_change(struct All_variables *E,
- float **B, float **B_b,
- float Ra, float clapeyron,
- float depth, float transT, float width)
+static void calc_phase_change(struct All_variables *E,
+ float **B, float **B_b,
+ float Ra, float clapeyron,
+ float depth, float transT, float width)
{
int i,j,k,n,ns,m;
float e_pressure,pt5,one;
@@ -188,7 +189,7 @@
}
-void debug_phase_change(struct All_variables *E, float **B)
+static void debug_phase_change(struct All_variables *E, float **B)
{
int m, j;
@@ -202,110 +203,3 @@
return;
}
-
-
-
-/* The following three functions are obsolete. */
-
-void phase_change_410(E,B,B_b)
- struct All_variables *E;
- float **B,**B_b;
-{
- int i,j,k,n,ns,m;
- float e_pressure,pt5,one;
-
- pt5 = 0.5; one=1.0;
-
- for(m=1;m<=E->sphere.caps_per_proc;m++) {
- for(i=1;i<=E->lmesh.nno;i++) {
- e_pressure = (E->sphere.ro-E->sx[m][3][i])-E->viscosity.z410-
- E->control.clapeyron410*(E->T[m][i]-E->control.transT410);
-
- B[m][i] = pt5*(one+tanh(E->control.width410*e_pressure));
- }
-
- ns = 0;
- for (k=1;k<=E->lmesh.noy;k++)
- for (j=1;j<=E->lmesh.nox;j++) {
- ns = ns + 1;
- B_b[m][ns]=0.0;
- for (i=1;i<E->lmesh.noz;i++) {
- n = (k-1)*E->lmesh.noz*E->lmesh.nox + (j-1)*E->lmesh.noz + i;
- if (B[m][n]>=pt5&&B[m][n+1]<=pt5)
- B_b[m][ns]=(E->sx[m][3][n+1]-E->sx[m][3][n])*(pt5-B[m][n])/(B[m][n+1]-B[m][n])+E->sx[m][3][n];
- }
- }
- }
-
-
- return;
- }
-
-
-void phase_change_670(E,B,B_b)
- struct All_variables *E;
- float **B,**B_b;
-{
- int i,j,k,n,ns,m;
- float e_pressure,pt5,one;
-
- pt5 = 0.5; one=1.0;
-
- for(m=1;m<=E->sphere.caps_per_proc;m++) {
- for(i=1;i<=E->lmesh.nno;i++) {
- e_pressure = (E->sphere.ro-E->sx[m][3][i])-E->viscosity.zlm-
- E->control.clapeyron670*(E->T[m][i]-E->control.transT670);
-
- B[m][i] = pt5*(one+tanh(E->control.width670*e_pressure));
- }
-
- ns = 0;
- for (k=1;k<=E->lmesh.noy;k++)
- for (j=1;j<=E->lmesh.nox;j++) {
- ns = ns + 1;
- B_b[m][ns]=0.0;
- for (i=1;i<E->lmesh.noz;i++) {
- n = (k-1)*E->lmesh.noz*E->lmesh.nox + (j-1)*E->lmesh.noz + i;
- if (B[m][n]>=pt5&&B[m][n+1]<=pt5)
- B_b[m][ns]=(E->sx[m][3][n+1]-E->sx[m][3][n])*(pt5-B[m][n])/(B[m][n+1]-B[m][n])+E->sx[m][3][n];
- }
- }
- }
-
-
- return;
- }
-
-
-void phase_change_cmb(E,B,B_b)
- struct All_variables *E;
- float **B,**B_b;
-{
- int i,j,k,n,ns,m;
- float e_pressure,pt5,one;
-
- pt5 = 0.5; one=1.0;
-
- for(m=1;m<=E->sphere.caps_per_proc;m++) {
- for(i=1;i<=E->lmesh.nno;i++) {
- e_pressure = (E->sphere.ro-E->sx[m][3][i])-E->viscosity.zcmb-
- E->control.clapeyroncmb*(E->T[m][i]-E->control.transTcmb);
-
- B[m][i] = pt5*(one+tanh(E->control.widthcmb*e_pressure));
- }
-
- ns = 0;
- for (k=1;k<=E->lmesh.noy;k++)
- for (j=1;j<=E->lmesh.nox;j++) {
- ns = ns + 1;
- B_b[m][ns]=0.0;
- for (i=1;i<E->lmesh.noz;i++) {
- n = (k-1)*E->lmesh.noz*E->lmesh.nox + (j-1)*E->lmesh.noz + i;
- if (B[m][n]>=pt5&&B[m][n+1]<=pt5)
- B_b[m][ns]=(E->sx[m][3][n+1]-E->sx[m][3][n])*(pt5-B[m][n])/(B[m][n+1]-B[m][n])+E->sx[m][3][n];
- }
- }
- }
-
- return;
- }
More information about the cig-commits
mailing list