Tempus
Version of the Day
Time Integration
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Tempus_StepperTrapezoidalModifierXBase.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_StepperTrapezoidalModifierXBase_hpp
10
#define Tempus_StepperTrapezoidalModifierXBase_hpp
11
12
#include "Tempus_config.hpp"
13
#include "Tempus_SolutionHistory.hpp"
14
#include "
Tempus_StepperTrapezoidalAppAction.hpp
"
15
16
17
namespace
Tempus
{
18
36
template
<
class
Scalar>
37
class
StepperTrapezoidalModifierXBase
38
:
virtual
public
Tempus::StepperTrapezoidalAppAction
<Scalar>
39
{
40
private
:
41
42
/* \brief Adaptor execute function
43
*
44
* This is an adaptor function to bridge between the AppAction
45
* interface and the ModifierX interface. It is meant to be private
46
* and non-virtual as deriving from this class should only need to
47
* implement the modify function.
48
*
49
* For the ModifierX interface, this adaptor maps the
50
* StepperTrapezoidalAppAction::ACTION_LOCATION to the
51
* StepperTrapezoidalModifierX::MODIFIERX_TYPE, and only pass the solution
52
* (\f$x\f$ and/or \f$\dot{x}\f$ and other parameters to the modify
53
* function.
54
*/
55
void
execute
(
56
Teuchos::RCP<
SolutionHistory<Scalar>
> sh,
57
Teuchos::RCP<
StepperTrapezoidal<Scalar>
> stepper,
58
const
typename
StepperTrapezoidalAppAction<Scalar>::ACTION_LOCATION
actLoc)
59
{
60
using
Teuchos::RCP;
61
62
MODIFIER_TYPE
modType =
X_BEGIN_STEP
;
63
RCP<SolutionState<Scalar> > workingState = sh->getWorkingState();
64
const
Scalar time = workingState->getTime();
65
const
Scalar dt = workingState->getTimeStep();
66
RCP<Thyra::VectorBase<Scalar> > x;
67
68
switch
(actLoc) {
69
case
StepperTrapezoidalAppAction<Scalar>::BEGIN_STEP
:
70
{
71
modType =
X_BEGIN_STEP
;
72
x = workingState->getX();
73
break
;
74
}
75
case
StepperTrapezoidalAppAction<Scalar>::BEFORE_SOLVE
:
76
{
77
modType =
X_BEFORE_SOLVE
;
78
x = workingState->getX();
79
break
;
80
}
81
case
StepperTrapezoidalAppAction<Scalar>::AFTER_SOLVE
:
82
{
83
modType =
X_AFTER_SOLVE
;
84
x = workingState->getX();
85
break
;
86
}
87
case
StepperTrapezoidalAppAction<Scalar>::END_STEP
:
88
{
89
modType =
XDOT_END_STEP
;
90
if
(workingState->getXDot() != Teuchos::null)
91
x = workingState->getXDot();
92
else
93
x = stepper->getStepperXDot();
94
break
;
95
}
96
default
:
97
TEUCHOS_TEST_FOR_EXCEPTION(
true
, std::logic_error,
98
"Error - unknown action location.\n"
);
99
}
100
101
this->
modify
(x, time, dt, modType);
102
}
103
104
public
:
105
107
enum
MODIFIER_TYPE
{
108
X_BEGIN_STEP
,
109
X_BEFORE_SOLVE
,
110
X_AFTER_SOLVE
,
111
XDOT_END_STEP
112
};
113
115
virtual
void
modify
(
116
Teuchos::RCP<
Thyra::VectorBase<Scalar>
>
/* x */
,
117
const
Scalar
/* time */
,
const
Scalar
/* dt */
,
118
const
MODIFIER_TYPE
modType) = 0;
119
120
};
121
122
}
// namespace Tempus
123
124
#endif
// Tempus_StepperTrapezoidalModifierXBase_hpp
Tempus_StepperTrapezoidalAppAction.hpp
Tempus::SolutionHistory
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Definition
Tempus_SolutionHistory_decl.hpp:121
Tempus::StepperTrapezoidalAppAction
Application Action for StepperTrapezoidal.
Definition
Tempus_StepperTrapezoidalAppAction.hpp:35
Tempus::StepperTrapezoidalAppAction::ACTION_LOCATION
ACTION_LOCATION
Indicates the location of application action (see algorithm).
Definition
Tempus_StepperTrapezoidalAppAction.hpp:39
Tempus::StepperTrapezoidalAppAction::AFTER_SOLVE
@ AFTER_SOLVE
After then solve.
Definition
Tempus_StepperTrapezoidalAppAction.hpp:42
Tempus::StepperTrapezoidalAppAction::BEFORE_SOLVE
@ BEFORE_SOLVE
Before the solve.
Definition
Tempus_StepperTrapezoidalAppAction.hpp:41
Tempus::StepperTrapezoidalAppAction::BEGIN_STEP
@ BEGIN_STEP
At the beginning of the step.
Definition
Tempus_StepperTrapezoidalAppAction.hpp:40
Tempus::StepperTrapezoidalAppAction::END_STEP
@ END_STEP
At the end of the step.
Definition
Tempus_StepperTrapezoidalAppAction.hpp:43
Tempus::StepperTrapezoidalModifierXBase
Base ModifierX for StepperTrapezoidal.
Definition
Tempus_StepperTrapezoidalModifierXBase.hpp:39
Tempus::StepperTrapezoidalModifierXBase::execute
void execute(Teuchos::RCP< SolutionHistory< Scalar > > sh, Teuchos::RCP< StepperTrapezoidal< Scalar > > stepper, const typename StepperTrapezoidalAppAction< Scalar >::ACTION_LOCATION actLoc)
Execute application action for Trapezoidal Stepper.
Definition
Tempus_StepperTrapezoidalModifierXBase.hpp:55
Tempus::StepperTrapezoidalModifierXBase::modify
virtual void modify(Teuchos::RCP< Thyra::VectorBase< Scalar > >, const Scalar, const Scalar, const MODIFIER_TYPE modType)=0
Modify solution based on the MODIFIER_TYPE.
Tempus::StepperTrapezoidalModifierXBase::MODIFIER_TYPE
MODIFIER_TYPE
Indicates the location of application action (see algorithm).
Definition
Tempus_StepperTrapezoidalModifierXBase.hpp:107
Tempus::StepperTrapezoidalModifierXBase::X_BEFORE_SOLVE
@ X_BEFORE_SOLVE
Modify before the implicit solve.
Definition
Tempus_StepperTrapezoidalModifierXBase.hpp:109
Tempus::StepperTrapezoidalModifierXBase::X_BEGIN_STEP
@ X_BEGIN_STEP
Modify at the beginning of the step.
Definition
Tempus_StepperTrapezoidalModifierXBase.hpp:108
Tempus::StepperTrapezoidalModifierXBase::XDOT_END_STEP
@ XDOT_END_STEP
Modify at the end of the step.
Definition
Tempus_StepperTrapezoidalModifierXBase.hpp:111
Tempus::StepperTrapezoidalModifierXBase::X_AFTER_SOLVE
@ X_AFTER_SOLVE
Modify after the implicit solve.
Definition
Tempus_StepperTrapezoidalModifierXBase.hpp:110
Tempus::StepperTrapezoidal
Trapezoidal method time stepper.
Definition
Tempus_StepperTrapezoidal_decl.hpp:84
Thyra::VectorBase
Tempus
Definition
Tempus_AdjointAuxSensitivityModelEvaluator_decl.hpp:21
Generated by
1.17.0