diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 1126c4f34b7c7fa508fd26b02290c32c943a28c5..bac45dc240d091734cd4befc169f097f910f5c51 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; {