[cig-commits] [commit] master: add gravity visualization (b126911)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Tue Jun 17 07:59:08 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/cbc3b2ab6317c0e8dd95a2f58111ede8beadf8d7...9398730971b5217314dc121bc16852d75951d0b4
>---------------------------------------------------------------
commit b126911035bc6fb0d1ed6334b26f7405d66c9f66
Author: Timo Heister <timo.heister at gmail.com>
Date: Tue Jun 17 10:40:55 2014 -0400
add gravity visualization
>---------------------------------------------------------------
b126911035bc6fb0d1ed6334b26f7405d66c9f66
doc/modules/changes.h | 4 +
.../visualization/{density.h => gravity.h} | 18 ++--
.../{nonadiabatic_temperature.cc => gravity.cc} | 27 +++--
tests/own_gravity.cc | 24 +++++
tests/{graphical_output.prm => own_gravity.prm} | 12 +--
.../screen-output | 28 ++---
tests/own_gravity/solution-00000.0000.gnuplot | 119 +++++++++++++++++++++
tests/{inclusion_2 => own_gravity}/statistics | 2 +-
8 files changed, 188 insertions(+), 46 deletions(-)
diff --git a/doc/modules/changes.h b/doc/modules/changes.h
index f25178e..bc0c090 100644
--- a/doc/modules/changes.h
+++ b/doc/modules/changes.h
@@ -7,6 +7,10 @@
*
* <ol>
*
+ * <li> New: Added a visualization processor to output the local gravity vector.
+ * <br>
+ * (Timo Heister, 2014/06/17)
+ *
* <li> Fixed: The direct solver now works with nonlinear schemes like
* iterated IMPES.
* <br>
diff --git a/include/aspect/postprocess/visualization/density.h b/include/aspect/postprocess/visualization/gravity.h
similarity index 75%
copy from include/aspect/postprocess/visualization/density.h
copy to include/aspect/postprocess/visualization/gravity.h
index bc1b692..e5dbd17 100644
--- a/include/aspect/postprocess/visualization/density.h
+++ b/include/aspect/postprocess/visualization/gravity.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2011, 2012 by the authors of the ASPECT code.
+ Copyright (C) 2011 - 2014 by the authors of the ASPECT code.
This file is part of ASPECT.
@@ -19,8 +19,8 @@
*/
-#ifndef __aspect__postprocess_visualization_density_h
-#define __aspect__postprocess_visualization_density_h
+#ifndef __aspect__postprocess_visualization_gravity_h
+#define __aspect__postprocess_visualization_gravity_h
#include <aspect/postprocess/visualization.h>
#include <aspect/simulator_access.h>
@@ -35,20 +35,16 @@ namespace aspect
namespace VisualizationPostprocessors
{
/**
- * A class derived from DataPostprocessor that takes an output vector
- * and computes a variable that represents the density at every point.
- *
- * The member functions are all implementations of those declared in the
- * base class. See there for their meaning.
+ * A class derived from DataPostprocessor that outputs the gravity.
*/
template <int dim>
- class Density
- : public DataPostprocessorScalar<dim>,
+ class Gravity
+ : public DataPostprocessorVector<dim>,
public SimulatorAccess<dim>,
public Interface<dim>
{
public:
- Density ();
+ Gravity ();
virtual
void
diff --git a/source/postprocess/visualization/nonadiabatic_temperature.cc b/source/postprocess/visualization/gravity.cc
similarity index 69%
copy from source/postprocess/visualization/nonadiabatic_temperature.cc
copy to source/postprocess/visualization/gravity.cc
index 181373d..b9b6093 100644
--- a/source/postprocess/visualization/nonadiabatic_temperature.cc
+++ b/source/postprocess/visualization/gravity.cc
@@ -19,7 +19,7 @@
*/
-#include <aspect/postprocess/visualization/nonadiabatic_temperature.h>
+#include <aspect/postprocess/visualization/gravity.h>
#include <aspect/simulator_access.h>
#include <deal.II/numerics/data_out.h>
@@ -32,18 +32,18 @@ namespace aspect
namespace VisualizationPostprocessors
{
template <int dim>
- NonadiabaticTemperature<dim>::
- NonadiabaticTemperature ()
+ Gravity<dim>::
+ Gravity ()
:
- DataPostprocessorScalar<dim> ("nonadiabatic_temperature",
- update_values | update_q_points)
+ DataPostprocessorVector<dim> ("gravity",
+ update_q_points)
{}
template <int dim>
void
- NonadiabaticTemperature<dim>::
+ Gravity<dim>::
compute_derived_quantities_vector (const std::vector<Vector<double> > &uh,
const std::vector<std::vector<Tensor<1,dim> > > &,
const std::vector<std::vector<Tensor<2,dim> > > &,
@@ -53,14 +53,14 @@ namespace aspect
{
const unsigned int n_quadrature_points = uh.size();
Assert (computed_quantities.size() == n_quadrature_points, ExcInternalError());
- Assert (computed_quantities[0].size() == 1, ExcInternalError());
+ Assert (computed_quantities[0].size() == dim, ExcInternalError());
Assert (uh[0].size() == this->introspection().n_components, ExcInternalError());
for (unsigned int q=0; q<n_quadrature_points; ++q)
{
- const double temperature = uh[q][this->introspection().component_indices.temperature];
-
- computed_quantities[q](0) = temperature - this->get_adiabatic_conditions().temperature(evaluation_points[q]);
+ Tensor<1,dim> g = this->get_gravity_model().gravity_vector (evaluation_points[q]);
+ for (unsigned int k=0; k<dim; ++k)
+ computed_quantities[q](k) = g[k];
}
}
}
@@ -75,10 +75,9 @@ namespace aspect
{
namespace VisualizationPostprocessors
{
- ASPECT_REGISTER_VISUALIZATION_POSTPROCESSOR(NonadiabaticTemperature,
- "nonadiabatic temperature",
- "A visualization output object that generates output "
- "for the non-adiabatic component of the pressure.")
+ ASPECT_REGISTER_VISUALIZATION_POSTPROCESSOR(Gravity,
+ "gravity",
+ "A visualization output object that outputs the gravity vector.")
}
}
}
diff --git a/tests/own_gravity.cc b/tests/own_gravity.cc
new file mode 100644
index 0000000..47359b4
--- /dev/null
+++ b/tests/own_gravity.cc
@@ -0,0 +1,24 @@
+#include <aspect/simulator_access.h>
+#include <aspect/global.h>
+#include <aspect/gravity_model/interface.h>
+
+using namespace dealii;
+
+
+template <int dim>
+class MyGravity :
+ public aspect::GravityModel::Interface<dim>
+{
+ public:
+ virtual Tensor<1,dim> gravity_vector (const Point<dim> &position) const
+ {
+ Tensor<1,dim> ret;
+ ret[0] = position[1];
+ ret[1] = 42.0;
+ return ret;
+ }
+};
+
+
+// explicit instantiation
+ASPECT_REGISTER_GRAVITY_MODEL(MyGravity, "my gravity", "no description")
diff --git a/tests/graphical_output.prm b/tests/own_gravity.prm
similarity index 89%
copy from tests/graphical_output.prm
copy to tests/own_gravity.prm
index 4ef539a..8d43545 100644
--- a/tests/graphical_output.prm
+++ b/tests/own_gravity.prm
@@ -1,4 +1,4 @@
-
+# implement own gravity model, also test gravity visualization
set Dimension = 2
@@ -52,7 +52,7 @@ subsection Geometry model
subsection Box
set X extent = 1
- set Y extent = 1
+ set Y extent = 2
set Z extent = 1
end
@@ -60,7 +60,7 @@ end
subsection Gravity model
- set Model name = vertical
+ set Model name = my gravity
end
@@ -72,7 +72,7 @@ end
subsection Material model
- set Model name = SolCxMaterial
+ set Model name = simpler
end
@@ -100,7 +100,7 @@ end
subsection Postprocess
- set List of postprocessors = SolCxPostprocessor, visualization
+ set List of postprocessors = visualization
subsection Depth average
set Time between graphical output = 0
@@ -113,7 +113,7 @@ subsection Postprocess
set Time between graphical output = 0 # default: 1e8
- set List of output variables = viscosity, nonadiabatic pressure
+ set List of output variables = gravity
end
end
diff --git a/tests/time-dependent-temperature-bc/screen-output b/tests/own_gravity/screen-output
similarity index 53%
copy from tests/time-dependent-temperature-bc/screen-output
copy to tests/own_gravity/screen-output
index 0ba1ed1..1dab6c5 100644
--- a/tests/time-dependent-temperature-bc/screen-output
+++ b/tests/own_gravity/screen-output
@@ -1,12 +1,12 @@
-----------------------------------------------------------------------------
-- This is ASPECT, the Advanced Solver for Problems in Earth's ConvecTion.
--- . version 1.1.pre
+-- . version 1.2.pre
-- . running in DEBUG mode
-- . running with 1 MPI process
-- . using Trilinos
-----------------------------------------------------------------------------
-Loading shared library <./libtime-dependent-temperature-bc.so>
+Loading shared library <./libown_gravity.so>
Number of active cells: 16 (on 3 levels)
Number of degrees of freedom: 268 (162+25+81)
@@ -14,27 +14,27 @@ Number of degrees of freedom: 268 (162+25+81)
*** Timestep 0: t=0 seconds
Solving temperature system... 0 iterations.
Rebuilding Stokes preconditioner...
- Solving Stokes system... 17 iterations.
+ Solving Stokes system... 11 iterations.
Postprocessing:
- Temperature min/avg/max: 0 K, 0 K, 0 K
+ Writing graphical output: output-own_gravity/solution-00000
Termination requested by criterion: end time
+---------------------------------------------+------------+------------+
-| Total wallclock time elapsed since start | 0.0651s | |
+| Total wallclock time elapsed since start | 0.0391s | |
| | | |
| Section | no. calls | wall time | % of total |
+---------------------------------+-----------+------------+------------+
-| Assemble Stokes system | 1 | 0.00508s | 7.8% |
-| Assemble temperature system | 1 | 0.00732s | 11% |
-| Build Stokes preconditioner | 1 | 0.01s | 15% |
-| Build temperature preconditioner| 1 | 0.000789s | 1.2% |
-| Solve Stokes system | 1 | 0.00444s | 6.8% |
-| Solve temperature system | 1 | 0.000371s | 0.57% |
-| Initialization | 2 | 0.0241s | 37% |
-| Postprocessing | 1 | 0.0007s | 1.1% |
-| Setup dof systems | 1 | 0.00701s | 11% |
+| Assemble Stokes system | 1 | 0.00282s | 7.2% |
+| Assemble temperature system | 1 | 0.0047s | 12% |
+| Build Stokes preconditioner | 1 | 0.00604s | 15% |
+| Build temperature preconditioner| 1 | 0.000534s | 1.4% |
+| Solve Stokes system | 1 | 0.00183s | 4.7% |
+| Solve temperature system | 1 | 0.000208s | 0.53% |
+| Initialization | 2 | 0.0147s | 37% |
+| Postprocessing | 1 | 0.00106s | 2.7% |
+| Setup dof systems | 1 | 0.00417s | 11% |
+---------------------------------+-----------+------------+------------+
diff --git a/tests/own_gravity/solution-00000.0000.gnuplot b/tests/own_gravity/solution-00000.0000.gnuplot
new file mode 100644
index 0000000..fd3efef
--- /dev/null
+++ b/tests/own_gravity/solution-00000.0000.gnuplot
@@ -0,0 +1,119 @@
+# This file was generated by the deal.II library.
+
+
+#
+# For a description of the GNUPLOT format see the GNUPLOT manual.
+#
+# <x> <y> <velocity> <velocity> <p> <T> <gravity> <gravity>
+0 0 0 0 -279223 1 0 42
+0.25 0 -9.44416e-24 0 -279088 1 0 42
+
+0 0.5 0 1.66179e-23 -210007 1 0.5 42
+0.25 0.5 -4.54725e-24 1.12404e-23 -209576 1.05 0.5 42
+
+
+0.25 0 -9.44416e-24 0 -279088 1 0 42
+0.5 0 -1.31186e-23 0 -278819 1 0 42
+
+0.25 0.5 -4.54725e-24 1.12404e-23 -209576 1.05 0.5 42
+0.5 0.5 -6.43623e-24 -1.24855e-27 -209114 1.07071 0.5 42
+
+
+0 0.5 0 1.66179e-23 -210007 1 0.5 42
+0.25 0.5 -4.54725e-24 1.12404e-23 -209576 1.05 0.5 42
+
+0 1 0 2.16593e-23 -141069 1 1 42
+0.25 1 -9.20536e-30 1.47713e-23 -140239 1.07071 1 42
+
+
+0.25 0.5 -4.54725e-24 1.12404e-23 -209576 1.05 0.5 42
+0.5 0.5 -6.43623e-24 -1.24855e-27 -209114 1.07071 0.5 42
+
+0.25 1 -9.20536e-30 1.47713e-23 -140239 1.07071 1 42
+0.5 1 -1.20213e-29 -1.53692e-27 -139409 1.1 1 42
+
+
+0.5 0 -1.31186e-23 0 -278819 1 0 42
+0.75 0 -9.44273e-24 0 -278550 1 0 42
+
+0.5 0.5 -6.43623e-24 -1.24855e-27 -209114 1.07071 0.5 42
+0.75 0.5 -4.5469e-24 -1.12411e-23 -208652 1.05 0.5 42
+
+
+0.75 0 -9.44273e-24 0 -278550 1 0 42
+1 0 0 0 -278414 0 0 42
+
+0.75 0.5 -4.5469e-24 -1.12411e-23 -208652 1.05 0.5 42
+1 0.5 0 -1.66139e-23 -208221 0 0.5 42
+
+
+0.5 0.5 -6.43623e-24 -1.24855e-27 -209114 1.07071 0.5 42
+0.75 0.5 -4.5469e-24 -1.12411e-23 -208652 1.05 0.5 42
+
+0.5 1 -1.20213e-29 -1.53692e-27 -139409 1.1 1 42
+0.75 1 -1.17835e-29 -1.4772e-23 -138580 1.07071 1 42
+
+
+0.75 0.5 -4.5469e-24 -1.12411e-23 -208652 1.05 0.5 42
+1 0.5 0 -1.66139e-23 -208221 0 0.5 42
+
+0.75 1 -1.17835e-29 -1.4772e-23 -138580 1.07071 1 42
+1 1 0 -2.16545e-23 -137750 0 1 42
+
+
+0 1 0 2.16593e-23 -141069 1 1 42
+0.25 1 -9.20536e-30 1.47713e-23 -140239 1.07071 1 42
+
+0 1.5 0 1.6618e-23 -72131.2 1 1.5 42
+0.25 1.5 4.54725e-24 1.12404e-23 -70902.6 1.05 1.5 42
+
+
+0.25 1 -9.20536e-30 1.47713e-23 -140239 1.07071 1 42
+0.5 1 -1.20213e-29 -1.53692e-27 -139409 1.1 1 42
+
+0.25 1.5 4.54725e-24 1.12404e-23 -70902.6 1.05 1.5 42
+0.5 1.5 6.43623e-24 -1.24855e-27 -69704.7 1.07071 1.5 42
+
+
+0 1.5 0 1.6618e-23 -72131.2 1 1.5 42
+0.25 1.5 4.54725e-24 1.12404e-23 -70902.6 1.05 1.5 42
+
+0 2 0 0 -2914.78 1 2 42
+0.25 2 9.44419e-24 0 -1390.69 1 2 42
+
+
+0.25 1.5 4.54725e-24 1.12404e-23 -70902.6 1.05 1.5 42
+0.5 1.5 6.43623e-24 -1.24855e-27 -69704.7 1.07071 1.5 42
+
+0.25 2 9.44419e-24 0 -1390.69 1 2 42
+0.5 2 1.31186e-23 0 -0.0286976 1 2 42
+
+
+0.5 1 -1.20213e-29 -1.53692e-27 -139409 1.1 1 42
+0.75 1 -1.17835e-29 -1.4772e-23 -138580 1.07071 1 42
+
+0.5 1.5 6.43623e-24 -1.24855e-27 -69704.7 1.07071 1.5 42
+0.75 1.5 4.54689e-24 -1.12411e-23 -68506.9 1.05 1.5 42
+
+
+0.75 1 -1.17835e-29 -1.4772e-23 -138580 1.07071 1 42
+1 1 0 -2.16545e-23 -137750 0 1 42
+
+0.75 1.5 4.54689e-24 -1.12411e-23 -68506.9 1.05 1.5 42
+1 1.5 0 -1.66139e-23 -67278.2 0 1.5 42
+
+
+0.5 1.5 6.43623e-24 -1.24855e-27 -69704.7 1.07071 1.5 42
+0.75 1.5 4.54689e-24 -1.12411e-23 -68506.9 1.05 1.5 42
+
+0.5 2 1.31186e-23 0 -0.0286976 1 2 42
+0.75 2 9.44275e-24 0 1390.67 1 2 42
+
+
+0.75 1.5 4.54689e-24 -1.12411e-23 -68506.9 1.05 1.5 42
+1 1.5 0 -1.66139e-23 -67278.2 0 1.5 42
+
+0.75 2 9.44275e-24 0 1390.67 1 2 42
+1 2 0 0 2914.88 0 2 42
+
+
diff --git a/tests/inclusion_2/statistics b/tests/own_gravity/statistics
similarity index 86%
copy from tests/inclusion_2/statistics
copy to tests/own_gravity/statistics
index 821c2d4..0f24845 100644
--- a/tests/inclusion_2/statistics
+++ b/tests/own_gravity/statistics
@@ -9,4 +9,4 @@
# 9: Schur complement iterations in Stokes preconditioner
# 10: Time step size (seconds)
# 11: Visualization file name
-0 0.0000e+00 16 187 81 0 16 17 51 1.7685e-01 output-inclusion_2/solution-00000
+0 0.0000e+00 16 187 81 0 11 12 11 5.7712e+21 output-own_gravity/solution-00000
More information about the CIG-COMMITS
mailing list