From f34a10622ea1ea3aba5d1e2e5c866a1dd9a1a51a Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Thu, 6 Jun 2013 18:14:52 +0200 Subject: [PATCH] udd -> a, ud -> v --- src/one-body-sample.cc | 30 +++++++++--------- src/timestepping.cc | 70 +++++++++++++++++++++--------------------- src/timestepping.hh | 24 +++++++-------- 3 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index e3eb4ee5..edcc2bcb 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -89,23 +89,23 @@ Dune::shared_ptr<TimeSteppingScheme<VectorType, MatrixType, FunctionType, dims>> initTimeStepper(Config::scheme scheme, FunctionType const &dirichletFunction, Dune::BitSetVector<dims> const &ignoreNodes, MatrixType const &massMatrix, MatrixType const &stiffnessMatrix, - VectorType const &u_initial, VectorType const &ud_initial, - VectorType const &udd_initial) { + VectorType const &u_initial, VectorType const &v_initial, + VectorType const &a_initial) { switch (scheme) { case Config::ImplicitEuler: return Dune::make_shared< ImplicitEuler<VectorType, MatrixType, FunctionType, dims>>( - stiffnessMatrix, u_initial, ud_initial, ignoreNodes, + stiffnessMatrix, u_initial, v_initial, ignoreNodes, dirichletFunction); case Config::Newmark: return Dune::make_shared< Newmark<VectorType, MatrixType, FunctionType, dims>>( - stiffnessMatrix, massMatrix, u_initial, ud_initial, udd_initial, + stiffnessMatrix, massMatrix, u_initial, v_initial, a_initial, ignoreNodes, dirichletFunction); case Config::EulerPair: return Dune::make_shared< EulerPair<VectorType, MatrixType, FunctionType, dims>>( - stiffnessMatrix, massMatrix, u_initial, ud_initial, ignoreNodes, + stiffnessMatrix, massMatrix, u_initial, v_initial, ignoreNodes, dirichletFunction); default: assert(false); @@ -328,11 +328,11 @@ int main(int argc, char *argv[]) { // {{{ Initial conditions VectorType u_initial(finestSize); u_initial = 0.0; - VectorType ud_initial(finestSize); - ud_initial = 0.0; + VectorType v_initial(finestSize); + v_initial = 0.0; // FIXME: This only happens to be correct - VectorType udd_initial(finestSize); - udd_initial = 0.0; + VectorType a_initial(finestSize); + a_initial = 0.0; SingletonVectorType alpha_initial(finestSize); alpha_initial = @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) { auto timeSteppingScheme = initTimeStepper(parset.get<Config::scheme>("timeSteppingScheme"), dirichletFunction, ignoreNodes, massMatrix, - stiffnessMatrix, u_initial, ud_initial, udd_initial); + stiffnessMatrix, u_initial, v_initial, a_initial); auto stateUpdater = initStateUpdater<SingletonVectorType, VectorType>( parset.get<Config::state_model>("boundary.friction.state_model"), alpha_initial, frictionalNodes, frictionData); @@ -378,7 +378,7 @@ int main(int argc, char *argv[]) { _ell += gravityFunctional; }; - VectorType ud = ud_initial; + VectorType v = v_initial; SingletonVectorType alpha = alpha_initial; auto const state_fpi_max = parset.get<size_t>("solver.tnnmg.fixed_point_iterations"); @@ -437,7 +437,7 @@ int main(int argc, char *argv[]) { parset.get<double>("solver.minimal_correction_reduction"); for (size_t state_fpi = 1; state_fpi <= state_fpi_max; ++state_fpi) { - stateUpdater->solve(ud); + stateUpdater->solve(v); { SingletonVectorType computed_state; stateUpdater->extractState(computed_state); @@ -457,7 +457,7 @@ int main(int argc, char *argv[]) { solveVelocityProblem(problem_iterate, alpha); timeSteppingScheme->postProcess(problem_iterate); timeSteppingScheme->extractDisplacement(u); - timeSteppingScheme->extractVelocity(ud); + timeSteppingScheme->extractVelocity(v); iterationWriter << iterationCounter << " "; if (parset.get<bool>("printProgress")) { @@ -486,8 +486,8 @@ int main(int argc, char *argv[]) { if (frictionalNodes[i][0]) { stateWriter << alpha[i][0] << " "; displacementWriter << u[i][0] << " "; - velocityWriter << ud[i][0] << " "; - coefficientWriter << computeCOF(frictionData, ud[i].two_norm(), + velocityWriter << v[i][0] << " "; + coefficientWriter << computeCOF(frictionData, v[i].two_norm(), alpha[i]) << " "; } diff --git a/src/timestepping.cc b/src/timestepping.cc index 695bccdb..8d89ae76 100644 --- a/src/timestepping.cc +++ b/src/timestepping.cc @@ -9,18 +9,18 @@ template <class VectorType, class MatrixType, class FunctionType, int dim> ImplicitEuler<VectorType, MatrixType, FunctionType, dim>::ImplicitEuler( MatrixType const &_A, VectorType const &_u_initial, - VectorType const &_ud_initial, + VectorType const &_v_initial, Dune::BitSetVector<dim> const &_dirichletNodes, FunctionType const &_dirichletFunction) : A(_A), u(_u_initial), - ud(_ud_initial), + v(_v_initial), dirichletNodes(_dirichletNodes), dirichletFunction(_dirichletFunction) {} template <class VectorType, class MatrixType, class FunctionType, int dim> void ImplicitEuler<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() { - ud_old = ud; + v_old = v; u_old = u; } @@ -39,8 +39,8 @@ void ImplicitEuler<VectorType, MatrixType, FunctionType, dim>::setup( problem_AB = A; problem_AB *= tau; - // ud_old makes a good initial iterate; we could use anything, though - problem_iterate = ud_old; + // v_old makes a good initial iterate; we could use anything, though + problem_iterate = v_old; for (size_t i = 0; i < dirichletNodes.size(); ++i) switch (dirichletNodes[i].count()) { @@ -70,10 +70,10 @@ void ImplicitEuler<VectorType, MatrixType, FunctionType, dim>::postProcess( VectorType const &problem_iterate) { postProcessCalled = true; - ud = problem_iterate; + v = problem_iterate; u = u_old; - Arithmetic::addProduct(u, tau, ud); + Arithmetic::addProduct(u, tau, v); } template <class VectorType, class MatrixType, class FunctionType, int dim> @@ -91,7 +91,7 @@ void ImplicitEuler<VectorType, MatrixType, FunctionType, dim>::extractVelocity( if (!postProcessCalled) DUNE_THROW(Dune::Exception, "It seems you forgot to call postProcess!"); - velocity = ud; + velocity = v; } template <class VectorType, class MatrixType, class FunctionType, int dim> @@ -102,21 +102,21 @@ ImplicitEuler<VectorType, MatrixType, FunctionType, dim>::clone() { template <class VectorType, class MatrixType, class FunctionType, int dim> Newmark<VectorType, MatrixType, FunctionType, dim>::Newmark( MatrixType const &_A, MatrixType const &_B, VectorType const &_u_initial, - VectorType const &_ud_initial, VectorType const &_udd_initial, + VectorType const &_v_initial, VectorType const &_a_initial, Dune::BitSetVector<dim> const &_dirichletNodes, FunctionType const &_dirichletFunction) : A(_A), B(_B), u(_u_initial), - ud(_ud_initial), - udd(_udd_initial), + v(_v_initial), + a(_a_initial), dirichletNodes(_dirichletNodes), dirichletFunction(_dirichletFunction) {} template <class VectorType, class MatrixType, class FunctionType, int dim> void Newmark<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() { - udd_old = udd; - ud_old = ud; + a_old = a; + v_old = v; u_old = u; } @@ -129,10 +129,10 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup( tau = _tau; problem_rhs = ell; - Arithmetic::addProduct(problem_rhs, 2.0 / tau, B, ud_old); - Arithmetic::addProduct(problem_rhs, B, udd_old); + Arithmetic::addProduct(problem_rhs, 2.0 / tau, B, v_old); + Arithmetic::addProduct(problem_rhs, B, a_old); Arithmetic::addProduct(problem_rhs, -1.0, A, u_old); - Arithmetic::addProduct(problem_rhs, -tau / 2.0, A, ud_old); + Arithmetic::addProduct(problem_rhs, -tau / 2.0, A, v_old); // For fixed tau, we'd only really have to do this once Dune::MatrixIndexSet indices(A.N(), A.M()); @@ -143,8 +143,8 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup( Arithmetic::addProduct(problem_AB, tau / 2.0, A); Arithmetic::addProduct(problem_AB, 2.0 / tau, B); - // ud_old makes a good initial iterate; we could use anything, though - problem_iterate = ud_old; + // v_old makes a good initial iterate; we could use anything, though + problem_iterate = v_old; for (size_t i = 0; i < dirichletNodes.size(); ++i) switch (dirichletNodes[i].count()) { @@ -174,16 +174,16 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::postProcess( VectorType const &problem_iterate) { postProcessCalled = true; - ud = problem_iterate; + v = problem_iterate; u = u_old; - Arithmetic::addProduct(u, tau / 2.0, ud); - Arithmetic::addProduct(u, tau / 2.0, ud_old); + Arithmetic::addProduct(u, tau / 2.0, v); + Arithmetic::addProduct(u, tau / 2.0, v_old); - udd = 0; - Arithmetic::addProduct(udd, 2.0 / tau, ud); - Arithmetic::addProduct(udd, -2.0 / tau, ud_old); - Arithmetic::addProduct(udd, -1.0, udd_old); + a = 0; + Arithmetic::addProduct(a, 2.0 / tau, v); + Arithmetic::addProduct(a, -2.0 / tau, v_old); + Arithmetic::addProduct(a, -1.0, a_old); } template <class VectorType, class MatrixType, class FunctionType, int dim> @@ -201,7 +201,7 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::extractVelocity( if (!postProcessCalled) DUNE_THROW(Dune::Exception, "It seems you forgot to call postProcess!"); - velocity = ud; + velocity = v; } template <class VectorType, class MatrixType, class FunctionType, int dim> @@ -212,19 +212,19 @@ Newmark<VectorType, MatrixType, FunctionType, dim>::clone() { template <class VectorType, class MatrixType, class FunctionType, int dim> EulerPair<VectorType, MatrixType, FunctionType, dim>::EulerPair( MatrixType const &_A, MatrixType const &_B, VectorType const &_u_initial, - VectorType const &_ud_initial, + VectorType const &_v_initial, Dune::BitSetVector<dim> const &_dirichletNodes, FunctionType const &_dirichletFunction) : A(_A), B(_B), u(_u_initial), - ud(_ud_initial), + v(_v_initial), dirichletNodes(_dirichletNodes), dirichletFunction(_dirichletFunction) {} template <class VectorType, class MatrixType, class FunctionType, int dim> void EulerPair<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() { - ud_old = ud; + v_old = v; u_old = u; } @@ -237,7 +237,7 @@ void EulerPair<VectorType, MatrixType, FunctionType, dim>::setup( tau = _tau; problem_rhs = ell; - Arithmetic::addProduct(problem_rhs, 1.0 / tau, B, ud_old); + Arithmetic::addProduct(problem_rhs, 1.0 / tau, B, v_old); Arithmetic::addProduct(problem_rhs, -1.0, A, u_old); // For fixed tau, we'd only really have to do this once @@ -249,8 +249,8 @@ void EulerPair<VectorType, MatrixType, FunctionType, dim>::setup( Arithmetic::addProduct(problem_AB, tau, A); Arithmetic::addProduct(problem_AB, 1.0 / tau, B); - // ud_old makes a good initial iterate; we could use anything, though - problem_iterate = ud_old; + // v_old makes a good initial iterate; we could use anything, though + problem_iterate = v_old; for (size_t i = 0; i < dirichletNodes.size(); ++i) switch (dirichletNodes[i].count()) { @@ -280,10 +280,10 @@ void EulerPair<VectorType, MatrixType, FunctionType, dim>::postProcess( VectorType const &problem_iterate) { postProcessCalled = true; - ud = problem_iterate; + v = problem_iterate; u = u_old; - Arithmetic::addProduct(u, tau, ud); + Arithmetic::addProduct(u, tau, v); } template <class VectorType, class MatrixType, class FunctionType, int dim> @@ -301,7 +301,7 @@ void EulerPair<VectorType, MatrixType, FunctionType, dim>::extractVelocity( if (!postProcessCalled) DUNE_THROW(Dune::Exception, "It seems you forgot to call postProcess!"); - velocity = ud; + velocity = v; } template <class VectorType, class MatrixType, class FunctionType, int dim> diff --git a/src/timestepping.hh b/src/timestepping.hh index 6484dceb..55ed3450 100644 --- a/src/timestepping.hh +++ b/src/timestepping.hh @@ -24,7 +24,7 @@ class ImplicitEuler : public TimeSteppingScheme<VectorType, MatrixType, FunctionType, dim> { public: ImplicitEuler(MatrixType const &_A, VectorType const &_u_initial, - VectorType const &_ud_initial, + VectorType const &_v_initial, Dune::BitSetVector<dim> const &_dirichletNodes, FunctionType const &_dirichletFunction); @@ -41,12 +41,12 @@ class ImplicitEuler private: MatrixType const &A; VectorType u; - VectorType ud; + VectorType v; Dune::BitSetVector<dim> const &dirichletNodes; FunctionType const &dirichletFunction; VectorType u_old; - VectorType ud_old; + VectorType v_old; double tau; @@ -58,8 +58,8 @@ class Newmark : public TimeSteppingScheme<VectorType, MatrixType, FunctionType, dim> { public: Newmark(MatrixType const &_A, MatrixType const &_B, - VectorType const &_u_initial, VectorType const &_ud_initial, - VectorType const &_udd_initial, + VectorType const &_u_initial, VectorType const &_v_initial, + VectorType const &_a_initial, Dune::BitSetVector<dim> const &_dirichletNodes, FunctionType const &_dirichletFunction); @@ -77,14 +77,14 @@ class Newmark MatrixType const &A; MatrixType const &B; VectorType u; - VectorType ud; - VectorType udd; + VectorType v; + VectorType a; Dune::BitSetVector<dim> const &dirichletNodes; FunctionType const &dirichletFunction; VectorType u_old; - VectorType ud_old; - VectorType udd_old; + VectorType v_old; + VectorType a_old; double tau; @@ -96,7 +96,7 @@ class EulerPair : public TimeSteppingScheme<VectorType, MatrixType, FunctionType, dim> { public: EulerPair(MatrixType const &_A, MatrixType const &_B, - VectorType const &_u_initial, VectorType const &_ud_initial, + VectorType const &_u_initial, VectorType const &_v_initial, Dune::BitSetVector<dim> const &_dirichletNodes, FunctionType const &_dirichletFunction); @@ -114,12 +114,12 @@ class EulerPair MatrixType const &A; MatrixType const &B; VectorType u; - VectorType ud; + VectorType v; Dune::BitSetVector<dim> const &dirichletNodes; FunctionType const &dirichletFunction; VectorType u_old; - VectorType ud_old; + VectorType v_old; double tau; -- GitLab