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

leif at geodynamics.org leif at geodynamics.org
Fri Feb 27 13:34:48 PST 2009


Author: leif
Date: 2009-02-27 13:34:47 -0800 (Fri, 27 Feb 2009)
New Revision: 14170

Modified:
   mc/3D/CitcomS/branches/cxx/CitcomS/BaseApplication.py
   mc/3D/CitcomS/branches/cxx/CitcomS/Components/Tracer.py
   mc/3D/CitcomS/branches/cxx/CitcomS/Controller.py
   mc/3D/CitcomS/branches/cxx/lib/Process_buoyancy.cc
   mc/3D/CitcomS/branches/cxx/lib/Tracer_setup.cc
   mc/3D/CitcomS/branches/cxx/lib/tracer_defs.h
   mc/3D/CitcomS/branches/cxx/module/initial_conditions.cc
   mc/3D/CitcomS/branches/cxx/module/setProperties.cc
Log:
Merged r14046:14108 from trunk.


Modified: mc/3D/CitcomS/branches/cxx/CitcomS/BaseApplication.py
===================================================================
--- mc/3D/CitcomS/branches/cxx/CitcomS/BaseApplication.py	2009-02-27 17:12:27 UTC (rev 14169)
+++ mc/3D/CitcomS/branches/cxx/CitcomS/BaseApplication.py	2009-02-27 21:34:47 UTC (rev 14170)
@@ -60,11 +60,7 @@
         '''
         self.initialize()
         self.reportConfiguration()
-
-        try:
-            self.launch()
-        except SystemExit:
-            pass
+        self.launch()
         return
 
 

Modified: mc/3D/CitcomS/branches/cxx/CitcomS/Components/Tracer.py
===================================================================
--- mc/3D/CitcomS/branches/cxx/CitcomS/Components/Tracer.py	2009-02-27 17:12:27 UTC (rev 14169)
+++ mc/3D/CitcomS/branches/cxx/CitcomS/Components/Tracer.py	2009-02-27 21:34:47 UTC (rev 14170)
@@ -92,9 +92,6 @@
         # Warning level
         itracer_warnings = inv.bool("itracer_warnings", default=True)
 
-        # Interpolate convection fields onto the location of tracers
-        itracer_interpolate_fields = inv.int("itracer_interpolate_fields",
-                                              default=0)
         # Enriched internal heat production
         tracer_enriched = inv.bool("tracer_enriched", default=False)
         Q0_enriched = inv.float("Q0_enriched", default=0.0)

Modified: mc/3D/CitcomS/branches/cxx/CitcomS/Controller.py
===================================================================
--- mc/3D/CitcomS/branches/cxx/CitcomS/Controller.py	2009-02-27 17:12:27 UTC (rev 14169)
+++ mc/3D/CitcomS/branches/cxx/CitcomS/Controller.py	2009-02-27 21:34:47 UTC (rev 14170)
@@ -73,10 +73,6 @@
         if not self.solver.inventory.ic.inventory.restart:
             self.checkpoint()
 
-        if self.solver.inventory.ic.inventory.post_p:
-            self.endSimulation()
-            raise SystemExit()
-
         ### XXX: if stokes: advection tracers and terminate
         return
 

Modified: mc/3D/CitcomS/branches/cxx/lib/Process_buoyancy.cc
===================================================================
--- mc/3D/CitcomS/branches/cxx/lib/Process_buoyancy.cc	2009-02-27 17:12:27 UTC (rev 14169)
+++ mc/3D/CitcomS/branches/cxx/lib/Process_buoyancy.cc	2009-02-27 21:34:47 UTC (rev 14170)
@@ -36,7 +36,6 @@
 
 #include "element_definitions.h"
 #include "global_defs.h"
-#include "output.h"
 #include <math.h>		/* for sqrt */
 
 #include "cproto.h"
@@ -44,173 +43,8 @@
 void parallel_process_termination(void);
 
 
-static void output_interpolated_fields(struct All_variables *E)
-{
-    void compute_horiz_avg(struct All_variables *E);
-    void full_get_shape_functions(struct All_variables *E,
-                                  double shp[9], int nelem,
-                                  double theta, double phi, double rad);
-    void regional_get_shape_functions(struct All_variables *E,
-                                      double shp[9], int nelem,
-                                      double theta, double phi, double rad);
-    double full_interpolate_data(struct All_variables *E,
-                                 double shp[9], double data[9]);
-    double regional_interpolate_data(struct All_variables *E,
-                                     double shp[9], double data[9]);
-    char output_file[256];
-    FILE *fp1;
-    const int m = 1;
-    int n, ncolumns, ncomp;
-    double *compositions;
-
-    snprintf(output_file, 255, "%s.intp_fields.%d",
-             E->control.data_file, E->parallel.me);
-    fp1 = output_open(output_file, "w");
-
-    ncomp = 0;
-    compositions = NULL;
-    if(E->composition.on) {
-        ncomp = E->composition.ncomp;
-        compositions = (double *)malloc(ncomp * sizeof(double));
-        if(compositions == NULL) {
-            fprintf(stderr, "output_interpolated_fields(): 2 not enough memory.\n");
-            exit(1);
-        }
-    }
-
-    switch(E->trace.itracer_interpolate_fields) {
-    case 1:
-    case 2:
-    case 3:
-        /* Format of the output --
-         * 1st line is the header:
-         *   [ntracers, model_type, ncolumns, ncompositions]
-         * the rest is data:
-         *   [flavor0, flavor1, radius, temperature, composition(s)]
-         */
-
-        if(E->parallel.me == 0) {
-            fprintf(E->fp, "Temperature contrast is %e Kelvin\n",
-                    E->data.ref_temperature);
-            fprintf(stderr, "Temperature contrast is %e Kelvin\n",
-                    E->data.ref_temperature);
-        }
-
-        ncolumns = 4;
-        if(E->composition.on) {
-            ncolumns += E->composition.ncomp;
-        }
-
-        /* get the horizontal average of temperature and composition */
-        compute_horiz_avg(E);
-
-        fprintf(fp1,"%d %d %d %d\n",
-                E->trace.ntracers[m], E->trace.itracer_interpolate_fields,
-                ncolumns, ncomp);
-
-
-        for(n=1; n<=E->trace.ntracers[m]; n++) {
-            int i, j, k;
-            int nelem, flavor0, flavor1;
-            int node[9], nz[9];
-            double shpfn[9], data[9];
-            double theta, phi, rad;
-            double temperature;
-
-            nelem = E->trace.ielement[m][n];
-            theta = E->trace.basicq[m][0][n];
-            phi = E->trace.basicq[m][1][n];
-            rad = E->trace.basicq[m][2][n];
-
-            flavor0 = (int)E->trace.extraq[m][0][n];
-            flavor1 = (int)E->trace.extraq[m][1][n];
-
-            /* get shape functions at the tracer location */
-            if(E->parallel.nprocxy == 12)
-                full_get_shape_functions(E, shpfn, nelem, theta, phi, rad);
-            else
-                regional_get_shape_functions(E, shpfn, nelem, theta, phi, rad);
-
-            /* fetch element data for interpolation */
-            for(i=1; i<=ENODES3D; i++) {
-                node[i] = E->ien[m][nelem].node[i];
-                nz[i] = (node[i] - 1) % E->lmesh.noz + 1;
-            }
-
-            for(i=1; i<=ENODES3D; i++) {
-                data[i] = E->T[m][node[i]] - E->Have.T[nz[i]];
-            }
-
-            if(E->parallel.nprocxy == 12)
-                temperature = full_interpolate_data(E, shpfn, data);
-            else
-                temperature = regional_interpolate_data(E, shpfn, data);
-
-            /** debug **
-            fprintf(E->trace.fpt, "result: %e   data: %e %e %e %e %e %e %e %e\n",
-                    temperature, data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);
-            /**/
-
-            for(j=0; j<E->composition.ncomp; j++) {
-                for(i=1; i<=ENODES3D; i++) {
-                    data[i] = E->composition.comp_node[m][j][node[i]]
-                        - E->Have.C[j][nz[i]];
-                }
-                if(E->parallel.nprocxy == 12)
-                    compositions[j] = full_interpolate_data(E, shpfn, data);
-                else
-                    compositions[j] = regional_interpolate_data(E, shpfn, data);
-
-                /** debug **
-                fprintf(E->trace.fpt, "result: %e   data: %e %e %e %e %e %e %e %e\n",
-                        compositions[j], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);
-                /**/
-            }
-
-            /* dimensionalize */
-            rad *= 1e3 * E->data.radius_km;
-            temperature *= E->data.ref_temperature;
-
-            /* output */
-            fprintf(fp1,"%d %d %e %e",
-                    flavor0, flavor1, rad, temperature);
-
-            for(j=0; j<E->composition.ncomp; j++) {
-                fprintf(fp1," %e", compositions[j]);
-            }
-            fprintf(fp1, "\n");
-        }
-
-        break;
-    case 100:
-        /* user modification here */
-        ncolumns = 2;
-        break;
-    default:
-        if(E->parallel.me == 0) {
-            fprintf(stderr, "Paramter `itracer_interpolate_fields' has unknown value: %d", E->trace.itracer_interpolate_fields);
-            fprintf(E->fp, "Paramter `itracer_interpolate_fields' has unknown value: %d", E->trace.itracer_interpolate_fields);
-        }
-        parallel_process_termination();
-
-    }
-
-    if(E->composition.on)
-        free(compositions);
-
-    fclose(fp1);
-    return;
-}
-
-
 void post_processing(struct All_variables *E)
 {
-    void dump_and_get_new_tracers_to_interpolate_fields(struct All_variables *E);
-
-    if (E->control.tracer && E->trace.itracer_interpolate_fields) {
-        dump_and_get_new_tracers_to_interpolate_fields(E);
-        output_interpolated_fields(E);
-    }
     return;
 }
 

Modified: mc/3D/CitcomS/branches/cxx/lib/Tracer_setup.cc
===================================================================
--- mc/3D/CitcomS/branches/cxx/lib/Tracer_setup.cc	2009-02-27 17:12:27 UTC (rev 14169)
+++ mc/3D/CitcomS/branches/cxx/lib/Tracer_setup.cc	2009-02-27 21:34:47 UTC (rev 14170)
@@ -83,7 +83,6 @@
 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);
-static void free_tracer_arrays(struct All_variables *E, int j);
 static void reduce_tracer_arrays(struct All_variables *E);
 static void put_away_later(struct All_variables *E, int j, int it);
 static void eject_tracer(struct All_variables *E, int j, int it);
@@ -186,10 +185,6 @@
         input_boolean("itracer_warnings",&(E->trace.itracer_warnings),"on",m);
 
 
-        /* Interpolate convection fields onto the location of tracers */
-        input_int("itracer_interpolate_fields",&(E->trace.itracer_interpolate_fields),"0",m);
-
-
         if(E->parallel.nprocxy == 12)
             full_tracer_input(E);
 
@@ -657,7 +652,7 @@
 
 
 
-static void get_new_tracers(struct All_variables *E)
+void initialize_tracers(struct All_variables *E)
 {
     if (E->trace.ic_method==0)
         make_tracer_array(E);
@@ -683,13 +678,7 @@
 
     find_tracers(E);
 
-    return;
-}
 
-void initialize_tracers(struct All_variables *E)
-{
-    get_new_tracers(E);
-
     /* count # of tracers of each flavor */
 
     if (E->trace.nflavors > 0)
@@ -699,23 +688,6 @@
 }
 
 
-void dump_and_get_new_tracers_to_interpolate_fields(struct All_variables *E)
-{
-    int j;
-
-    for (j=1;j<=E->sphere.caps_per_proc;j++)
-        free_tracer_arrays(E, j);
-
-    E->trace.number_of_extra_quantities = 2;
-    E->trace.number_of_tracer_quantities =
-        E->trace.number_of_basic_quantities +
-        E->trace.number_of_extra_quantities;
-
-    get_new_tracers(E);
-    return;
-}
-
-
 /************** MAKE TRACER ARRAY ********************************/
 /* Here, each processor will generate tracers somewhere          */
 /* in the sphere - check if its in this cap  - then check radial */
@@ -908,7 +880,7 @@
 
             len = read_double_vector(fptracer, ncol, buffer);
             if (len != ncol) {
-                fprintf(E->trace.fpt,"ERROR(read tracer file) - wrong input file format: %d-th tracer in %s\n", kk, E->trace.tracer_file);
+                fprintf(E->trace.fpt,"ERROR(read tracer file) - wrong input file format: %s\n", E->trace.tracer_file);
                 fflush(E->trace.fpt);
                 exit(10);
             }
@@ -1453,31 +1425,6 @@
 }
 
 
-/****** FREE TRACER ARRAYS *****************************************/
-static void free_tracer_arrays(struct All_variables *E, int j)
-{
-    int kk;
-
-    if (E->trace.nflavors > 0) {
-        for (kk=0;kk<E->trace.nflavors;kk++)
-            free(E->trace.ntracer_flavor[j][kk]);
-        free(E->trace.ntracer_flavor[j]);
-    }
-
-    for (kk=0;kk<E->trace.number_of_extra_quantities;kk++)
-        free(E->trace.extraq[j][kk]);
-
-    for (kk=0;kk<E->trace.number_of_basic_quantities;kk++)
-        free(E->trace.basicq[j][kk]);
-
-    free(E->trace.ielement[j]);
-
-    E->trace.max_ntracers[j] = E->trace.ntracers[j] = 0;
-
-    return;
-}
-
-
 /****** EXPAND TRACER ARRAYS *****************************************/
 
 void expand_tracer_arrays(struct All_variables *E, int j)

Modified: mc/3D/CitcomS/branches/cxx/lib/tracer_defs.h
===================================================================
--- mc/3D/CitcomS/branches/cxx/lib/tracer_defs.h	2009-02-27 17:12:27 UTC (rev 14169)
+++ mc/3D/CitcomS/branches/cxx/lib/tracer_defs.h	2009-02-27 21:34:47 UTC (rev 14170)
@@ -43,7 +43,6 @@
     int ic_method;
     int itperel;
     int itracer_interpolation_scheme;
-    int itracer_interpolate_fields;
 
     double box_cushion;
 

Modified: mc/3D/CitcomS/branches/cxx/module/initial_conditions.cc
===================================================================
--- mc/3D/CitcomS/branches/cxx/module/initial_conditions.cc	2009-02-27 17:12:27 UTC (rev 14169)
+++ mc/3D/CitcomS/branches/cxx/module/initial_conditions.cc	2009-02-27 21:34:47 UTC (rev 14170)
@@ -211,6 +211,8 @@
     E = (struct All_variables*)(PyCObject_AsVoidPtr(obj));
 
     post_processing(E);
+    (E->problem_output)(E, E->monitor.solution_cycles);
+    parallel_process_termination();
 
     Py_INCREF(Py_None);
     return Py_None;

Modified: mc/3D/CitcomS/branches/cxx/module/setProperties.cc
===================================================================
--- mc/3D/CitcomS/branches/cxx/module/setProperties.cc	2009-02-27 17:12:27 UTC (rev 14169)
+++ mc/3D/CitcomS/branches/cxx/module/setProperties.cc	2009-02-27 21:34:47 UTC (rev 14170)
@@ -677,7 +677,6 @@
     }
 
     getIntProperty(properties, "itracer_warnings", E->trace.itracer_warnings, fp);
-    getIntProperty(properties, "itracer_interpolate_fields", E->trace.itracer_interpolate_fields, fp);
 
     getIntProperty(properties, "chemical_buoyancy",
                    E->composition.ichemical_buoyancy, fp);



More information about the CIG-COMMITS mailing list