From c7f3e0f988e5fb1771c3e30ed876f64c70cb385c Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Fri, 5 Jul 2013 11:53:28 +0200
Subject: [PATCH] [Problem] Choose a spatially constant initial velocity

---
 src/one-body-sample.cc | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index 1126c4f3..bac45dc2 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -341,10 +341,18 @@ int main(int argc, char *argv[]) {
 
     VectorType u_initial(finestSize);
     u_initial = 0.0;
-    VectorType v_initial(finestSize);
-    v_initial = 0.0;
 
-    // From here on: calculate the initial acceleration
+    VectorType v_initial(finestSize);
+    {
+      // Prescribe a homogeneous velocity field in the x-direction
+      // This way, the initial condition for v and the Dirichlet
+      // condition match up at t=0
+      v_initial = 0.0;
+      double v_initial_const;
+      dirichletFunction.evaluate(0.0, v_initial_const);
+      for (size_t i = 0; i < v_initial.size(); ++i)
+        v_initial[i][0] = v_initial_const;
+    }
     VectorType a_initial(finestSize);
     a_initial = 0.0;
     {
-- 
GitLab