Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperBackwardEulerModifierBase.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_StepperBackwardEulerModifierBase_hpp
10 #define Tempus_StepperBackwardEulerModifierBase_hpp
11 
12 #include "Tempus_config.hpp"
13 #include "Tempus_SolutionHistory.hpp"
15 
16 
17 namespace Tempus {
18 
19 /** \brief Base modifier for StepperBackwardEuler.
20  *
21  * This class provides a means to modify values (e.g., solution variables
22  * through SolutionHistory, and stepper member data through the Stepper),
23  * and can be very powerful and easy to make changes to the stepper and
24  * the solution.
25  *
26  * Users deriving from this class can access a lot of data, and it is
27  * expected that those users know what changes are allowable without
28  * affecting the Stepper correctness, performance, accuracy and stability.
29  * Thus the user should be careful when accessing data through classes
30  * derived from the default modifier (i.e., USER BEWARE!!).
31  *
32  * Below is the BackwardEuler algorithm with the locations of the modify calls
33  * italicized.
34  *
35  * \f{algorithm}{
36  * \renewcommand{\thealgorithm}{}
37  * \caption{Backward Euler with modify calls indicated.}
38  * \begin{algorithmic}[1]
39  * \State \quad {\it modifier.modify(solutionHistory, stepper, BEGIN\_STEP)}
40  * \State Compute the predictor (e.g., apply stepper to $x_n$).
41  * \State \quad {\it modifier.modify(solutionHistory, stepper, BEFORE\_SOLVE)}
42  * \State Solve $\mathcal{F}_n(\dot{x}=(x_n-x_{n-1})/\Delta t_n, x_n, t_n)=0$ for $x_n$
43  * \State \quad {\it modifier.modify(solutionHistory, stepper, AFTER\_SOLVE)}
44  * \State $\dot{x}_n \leftarrow (x_n-x_{n-1})/\Delta t_n$
45  * \State \quad {\it modifier.modify(solutionHistory, stepper, END\_STEP)}
46  * \end{algorithmic}
47  * \f}
48  */
49 template<class Scalar>
51  : virtual public Tempus::StepperBackwardEulerAppAction<Scalar>
52 {
53 private:
54 
55  /* \brief Adaptor execute function
56  *
57  * This is an adaptor function to bridge between the AppAction
58  * interface and the Modifier interface. It is meant to be private
59  * and non-virtual as deriving from this class should only need to
60  * implement the modify function.
61  *
62  * For the Modifier interface, this adaptor is a "simple pass through".
63  */
64  void execute(
65  Teuchos::RCP<SolutionHistory<Scalar> > sh,
66  Teuchos::RCP<StepperBackwardEuler<Scalar> > stepper,
68  { this->modify(sh, stepper, actLoc); }
69 
70 public:
71 
72  /// Modify BackwardEuler Stepper.
73  virtual void modify(
74  Teuchos::RCP<SolutionHistory<Scalar> > /* sh */,
75  Teuchos::RCP<StepperBackwardEuler<Scalar> > /* stepper */,
77 
78 };
79 
80 } // namespace Tempus
81 
82 #endif // Tempus_StepperBackwardEulerModifierBase_hpp
ACTION_LOCATION
Indicates the location of application action (see algorithm).
Application Action for StepperBackwardEuler.
virtual void modify(Teuchos::RCP< SolutionHistory< Scalar > >, Teuchos::RCP< StepperBackwardEuler< Scalar > >, const typename StepperBackwardEulerAppAction< Scalar >::ACTION_LOCATION actLoc)=0
Modify BackwardEuler Stepper.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
void execute(Teuchos::RCP< SolutionHistory< Scalar > > sh, Teuchos::RCP< StepperBackwardEuler< Scalar > > stepper, const typename StepperBackwardEulerAppAction< Scalar >::ACTION_LOCATION actLoc)
Execute application action for BackwardEuler Stepper.