[cig-commits] [commit] master: Create a new statistics postprocessor that outputs basic statistics. (0a5cffe)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Fri May 23 05:56:45 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/4f52773fbf2cfbb51201a7d742b1c38faa940596...11c2ea4df18afb9cd1e6cdc9b772c124d6a191db
>---------------------------------------------------------------
commit 0a5cffe8597c5108c74578c9985bde57f5a135dc
Author: Rene Gassmoeller <R.Gassmoeller at mailbox.org>
Date: Thu May 22 16:30:11 2014 -0500
Create a new statistics postprocessor that outputs basic statistics.
>---------------------------------------------------------------
0a5cffe8597c5108c74578c9985bde57f5a135dc
.../{velocity_statistics.h => basic_statistics.h} | 8 +-
...{velocity_statistics.cc => basic_statistics.cc} | 110 ++-------------------
2 files changed, 12 insertions(+), 106 deletions(-)
diff --git a/include/aspect/postprocess/velocity_statistics.h b/include/aspect/postprocess/basic_statistics.h
similarity index 81%
copy from include/aspect/postprocess/velocity_statistics.h
copy to include/aspect/postprocess/basic_statistics.h
index 5a3247c..9e2ceb8 100644
--- a/include/aspect/postprocess/velocity_statistics.h
+++ b/include/aspect/postprocess/basic_statistics.h
@@ -19,8 +19,8 @@
*/
-#ifndef __aspect__postprocess_velocity_statistics_h
-#define __aspect__postprocess_velocity_statistics_h
+#ifndef __aspect__postprocess_basic_statistics_h
+#define __aspect__postprocess_basic_statistics_h
#include <aspect/postprocess/interface.h>
#include <aspect/simulator_access.h>
@@ -31,12 +31,12 @@ namespace aspect
{
/**
- * A postprocessor that computes some statistics about the velocity.
+ * A postprocessor that computes some simplified statistics.
*
* @ingroup Postprocessing
*/
template <int dim>
- class VelocityStatistics : public Interface<dim>, public ::aspect::SimulatorAccess<dim>
+ class BasicStatistics : public Interface<dim>, public ::aspect::SimulatorAccess<dim>
{
public:
/**
diff --git a/source/postprocess/velocity_statistics.cc b/source/postprocess/basic_statistics.cc
similarity index 53%
copy from source/postprocess/velocity_statistics.cc
copy to source/postprocess/basic_statistics.cc
index 86ddfd2..134f356 100644
--- a/source/postprocess/velocity_statistics.cc
+++ b/source/postprocess/basic_statistics.cc
@@ -19,7 +19,7 @@
*/
-#include <aspect/postprocess/velocity_statistics.h>
+#include <aspect/postprocess/basic_statistics.h>
#include <aspect/material_model/simple.h>
#include <aspect/simulator_access.h>
#include <aspect/global.h>
@@ -37,102 +37,8 @@ namespace aspect
{
template <int dim>
std::pair<std::string,std::string>
- VelocityStatistics<dim>::execute (TableHandler &statistics)
+ BasicStatistics<dim>::execute (TableHandler &statistics)
{
- const QGauss<dim> quadrature_formula (this->get_fe()
- .base_element(this->introspection().base_elements.velocities).degree+1);
- const unsigned int n_q_points = quadrature_formula.size();
-
- FEValues<dim> fe_values (this->get_mapping(),
- this->get_fe(),
- quadrature_formula,
- update_values |
- update_quadrature_points |
- update_JxW_values);
- std::vector<Tensor<1,dim> > velocity_values(n_q_points);
-
- double local_velocity_square_integral = 0;
- double local_max_velocity = 0;
-
- typename DoFHandler<dim>::active_cell_iterator
- cell = this->get_dof_handler().begin_active(),
- endc = this->get_dof_handler().end();
- for (; cell!=endc; ++cell)
- if (cell->is_locally_owned())
- {
- fe_values.reinit (cell);
- fe_values[this->introspection().extractors.velocities].get_function_values (this->get_solution(),
- velocity_values);
- for (unsigned int q = 0; q < n_q_points; ++q)
- {
- local_velocity_square_integral += ((velocity_values[q] * velocity_values[q]) *
- fe_values.JxW(q));
- local_max_velocity = std::max (std::sqrt(velocity_values[q]*velocity_values[q]),
- local_max_velocity);
- }
- }
-
- const double global_velocity_square_integral
- = Utilities::MPI::sum (local_velocity_square_integral, this->get_mpi_communicator());
- const double global_max_velocity
- = Utilities::MPI::max (local_max_velocity, this->get_mpi_communicator());
-
- const double vrms = std::sqrt(global_velocity_square_integral) /
- std::sqrt(this->get_volume());
-
- if (this->convert_output_to_years() == true)
- {
- statistics.add_value ("RMS velocity (m/year)",
- vrms * year_in_seconds);
- statistics.add_value ("Max. velocity (m/year)",
- global_max_velocity * year_in_seconds);
-
- // also make sure that the other columns filled by the this object
- // all show up with sufficient accuracy and in scientific notation
- {
- const char *columns[] = { "RMS velocity (m/year)",
- "Max. velocity (m/year)"
- };
- 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 ("RMS velocity (m/s)", vrms);
- statistics.add_value ("Max. velocity (m/s)", global_max_velocity);
-
- // also make sure that the other columns filled by the this object
- // all show up with sufficient accuracy and in scientific notation
- {
- const char *columns[] = { "RMS velocity (m/s)",
- "Max. velocity (m/s)"
- };
- 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;
- output.precision(3);
- if (this->convert_output_to_years() == true)
- output << vrms *year_in_seconds
- << " m/year, "
- << global_max_velocity *year_in_seconds
- << " m/year";
- else
- output << vrms
- << " m/s, "
- << global_max_velocity
- << " m/s";
-
-// TODO: This really doesn't belong here
if (this->get_time() == 0e0)
{
if (dynamic_cast<const MaterialModel::Simple<dim> *>(&this->get_material_model()) != 0)
@@ -194,8 +100,7 @@ namespace aspect
this->get_pcout()<< std::endl;
}
}
- return std::pair<std::string, std::string> ("RMS, max velocity:",
- output.str());
+ return std::make_pair (std::string(),std::string());
}
}
}
@@ -206,9 +111,10 @@ namespace aspect
{
namespace Postprocess
{
- ASPECT_REGISTER_POSTPROCESSOR(VelocityStatistics,
- "velocity statistics",
- "A postprocessor that computes some statistics about the "
- "velocity field.")
+ ASPECT_REGISTER_POSTPROCESSOR(BasicStatistics,
+ "basic statistics",
+ "A postprocessor that computes some simplified statistics "
+ "like the Rayleigh number and other quantities that only "
+ "make sense in certain model setups.")
}
}
More information about the CIG-COMMITS
mailing list