diff --git a/dune/tectonic/myblockproblem.hh b/dune/tectonic/myblockproblem.hh index fa727174c3b4f9dacd0efc35ed19cdc55e1e927c..a55141c0d850ef808dc7d46fe862c01edaae5974 100644 --- a/dune/tectonic/myblockproblem.hh +++ b/dune/tectonic/myblockproblem.hh @@ -289,15 +289,22 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject { LocalVectorType &ui, int m, typename Dune::BitSetVector<block_size>::const_reference ignore) { { - int ignore_component = - block_size; // Special value that indicates nothing should be ignored + int ignore_component = block_size; + // Special value that indicates nothing should be ignored switch (ignore.count()) { case 0: // Full problem break; case 1: // 1 Dimension is fixed - assert( - ignore[1]); // Only the second component is allowed to stay fixed - ignore_component = 1; + // Only the X and Y components are allowed to be fixed in this manner + if (ignore[0]) { + ignore_component = 0; + break; + } + if (ignore[1]) { + ignore_component = 1; + break; + } + assert(false); break; case block_size: // Ignore the whole node return; diff --git a/src/timestepping.org b/src/timestepping.org index ced459176368a8505804787858487e02fed56a4d..074f2ad0e6e6d36138ace9eeceed37fccfc39f56 100644 --- a/src/timestepping.org +++ b/src/timestepping.org @@ -26,6 +26,30 @@ void virtual extractDisplacement(VectorType &) const; void virtual extractVelocity(VectorType &) const; #+end_src +#+name: dirichletCondition +#+begin_src c++ + for (size_t i=0; i < dirichletNodes.size(); ++i) + switch (dirichletNodes[i].count()) { + case 0: + continue; + case dim: + problem_iterate[i] = 0; + dirichletFunction.evaluate(time, problem_iterate[i][0]); + break; + case 1: + if (dirichletNodes[i][0]) { + dirichletFunction.evaluate(time, problem_iterate[i][0]); + break; + } + if (dirichletNodes[i][1]) { + problem_iterate[i][1] = 0; + break; + } + assert(false); + default: + assert(false); + } +#+end_src * Abstract TimeSteppingScheme #+name: TimeSteppingScheme.hh #+begin_src c++ @@ -119,12 +143,7 @@ // ud_old makes a good initial iterate; we could use anything, though problem_iterate = ud_old; - for (size_t i=0; i < dirichletNodes.size(); ++i) - if (dirichletNodes[i].count() == dim) { - problem_iterate[i] = 0; - dirichletFunction.evaluate(time, problem_iterate[i][0]); - } else if (dirichletNodes[i][1]) - problem_iterate[i][1] = 0; // Y direction prescribed + <<dirichletCondition>> } template <class VectorType, class MatrixType, class FunctionType, int dim> @@ -281,12 +300,7 @@ // ud_old makes a good initial iterate; we could use anything, though problem_iterate = ud_old; - for (size_t i=0; i < dirichletNodes.size(); ++i) - if (dirichletNodes[i].count() == dim) { - problem_iterate[i] = 0; - dirichletFunction.evaluate(time, problem_iterate[i][0]); - } else if (dirichletNodes[i][1]) - problem_iterate[i][1] = 0; // Y direction prescribed + <<dirichletCondition>> } template <class VectorType, class MatrixType, class FunctionType, int dim> @@ -454,12 +468,7 @@ // ud_old makes a good initial iterate; we could use anything, though problem_iterate = ud_old; - for (size_t i=0; i < dirichletNodes.size(); ++i) - if (dirichletNodes[i].count() == dim) { - problem_iterate[i] = 0; - dirichletFunction.evaluate(time, problem_iterate[i][0]); - } else if (dirichletNodes[i][1]) - problem_iterate[i][1] = 0; // Y direction prescribed + <<dirichletCondition>> } template <class VectorType, class MatrixType, class FunctionType, int dim>