[cig-commits] r1398 - in trunk/aspect: include/aspect/mesh_refinement source/mesh_refinement
bangerth at dealii.org
bangerth at dealii.org
Thu Nov 29 13:59:14 PST 2012
Author: bangerth
Date: 2012-11-29 14:59:14 -0700 (Thu, 29 Nov 2012)
New Revision: 1398
Added:
trunk/aspect/include/aspect/mesh_refinement/temperature.h
trunk/aspect/include/aspect/mesh_refinement/velocity.h
trunk/aspect/source/mesh_refinement/temperature.cc
trunk/aspect/source/mesh_refinement/velocity.cc
Modified:
trunk/aspect/include/aspect/mesh_refinement/composition.h
trunk/aspect/source/mesh_refinement/composition.cc
Log:
More refinement indicators.
Modified: trunk/aspect/include/aspect/mesh_refinement/composition.h
===================================================================
--- trunk/aspect/include/aspect/mesh_refinement/composition.h 2012-11-29 20:55:56 UTC (rev 1397)
+++ trunk/aspect/include/aspect/mesh_refinement/composition.h 2012-11-29 21:59:14 UTC (rev 1398)
@@ -39,21 +39,21 @@
*/
template <int dim>
class Composition : public Interface<dim>,
- public SimulatorAccess<dim>
+ public SimulatorAccess<dim>
{
public:
- /**
- * Execute this mesh refinement criterion.
- *
- * @param[out] error_indicators A vector that for every active
- * cell of the current mesh
- * (which may be a partition of a distributed mesh) provides an error
- * indicator. This vector will already have the correct size when the
- * function is called.
- */
- virtual
- void
- execute (Vector<float> &error_indicators) const;
+ /**
+ * Execute this mesh refinement criterion.
+ *
+ * @param[out] error_indicators A vector that for every active
+ * cell of the current mesh
+ * (which may be a partition of a distributed mesh) provides an error
+ * indicator. This vector will already have the correct size when the
+ * function is called.
+ */
+ virtual
+ void
+ execute (Vector<float> &error_indicators) const;
};
}
}
Copied: trunk/aspect/include/aspect/mesh_refinement/temperature.h (from rev 1396, trunk/aspect/include/aspect/mesh_refinement/composition.h)
===================================================================
--- trunk/aspect/include/aspect/mesh_refinement/temperature.h (rev 0)
+++ trunk/aspect/include/aspect/mesh_refinement/temperature.h 2012-11-29 21:59:14 UTC (rev 1398)
@@ -0,0 +1,61 @@
+/*
+ Copyright (C) 2011, 2012 by the authors of the ASPECT code.
+
+ This file is part of ASPECT.
+
+ ASPECT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ ASPECT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ASPECT; see the file doc/COPYING. If not see
+ <http://www.gnu.org/licenses/>.
+*/
+/* $Id$ */
+
+
+#ifndef __aspect__mesh_refinement_temperature_h
+#define __aspect__mesh_refinement_temperature_h
+
+#include <aspect/mesh_refinement/interface.h>
+#include <aspect/simulator.h>
+
+namespace aspect
+{
+ namespace MeshRefinement
+ {
+
+ /**
+ * A class that implements a mesh refinement criterion based on
+ * the temperature field.
+ *
+ * @ingroup MeshRefinement
+ */
+ template <int dim>
+ class Temperature : public Interface<dim>,
+ public SimulatorAccess<dim>
+ {
+ public:
+ /**
+ * Execute this mesh refinement criterion.
+ *
+ * @param[out] error_indicators A vector that for every active
+ * cell of the current mesh
+ * (which may be a partition of a distributed mesh) provides an error
+ * indicator. This vector will already have the correct size when the
+ * function is called.
+ */
+ virtual
+ void
+ execute (Vector<float> &error_indicators) const;
+ };
+ }
+}
+
+#endif
Copied: trunk/aspect/include/aspect/mesh_refinement/velocity.h (from rev 1396, trunk/aspect/include/aspect/mesh_refinement/composition.h)
===================================================================
--- trunk/aspect/include/aspect/mesh_refinement/velocity.h (rev 0)
+++ trunk/aspect/include/aspect/mesh_refinement/velocity.h 2012-11-29 21:59:14 UTC (rev 1398)
@@ -0,0 +1,61 @@
+/*
+ Copyright (C) 2011, 2012 by the authors of the ASPECT code.
+
+ This file is part of ASPECT.
+
+ ASPECT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ ASPECT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ASPECT; see the file doc/COPYING. If not see
+ <http://www.gnu.org/licenses/>.
+*/
+/* $Id$ */
+
+
+#ifndef __aspect__mesh_refinement_velocity_h
+#define __aspect__mesh_refinement_velocity_h
+
+#include <aspect/mesh_refinement/interface.h>
+#include <aspect/simulator.h>
+
+namespace aspect
+{
+ namespace MeshRefinement
+ {
+
+ /**
+ * A class that implements a mesh refinement criterion based on
+ * the velocity field.
+ *
+ * @ingroup MeshRefinement
+ */
+ template <int dim>
+ class Velocity : public Interface<dim>,
+ public SimulatorAccess<dim>
+ {
+ public:
+ /**
+ * Execute this mesh refinement criterion.
+ *
+ * @param[out] error_indicators A vector that for every active
+ * cell of the current mesh
+ * (which may be a partition of a distributed mesh) provides an error
+ * indicator. This vector will already have the correct size when the
+ * function is called.
+ */
+ virtual
+ void
+ execute (Vector<float> &error_indicators) const;
+ };
+ }
+}
+
+#endif
Modified: trunk/aspect/source/mesh_refinement/composition.cc
===================================================================
--- trunk/aspect/source/mesh_refinement/composition.cc 2012-11-29 20:55:56 UTC (rev 1397)
+++ trunk/aspect/source/mesh_refinement/composition.cc 2012-11-29 21:59:14 UTC (rev 1398)
@@ -35,7 +35,7 @@
{
AssertThrow (this->n_compositional_fields() >= 1,
ExcMessage ("This refinement criterion can not be used when no "
- "compositional fields are active!"));
+ "compositional fields are active!"));
indicators = 0;
for (unsigned int c=0; c<this->n_compositional_fields(); ++c)
@@ -66,11 +66,11 @@
namespace MeshRefinement
{
ASPECT_REGISTER_MESH_REFINEMENT_CRITERION(Composition,
- "composition",
- "A mesh refinement criterion that computes "
- "refinement indicators from the compositional fields. "
- "If there is more than one compositional field, then "
- "it simply takes the sum of the indicators computed "
- "from each of the compositional field.")
+ "composition",
+ "A mesh refinement criterion that computes "
+ "refinement indicators from the compositional fields. "
+ "If there is more than one compositional field, then "
+ "it simply takes the sum of the indicators computed "
+ "from each of the compositional field.")
}
}
Copied: trunk/aspect/source/mesh_refinement/temperature.cc (from rev 1396, trunk/aspect/source/mesh_refinement/composition.cc)
===================================================================
--- trunk/aspect/source/mesh_refinement/temperature.cc (rev 0)
+++ trunk/aspect/source/mesh_refinement/temperature.cc 2012-11-29 21:59:14 UTC (rev 1398)
@@ -0,0 +1,67 @@
+/*
+ Copyright (C) 2011, 2012 by the authors of the ASPECT code.
+
+ This file is part of ASPECT.
+
+ ASPECT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ ASPECT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ASPECT; see the file doc/COPYING. If not see
+ <http://www.gnu.org/licenses/>.
+*/
+/* $Id$ */
+
+
+#include <aspect/mesh_refinement/temperature.h>
+
+#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/numerics/error_estimator.h>
+
+namespace aspect
+{
+ namespace MeshRefinement
+ {
+ template <int dim>
+ void
+ Temperature<dim>::execute(Vector<float> &indicators) const
+ {
+ AssertThrow (this->n_compositional_fields() >= 1,
+ ExcMessage ("This refinement criterion can not be used when no "
+ "compositional fields are active!"));
+ indicators = 0;
+
+ std::vector<bool> temperature_component (dim+2+this->n_compositional_fields(), false);
+ temperature_component[dim+2] = true;
+ KellyErrorEstimator<dim>::estimate (this->get_dof_handler(),
+//TODO: Replace the 2 by something reasonable, adjusted to the polynomial degree
+ QGauss<dim-1>(2),
+ typename FunctionMap<dim>::type(),
+ this->get_solution(),
+ indicators,
+ temperature_component,
+ 0,
+ 0,
+ this->get_triangulation().locally_owned_subdomain());
+ }
+ }
+}
+
+// explicit instantiations
+namespace aspect
+{
+ namespace MeshRefinement
+ {
+ ASPECT_REGISTER_MESH_REFINEMENT_CRITERION(Temperature,
+ "temperature",
+ "A mesh refinement criterion that computes "
+ "refinement indicators from the temperature field.")
+ }
+}
Copied: trunk/aspect/source/mesh_refinement/velocity.cc (from rev 1396, trunk/aspect/source/mesh_refinement/composition.cc)
===================================================================
--- trunk/aspect/source/mesh_refinement/velocity.cc (rev 0)
+++ trunk/aspect/source/mesh_refinement/velocity.cc 2012-11-29 21:59:14 UTC (rev 1398)
@@ -0,0 +1,68 @@
+/*
+ Copyright (C) 2011, 2012 by the authors of the ASPECT code.
+
+ This file is part of ASPECT.
+
+ ASPECT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ ASPECT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ASPECT; see the file doc/COPYING. If not see
+ <http://www.gnu.org/licenses/>.
+*/
+/* $Id$ */
+
+
+#include <aspect/mesh_refinement/velocity.h>
+
+#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/numerics/error_estimator.h>
+
+namespace aspect
+{
+ namespace MeshRefinement
+ {
+ template <int dim>
+ void
+ Velocity<dim>::execute(Vector<float> &indicators) const
+ {
+ AssertThrow (this->n_compositional_fields() >= 1,
+ ExcMessage ("This refinement criterion can not be used when no "
+ "compositional fields are active!"));
+ indicators = 0;
+
+ std::vector<bool> velocity_components (dim+2+this->n_compositional_fields(), false);
+ for (unsigned int d=0; d<dim; ++d)
+ velocity_components[d] = true;
+ KellyErrorEstimator<dim>::estimate (this->get_dof_handler(),
+//TODO: Replace the 2 by something reasonable, adjusted to the polynomial degree
+ QGauss<dim-1>(2),
+ typename FunctionMap<dim>::type(),
+ this->get_solution(),
+ indicators,
+ velocity_components,
+ 0,
+ 0,
+ this->get_triangulation().locally_owned_subdomain());
+ }
+ }
+}
+
+// explicit instantiations
+namespace aspect
+{
+ namespace MeshRefinement
+ {
+ ASPECT_REGISTER_MESH_REFINEMENT_CRITERION(Velocity,
+ "velocity",
+ "A mesh refinement criterion that computes "
+ "refinement indicators from the velocity field.")
+ }
+}
More information about the CIG-COMMITS
mailing list