29 #ifndef Rythmos_BACKWARD_EULER_STEPPER_DECL_H
30 #define Rythmos_BACKWARD_EULER_STEPPER_DECL_H
32 #include "Rythmos_SolverAcceptingStepperBase.hpp"
33 #include "Rythmos_StepControlStrategyAcceptingStepperBase.hpp"
34 #include "Rythmos_InterpolatorAcceptingObjectBase.hpp"
35 #include "Rythmos_SingleResidualModelEvaluator.hpp"
36 #include "Rythmos_MomentoBase.hpp"
38 #include "Thyra_VectorBase.hpp"
39 #include "Thyra_ModelEvaluator.hpp"
40 #include "Thyra_NonlinearSolverBase.hpp"
41 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
52 template<
class Scalar>
55 virtual public Teuchos::ParameterListAcceptorDefaultBase
61 RCP<MomentoBase<Scalar> > clone()
const
63 RCP<BackwardEulerStepperMomento<Scalar> > m =
65 m->set_scaled_x_old(scaled_x_old_);
66 m->set_x_dot_old(x_dot_old_);
74 m->set_numSteps(numSteps_);
75 m->set_isInitialized(isInitialized_);
76 m->set_haveInitialCondition(haveInitialCondition_);
77 m->set_parameterList(parameterList_);
78 m->set_basePoint(basePoint_);
79 m->set_neModel(neModel_);
80 m->set_interpolator(interpolator_);
81 m->set_stepControl(stepControl_);
82 if (!Teuchos::is_null(this->getMyParamList())) {
83 m->setParameterList(Teuchos::parameterList(*(this->getMyParamList())));
102 void set_scaled_x_old(
const RCP<
const VectorBase<Scalar> >& scaled_x_old )
104 scaled_x_old_ = Teuchos::null;
105 if (!Teuchos::is_null(scaled_x_old)) {
106 scaled_x_old_ = scaled_x_old->clone_v();
109 RCP<VectorBase<Scalar> > get_scaled_x_old()
const
110 {
return scaled_x_old_; }
112 void set_x_dot_old(
const RCP<
const VectorBase<Scalar> >& x_dot_old )
114 x_dot_old_ = Teuchos::null;
115 if (!Teuchos::is_null(x_dot_old)) {
116 x_dot_old_ = x_dot_old->clone_v();
119 RCP<VectorBase<Scalar> > get_x_dot_old()
const
120 {
return x_dot_old_; }
122 void set_x_old(
const RCP<
const VectorBase<Scalar> >& x_old )
124 x_old_ = Teuchos::null;
125 if (!Teuchos::is_null(x_old)) {
126 x_old_ = x_old->clone_v();
129 RCP<VectorBase<Scalar> > get_x_old()
const
132 void set_x(
const RCP<
const VectorBase<Scalar> >& x )
135 if (!Teuchos::is_null(x)) {
139 RCP<VectorBase<Scalar> > get_x()
const
142 void set_dx(
const RCP<
const VectorBase<Scalar> >& dx )
145 if (!Teuchos::is_null(dx)) {
149 RCP<VectorBase<Scalar> > get_dx()
const
152 void set_x_dot(
const RCP<
const VectorBase<Scalar> >& x_dot )
154 x_dot_ = Teuchos::null;
155 if (!Teuchos::is_null(x_dot)) {
156 x_dot_ = x_dot->clone_v();
159 RCP<VectorBase<Scalar> > get_x_dot()
const
162 void set_t(
const Scalar & t)
167 void set_t_old(
const Scalar & t_old)
169 Scalar get_t_old()
const
172 void set_dt(
const Scalar & dt)
174 Scalar get_dt()
const
177 void set_numSteps(
const int & numSteps)
178 { numSteps_ = numSteps; }
179 int get_numSteps()
const
180 {
return numSteps_; }
182 void set_newtonConvergenceStatus(
const int & newtonConvergenceStatus)
183 { newtonConvergenceStatus_ = newtonConvergenceStatus; }
184 int get_newtonConvergenceStatus()
const
185 {
return newtonConvergenceStatus_; }
187 void set_isInitialized(
const bool & isInitialized)
188 { isInitialized_ = isInitialized; }
189 bool get_isInitialized()
const
190 {
return isInitialized_; }
192 void set_haveInitialCondition(
const bool & haveInitialCondition)
193 { haveInitialCondition_ = haveInitialCondition; }
194 bool get_haveInitialCondition()
const
195 {
return haveInitialCondition_; }
197 void set_parameterList(
const RCP<const ParameterList>& pl)
199 parameterList_ = Teuchos::null;
200 if (!Teuchos::is_null(pl)) {
201 parameterList_ = Teuchos::parameterList(*pl);
204 RCP<ParameterList> get_parameterList()
const
205 {
return parameterList_; }
207 void set_basePoint(Thyra::ModelEvaluatorBase::InArgs<Scalar> basePoint)
208 { basePoint_ = basePoint; };
209 Thyra::ModelEvaluatorBase::InArgs<Scalar> get_basePoint()
const
210 {
return basePoint_; }
214 neModel_ = Teuchos::null;
215 if (!Teuchos::is_null(neModel)) {
219 RCP<Rythmos::SingleResidualModelEvaluator<Scalar> > get_neModel()
const
224 interpolator_ = Teuchos::null;
225 if (!Teuchos::is_null(interpolator)) {
226 TEUCHOS_ASSERT(interpolator->supportsCloning());
227 interpolator_ = interpolator->cloneInterpolator();
230 RCP<InterpolatorBase<Scalar> > get_interpolator()
const
231 {
return interpolator_; }
235 stepControl_ = Teuchos::null;
236 if (!Teuchos::is_null(stepControl)) {
237 TEUCHOS_ASSERT(stepControl->supportsCloning());
238 stepControl_ = stepControl->cloneStepControlStrategyAlgorithm();
241 RCP<StepControlStrategyBase<Scalar> > get_stepControl()
const
242 {
return stepControl_; }
244 void setParameterList(
const RCP<ParameterList>& paramList)
245 { this->setMyParamList(paramList); }
246 RCP<const ParameterList> getValidParameters()
const
247 {
return Teuchos::null; }
250 RCP<Thyra::VectorBase<Scalar> > scaled_x_old_;
251 RCP<Thyra::VectorBase<Scalar> > x_old_;
252 RCP<Thyra::VectorBase<Scalar> > x_dot_old_;
253 RCP<Thyra::VectorBase<Scalar> > x_;
254 RCP<Thyra::VectorBase<Scalar> > x_dot_;
255 RCP<Thyra::VectorBase<Scalar> > dx_;
260 int newtonConvergenceStatus_;
262 bool haveInitialCondition_;
263 RCP<Teuchos::ParameterList> parameterList_;
264 Thyra::ModelEvaluatorBase::InArgs<Scalar> basePoint_;
265 RCP<Rythmos::SingleResidualModelEvaluator<Scalar> > neModel_;
266 RCP<InterpolatorBase<Scalar> > interpolator_;
267 RCP<StepControlStrategyBase<Scalar> > stepControl_;
282 template<
class Scalar>
291 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType
ScalarMag;
301 const RCP<Thyra::ModelEvaluator<Scalar> >& model,
302 const RCP<Thyra::NonlinearSolverBase<Scalar> >& solver
333 RCP<StepControlStrategyBase<Scalar> >
337 RCP<const StepControlStrategyBase<Scalar> >
347 const RCP<Thyra::NonlinearSolverBase<Scalar> > &solver
351 RCP<Thyra::NonlinearSolverBase<Scalar> >
355 RCP<const Thyra::NonlinearSolverBase<Scalar> >
379 void setModel(
const RCP<
const Thyra::ModelEvaluator<Scalar> >& model);
385 RCP<const Thyra::ModelEvaluator<Scalar> >
getModel()
const;
392 const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition
399 Scalar
takeStep(Scalar dt, StepSizeType flag);
410 RCP<const Thyra::VectorSpaceBase<Scalar> >
415 const Array<Scalar>& time_vec,
416 const Array<RCP<
const Thyra::VectorBase<Scalar> > >& x_vec,
417 const Array<RCP<
const Thyra::VectorBase<Scalar> > >& xdot_vec
425 const Array<Scalar>& time_vec,
426 Array<RCP<
const Thyra::VectorBase<Scalar> > >* x_vec,
427 Array<RCP<
const Thyra::VectorBase<Scalar> > >* xdot_vec,
428 Array<ScalarMag>* accuracy_vec
432 void getNodes(Array<Scalar>* time_vec)
const;
464 Teuchos::FancyOStream &out,
465 const Teuchos::EVerbosityLevel verbLevel
476 RCP<const MomentoBase<Scalar> >
getMomento()
const;
482 const RCP<Thyra::ModelEvaluator<Scalar> >& model,
483 const RCP<Thyra::NonlinearSolverBase<Scalar> >& solver
495 bool haveInitialCondition_;
496 RCP<const Thyra::ModelEvaluator<Scalar> > model_;
497 RCP<Thyra::NonlinearSolverBase<Scalar> > solver_;
498 RCP<Thyra::VectorBase<Scalar> > x_old_;
499 RCP<Thyra::VectorBase<Scalar> > scaled_x_old_;
500 RCP<Thyra::VectorBase<Scalar> > x_dot_old_;
502 Thyra::ModelEvaluatorBase::InArgs<Scalar> basePoint_;
503 RCP<Thyra::VectorBase<Scalar> > x_;
504 RCP<Thyra::VectorBase<Scalar> > x_dot_;
505 RCP<Thyra::VectorBase<Scalar> > dx_;
512 RCP<Rythmos::SingleResidualModelEvaluator<Scalar> > neModel_;
514 RCP<Teuchos::ParameterList> parameterList_;
516 RCP<InterpolatorBase<Scalar> > interpolator_;
517 RCP<StepControlStrategyBase<Scalar> > stepControl_;
519 int newtonConvergenceStatus_;
525 void defaultInitializeAll_();
527 void checkConsistentState_();
528 void obtainPredictor_();
537 template<
class Scalar>
538 RCP<BackwardEulerStepper<Scalar> >
539 backwardEulerStepper();
546 template<
class Scalar>
547 RCP<BackwardEulerStepper<Scalar> >
548 backwardEulerStepper(
549 const RCP<Thyra::ModelEvaluator<Scalar> >& model,
550 const RCP<Thyra::NonlinearSolverBase<Scalar> >& solver
557 #endif //Rythmos_BACKWARD_EULER_STEPPER_DECL_H
Simple concrete stepper subclass implementing an implicit backward Euler method.
Mix-in interface for stepper objects that accept a step control strategy object to be used for evalua...
bool supportsCloning() const
Returns true.
Base strategy class for interpolation functionality.
RCP< const InterpolatorBase< Scalar > > getInterpolator() const
void setSolver(const RCP< Thyra::NonlinearSolverBase< Scalar > > &solver)
void setStepControlStrategy(const RCP< StepControlStrategyBase< Scalar > > &stepControlStrategy)
void getNodes(Array< Scalar > *time_vec) const
Base class for serializing Rythmos state data.
RCP< Teuchos::ParameterList > unsetParameterList()
void setInitialCondition(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &initialCondition)
void setModel(const RCP< const Thyra::ModelEvaluator< Scalar > > &model)
void removeNodes(Array< Scalar > &time_vec)
Scalar takeStep(Scalar dt, StepSizeType flag)
void addPoints(const Array< Scalar > &time_vec, const Array< RCP< const Thyra::VectorBase< Scalar > > > &x_vec, const Array< RCP< const Thyra::VectorBase< Scalar > > > &xdot_vec)
RCP< Teuchos::ParameterList > getNonconstParameterList()
RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
RCP< StepControlStrategyBase< Scalar > > getNonconstStepControlStrategy()
The member functions in the StepControlStrategyBase move you between these states in the following fa...
void setNonconstModel(const RCP< Thyra::ModelEvaluator< Scalar > > &model)
Mix-in interface for objects that accept an interpolator object.
RCP< InterpolatorBase< Scalar > > unSetInterpolator()
Thyra::ModelEvaluatorBase::InArgs< Scalar > getInitialCondition() const
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
void getPoints(const Array< Scalar > &time_vec, Array< RCP< const Thyra::VectorBase< Scalar > > > *x_vec, Array< RCP< const Thyra::VectorBase< Scalar > > > *xdot_vec, Array< ScalarMag > *accuracy_vec) const
void setMomento(const Ptr< const MomentoBase< Scalar > > &momentoPtr, const RCP< Thyra::ModelEvaluator< Scalar > > &model, const RCP< Thyra::NonlinearSolverBase< Scalar > > &solver)
Set momento object for use in restarts.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Concrete momento class for the BackwardEulerStepper.
RCP< Thyra::NonlinearSolverBase< Scalar > > getNonconstSolver()
RCP< const MomentoBase< Scalar > > getMomento() const
Get momento object for use in restarts.
Decorator subclass for a steady-state version of a DAE for single-residual time stepper methods...
RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const
RCP< const StepControlStrategyBase< Scalar > > getStepControlStrategy() const
RCP< const Teuchos::ParameterList > getValidParameters() const
RCP< StepperBase< Scalar > > cloneStepperAlgorithm() const
Creates copies of all internal data (including the parameter list) except the model which is assumed ...
const StepStatus< Scalar > getStepStatus() const
Mix-in interface all implicit stepper objects that accept a nonlinear solver to be used to compute th...
RCP< const Thyra::NonlinearSolverBase< Scalar > > getSolver() const
RCP< InterpolatorBase< Scalar > > getNonconstInterpolator()
void setParameterList(RCP< Teuchos::ParameterList > const ¶mList)
RCP< Thyra::ModelEvaluator< Scalar > > getNonconstModel()
void setInterpolator(const RCP< InterpolatorBase< Scalar > > &interpolator)
Base class for a momento object.
TimeRange< Scalar > getTimeRange() const