[cig-commits] r15777 - mc/3D/CitcomS/trunk/lib

becker at geodynamics.org becker at geodynamics.org
Tue Oct 6 11:48:28 PDT 2009


Author: becker
Date: 2009-10-06 11:48:28 -0700 (Tue, 06 Oct 2009)
New Revision: 15777

Modified:
   mc/3D/CitcomS/trunk/lib/Full_read_input_from_files.c
   mc/3D/CitcomS/trunk/lib/Ggrd_handling.c
   mc/3D/CitcomS/trunk/lib/Instructions.c
   mc/3D/CitcomS/trunk/lib/Regional_read_input_from_files.c
Log:
Modified handling of ggrd_mat_control, > 0 will select all layers above, 
< 0 will select individual layer == - ggrd_mat_control



Modified: mc/3D/CitcomS/trunk/lib/Full_read_input_from_files.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Full_read_input_from_files.c	2009-10-05 22:49:54 UTC (rev 15776)
+++ mc/3D/CitcomS/trunk/lib/Full_read_input_from_files.c	2009-10-06 18:48:28 UTC (rev 15777)
@@ -159,7 +159,7 @@
 
       case 3:  /* read element materials */
 #ifdef USE_GGRD
-	if(!E->control.ggrd.mat_control){
+	if(E->control.ggrd.mat_control == 0){
 #endif
 	sprintf(output_file1,"%s%0.0f.%d",E->control.mat_file,newage1,cap);
 	sprintf(output_file2,"%s%0.0f.%d",E->control.mat_file,newage2,cap);
@@ -311,7 +311,7 @@
 
       case 3:  /* read element materials and Ray */
 #ifdef USE_GGRD
-	if(E->control.ggrd.mat_control){ /* use netcdf grids */
+	if(E->control.ggrd.mat_control != 0){ /* use netcdf grids */
 	  ggrd_read_mat_from_file(E, 1);
 	}else{
 #endif

Modified: mc/3D/CitcomS/trunk/lib/Ggrd_handling.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Ggrd_handling.c	2009-10-05 22:49:54 UTC (rev 15776)
+++ mc/3D/CitcomS/trunk/lib/Ggrd_handling.c	2009-10-06 18:48:28 UTC (rev 15777)
@@ -328,9 +328,13 @@
 
 read in material, i.e. viscosity prefactor from ggrd file, this will get assigned if
 
-layer <=  E->control.ggrd.mat_control
+layer <=  E->control.ggrd.mat_control for  E->control.ggrd.mat_control > 0
 
+or 
 
+layer ==  -E->control.ggrd.mat_control for  E->control.ggrd.mat_control < 0
+
+
 */
 void ggrd_read_mat_from_file(struct All_variables *E, int is_global)
 {
@@ -369,8 +373,15 @@
     /* assign the general depth dependent material group */
     construct_mat_group(E);
     if(E->parallel.me==0)
-      fprintf(stderr,"ggrd_read_mat_from_file: initializing ggrd materials, assigning to all above %g km\n",
-	      E->data.radius_km*E->viscosity.zbase_layer[E->control.ggrd.mat_control-1]);
+      
+      if(E->control.ggrd.mat_control > 0)
+	fprintf(stderr,"ggrd_read_mat_from_file: initializing ggrd materials, assigning to all above %g km\n",
+		E->data.radius_km*E->viscosity.zbase_layer[E->control.ggrd.mat_control-1]);
+      else
+	fprintf(stderr,"ggrd_read_mat_from_file: initializing ggrd materials, assigning to single layer at %g km\n",
+		E->data.radius_km*E->viscosity.zbase_layer[-E->control.ggrd.mat_control-1]);
+
+	
     if(is_global)		/* decide on GMT flag */
       sprintf(gmt_string,GGRD_GMT_GLOBAL_STRING); /* global */
     else
@@ -424,7 +435,8 @@
     */
     for (m=1;m <= E->sphere.caps_per_proc;m++) {
       for (j=1;j <= elz;j++)  {	/* this assumes a regular grid sorted as in (1)!!! */
-	if(E->mat[m][j] <= E->control.ggrd.mat_control ){
+	if(((E->control.ggrd.mat_control > 0) && (E->mat[m][j] <=  E->control.ggrd.mat_control )) || 
+	   ((E->control.ggrd.mat_control < 0) && (E->mat[m][j] == -E->control.ggrd.mat_control ))){
 	  /*
 	     lithosphere or asthenosphere
 	  */

Modified: mc/3D/CitcomS/trunk/lib/Instructions.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Instructions.c	2009-10-05 22:49:54 UTC (rev 15776)
+++ mc/3D/CitcomS/trunk/lib/Instructions.c	2009-10-06 18:48:28 UTC (rev 15777)
@@ -487,6 +487,10 @@
 
      read in time-constant prefactors from weak.grd netcdf file that apply to top two E->mat layers
 
+     i.e.  ggrd_mat_control > 0 --> assign to layers with ilayer <=   ggrd_mat_control
+           ggrd_mat_control < 0 --> assign to layers with ilayer ==  -ggrd_mat_control
+
+
      (b)
 
      ggrd_mat_control=2
@@ -503,7 +507,10 @@
      0 15
      15 30
      30 60
+
+
      
+     
   */
   ggrd_init_master(&E->control.ggrd);
   /* this is controlling velocities, material, and age */
@@ -511,9 +518,10 @@
   input_string("ggrd_time_hist_file",
 	       E->control.ggrd.time_hist.file,"",m); 
   /* if > 0, will use top  E->control.ggrd.mat_control layers and assign a prefactor for the viscosity */
+  /* if < 0, will assign only to layer == -ggrd_mat_control */
   input_int("ggrd_mat_control",&(E->control.ggrd.mat_control),"0",m); 
   input_string("ggrd_mat_file",E->control.ggrd.mat_file,"",m); /* file to read prefactors from */
-  if(E->control.ggrd.mat_control) /* this will override mat_control setting */
+  if(E->control.ggrd.mat_control != 0) /* this will override mat_control setting */
     E->control.mat_control = 1;
   /* 
      

Modified: mc/3D/CitcomS/trunk/lib/Regional_read_input_from_files.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Regional_read_input_from_files.c	2009-10-05 22:49:54 UTC (rev 15776)
+++ mc/3D/CitcomS/trunk/lib/Regional_read_input_from_files.c	2009-10-06 18:48:28 UTC (rev 15777)
@@ -160,7 +160,7 @@
 
       case 3:  /* read element materials */
 #ifdef USE_GGRD
-	if(!E->control.ggrd.mat_control){
+	if(E->control.ggrd.mat_control == 0 ){
 #endif
         sprintf(output_file1,"%s%0.0f.0",E->control.mat_file,newage1);
         sprintf(output_file2,"%s%0.0f.0",E->control.mat_file,newage2);
@@ -316,7 +316,7 @@
 
       case 3:  /* read element materials */
 #ifdef USE_GGRD
-	if(E->control.ggrd.mat_control){
+	if(E->control.ggrd.mat_control != 0){
 	  ggrd_read_mat_from_file(E, 0);
 	}else{
 #endif



More information about the CIG-COMMITS mailing list