Rythmos - Transient Integration for Differential Equations  Version of the Day
 All Classes Functions Variables Typedefs Pages
Rythmos_ExplicitRKStepper_decl.hpp
1 //@HEADER
2 // ***********************************************************************
3 //
4 // Rythmos Package
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
25 //
26 // ***********************************************************************
27 //@HEADER
28 
29 #ifndef Rythmos_ExplicitRK_STEPPER_DECL_H
30 #define Rythmos_ExplicitRK_STEPPER_DECL_H
31 
32 #include "Rythmos_RKButcherTableauAcceptingStepperBase.hpp"
33 #include "Rythmos_RKButcherTableauBase.hpp"
34 #include "Rythmos_Types.hpp"
35 #include "Thyra_ModelEvaluator.hpp"
36 
37 #include "Rythmos_StepControlStrategyAcceptingStepperBase.hpp"
38 #include "Rythmos_StepControlStrategyBase.hpp"
39 
40 namespace Rythmos {
41 
43 template<class Scalar>
45  virtual public StepControlStrategyAcceptingStepperBase<Scalar>
46 {
47  public:
48  typedef Teuchos::ScalarTraits<Scalar> ST;
49  typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
50 
53 
56 
58  bool supportsCloning() const;
59 
61  RCP<StepperBase<Scalar> > cloneStepperAlgorithm() const;
62 
64 
67 
69  void setRKButcherTableau(const RCP<const RKButcherTableauBase<Scalar> > &rkbt);
70 
72  RCP<const RKButcherTableauBase<Scalar> > getRKButcherTableau() const;
73 
75 
77  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const;
78 
80  void setModel(const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model);
81 
83  void setNonconstModel(const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& model);
84 
86  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const;
87 
89  RCP<Thyra::ModelEvaluator<Scalar> > getNonconstModel();
90 
93 
96  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition
97  );
98 
100  Thyra::ModelEvaluatorBase::InArgs<Scalar> getInitialCondition() const;
101 
103  Scalar takeStep(Scalar dt, StepSizeType flag);
104 
106  const StepStatus<Scalar> getStepStatus() const;
107 
109  void describe(
110  Teuchos::FancyOStream &out,
111  const Teuchos::EVerbosityLevel verbLevel
112  ) const;
113 
116  void addPoints(
117  const Array<Scalar>& time_vec
118  ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > >& x_vec
119  ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > >& xdot_vec
120  );
121 
123  void getPoints(
124  const Array<Scalar>& time_vec
125  ,Array<RCP<const VectorBase<Scalar> > >* x_vec
126  ,Array<RCP<const VectorBase<Scalar> > >* xdot_vec
127  ,Array<ScalarMag>* accuracy_vec) const;
128 
131 
133  void getNodes(Array<Scalar>* time_vec) const;
134 
136  void removeNodes(Array<Scalar>& time_vec);
137 
139  int getOrder() const;
140 
142 
143  void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const& paramList);
144 
146  Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList();
147 
149  Teuchos::RCP<Teuchos::ParameterList> unsetParameterList();
150 
152  RCP<const Teuchos::ParameterList> getValidParameters() const;
153 
154 
157 
160  const RCP<StepControlStrategyBase<Scalar> >& stepControlStrategy
161  );
162 
164  RCP<StepControlStrategyBase<Scalar> >
166 
168  RCP<const StepControlStrategyBase<Scalar> >
169  getStepControlStrategy() const;
170 
172 
173  private:
174 
175  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > model_;
176  Teuchos::RCP<Thyra::VectorBase<Scalar> > solution_vector_;
177  Teuchos::RCP<Thyra::VectorBase<Scalar> > solution_vector_old_;
178  Array<Teuchos::RCP<Thyra::VectorBase<Scalar> > > k_vector_;
179  Teuchos::RCP<Thyra::VectorBase<Scalar> > ktemp_vector_;
180  Teuchos::RCP<Thyra::VectorBase<Scalar> > solution_hat_vector_;
181 
182  Thyra::ModelEvaluatorBase::InArgs<Scalar> basePoint_;
183 
184  RCP<const RKButcherTableauBase<Scalar> > erkButcherTableau_;
185 
186  Scalar t_;
187  Scalar t_old_;
188  Scalar dt_;
189  int numSteps_;
190  Scalar LETvalue_; // ck * e
191 
192  Teuchos::RCP<Teuchos::ParameterList> parameterList_;
193  RCP<Thyra::VectorBase<Scalar> > ee_; // error (Sidafa)
194  EStepLETStatus stepLETStatus_; // Local Error Test Status (Sidafa)
195  TimeRange<Scalar> timeRange_;
196 
197  bool isInitialized_;
198 
199  bool haveInitialCondition_;
200 
201  // Private member functions:
202  void defaultInitializeAll_();
203  void initialize_();
204 
205  // Sidafa 9/4/15
206  int rkNewtonConvergenceStatus_;
207  RCP<Rythmos::StepControlStrategyBase<Scalar> > stepControl_;
208  bool isVariableStep_ = false;
209 
210  Scalar takeVariableStep_(Scalar dt, StepSizeType flag);
211 
212  Scalar takeFixedStep_(Scalar dt, StepSizeType flag);
213 
214 };
215 
216 // Non-member constructors
217 template<class Scalar>
218 RCP<ExplicitRKStepper<Scalar> > explicitRKStepper();
219 
220 template<class Scalar>
221 RCP<ExplicitRKStepper<Scalar> > explicitRKStepper(
222  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& model
223  );
224 
225 template<class Scalar>
226 RCP<ExplicitRKStepper<Scalar> > explicitRKStepper(
227  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& model,
228  const RCP<const RKButcherTableauBase<Scalar> >& rkbt
229  );
230 
231 } // namespace Rythmos
232 
233 #endif //Rythmos_ExplicitRK_STEPPER_DECL_H
234 
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
Mix-in interface for stepper objects that accept a step control strategy object to be used for evalua...
Scalar takeStep(Scalar dt, StepSizeType flag)
void setStepControlStrategy(const RCP< StepControlStrategyBase< Scalar > > &stepControlStrategy)
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
RCP< const Teuchos::ParameterList > getValidParameters() const
The member functions in the StepControlStrategyBase move you between these states in the following fa...
void getNodes(Array< Scalar > *time_vec) const
Get interpolation nodes.
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const &paramList)
Redefined from Teuchos::ParameterListAcceptor.
RCP< const StepControlStrategyBase< Scalar > > getStepControlStrategy() const
const StepStatus< Scalar > getStepStatus() const
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
int getOrder() const
Get order of interpolation.
void setRKButcherTableau(const RCP< const RKButcherTableauBase< Scalar > > &rkbt)
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const
void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
void getPoints(const Array< Scalar > &time_vec, Array< RCP< const VectorBase< Scalar > > > *x_vec, Array< RCP< const VectorBase< Scalar > > > *xdot_vec, Array< ScalarMag > *accuracy_vec) const
Get values from buffer.
void removeNodes(Array< Scalar > &time_vec)
Remove interpolation nodes.
Thyra::ModelEvaluatorBase::InArgs< Scalar > getInitialCondition() const
Mix-in interface stepper objects that accept an RK Butcher Tableau.
RCP< StepperBase< Scalar > > cloneStepperAlgorithm() const
RCP< const RKButcherTableauBase< Scalar > > getRKButcherTableau() const
RCP< StepControlStrategyBase< Scalar > > getNonconstStepControlStrategy()
RCP< Thyra::ModelEvaluator< Scalar > > getNonconstModel()
void setNonconstModel(const Teuchos::RCP< Thyra::ModelEvaluator< Scalar > > &model)
TimeRange< Scalar > getTimeRange() const
void addPoints(const Array< Scalar > &time_vec, const Array< Teuchos::RCP< const Thyra::VectorBase< Scalar > > > &x_vec, const Array< Teuchos::RCP< const Thyra::VectorBase< Scalar > > > &xdot_vec)
void setInitialCondition(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &initialCondition)