[cig-commits] [commit] master: Incorporated bugfix from minimum refinement function to standardize the way variables are read for different coordinate systems. (884d33c)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Mon Aug 4 14:17:10 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/ea45ef11705f505f2d2d63c77aa04f2d7be9a4c1...3811725812cafa918bbabc2515f52af7857aad31
>---------------------------------------------------------------
commit 884d33cf4eacef82ce5db6c70b67c8da5bca615e
Author: Jonathan Perry-Houts <jperryh2 at uoregon.edu>
Date: Mon Aug 4 12:04:16 2014 -0700
Incorporated bugfix from minimum refinement function to standardize the way variables are read for different coordinate systems.
>---------------------------------------------------------------
884d33cf4eacef82ce5db6c70b67c8da5bca615e
doc/modules/changes.h | 7 ++++
.../mesh_refinement/maximum_refinement_function.h | 10 ++---
.../mesh_refinement/maximum_refinement_function.cc | 49 +++++++++++++---------
tests/maximum_refinement_function.prm | 14 ++++++-
4 files changed, 54 insertions(+), 26 deletions(-)
diff --git a/doc/modules/changes.h b/doc/modules/changes.h
index 617fbdf..6ee1bb7 100644
--- a/doc/modules/changes.h
+++ b/doc/modules/changes.h
@@ -7,6 +7,13 @@
*
* <ol>
*
+ * <li> Changed: Updated maximum refinement function with the same
+ * bugfix as the minimum refinement function. It now always declares
+ * dim number of variables. When using the 'depth' coordinate system,
+ * only the first variable is used. The others are set to zero.
+ * <br>
+ * (Jonathan Perry-Houts, 2014/08/04)
+ *
* <li> Fixed: The viscosity mesh refinement criterion did not ask
* the material model for the viscosity, therefore it did not work
* with many material models. Some material models calculate the
diff --git a/include/aspect/mesh_refinement/maximum_refinement_function.h b/include/aspect/mesh_refinement/maximum_refinement_function.h
index c00bd90..97db692 100644
--- a/include/aspect/mesh_refinement/maximum_refinement_function.h
+++ b/include/aspect/mesh_refinement/maximum_refinement_function.h
@@ -80,12 +80,12 @@ namespace aspect
} coordinate_system;
/**
- * A function object representing the maximum refinement level. Which
- * of the two functions is actually evaluated is determined by the
- * 'Coordinate dependence' input parameter.
+ * A function object representing the maximum refinement level. The
+ * function always depends on 3 variables, although in the case of the
+ * 'depth' coordinate system only the first is used to evaluate the
+ * function.
*/
- Functions::ParsedFunction<1> max_refinement_level_depth;
- Functions::ParsedFunction<dim> max_refinement_level_position;
+ Functions::ParsedFunction<dim> max_refinement_level;
};
}
diff --git a/source/mesh_refinement/maximum_refinement_function.cc b/source/mesh_refinement/maximum_refinement_function.cc
index 42e096a..18a0aa4 100644
--- a/source/mesh_refinement/maximum_refinement_function.cc
+++ b/source/mesh_refinement/maximum_refinement_function.cc
@@ -52,8 +52,9 @@ namespace aspect
if (coordinate_system == depth)
{
const double depth = this->get_geometry_model().depth(vertex);
- const Point<1> point(depth);
- maximum_refinement_level = max_refinement_level_depth.value(point);
+ Point<dim> point;
+ point(0) = depth;
+ maximum_refinement_level = max_refinement_level.value(point);
}
else if (coordinate_system == spherical)
{
@@ -66,11 +67,11 @@ namespace aspect
for (unsigned int i = 0;i<dim;++i)
point[i] = spherical_coordinates[i];
- maximum_refinement_level = max_refinement_level_position.value(point);
+ maximum_refinement_level = max_refinement_level.value(point);
}
else if (coordinate_system == cartesian)
{
- maximum_refinement_level = max_refinement_level_position.value(vertex);
+ maximum_refinement_level = max_refinement_level.value(vertex);
}
if (cell->level() >= rint(maximum_refinement_level))
@@ -109,21 +110,17 @@ namespace aspect
*/
prm.declare_entry ("Coordinate system", "depth",
Patterns::Selection ("depth|cartesian|spherical"),
- "A selection, which determines the assumed coordinate "
+ "A selection that determines the assumed coordinate "
"system for the function variables. Allowed values "
"are 'depth', 'cartesian' and 'spherical'. 'depth' "
- "requires a function expression that only "
- "depends on one variable, which is interpreted to "
+ "will create a function, in which only the first "
+ "variable is non-zero, which is interpreted to "
"be the depth of the point. 'spherical' coordinates "
"are interpreted as r,phi or r,phi,theta in 2D/3D "
"respectively with theta being the polar angle.");
/**
* Let the function that describes the maximal level of refinement
- * as a function of position declare its parameters. This is actually
- * not the one that parses the parameters in case the user choose
- * 'depth' as coordinate dependence, but the parameters of the depth
- * function are a subset of the parameters of this one so everything
- * should work out ok.
+ * as a function of position declare its parameters.
* This defines the maximum refinement level each cell should have,
* and that can not be exceeded by coarsening.
*/
@@ -153,10 +150,7 @@ namespace aspect
try
{
- if (coordinate_system == depth)
- max_refinement_level_depth.parse_parameters (prm);
- else
- max_refinement_level_position.parse_parameters (prm);
+ max_refinement_level.parse_parameters (prm);
}
catch (...)
{
@@ -186,10 +180,25 @@ namespace aspect
"explicit formula with the depth or position "
"as argument. Which coordinate representation "
"is used is determined by an input parameter. "
- "Note that the order of spherical coordinates "
- "is r,phi,theta and not r,theta,phi, since this "
- "allows for dimension independent expressions. "
+ "Whatever the coordinate system chosen, the "
+ "function you provide in the input file will "
+ "by default depend on variables 'x', 'y' and "
+ "'z' (if in 3d). However, the meaning of these "
+ "symbols depends on the coordinate system. In "
+ "the Cartesian coordinate system, they simply "
+ "refer to their natural meaning. If you have "
+ "selected 'depth' for the coordinate system, "
+ "then 'x' refers to the depth variable and 'y' "
+ "and 'z' will simply always be zero. If you "
+ "have selected a spherical coordinate system, "
+ "then 'x' will refer to the radial distance of "
+ "the point to the origin, 'y' to the azimuth "
+ "angle and 'z' to the polar angle measured "
+ "positive from the north pole. Note that the "
+ "order of spherical coordinates is r,phi,theta "
+ "and not r,theta,phi, since this allows for "
+ "dimension independent expressions. "
"After evaluating the function, its values are "
- "rounded to the nearest integer. ")
+ "rounded to the nearest integer.")
}
}
diff --git a/tests/maximum_refinement_function.prm b/tests/maximum_refinement_function.prm
index 888b183..eaa099f 100644
--- a/tests/maximum_refinement_function.prm
+++ b/tests/maximum_refinement_function.prm
@@ -157,8 +157,20 @@ subsection Mesh refinement
set Time steps between mesh refinement = 1
subsection Maximum refinement function
set Function constants =
+
+ # This is in fact the default value
+ set Coordinate system = depth
+
+ # The following lines are equal to set the line:
+ # set Function expression = 4 + 2*sin(x*pi/250000)
+ # which implies:
+ # set Variable names = x,y
+ # because that is the default value for Variable names.
+ # To illustrate the possibility to rename function variables
+ # in your favourite naming scheme we use the following:
+ set Variable names = depth,not_used1
set Function expression = 6 + 2*sin(depth*2*pi/250000)
- set Variable names = depth
+
end
end
More information about the CIG-COMMITS
mailing list