[cig-commits] [commit] master: Implement Wolfgang's comments (29b5431)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Tue May 20 11:26:41 PDT 2014


Repository : https://github.com/geodynamics/aspect

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/19fcaae1dae23206c4e6f1f4e9965965f0128967...6204d1b7337a0741858189f8e4ee9cf2f447ebd6

>---------------------------------------------------------------

commit 29b54316bf2ae99e779230c08b3e0418569d4e14
Author: anne-glerum <a.c.glerum at uu.nl>
Date:   Tue May 20 16:35:04 2014 +0200

    Implement Wolfgang's comments


>---------------------------------------------------------------

29b54316bf2ae99e779230c08b3e0418569d4e14
 .../postprocess/spherical_velocity_statistics.h    |  3 +-
 .../postprocess/spherical_velocity_statistics.cc   | 37 ++++++++++------------
 2 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/include/aspect/postprocess/spherical_velocity_statistics.h b/include/aspect/postprocess/spherical_velocity_statistics.h
index 30d4213..0959c0d 100644
--- a/include/aspect/postprocess/spherical_velocity_statistics.h
+++ b/include/aspect/postprocess/spherical_velocity_statistics.h
@@ -32,7 +32,8 @@ namespace aspect
   {
 
     /**
-     * A postprocessor that computes some statistics about the velocity of spherical/cylindrical models.
+     * A postprocessor that computes some statistics about the radial and tangential components
+     * of the velocity in spherical/cylindrical models.
      *
      * @ingroup Postprocessing
      */
diff --git a/source/postprocess/spherical_velocity_statistics.cc b/source/postprocess/spherical_velocity_statistics.cc
index 5797f37..bf7a08d 100644
--- a/source/postprocess/spherical_velocity_statistics.cc
+++ b/source/postprocess/spherical_velocity_statistics.cc
@@ -92,55 +92,50 @@ namespace aspect
       const double global_tan_velocity_square_integral
         = Utilities::MPI::sum (local_tan_velocity_square_integral, this->get_mpi_communicator());
 
-      // compute the final output by dividing by the volume over which we integrated
-      const double rad_vrms = std::sqrt(global_rad_velocity_square_integral) /
-                              std::sqrt(this->get_volume());
-      const double tan_vrms = std::sqrt(global_tan_velocity_square_integral) /
-                              std::sqrt(this->get_volume());
+      // compute the final output by dividing by the volume over which we integrated and taking the sqrt
+      const double rad_vrms = std::sqrt(global_rad_velocity_square_integral / this->get_volume());
+      const double tan_vrms = std::sqrt(global_tan_velocity_square_integral / this->get_volume());
       const double vrms = std::sqrt(rad_vrms*rad_vrms + tan_vrms*tan_vrms);
 
       if (this->convert_output_to_years() == true)
         {
-          statistics.add_value ("Radial RMS velocity (m/yr)",
-                                rad_vrms * year_in_seconds);
-          statistics.add_value ("Tangential RMS velocity (m/yr)",
-                                tan_vrms * year_in_seconds);
-          statistics.add_value ("Total RMS velocity (m/yr)",
-                                vrms * year_in_seconds);
-
-          // also make sure that the other columns filled by the this object
+          // make sure that the columns filled by the this object
           // all show up with sufficient accuracy and in scientific notation
-          {
             const char *columns[] = { "Radial RMS velocity (m/yr)",
                                       "Tangential RMS velocity (m/yr)",
                                       "Total RMS velocity (m/yr)"
                                     };
+          statistics.add_value (columns[0],
+                                rad_vrms * year_in_seconds);
+          statistics.add_value (columns[1],
+                                tan_vrms * year_in_seconds);
+          statistics.add_value (columns[2],
+                                vrms * year_in_seconds);
             for (unsigned int i=0; i<sizeof(columns)/sizeof(columns[0]); ++i)
               {
                 statistics.set_precision (columns[i], 8);
                 statistics.set_scientific (columns[i], true);
               }
-          }
+
         }
       else
         {
-          statistics.add_value ("Radial RMS velocity (m/s)", rad_vrms);
-          statistics.add_value ("Tangential RMS velocity (m/s)", tan_vrms);
-          statistics.add_value ("Total RMS velocity (m/s)", vrms);
 
-          // also make sure that the other columns filled by the this object
+          // make sure that the columns filled by the this object
           // all show up with sufficient accuracy and in scientific notation
-          {
             const char *columns[] = { "Radial RMS velocity (m/s)",
                                       "Tangential RMS velocity (m/s)",
                                       "Total RMS velocity (m/s)"
                                     };
+          statistics.add_value (columns[0], rad_vrms);
+          statistics.add_value (columns[1], tan_vrms);
+          statistics.add_value (columns[2], vrms);
             for (unsigned int i=0; i<sizeof(columns)/sizeof(columns[0]); ++i)
               {
                 statistics.set_precision (columns[i], 8);
                 statistics.set_scientific (columns[i], true);
               }
-          }
+          
         }
 
       std::ostringstream output;



More information about the CIG-COMMITS mailing list