AdaptInstationary.hpp 2.64 KB
Newer Older
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 <string>

// 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.
   */
22
23
  class AdaptInstationary
      : public AdaptBase
24
25
26
27
  {
  public:
    /// Creates a AdaptInstationary object with the given name for the time
    /// dependent problem problemInstat.
28
    AdaptInstationary(std::string const& name,
29
30
31
32
33
34
                      ProblemIterationInterface& problemStat,
                      AdaptInfo& info,
                      ProblemTimeInterface& problemInstat,
                      AdaptInfo& initialInfo);

    /// Sets \ref strategy to aStrategy
35
    void setStrategy(int strategy)
36
    {
37
      strategy_ = strategy;
38
39
40
    }

    /// Returns \ref strategy
Praetorius, Simon's avatar
Praetorius, Simon committed
41
    int strategy() const
42
    {
43
      return strategy_;
44
45
46
    }

    /// Implementation of AdaptBase::adapt()
47
    int adapt() override;
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
76
    int strategy_ = 0;
77
78

    /// Parameter \f$ \delta_1 \f$ used in time step reduction
79
    double timeDelta1_ = 0.7071;
80
81

    /// Parameter \f$ \delta_2 \f$ used in time step enlargement
82
    double timeDelta2_ = 1.4142;
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.
86
    bool breakWhenStable_ = false;
87

88
    /// min-timestep == max-timestep
89
    bool fixedTimestep_;
90
91
92
  };

} // end namespace AMDiS