[cig-commits] commit 2460 by heister to /var/svn/dealii/aspect
dealii.demon at gmail.com
dealii.demon at gmail.com
Thu Apr 10 05:25:54 PDT 2014
Revision 2460
now selectively use some parts of r2453
U trunk/aspect/include/aspect/simulator.h
U trunk/aspect/source/simulator/nullspace.cc
U trunk/aspect/source/simulator/parameters.cc
http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=2460&peg=2460
Diff:
Modified: trunk/aspect/include/aspect/simulator.h
===================================================================
--- trunk/aspect/include/aspect/simulator.h 2014-04-10 12:15:11 UTC (rev 2459)
+++ trunk/aspect/include/aspect/simulator.h 2014-04-10 12:25:52 UTC (rev 2460)
@@ -919,13 +919,19 @@
/**
- * interpolates the given function onto the velocity FE space and write it into the given vector.
+ * Interpolate the given function onto the velocity FE space and write it into the given vector.
+ *
+ * This function is implemented in
+ * <code>source/simulator/helper_functions.cc</code>.
*/
void interpolate_onto_velocity_system(const TensorFunction<1,dim> &func,
LinearAlgebra::Vector &vec);
/**
- * Sets up data structures for null space removal. Called after every mesh refinement.
+ * Set up data structures for null space removal. Called after every mesh refinement.
+ *
+ * This function is implemented in
+ * <code>source/simulator/nullspace.cc</code>.
*/
void setup_nullspace_removal();
@@ -935,6 +941,9 @@
*
* @param relevant_dst locally relevant vector for the whole FE, will be filled at the end.
* @param tmp_distributed_stokes only contains velocity and pressure.
+ *
+ * This function is implemented in
+ * <code>source/simulator/nullspace.cc</code>.
*/
void remove_nullspace(LinearAlgebra::BlockVector &relevant_dst,
LinearAlgebra::BlockVector &tmp_distributed_stokes);
Modified: trunk/aspect/source/simulator/nullspace.cc
===================================================================
--- trunk/aspect/source/simulator/nullspace.cc 2014-04-10 12:15:11 UTC (rev 2459)
+++ trunk/aspect/source/simulator/nullspace.cc 2014-04-10 12:25:52 UTC (rev 2460)
@@ -46,24 +46,54 @@
+ /**
+ * A class we use when setting up the data structures for nullspace removal
+ * of the rotations in spherical or annular shells.
+ */
template<int dim>
class Rotation : public TensorFunction<1,dim>
- {
- private:
- Tensor<1,dim> axis;
- public:
- Rotation(const unsigned int a) : axis(Tensor<1,dim>(Point<dim>::unit_vector(a))) {}
- virtual Tensor<1,dim> value (const Point<dim> &p) const { Tensor<1,dim> vel; if( dim == 2) cross_product(vel, p); else cross_product(vel, axis, p); return vel;}
- };
+ {
+ private:
+ Tensor<1,dim> axis;
+ public:
+ Rotation(const unsigned int a)
+ :
+ axis(Tensor<1,dim>(Point<dim>::unit_vector(a)))
+ {}
+
+ virtual Tensor<1,dim> value (const Point<dim> &p) const
+ {
+ Tensor<1,dim> vel;
+ if( dim == 2)
+ cross_product(vel, p);
+ else
+ cross_product(vel, axis, p);
+ return vel;
+ }
+ };
+
+
+ /**
+ * A class we use when setting up the data structures for nullspace removal
+ * of the translations in box-like geometries.
+ */
template <int dim>
class Translation : public TensorFunction<1,dim>
{
- private:
- const unsigned int direction;
- public:
- Translation(const unsigned int d) : direction(d) {}
- virtual Tensor<1,dim> value(const Point<dim> &) const { return Tensor<1,dim>(Point<dim>::unit_vector(direction)); }
+ private:
+ const unsigned int direction;
+
+ public:
+ Translation(const unsigned int d)
+ :
+ direction(d)
+ {}
+
+ virtual Tensor<1,dim> value(const Point<dim> &) const
+ {
+ return Point<dim>::unit_vector(direction);
+ }
};
}
@@ -95,13 +125,13 @@
{
net_rotations_translations.resize(funcs.size());
for (unsigned int i=0;i<funcs.size();++i)
- net_rotations_translations[i].reinit(
- introspection.index_sets.system_partitioning[introspection.block_indices.velocities],
- mpi_communicator);
-
- unsigned int idx = 0;
- for (unsigned int i=0;i<funcs.size();++i)
{
+ // for each of the null space dimensions, set up
+ // a vector, fill it with an element of the null space,
+ // and normalize it
+ net_rotations_translations[i].reinit(
+ introspection.index_sets.system_partitioning[introspection.block_indices.velocities],
+ mpi_communicator);
interpolate_onto_velocity_system(*funcs[i],
net_rotations_translations[i]);
net_rotations_translations[i] /= net_rotations_translations[i].l2_norm();
@@ -110,6 +140,8 @@
}
}
+
+
template <int dim>
void Simulator<dim>::remove_nullspace(LinearAlgebra::BlockVector &relevant_dst, LinearAlgebra::BlockVector &tmp_distributed_stokes)
{
@@ -118,7 +150,9 @@
{
for(unsigned int i=0; i<net_rotations_translations.size(); ++i)
{
- double power = net_rotations_translations[i]
+ // compute the magnitude of the solution vector in direction
+ // of this null space vector and subtract the corresponding multiple
+ const double power = net_rotations_translations[i]
* tmp_distributed_stokes.block(introspection.block_indices.velocities);
tmp_distributed_stokes.block(introspection.block_indices.velocities).sadd(1.0,
-1.0*power,
@@ -132,18 +166,22 @@
}
}
+
+
template <>
void
- Simulator<3>::remove_net_angular_momentum( LinearAlgebra::BlockVector &relevant_dst, LinearAlgebra::BlockVector &tmp_distributed_stokes )
+ Simulator<3>::remove_net_angular_momentum( LinearAlgebra::BlockVector &relevant_dst,
+ LinearAlgebra::BlockVector &tmp_distributed_stokes )
{
AssertThrow(false, ExcNotImplemented());
}
+
template <>
void
- Simulator<2>::remove_net_angular_momentum( LinearAlgebra::BlockVector &relevant_dst, LinearAlgebra::BlockVector &tmp_distributed_stokes )
+ Simulator<2>::remove_net_angular_momentum( LinearAlgebra::BlockVector &relevant_dst,
+ LinearAlgebra::BlockVector &tmp_distributed_stokes )
{
-
// compute and remove angular momentum from velocity field, by computing
// int rho V
More information about the CIG-COMMITS
mailing list