Skip to content
Snippets Groups Projects
Commit 52b7a5f0 authored by podlesny's avatar podlesny
Browse files

add uniformtimestepper

parent 2cfdb544
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,8 @@ add_custom_target(tectonic_dune_time-stepping SOURCES ...@@ -12,6 +12,8 @@ add_custom_target(tectonic_dune_time-stepping SOURCES
state.cc state.cc
step.hh step.hh
stepbase.hh stepbase.hh
uniformtimestepper.hh
uniformtimestepper.cc
updaters.hh updaters.hh
) )
...@@ -23,5 +25,6 @@ install(FILES ...@@ -23,5 +25,6 @@ install(FILES
state.hh state.hh
step.hh step.hh
stepbase.hh stepbase.hh
uniformtimestepper.hh
updaters.hh updaters.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dune/tectonic) DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dune/tectonic)
#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 &current,
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"
#ifndef SRC_TIME_STEPPING_UNIFORMTIMESTEPPER_HH
#define SRC_TIME_STEPPING_UNIFORMTIMESTEPPER_HH
#include "../spatial-solving/fixedpointiterator.hh"
#include "adaptivetimestepper.hh"
#include "stepbase.hh"
template <class Factory, class ContactNetwork, class Updaters, class ErrorNorms>
class UniformTimeStepper {
using UpdatersWithCount = UpdatersWithCount<Updaters>;
using StepBase = StepBase<Factory, ContactNetwork, Updaters, ErrorNorms>;
public:
UniformTimeStepper(const StepBase& stepBase,
ContactNetwork& contactNetwork,
Updaters &current,
double relativeTime,
double relativeTau);
bool reachedEnd();
IterationRegister advance();
double relativeTime_;
const double relativeTau_;
private:
const StepBase& stepBase_;
ContactNetwork& contactNetwork_;
Updaters &current_;
IterationRegister iterationRegister_;
};
#endif
#ifndef MY_DIM
#error MY_DIM unset
#endif
#include <future>
#include <thread>
#include "../explicitgrid.hh"
#include "../explicitvectors.hh"
#include <dune/solvers/norms/energynorm.hh>
#include <dune/solvers/solvers/loopsolver.hh>
#include "../spatial-solving/tnnmg/functional.hh"
#include "../spatial-solving/solverfactory.hh"
#include "../data-structures/network/contactnetwork.hh"
#include "../data-structures/friction/globalfriction.hh"
#include "rate/rateupdater.hh"
#include "state/stateupdater.hh"
#include "updaters.hh"
using MyContactNetwork = ContactNetwork<Grid, Vector>;
using BoundaryNodes = typename MyContactNetwork::BoundaryNodes;
using BoundaryFunctions = typename MyContactNetwork::BoundaryFunctions;
using MyStateUpdater = StateUpdater<ScalarVector, Vector>;
using MyRateUpdater = RateUpdater<Vector, Matrix, BoundaryFunctions, BoundaryNodes>;
using MyUpdaters = Updaters<MyRateUpdater, MyStateUpdater>;
using LinearSolver = Dune::Solvers::LoopSolver<Vector>;
using MyNBodyAssembler = typename MyContactNetwork::NBodyAssembler;
using ErrorNorms = typename MyContactNetwork::StateEnergyNorms;
using MyGlobalFriction = GlobalFriction<Matrix, Vector>;
using MyFunctional = Functional<Matrix&, Vector&, MyGlobalFriction&, Vector&, Vector&, double>;
using MySolverFactory = SolverFactory<MyFunctional, BitVector>;
template class UniformTimeStepper<MySolverFactory, MyContactNetwork, MyUpdaters, ErrorNorms>;
/*
template std::packaged_task<typename AdaptiveTimeStepper<MySolverFactory, MyContactNetwork, MyUpdaters, ErrorNorms>::UpdatersWithCount()>
AdaptiveTimeStepper<MySolverFactory, MyContactNetwork, MyUpdaters, ErrorNorms>::step<LinearSolver>(
const MyUpdaters&, const MyNBodyAssembler&, std::shared_ptr<LinearSolver>&, double, double); */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment