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