Praetorius, Simon committed Mar 20, 2016 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 #pragma once // std c++ headers #include // AMDiS includes #include "AdaptBase.hpp" namespace AMDiS { // forward declarations class AdaptInfo; class ProblemInterationInterface; class ProblemTimeInterface; /** \ingroup Adaption * \brief * AdaptInstationary implements the adaptive procdure for time dependent * problems (see ProblemInstat). It contains a pointer to a ProblemInstat * object. */ class AdaptInstationary : public AdaptBase { public: /// Creates a AdaptInstationary object with the given name for the time /// dependent problem problemInstat. AdaptInstationary(std::string name, ProblemIterationInterface& problemStat, AdaptInfo& info, ProblemTimeInterface& problemInstat, AdaptInfo& initialInfo); /// Sets \ref strategy to aStrategy void setStrategy(int aStrategy) { strategy = aStrategy; } /// Returns \ref strategy int getStrategy() const { return strategy; } /// Implementation of AdaptBase::adapt() virtual int adapt() override; protected: /** \brief * Implements one (maybe adaptive) timestep. Both the explicit and the * implicit time strategy are implemented. The semi-implicit strategy * is only a special case of the implicit strategy with a limited number of * iterations (exactly one). * The routine uses the parameter \ref strategy to select the strategy: * strategy 0: Explicit strategy, * strategy 1: Implicit strategy. */ virtual void oneTimestep(); /// Initialisation of this AdaptInstationary object void initialize(std::string aName); /// Implements the explit time strategy. Used by \ref oneTimestep(). virtual void explicitTimeStrategy(); /// Implements the implicit time strategy. Used by \ref oneTimestep(). virtual void implicitTimeStrategy(); /** \brief * This iteration strategy allows the timestep and the mesh to be adapted * after each timestep solution. There are no inner loops for mesh adaption and * no refused timesteps. */ void simpleAdaptiveTimeStrategy(); protected: /// Strategy for choosing one timestep int strategy; /// Parameter \f$\delta_1 \f$ used in time step reduction double timeDelta1; /// Parameter \f$\delta_2 \f$ used in time step enlargement double timeDelta2; /// If this parameter is 1 and the instationary problem is stable, hence the number /// of solver iterations to solve the problem is zero, the adaption loop will stop. int breakWhenStable; /// bool fixedTimestep; }; } // end namespace AMDiS