[cig-commits] r20614 - mc/3D/CitcomS/trunk/lib
becker at geodynamics.org
becker at geodynamics.org
Tue Aug 21 09:30:28 PDT 2012
Author: becker
Date: 2012-08-21 09:30:28 -0700 (Tue, 21 Aug 2012)
New Revision: 20614
Modified:
mc/3D/CitcomS/trunk/lib/BC_util.c
mc/3D/CitcomS/trunk/lib/Full_boundary_conditions.c
mc/3D/CitcomS/trunk/lib/Ggrd_handling.c
mc/3D/CitcomS/trunk/lib/Initial_temperature.c
mc/3D/CitcomS/trunk/lib/Output.c
mc/3D/CitcomS/trunk/lib/Output_vtk.c
mc/3D/CitcomS/trunk/lib/Regional_boundary_conditions.c
mc/3D/CitcomS/trunk/lib/Regional_read_input_from_files.c
mc/3D/CitcomS/trunk/lib/prototypes.h
Log:
Implemented Output_vtk.c fixes from Rene.
Modified: mc/3D/CitcomS/trunk/lib/BC_util.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/BC_util.c 2012-08-21 16:24:21 UTC (rev 20613)
+++ mc/3D/CitcomS/trunk/lib/BC_util.c 2012-08-21 16:30:28 UTC (rev 20614)
@@ -206,7 +206,7 @@
toplayerbc = -1 is one node underneath surface
*/
-void assign_internal_bc(struct All_variables *E,int is_global)
+void assign_internal_bc(struct All_variables *E)
{
int lv, j, noz, k,lay,ncount,ontop,onbottom;
@@ -252,7 +252,7 @@
/* read in velocities/stresses from grd file? */
#ifdef USE_GGRD
if(E->control.ggrd.vtop_control)
- ggrd_read_vtop_from_file(E, is_global);
+ ggrd_read_vtop_from_file(E, TRUE);
#endif
/* end toplayerbc > 0 branch */
}else if(E->mesh.toplayerbc < 0){
@@ -297,7 +297,7 @@
/* read in velocities/stresses from grd file? */
#ifdef USE_GGRD
if(E->control.ggrd.vtop_control)
- ggrd_read_vtop_from_file(E, is_global);
+ ggrd_read_vtop_from_file(E, TRUE);
#endif
/* end toplayerbc < 0 branch */
}
Modified: mc/3D/CitcomS/trunk/lib/Full_boundary_conditions.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Full_boundary_conditions.c 2012-08-21 16:24:21 UTC (rev 20613)
+++ mc/3D/CitcomS/trunk/lib/Full_boundary_conditions.c 2012-08-21 16:30:28 UTC (rev 20614)
@@ -36,7 +36,7 @@
/* ========================================== */
static void horizontal_bc(struct All_variables *,float *[],int,int,float,unsigned int,char,int,int);
-void assign_internal_bc(struct All_variables *,int );
+void assign_internal_bc(struct All_variables * );
static void velocity_apply_periodic_bcs();
static void temperature_apply_periodic_bcs();
void read_temperature_boundary_from_file(struct All_variables *);
@@ -122,7 +122,7 @@
settings are to be implemented in those routines (will only do
anything at present, if E->mesh.toplayerbc != 0
*/
- assign_internal_bc(E,1);
+ assign_internal_bc(E);
#ifdef USE_GGRD
if(E->control.ggrd.vtop_control) /* assign stress or velocity BCs */
ggrd_read_vtop_from_file(E,1);
Modified: mc/3D/CitcomS/trunk/lib/Ggrd_handling.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Ggrd_handling.c 2012-08-21 16:24:21 UTC (rev 20613)
+++ mc/3D/CitcomS/trunk/lib/Ggrd_handling.c 2012-08-21 16:30:28 UTC (rev 20614)
@@ -184,14 +184,6 @@
fprintf(stderr,"ggrd tracer init OK for all layers <= %i\n",E->trace.ggrd_layers);
}
-void ggrd_full_temp_init(struct All_variables *E)
-{
- ggrd_temp_init_general(E,1);
-}
-void ggrd_reg_temp_init(struct All_variables *E)
-{
- ggrd_temp_init_general(E,0);
-}
@@ -201,7 +193,7 @@
*/
-void ggrd_temp_init_general(struct All_variables *E,int is_global)
+void ggrd_temp_init_general(struct All_variables *E,int is_geographic)
{
MPI_Status mpi_stat;
@@ -212,8 +204,8 @@
int i,j,k,m,node,noxnoz,nox,noy,noz;
static ggrd_boolean shift_to_pos_lon = FALSE;
- if(is_global) /* decide on GMT flag */
- sprintf(gmt_string,GGRD_GMT_GLOBAL_STRING); /* global */
+ if(is_geographic) /* decide on GMT flag */
+ sprintf(gmt_string,GGRD_GMT_GEOGRAPHIC_STRING); /* geographic grid */
else
sprintf(gmt_string,"");
@@ -223,7 +215,8 @@
noxnoz = nox * noz;
if(E->parallel.me == 0)
- fprintf(stderr,"ggrd_temp_init_general: using GMT grd files for temperatures, gmtflag: %s\n",gmt_string);
+ fprintf(stderr,"ggrd_temp_init_general: using GMT grd files for temperatures, gmtflag: %s\n",
+ gmt_string);
/*
@@ -394,7 +387,7 @@
several layers)
*/
-void ggrd_read_mat_from_file(struct All_variables *E, int is_global)
+void ggrd_read_mat_from_file(struct All_variables *E, int is_geographic)
{
MPI_Status mpi_stat;
int mpi_rc,timedep,interpolate;
@@ -440,8 +433,8 @@
/* assign the general depth dependent material group */
construct_mat_group(E);
- if(is_global) /* decide on GMT flag */
- sprintf(gmt_string,GGRD_GMT_GLOBAL_STRING); /* global */
+ if(is_geographic) /* decide on GMT flag */
+ sprintf(gmt_string,GGRD_GMT_GEOGRAPHIC_STRING); /* geographic */
else
sprintf(gmt_string,"");
/*
@@ -468,11 +461,11 @@
if(E->control.ggrd.mat_control > 0){
fprintf(stderr,"ggrd_read_mat_from_file: initializing, assigning to all above %g km, input is %s, %s\n",
E->data.radius_km*E->viscosity.zbase_layer[E->control.ggrd.mat_control-1],
- (is_global)?("global"):("regional"),(E->control.ggrd_mat_is_3d)?("3D"):("single layer"));
+ (is_geographic)?("geographic"):("Cartesian"),(E->control.ggrd_mat_is_3d)?("3D"):("single layer"));
}else{
fprintf(stderr,"ggrd_read_mat_from_file: initializing, assigning to single layer at %g km, input is %s, %s\n",
E->data.radius_km*E->viscosity.zbase_layer[-E->control.ggrd.mat_control-1],
- (is_global)?("global"):("regional"),(E->control.ggrd_mat_is_3d)?("3D"):("single layer"));
+ (is_geographic)?("geographic"):("Cartesian"),(E->control.ggrd_mat_is_3d)?("3D"):("single layer"));
}
}
for(i=0;i < E->control.ggrd.time_hist.nvtimes;i++){
@@ -668,7 +661,7 @@
way to represent stationary, chemical heterogeneity
*/
-void ggrd_read_ray_from_file(struct All_variables *E, int is_global)
+void ggrd_read_ray_from_file(struct All_variables *E, int is_geographic)
{
MPI_Status mpi_stat;
int mpi_rc,timedep,interpolate;
@@ -706,8 +699,8 @@
/* init step */
if(E->parallel.me==0)
fprintf(stderr,"ggrd_read_ray_from_file: initializing from %s\n",E->control.ggrd.ray_file);
- if(is_global) /* decide on GMT flag */
- sprintf(gmt_string,GGRD_GMT_GLOBAL_STRING); /* global */
+ if(is_geographic) /* decide on GMT flag */
+ sprintf(gmt_string,GGRD_GMT_GEOGRAPHIC_STRING); /* geographic */
else
sprintf(gmt_string,"");
if(E->parallel.me > 0) /* wait for previous processor */
@@ -800,7 +793,7 @@
*/
-void ggrd_read_vtop_from_file(struct All_variables *E, int is_global)
+void ggrd_read_vtop_from_file(struct All_variables *E, int is_geographic)
{
MPI_Status mpi_stat;
int mpi_rc,interpolate,timedep,*max_code,code,assign,ontop;
@@ -931,10 +924,10 @@
*/
if(verbose)
fprintf(stderr,"ggrd_read_vtop_from_file: initializing ggrd velocities/tractions for %s setup\n",
- is_global?("global"):("regional"));
- if(is_global){ /* decide on GMT flag */
+ is_geographic?("geographic"):("Cartesian"));
+ if(is_geographic){ /* decide on GMT flag */
//sprintf(gmt_string,""); /* periodic */
- sprintf(gmt_string,GGRD_GMT_GLOBAL_STRING); /* global */
+ sprintf(gmt_string,GGRD_GMT_GEOGRAPHIC_STRING); /* geographic */
}else
sprintf(gmt_string,"");
@@ -1132,10 +1125,10 @@
rout[2] = E->SX[level][m][2][nodel];
/*
- for global grid, shift theta if too close to poles
+ for geographic grid, shift theta if too close to poles
*/
- if((is_global)&&(rout[1] > theta_max)){
+ if((is_geographic)&&(rout[1] > theta_max)){
if(!pole_warned){
fprintf(stderr,"ggrd_read_vtop_from_file: WARNING: shifting theta from %g (%g) to max theta %g (%g)\n",
rout[1],90-180/M_PI*rout[1],theta_max,90-180/M_PI*theta_max);
@@ -1143,7 +1136,7 @@
}
rout[1] = theta_max;
}
- if((is_global)&&(rout[1] < theta_min)){
+ if((is_geographic)&&(rout[1] < theta_min)){
if(!pole_warned){
fprintf(stderr,"ggrd_read_vtop_from_file: WARNING: shifting theta from %g (%g) to min theta %g (%g)\n",
rout[1],90-180/M_PI*rout[1],theta_min,90-180/M_PI*theta_min);
@@ -1244,10 +1237,10 @@
if(we_have_velocity_grids){
/*
- for global grid, shift theta if too close to poles
+ for geographic grid, shift theta if too close to poles
*/
- if((is_global)&&(rout[1] > theta_max)){
+ if((is_geographic)&&(rout[1] > theta_max)){
if(!pole_warned){
fprintf(stderr,"WARNING: shifting theta from %g (%g) to max theta %g (%g)\n",
rout[1],90-180/M_PI*rout[1],theta_max,90-180/M_PI*theta_max);
@@ -1255,7 +1248,7 @@
}
rout[1] = theta_max;
}
- if((is_global)&&(rout[1] < theta_min)){
+ if((is_geographic)&&(rout[1] < theta_min)){
if(!pole_warned){
fprintf(stderr,"WARNING: shifting theta from %g (%g) to min theta %g (%g)\n",
rout[1],90-180/M_PI*rout[1],theta_min,90-180/M_PI*theta_min);
@@ -1448,7 +1441,7 @@
}
-void ggrd_read_age_from_file(struct All_variables *E, int is_global)
+void ggrd_read_age_from_file(struct All_variables *E, int is_geographic)
{
myerror(E,"not implemented yet");
} /* end age control */
@@ -1539,7 +1532,7 @@
nr.grd, nt.grd, np.grd for the directors
*/
-void ggrd_read_anivisc_from_file(struct All_variables *E, int is_global)
+void ggrd_read_anivisc_from_file(struct All_variables *E, int is_geographic)
{
MPI_Status mpi_stat;
int mpi_rc;
@@ -1586,8 +1579,8 @@
}
}
}
- if(is_global) /* decide on GMT flag */
- sprintf(gmt_string,GGRD_GMT_GLOBAL_STRING); /* global */
+ if(is_geographic) /* decide on GMT flag */
+ sprintf(gmt_string,GGRD_GMT_GEOGRAPHIC_STRING); /* geographic */
else
sprintf(gmt_string,"");
/*
@@ -1611,12 +1604,12 @@
if(E->viscosity.anivisc_layer > 0){
fprintf(stderr,"ggrd_read_anivisc_from_file: initializing, assigning to all elements above %g km, input is %s\n",
E->data.radius_km*E->viscosity.zbase_layer[E->viscosity.anivisc_layer - 1],
- (is_global)?("global"):("regional"));
+ (is_geographic)?("geographic"):("Cartesian"));
}else{
fprintf(stderr,"ggrd_read_anivisc_from_file: initializing, assigning to all elements between %g and %g km, input is %s\n",
E->data.radius_km*((E->viscosity.anivisc_layer<-1)?(E->viscosity.zbase_layer[-E->viscosity.anivisc_layer - 2]):(0)),
E->data.radius_km*E->viscosity.zbase_layer[-E->viscosity.anivisc_layer - 1],
- (is_global)?("global"):("regional"));
+ (is_geographic)?("geographic"):("Cartesian"));
}
}
Modified: mc/3D/CitcomS/trunk/lib/Initial_temperature.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Initial_temperature.c 2012-08-21 16:24:21 UTC (rev 20613)
+++ mc/3D/CitcomS/trunk/lib/Initial_temperature.c 2012-08-21 16:30:28 UTC (rev 20614)
@@ -650,10 +650,7 @@
case 4:
/* read initial temperature from grd files */
#ifdef USE_GGRD
- if (E->sphere.caps == 1)
- ggrd_reg_temp_init(E);
- else
- ggrd_full_temp_init(E);
+ ggrd_temp_init_general(E,1);
#else
fprintf(stderr,"tic_method 4 only works for USE_GGRD compiled code\n");
parallel_process_termination();
Modified: mc/3D/CitcomS/trunk/lib/Output.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Output.c 2012-08-21 16:24:21 UTC (rev 20613)
+++ mc/3D/CitcomS/trunk/lib/Output.c 2012-08-21 16:30:28 UTC (rev 20614)
@@ -82,7 +82,7 @@
/*
vtk_io = 1: write files for post-processing into VTK
vtk_io = 2: write serial legacy VTK file
- vtk_io = 3: write paralle legacy VTK file
+ vtk_io = 3: write parallel legacy VTK file
*/
input_int("gzdir_vtkio",&(E->output.gzdir.vtk_io),"0",m);
Modified: mc/3D/CitcomS/trunk/lib/Output_vtk.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Output_vtk.c 2012-08-21 16:24:21 UTC (rev 20613)
+++ mc/3D/CitcomS/trunk/lib/Output_vtk.c 2012-08-21 16:30:28 UTC (rev 20614)
@@ -633,7 +633,7 @@
base64(charhead, 16, b64head);
// base64 data
- b64bodylength = 4*ceil((float) nn/3.0);
+ b64bodylength = 4*ceil((double) nn/3.0);
b64body = malloc(sizeof(unsigned char)*b64bodylength);
// writes base64 data to b64body
base64(in,nn,b64body);
@@ -671,7 +671,7 @@
/* special header for zip compressed and bas64 encoded data
header needs 4 int32 = 16 byte -> 24 byte due to base64 (4*16/3) */
- base64plusheadlength = 24 + 4*ceil((float) compressedarraylength/3.0);
+ base64plusheadlength = 24 + 4*ceil((double) compressedarraylength/3.0);
base64plusheadarray = malloc(sizeof(unsigned char)* base64plusheadlength);
/* fills base64plusheadarray with everything ready for simple writing */
@@ -681,6 +681,7 @@
fprintf(f,"\n");
free(chararray);
free(base64plusheadarray);
+ free(compressedarray);
}
/**********************************************************************/
Modified: mc/3D/CitcomS/trunk/lib/Regional_boundary_conditions.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Regional_boundary_conditions.c 2012-08-21 16:24:21 UTC (rev 20613)
+++ mc/3D/CitcomS/trunk/lib/Regional_boundary_conditions.c 2012-08-21 16:30:28 UTC (rev 20614)
@@ -36,7 +36,7 @@
/* ========================================== */
static void horizontal_bc(struct All_variables *,float *[],int,int,float,unsigned int,char,int,int);
-void assign_internal_bc(struct All_variables * ,int);
+void assign_internal_bc(struct All_variables *);
static void velocity_apply_periodic_bcs();
static void temperature_apply_periodic_bcs();
static void velocity_refl_vert_bc();
@@ -122,10 +122,10 @@
anything at present, if E->mesh.toplayerbc != 0
*/
- assign_internal_bc(E,0);
+ assign_internal_bc(E);
#ifdef USE_GGRD
if(E->control.ggrd.vtop_control)
- ggrd_read_vtop_from_file(E,0);
+ ggrd_read_vtop_from_file(E,1);
#endif
Modified: mc/3D/CitcomS/trunk/lib/Regional_read_input_from_files.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Regional_read_input_from_files.c 2012-08-21 16:24:21 UTC (rev 20613)
+++ mc/3D/CitcomS/trunk/lib/Regional_read_input_from_files.c 2012-08-21 16:30:28 UTC (rev 20614)
@@ -284,7 +284,7 @@
case 2: /* ages for lithosphere temperature assimilation */
#ifdef USE_GGRD
if(E->control.ggrd.age_control){
- ggrd_read_age_from_file(E, 0);
+ ggrd_read_age_from_file(E, 1);
}else{
#endif
for(i=1;i<=noy;i++)
@@ -315,7 +315,7 @@
case 3: /* read element materials */
#ifdef USE_GGRD
if(E->control.ggrd.mat_control != 0){
- ggrd_read_mat_from_file(E, 0);
+ ggrd_read_mat_from_file(E, 1);
}else{
#endif
@@ -376,7 +376,7 @@
case 4: /* material control */
#ifdef USE_GGRD
if(E->control.ggrd.ray_control)
- ggrd_read_ray_from_file(E, 0);
+ ggrd_read_ray_from_file(E, 1);
#else
myerror(E,"input_from_files: mode 4 only for GGRD");
#endif
Modified: mc/3D/CitcomS/trunk/lib/prototypes.h
===================================================================
--- mc/3D/CitcomS/trunk/lib/prototypes.h 2012-08-21 16:24:21 UTC (rev 20613)
+++ mc/3D/CitcomS/trunk/lib/prototypes.h 2012-08-21 16:30:28 UTC (rev 20614)
@@ -49,7 +49,7 @@
void temperatures_conform_bcs(struct All_variables *);
void temperatures_conform_bcs2(struct All_variables *);
void velocities_conform_bcs(struct All_variables *, double **);
-void assign_internal_bc(struct All_variables *, int);
+void assign_internal_bc(struct All_variables *);
/* Checkpoints.c */
void output_checkpoint(struct All_variables *);
void read_checkpoint(struct All_variables *);
More information about the CIG-COMMITS
mailing list