Skip to content
Snippets Groups Projects
Commit 7ce6cd85 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Allow X-only Dirichlet conditions

parent 1b1c3d67
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment