[cig-commits] [commit] master: Add a testcase. (a8d8777)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed May 21 14:08:51 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/73a71ba37f203bfed63bb8b602fdbd30ab99b1af...58a3ca45d49c7d331fa02d1fce0b2a74705241eb
>---------------------------------------------------------------
commit a8d87774a13d8f3466a1615e455b26cda465bc58
Author: Wolfgang Bangerth <bangerth at math.tamu.edu>
Date: Wed May 21 15:50:13 2014 -0500
Add a testcase.
>---------------------------------------------------------------
a8d87774a13d8f3466a1615e455b26cda465bc58
tests/no-viscosity-in-adiabatic-conditions.cc | 80 ++++++++++++++++++++++
...rm => no-viscosity-in-adiabatic-conditions.prm} | 28 ++++----
.../screen-output | 26 +++----
3 files changed, 106 insertions(+), 28 deletions(-)
diff --git a/tests/no-viscosity-in-adiabatic-conditions.cc b/tests/no-viscosity-in-adiabatic-conditions.cc
new file mode 100644
index 0000000..fa6d5bb
--- /dev/null
+++ b/tests/no-viscosity-in-adiabatic-conditions.cc
@@ -0,0 +1,80 @@
+#include <aspect/material_model/simple.h>
+#include <aspect/simulator_access.h>
+
+namespace aspect
+{
+ namespace MaterialModel
+ {
+ using namespace dealii;
+
+ template <int dim>
+ class ReallySimple : public MaterialModel::Simple<dim>
+ {
+ public:
+ /**
+ * @name Physical parameters used in the basic equations
+ * @{
+ */
+ virtual double viscosity (const double temperature,
+ const double pressure,
+ const std::vector<double> &compositional_fields,
+ const SymmetricTensor<2,dim> &strain_rate,
+ const Point<dim> &position) const;
+
+ /**
+ * Return true if the viscosity() function returns something that
+ * may depend on the variable identifies by the argument.
+ */
+ virtual bool
+ viscosity_depends_on (const NonlinearDependence::Dependence dependence) const;
+ };
+
+ }
+}
+
+namespace aspect
+{
+ namespace MaterialModel
+ {
+
+ template <int dim>
+ double
+ ReallySimple<dim>::
+ viscosity (const double temperature,
+ const double,
+ const std::vector<double> &,
+ const SymmetricTensor<2,dim> &strain_rate,
+ const Point<dim> &) const
+ {
+ // the initial conditions for the viscosity are 1.0. If we find a zero,
+ // then we are getting here erroneously. at the time of writing this test,
+ // this happened when computing the adiabatic conditions, but we don't
+ // need the viscosity there, so why compute it?
+ Assert (temperature != 0, ExcMessage ("We can't evaluate the viscosity if the "
+ "temperature has not been initialized!"));
+
+ return 1;
+ }
+
+ template <int dim>
+ bool
+ ReallySimple<dim>::
+ viscosity_depends_on (const NonlinearDependence::Dependence dependence) const
+ {
+ return ((dependence & NonlinearDependence::strain_rate) != NonlinearDependence::none);
+ }
+ }
+}
+
+// explicit instantiations
+namespace aspect
+{
+ namespace MaterialModel
+ {
+ ASPECT_REGISTER_MATERIAL_MODEL(ReallySimple,
+ "really simple",
+ "A simple material model that is like the "
+ "'Simple' model, but aborts when the temperature has not been set.")
+ }
+}
+
diff --git a/tests/time-dependent-temperature-bc.prm b/tests/no-viscosity-in-adiabatic-conditions.prm
similarity index 79%
copy from tests/time-dependent-temperature-bc.prm
copy to tests/no-viscosity-in-adiabatic-conditions.prm
index 208261f..d374b7b 100644
--- a/tests/time-dependent-temperature-bc.prm
+++ b/tests/no-viscosity-in-adiabatic-conditions.prm
@@ -1,11 +1,10 @@
-# originally taken from diffusion.prm, but intended to test that we can deal
-# with time dependent temperature boundary conditions
-#
-# this is just a preliminary test. we used to crash because we forgot to set
-# the time before we evaluate the temperature boundary conditions for the
-# first time, and plugins providing such boundary conditions consequently
-# had no way to tell the time when evaluated when computing the initial
-# solution
+# we used to (accidentally) evaluate the viscosity of the material model
+# in the place where we compute the adiabatic conditions. but this
+# makes no sense, for two reasons: (i) we don't actually need it, (ii) we
+# have no sensible values for the temperature and compositional fields
+# where we call it. verify that this now works by initializing the
+# temperature field by 1, testing in the computation of the viscosity
+# that the temperature is not zero, and aborting if it happens to be
set Dimension = 2
@@ -30,11 +29,11 @@ set Nonlinear solver scheme = IMPES
subsection Boundary temperature model
- set Model name = time_dep_box
+ set Model name = box
- subsection Time_Dep_Box
- set Bottom temperature = 0
- set Top temperature = 1 # the model interprets this as T(t)=1*t
+ subsection Box
+ set Bottom temperature = 1
+ set Top temperature = 1
end
end
@@ -80,14 +79,14 @@ subsection Initial conditions
subsection Function
set Variable names = x,y
- set Function expression = 0.0
+ set Function expression = 1
end
end
subsection Material model
- set Model name = simple
+ set Model name = really simple
subsection Simple model
set Reference density = 1 # default: 3300
@@ -102,7 +101,6 @@ subsection Material model
set Viscosity = 1 # default: 5e24
end
-
end
diff --git a/tests/time-dependent-temperature-bc/screen-output b/tests/no-viscosity-in-adiabatic-conditions/screen-output
similarity index 55%
copy from tests/time-dependent-temperature-bc/screen-output
copy to tests/no-viscosity-in-adiabatic-conditions/screen-output
index 445bc6d..3975b90 100644
--- a/tests/time-dependent-temperature-bc/screen-output
+++ b/tests/no-viscosity-in-adiabatic-conditions/screen-output
@@ -5,7 +5,7 @@
-- . using Trilinos
-----------------------------------------------------------------------------
-Loading shared library <./libtime-dependent-temperature-bc.so>
+Loading shared library <./libno-viscosity-in-adiabatic-conditions.so>
Number of active cells: 16 (on 3 levels)
Number of degrees of freedom: 268 (162+25+81)
@@ -13,27 +13,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... 0 iterations.
+ Solving Stokes system... 2 iterations.
Postprocessing:
- Temperature min/avg/max: 0 K, 0 K, 0 K
+ Temperature min/avg/max: 1 K, 1 K, 1 K
Termination requested by criterion: end time
+---------------------------------------------+------------+------------+
-| Total wallclock time elapsed since start | 0.16s | |
+| Total wallclock time elapsed since start | 0.175s | |
| | | |
| Section | no. calls | wall time | % of total |
+---------------------------------+-----------+------------+------------+
-| Assemble Stokes system | 1 | 0.0229s | 14% |
-| Assemble temperature system | 1 | 0.0265s | 17% |
-| Build Stokes preconditioner | 1 | 0.0239s | 15% |
-| Build temperature preconditioner| 1 | 0.00085s | 0.53% |
-| Solve Stokes system | 1 | 0.00178s | 1.1% |
-| Solve temperature system | 1 | 0.000565s | 0.35% |
-| Initialization | 2 | 0.0411s | 26% |
-| Postprocessing | 1 | 0.00216s | 1.3% |
-| Setup dof systems | 1 | 0.0285s | 18% |
+| Assemble Stokes system | 1 | 0.0249s | 14% |
+| Assemble temperature system | 1 | 0.0299s | 17% |
+| Build Stokes preconditioner | 1 | 0.0263s | 15% |
+| Build temperature preconditioner| 1 | 0.00114s | 0.65% |
+| Solve Stokes system | 1 | 0.0029s | 1.7% |
+| Solve temperature system | 1 | 0.000615s | 0.35% |
+| Initialization | 2 | 0.043s | 25% |
+| Postprocessing | 1 | 0.0023s | 1.3% |
+| Setup dof systems | 1 | 0.0309s | 18% |
+---------------------------------+-----------+------------+------------+
More information about the CIG-COMMITS
mailing list