[cig-commits] r6683 - in mc/3D/CitcomS/branches/compressible: CitcomS/Components lib module

tan2 at geodynamics.org tan2 at geodynamics.org
Wed Apr 25 12:30:44 PDT 2007


Author: tan2
Date: 2007-04-25 12:30:44 -0700 (Wed, 25 Apr 2007)
New Revision: 6683

Modified:
   mc/3D/CitcomS/branches/compressible/CitcomS/Components/Tracer.py
   mc/3D/CitcomS/branches/compressible/lib/Composition_related.c
   mc/3D/CitcomS/branches/compressible/lib/Full_tracer_advection.c
   mc/3D/CitcomS/branches/compressible/lib/Tracer_setup.c
   mc/3D/CitcomS/branches/compressible/module/setProperties.c
Log:
Clean up the old way of tracers/composition restart.

Setting solver.ic.restart=on won't read the *.tracer.* and *.comp_el.* files 
anymore. 

Setting solver.tracer.ic_method=2 will read the old *.tracer.* files as before,
but the composition field will be calculated according to the tracers, not read
from the *.comp_el.* files. The parameter 
solver.tracer.reset_initial_composition becomes obsolete.


Modified: mc/3D/CitcomS/branches/compressible/CitcomS/Components/Tracer.py
===================================================================
--- mc/3D/CitcomS/branches/compressible/CitcomS/Components/Tracer.py	2007-04-25 19:03:00 UTC (rev 6682)
+++ mc/3D/CitcomS/branches/compressible/CitcomS/Components/Tracer.py	2007-04-25 19:30:44 UTC (rev 6683)
@@ -62,7 +62,7 @@
 
         # tracer_ic_method=0 (random generated array)
         # tracer_ic_method=1 (all proc read the same file)
-        # tracer_ic_method=2 (each proc reads its restart file)
+        # tracer_ic_method=2 (each proc reads its own file)
         tracer_ic_method = inv.int("tracer_ic_method", default=0)
 
         # (tracer_ic_method == 0)
@@ -94,6 +94,8 @@
         # ibuoy_type=1 (ratio method)
         buoy_type = inv.int("buoy_type", default=1)
         buoyancy_ratio = inv.float("buoyancy_ratio", default=1.0)
+
+        # This is not used anymore and is left here for backward compatibility
         reset_initial_composition = inv.bool("reset_initial_composition",
                                              default=False)
 

Modified: mc/3D/CitcomS/branches/compressible/lib/Composition_related.c
===================================================================
--- mc/3D/CitcomS/branches/compressible/lib/Composition_related.c	2007-04-25 19:03:00 UTC (rev 6682)
+++ mc/3D/CitcomS/branches/compressible/lib/Composition_related.c	2007-04-25 19:30:44 UTC (rev 6683)
@@ -62,9 +62,6 @@
             parallel_process_termination();
         }
 
-        input_int("reset_initial_composition",
-                  &(E->composition.ireset_initial_composition),"0",m);
-
     }
 
 
@@ -124,12 +121,6 @@
 
         fprintf(E->trace.fpt,"Buoyancy Ratio: %f\n", E->composition.buoyancy_ratio);
 
-        if (E->composition.ireset_initial_composition==0)
-            fprintf(E->trace.fpt,"Using old initial composition from tracer files\n");
-        else
-            fprintf(E->trace.fpt,"Resetting initial composition\n");
-
-
         /*
         if (E->composition.icompositional_rheology==0) {
             fprintf(E->trace.fpt,"Compositional Rheology - OFF\n");
@@ -356,22 +347,10 @@
 static void init_bulk_composition(struct All_variables *E)
 {
 
-    char output_file[200];
-    char input_s[1000];
-
     double return_bulk_value_d();
     double volume;
-    double rdum1;
-    double rdum2;
-    double rdum3;
-
     int ival=0;
-    int idum0, idum1;
 
-
-    FILE *fp;
-
-
     /* ival=0 returns integral not average */
 
     volume = return_bulk_value_d(E,E->composition.comp_node,ival);
@@ -379,25 +358,6 @@
     E->composition.bulk_composition = volume;
     E->composition.initial_bulk_composition = volume;
 
-
-    /* If retarting tracers, the initital bulk composition is read from file */
-    // XXX: remove
-    if (E->trace.ic_method == 2 &&
-        !E->composition.ireset_initial_composition) {
-
-        sprintf(output_file,"%s.comp_el.%d.%d",E->control.old_P_file,
-                E->parallel.me, E->monitor.solution_cycles);
-
-        fp=fopen(output_file,"r");
-        fgets(input_s,200,fp);
-        sscanf(input_s,"%d %d %lf %lf %lf",
-               &idum0,&idum1,&rdum1,&rdum2,&rdum3);
-
-        E->composition.initial_bulk_composition = rdum2;
-        fclose(fp);
-
-    }
-
     return;
 }
 

Modified: mc/3D/CitcomS/branches/compressible/lib/Full_tracer_advection.c
===================================================================
--- mc/3D/CitcomS/branches/compressible/lib/Full_tracer_advection.c	2007-04-25 19:03:00 UTC (rev 6682)
+++ mc/3D/CitcomS/branches/compressible/lib/Full_tracer_advection.c	2007-04-25 19:30:44 UTC (rev 6683)
@@ -1850,7 +1850,7 @@
         }
     if (E->trace.ic_method==2)
         {
-            fprintf(E->trace.fpt,"Restarting Tracers\n");
+            fprintf(E->trace.fpt,"Reading individual tracer files\n");
         }
 
     fprintf(E->trace.fpt,"Number of tracer flavors: %d\n", E->trace.nflavors);

Modified: mc/3D/CitcomS/branches/compressible/lib/Tracer_setup.c
===================================================================
--- mc/3D/CitcomS/branches/compressible/lib/Tracer_setup.c	2007-04-25 19:03:00 UTC (rev 6682)
+++ mc/3D/CitcomS/branches/compressible/lib/Tracer_setup.c	2007-04-25 19:30:44 UTC (rev 6683)
@@ -63,7 +63,7 @@
 static void generate_random_tracers(struct All_variables *E,
                                     int tracers_cap, int j);
 static void read_tracer_file(struct All_variables *E);
-static void restart_tracers(struct All_variables *E);
+static void read_old_tracer_file(struct All_variables *E);
 static void check_sum(struct All_variables *E);
 static int isum_tracers(struct All_variables *E);
 static void init_tracer_flavors(struct All_variables *E);
@@ -80,28 +80,22 @@
     input_int("tracer",&(E->control.tracer),"0",m);
     if(E->control.tracer) {
 
-        /* Initial condition, this option is ignored if E->control.restart is 1,
-         *  ie. restarted from a previous run */
         /* tracer_ic_method=0 (random generated array) */
         /* tracer_ic_method=1 (all proc read the same file) */
-        /* tracer_ic_method=2 (each proc reads its restart file) */
-        if(E->control.restart)
-            E->trace.ic_method = 2;
-        else {
-            input_int("tracer_ic_method",&(E->trace.ic_method),"0,0,nomax",m);
+        /* tracer_ic_method=2 (each proc reads its own file) */
+        input_int("tracer_ic_method",&(E->trace.ic_method),"0,0,nomax",m);
 
-            if (E->trace.ic_method==0)
-                input_int("tracers_per_element",&(E->trace.itperel),"10,0,nomax",m);
-            else if (E->trace.ic_method==1)
-                input_string("tracer_file",E->trace.tracer_file,"tracer.dat",m);
-            else if (E->trace.ic_method==2) {
-            }
-            else {
-                fprintf(stderr,"Sorry, tracer_ic_method only 0, 1 and 2 available\n");
-                fflush(stderr);
-                parallel_process_termination();
-            }
+        if (E->trace.ic_method==0)
+            input_int("tracers_per_element",&(E->trace.itperel),"10,0,nomax",m);
+        else if (E->trace.ic_method==1)
+            input_string("tracer_file",E->trace.tracer_file,"tracer.dat",m);
+        else if (E->trace.ic_method==2) {
         }
+        else {
+            fprintf(stderr,"Sorry, tracer_ic_method only 0, 1 and 2 available\n");
+            fflush(stderr);
+            parallel_process_termination();
+        }
 
 
         /* How many flavors of tracers */
@@ -596,7 +590,7 @@
     else if (E->trace.ic_method==1)
         read_tracer_file(E);
     else if (E->trace.ic_method==2)
-        restart_tracers(E);
+        read_old_tracer_file(E);
     else {
         fprintf(E->trace.fpt,"Not ready for other inputs yet\n");
         fflush(E->trace.fpt);
@@ -833,7 +827,7 @@
             /* XXX: if E->trace.number_of_extra_quantities is greater than 1 */
             /* this part has to be changed... */
             else {
-                fprintf(E->trace.fpt,"ERROR(restart tracers)-huh?\n");
+                fprintf(E->trace.fpt,"ERROR(read tracer file)-huh?\n");
                 fflush(E->trace.fpt);
                 exit(10);
             }
@@ -898,12 +892,12 @@
 }
 
 
-/************** RESTART TRACERS ******************************************/
+/************** READ OLD TRACER FILE *************************************/
 /*                                                                       */
-/* This function restarts tracers written from previous calculation      */
+/* This function read tracers written from previous calculation          */
 /* and the tracers are read as seperate files for each processor domain. */
 
-static void restart_tracers(struct All_variables *E)
+static void read_old_tracer_file(struct All_variables *E)
 {
 
     char output_file[200];
@@ -923,7 +917,7 @@
     FILE *fp1;
 
     if (E->trace.number_of_extra_quantities>99) {
-        fprintf(E->trace.fpt,"ERROR(restart_tracers)-increase size of extra[]\n");
+        fprintf(E->trace.fpt,"ERROR(read_old_tracer_file)-increase size of extra[]\n");
         fflush(E->trace.fpt);
         parallel_process_termination();
     }
@@ -931,12 +925,12 @@
     sprintf(output_file,"%s.tracer.%d.%d",E->control.old_P_file,E->parallel.me,E->monitor.solution_cycles_init);
 
     if ( (fp1=fopen(output_file,"r"))==NULL) {
-        fprintf(E->trace.fpt,"ERROR(restart tracers)-file not found %s\n",output_file);
+        fprintf(E->trace.fpt,"ERROR(read_old_tracer_file)-file not found %s\n",output_file);
         fflush(E->trace.fpt);
         exit(10);
     }
 
-    fprintf(stderr,"Restarting Tracers from %s\n",output_file);
+    fprintf(stderr,"Read old tracers from %s\n",output_file);
     fflush(stderr);
 
 
@@ -947,7 +941,7 @@
 
         /* some error control */
         if (E->trace.number_of_extra_quantities+3 != ncolumns) {
-            fprintf(E->trace.fpt,"ERROR(restart tracers)-wrong # of columns\n");
+            fprintf(E->trace.fpt,"ERROR(read_old_tracer_file)-wrong # of columns\n");
             fflush(E->trace.fpt);
             exit(10);
         }
@@ -968,7 +962,7 @@
             /* XXX: if E->trace.number_of_extra_quantities is greater than 1 */
             /* this part has to be changed... */
             else {
-                fprintf(E->trace.fpt,"ERROR(restart tracers)-huh?\n");
+                fprintf(E->trace.fpt,"ERROR(read_old_tracer_file)-huh?\n");
                 fflush(E->trace.fpt);
                 exit(10);
             }

Modified: mc/3D/CitcomS/branches/compressible/module/setProperties.c
===================================================================
--- mc/3D/CitcomS/branches/compressible/module/setProperties.c	2007-04-25 19:03:00 UTC (rev 6682)
+++ mc/3D/CitcomS/branches/compressible/module/setProperties.c	2007-04-25 19:30:44 UTC (rev 6683)
@@ -579,29 +579,24 @@
 
     getIntProperty(properties, "tracer", E->control.tracer, fp);
 
-    if(E->control.restart)
-        E->trace.ic_method = 2;
-    else {
+    getIntProperty(properties, "tracer_ic_method",
+                   E->trace.ic_method, fp);
 
-        getIntProperty(properties, "tracer_ic_method",
-                       E->trace.ic_method, fp);
-
-        if (E->trace.ic_method==0) {
-            getIntProperty(properties, "tracers_per_element",
-                           E->trace.itperel, fp);
-        }
-        else if (E->trace.ic_method==1) {
-            getStringProperty(properties, "tracer_file",
-                              E->trace.tracer_file, fp);
-        }
-        else if (E->trace.ic_method==2) {
-        }
-        else {
-            fprintf(stderr,"Sorry, tracer_ic_method only 0, 1 and 2 available\n");
-            fflush(stderr);
-            parallel_process_termination();
-        }
+    if (E->trace.ic_method==0) {
+        getIntProperty(properties, "tracers_per_element",
+                       E->trace.itperel, fp);
     }
+    else if (E->trace.ic_method==1) {
+        getStringProperty(properties, "tracer_file",
+                          E->trace.tracer_file, fp);
+    }
+    else if (E->trace.ic_method==2) {
+    }
+    else {
+        fprintf(stderr,"Sorry, tracer_ic_method only 0, 1 and 2 available\n");
+        fflush(stderr);
+        parallel_process_termination();
+    }
 
     getIntProperty(properties, "tracer_flavors", E->trace.nflavors, fp);
 
@@ -615,7 +610,6 @@
     if (E->composition.ichemical_buoyancy==1) {
         getIntProperty(properties, "buoy_type", E->composition.ibuoy_type, fp);
         getDoubleProperty(properties, "buoyancy_ratio", E->composition.buoyancy_ratio, fp);
-        getIntProperty(properties, "reset_initial_composition", E->composition.ireset_initial_composition, fp);
     }
 
 



More information about the cig-commits mailing list