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 #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. */  Praetorius, Simon committed Nov 19, 2017 22 23  class AdaptInstationary : public AdaptBase  Praetorius, Simon committed Mar 20, 2016 24 25 26 27  { public: /// Creates a AdaptInstationary object with the given name for the time /// dependent problem problemInstat.  Praetorius, Simon committed Oct 18, 2018 28  AdaptInstationary(std::string const& name,  Praetorius, Simon committed Mar 20, 2016 29 30 31 32 33 34  ProblemIterationInterface& problemStat, AdaptInfo& info, ProblemTimeInterface& problemInstat, AdaptInfo& initialInfo); /// Sets \ref strategy to aStrategy  Praetorius, Simon committed Oct 01, 2018 35  void setStrategy(int strategy)  Praetorius, Simon committed Mar 20, 2016 36  {  Praetorius, Simon committed Oct 01, 2018 37  strategy_ = strategy;  Praetorius, Simon committed Mar 20, 2016 38 39 40  } /// Returns \ref strategy  Praetorius, Simon committed Oct 23, 2018 41  int strategy() const  Praetorius, Simon committed Mar 20, 2016 42  {  Praetorius, Simon committed Oct 01, 2018 43  return strategy_;  Praetorius, Simon committed Mar 20, 2016 44 45 46  } /// Implementation of AdaptBase::adapt()  Praetorius, Simon committed Feb 28, 2019 47  int adapt() override;  Praetorius, Simon committed Mar 20, 2016 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  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(); /// 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  Praetorius, Simon committed Oct 01, 2018 76  int strategy_ = 0;  Praetorius, Simon committed Mar 20, 2016 77 78  /// Parameter \f$\delta_1 \f$ used in time step reduction  Praetorius, Simon committed Oct 01, 2018 79  double timeDelta1_ = 0.7071;  Praetorius, Simon committed Mar 20, 2016 80 81  /// Parameter \f$\delta_2 \f$ used in time step enlargement  Praetorius, Simon committed Oct 01, 2018 82  double timeDelta2_ = 1.4142;  Praetorius, Simon committed Mar 20, 2016 83 84 85  /// 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.  Praetorius, Simon committed Oct 01, 2018 86  bool breakWhenStable_ = false;  Praetorius, Simon committed Mar 20, 2016 87   Praetorius, Simon committed Nov 19, 2017 88  /// min-timestep == max-timestep  Praetorius, Simon committed Oct 01, 2018 89  bool fixedTimestep_;  Praetorius, Simon committed Mar 20, 2016 90 91 92  }; } // end namespace AMDiS