Forked from
agnumpde / dune-tectonic
156 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
uniformtimestepper.cc 1.85 KiB
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <dune/solvers/norms/energynorm.hh>
#include <dune/solvers/iterationsteps/multigridstep.hh>
#include <dune/solvers/iterationsteps/cgstep.hh>
#include <dune/solvers/solvers/loopsolver.hh>
#include "../spatial-solving/preconditioners/multilevelpatchpreconditioner.hh"
#include <dune/tectonic/utils/reductionfactors.hh>
#include "uniformtimestepper.hh"
#include "step.hh"
/*
* Implementation: AdaptiveTimeStepper
*/
template <class Factory, class ContactNetwork, class Updaters, class ErrorNorms>
UniformTimeStepper<Factory, ContactNetwork, Updaters, ErrorNorms>::UniformTimeStepper(
const StepBase& stepBase,
ContactNetwork& contactNetwork,
Updaters ¤t,
double relativeTime,
double relativeTau)
: relativeTime_(relativeTime),
relativeTau_(relativeTau),
stepBase_(stepBase),
contactNetwork_(contactNetwork),
current_(current) {}
template <class Factory, class ContactNetwork, class Updaters, class ErrorNorms>
bool UniformTimeStepper<Factory, ContactNetwork, Updaters, ErrorNorms>::reachedEnd() {
return relativeTime_ >= 1.0;
}
template <class Factory, class ContactNetwork, class Updaters, class ErrorNorms>
IterationRegister UniformTimeStepper<Factory, ContactNetwork, Updaters, ErrorNorms>::advance() {
//std::cout << "AdaptiveTimeStepper::advance()" << std::endl;
using Step = Step<Factory, ContactNetwork, Updaters, ErrorNorms>;
iterationRegister_.reset();
UpdatersWithCount N;
auto step = Step(stepBase_, current_, contactNetwork_.nBodyAssembler(), relativeTime_, relativeTau_, iterationRegister_);
step.run(Step::Mode::sameThread);
N = step.get();
current_ = N.updaters;
iterationRegister_.registerFinalCount(N.count);
relativeTime_ += relativeTau_;
return iterationRegister_;
}
#include "uniformtimestepper_tmpl.cc"