diff --git a/src/enum_scheme.cc b/src/enum_scheme.cc index 615d89337b8b4fe0428a90314a72a6b70b88c4a6..ce65159cb1db92bf08c9a973d441083e4c3a0e65 100644 --- a/src/enum_scheme.cc +++ b/src/enum_scheme.cc @@ -2,9 +2,6 @@ template <> struct StringToEnum<Config::scheme> { static Config::scheme convert(std::string const &s) { - if (s == "implicitTwoStep") - return Config::ImplicitTwoStep; - if (s == "implicitEuler") return Config::ImplicitEuler; diff --git a/src/enums.hh b/src/enums.hh index b6ffb7338d9350ca758fb8f1adc5a5bf05f95417..79bde17dbb83b1193ae8f87ccc2520ce222438ed 100644 --- a/src/enums.hh +++ b/src/enums.hh @@ -7,7 +7,6 @@ struct Config { Ruina }; enum scheme { - ImplicitTwoStep, ImplicitEuler, Newmark, EulerPair diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 4525e6bb13e9c4eb8af2c72ce8d00b2e0593381b..2aa4b751e82c75a3ab40d292e4e5f3555140733b 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -93,11 +93,6 @@ initTimeStepper(Config::scheme scheme, FunctionType const &dirichletFunction, VectorType const &u_initial, VectorType const &ud_initial, VectorType const &udd_initial) { switch (scheme) { - case Config::ImplicitTwoStep: - return Dune::make_shared< - ImplicitTwoStep<VectorType, MatrixType, FunctionType, dims>>( - stiffnessMatrix, u_initial, ud_initial, ignoreNodes, - dirichletFunction); case Config::ImplicitEuler: return Dune::make_shared< ImplicitEuler<VectorType, MatrixType, FunctionType, dims>>( diff --git a/src/timestepping.cc b/src/timestepping.cc index 614ed7181f316a9e9df5f050b5f523d41b7cccc7..5e7ff6f11adaac04610209c6611e4dd827e2e2d6 100644 --- a/src/timestepping.cc +++ b/src/timestepping.cc @@ -100,134 +100,6 @@ ImplicitEuler<VectorType, MatrixType, FunctionType, dim>::clone() { return new ImplicitEuler<VectorType, MatrixType, FunctionType, dim>(*this); } template <class VectorType, class MatrixType, class FunctionType, int dim> -ImplicitTwoStep<VectorType, MatrixType, FunctionType, dim>::ImplicitTwoStep( - MatrixType const &_A, VectorType const &_u_initial, - VectorType const &_ud_initial, - Dune::BitSetVector<dim> const &_dirichletNodes, - FunctionType const &_dirichletFunction) - : A(_A), - u(_u_initial), - ud(_ud_initial), - dirichletNodes(_dirichletNodes), - dirichletFunction(_dirichletFunction) {} - -template <class VectorType, class MatrixType, class FunctionType, int dim> -void -ImplicitTwoStep<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() { - u_old_old = u_old; - ud_old = ud; - u_old = u; -} - -template <class VectorType, class MatrixType, class FunctionType, int dim> -void ImplicitTwoStep<VectorType, MatrixType, FunctionType, dim>::setup( - VectorType const &ell, double _tau, double time, VectorType &problem_rhs, - VectorType &problem_iterate, MatrixType &problem_A) { - postProcessCalled = false; - - tau = _tau; - - switch (state) { - // Perform an implicit Euler step since we lack information - case NO_SETUP: - state = FIRST_SETUP; - - problem_rhs = ell; - A.mmv(u_old, problem_rhs); - - problem_A = A; - problem_A *= tau; - break; - case FIRST_SETUP: - state = SECOND_SETUP; - // FALLTHROUGH - case SECOND_SETUP: - problem_rhs = ell; - A.usmv(-4.0 / 3.0, u_old, problem_rhs); - A.usmv(+1.0 / 3.0, u_old_old, problem_rhs); - - // For fixed tau, we'd only really have to do this once - problem_A = A; - problem_A *= 2.0 / 3.0 * tau; - break; - default: - assert(false); - } - - // 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) - 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); - } -} - -template <class VectorType, class MatrixType, class FunctionType, int dim> -void ImplicitTwoStep<VectorType, MatrixType, FunctionType, dim>::postProcess( - VectorType const &problem_iterate) { - postProcessCalled = true; - - ud = problem_iterate; - - switch (state) { - case FIRST_SETUP: - u = u_old; - Arithmetic::addProduct(u, tau, ud); - break; - case SECOND_SETUP: - u = 0.0; - Arithmetic::addProduct(u, tau, ud); - Arithmetic::addProduct(u, 2.0, u_old); - Arithmetic::addProduct(u, -.5, u_old_old); - u *= 2.0 / 3.0; - break; - default: - assert(false); - } -} - -template <class VectorType, class MatrixType, class FunctionType, int dim> -void ImplicitTwoStep<VectorType, MatrixType, FunctionType, - dim>::extractDisplacement(VectorType &displacement) const { - if (!postProcessCalled) - DUNE_THROW(Dune::Exception, "It seems you forgot to call postProcess!"); - - displacement = u; -} - -template <class VectorType, class MatrixType, class FunctionType, int dim> -void ImplicitTwoStep<VectorType, MatrixType, FunctionType, - dim>::extractVelocity(VectorType &velocity) const { - if (!postProcessCalled) - DUNE_THROW(Dune::Exception, "It seems you forgot to call postProcess!"); - - velocity = ud; -} - -template <class VectorType, class MatrixType, class FunctionType, int dim> -TimeSteppingScheme<VectorType, MatrixType, FunctionType, dim> * -ImplicitTwoStep<VectorType, MatrixType, FunctionType, dim>::clone() { - return new ImplicitTwoStep<VectorType, MatrixType, FunctionType, dim>(*this); -} -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, diff --git a/src/timestepping.hh b/src/timestepping.hh index f57d67ffa3776340994e22bc1b753f0fde2561e6..7678c27fcf74fab42c532fb48d5424914d520818 100644 --- a/src/timestepping.hh +++ b/src/timestepping.hh @@ -51,48 +51,6 @@ class ImplicitEuler bool postProcessCalled = false; }; template <class VectorType, class MatrixType, class FunctionType, int dim> -class ImplicitTwoStep - : public TimeSteppingScheme<VectorType, MatrixType, FunctionType, dim> { -public: - ImplicitTwoStep(MatrixType const &_A, VectorType const &_u_initial, - VectorType const &_ud_initial, - Dune::BitSetVector<dim> const &_dirichletNodes, - FunctionType const &_dirichletFunction); - - void virtual nextTimeStep(); - void virtual setup(VectorType const &, double, double, VectorType &, - VectorType &, MatrixType &); - void virtual postProcess(VectorType const &); - void virtual extractDisplacement(VectorType &) const; - void virtual extractVelocity(VectorType &) const; - - virtual TimeSteppingScheme<VectorType, MatrixType, FunctionType, dim> * - clone(); - -private: - MatrixType const &A; - VectorType u; - VectorType ud; - Dune::BitSetVector<dim> const &dirichletNodes; - FunctionType const &dirichletFunction; - - VectorType u_old; - VectorType u_old_old; - VectorType ud_old; - - double tau; - - bool postProcessCalled = false; - - // Handle a lack of information - enum state_type { - NO_SETUP, - FIRST_SETUP, - SECOND_SETUP - }; - state_type state = NO_SETUP; -}; -template <class VectorType, class MatrixType, class FunctionType, int dim> class Newmark : public TimeSteppingScheme<VectorType, MatrixType, FunctionType, dim> { public: diff --git a/src/timestepping_tmpl.cc b/src/timestepping_tmpl.cc index 5feceaf63115d428b6b0cb1e34a6f68a4ffab216..868daf5ea3759a10262c480c1b49fccbf65f47e0 100644 --- a/src/timestepping_tmpl.cc +++ b/src/timestepping_tmpl.cc @@ -15,6 +15,5 @@ typedef Dune::BlockVector<SmallVector> VectorType; typedef Dune::VirtualFunction<double, double> FunctionType; template class ImplicitEuler<VectorType, MatrixType, FunctionType, DIM>; -template class ImplicitTwoStep<VectorType, MatrixType, FunctionType, DIM>; template class Newmark<VectorType, MatrixType, FunctionType, DIM>; template class EulerPair<VectorType, MatrixType, FunctionType, DIM>;