|
Rythmos - Transient Integration for Differential Equations
Version of the Day
|
00001 //@HEADER 00002 // *********************************************************************** 00003 // 00004 // Rythmos Package 00005 // Copyright (2006) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00023 // USA 00024 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 //@HEADER 00028 00029 #ifndef Rythmos_IMPLICIT_RK_STEPPER_DECL_H 00030 #define Rythmos_IMPLICIT_RK_STEPPER_DECL_H 00031 00032 #include "Rythmos_Types.hpp" 00033 #include "Rythmos_StepperBase.hpp" 00034 #include "Rythmos_DataStore.hpp" 00035 #include "Rythmos_SolverAcceptingStepperBase.hpp" 00036 #include "Rythmos_RKButcherTableauAcceptingStepperBase.hpp" 00037 #include "Rythmos_RKButcherTableauBase.hpp" 00038 00039 #include "Thyra_ModelEvaluator.hpp" 00040 #include "Thyra_ProductVectorBase.hpp" 00041 #include "Thyra_NonlinearSolverBase.hpp" 00042 00043 namespace Rythmos { 00044 00045 00047 template<class Scalar> 00048 class ImplicitRKStepper : 00049 virtual public SolverAcceptingStepperBase<Scalar>, 00050 virtual public RKButcherTableauAcceptingStepperBase<Scalar> 00051 { 00052 public: 00053 00055 typedef typename ScalarTraits<Scalar>::magnitudeType ScalarMag; 00056 00059 00061 ImplicitRKStepper(); 00062 00063 void set_W_factory( const RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> > &irk_W_factory ); 00064 00066 RCP<const Thyra::LinearOpWithSolveFactoryBase<Scalar> > get_W_factory() const; 00067 00070 00072 void setRKButcherTableau( const RCP<const RKButcherTableauBase<Scalar> > &rkButcherTableau ); 00073 00075 RCP<const RKButcherTableauBase<Scalar> > getRKButcherTableau() const; 00076 00078 00080 // This function is mostly for testing purposes to explicitely over-ride the 00081 // internal RKBT detection to allow testing of 1-stage RKBTs as both fully 00082 // implicit RK and as DIRK methods. 00083 void setDirk(bool isDirk); 00084 00086 00089 00091 void setSolver( 00092 const RCP<Thyra::NonlinearSolverBase<Scalar> > &solver 00093 ); 00094 00096 RCP<Thyra::NonlinearSolverBase<Scalar> > 00097 getNonconstSolver(); 00098 00100 RCP<const Thyra::NonlinearSolverBase<Scalar> > 00101 getSolver() const; 00102 00104 00107 00109 bool isImplicit() const; 00110 00112 bool supportsCloning() const; 00113 00115 RCP<StepperBase<Scalar> > cloneStepperAlgorithm() const; 00116 00118 void setModel(const RCP<const Thyra::ModelEvaluator<Scalar> >& model); 00119 00121 void setNonconstModel(const RCP<Thyra::ModelEvaluator<Scalar> >& model); 00122 00124 RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const; 00125 00127 RCP<Thyra::ModelEvaluator<Scalar> > getNonconstModel(); 00128 00130 void setInitialCondition( 00131 const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition 00132 ); 00133 00135 Thyra::ModelEvaluatorBase::InArgs<Scalar> getInitialCondition() const; 00136 00138 Scalar takeStep(Scalar dt, StepSizeType flag); 00139 00141 const StepStatus<Scalar> getStepStatus() const; 00142 00144 00147 00149 RCP<const Thyra::VectorSpaceBase<Scalar> > 00150 get_x_space() const; 00151 00153 void addPoints( 00154 const Array<Scalar>& time_vec, 00155 const Array<RCP<const Thyra::VectorBase<Scalar> > >& x_vec, 00156 const Array<RCP<const Thyra::VectorBase<Scalar> > >& xdot_vec 00157 ); 00158 00160 TimeRange<Scalar> getTimeRange() const; 00161 00163 void getPoints( 00164 const Array<Scalar>& time_vec, 00165 Array<RCP<const Thyra::VectorBase<Scalar> > >* x_vec, 00166 Array<RCP<const Thyra::VectorBase<Scalar> > >* xdot_vec, 00167 Array<ScalarMag>* accuracy_vec 00168 ) const; 00169 00171 void getNodes(Array<Scalar>* time_vec) const; 00172 00174 void removeNodes(Array<Scalar>& time_vec); 00175 00177 int getOrder() const; 00178 00180 00183 00185 void setParameterList(RCP<ParameterList> const& paramList); 00186 00188 RCP<ParameterList> getNonconstParameterList(); 00189 00191 RCP<ParameterList> unsetParameterList(); 00192 00194 RCP<const ParameterList> getValidParameters() const; 00195 00197 00200 00202 void describe( 00203 FancyOStream &out, 00204 const Teuchos::EVerbosityLevel verbLevel 00205 ) const; 00206 00208 00209 private: 00210 00211 // /////////////////////// 00212 // Private date members 00213 00214 bool isInitialized_; 00215 RCP<const Thyra::ModelEvaluator<Scalar> > model_; 00216 RCP<Thyra::NonlinearSolverBase<Scalar> > solver_; 00217 RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> > irk_W_factory_; 00218 RCP<ParameterList> paramList_; 00219 00220 Thyra::ModelEvaluatorBase::InArgs<Scalar> basePoint_; 00221 RCP<Thyra::VectorBase<Scalar> > x_; 00222 RCP<Thyra::VectorBase<Scalar> > x_old_; 00223 RCP<Thyra::VectorBase<Scalar> > x_dot_; 00224 00225 TimeRange<Scalar> timeRange_; 00226 00227 RCP<Thyra::ModelEvaluator<Scalar> > irkModel_; 00228 RCP<const RKButcherTableauBase<Scalar> > irkButcherTableau_; 00229 00230 bool isDirk_; // Used for Diagonal Implicit RK 00231 00232 int numSteps_; 00233 00234 bool haveInitialCondition_; 00235 00236 // Cache 00237 RCP<Thyra::ProductVectorBase<Scalar> > x_stage_bar_; 00238 00239 // ////////////////////////// 00240 // Private member functions 00241 00242 void defaultInitializeAll_(); 00243 void initialize_(); 00244 00245 }; 00246 00247 00252 template<class Scalar> 00253 RCP<ImplicitRKStepper<Scalar> > 00254 implicitRKStepper(); 00255 00256 template<class Scalar> 00257 RCP<ImplicitRKStepper<Scalar> > 00258 implicitRKStepper( 00259 const RCP<const Thyra::ModelEvaluator<Scalar> >& model, 00260 const RCP<Thyra::NonlinearSolverBase<Scalar> >& solver, 00261 const RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> >& irk_W_factory, 00262 const RCP<const RKButcherTableauBase<Scalar> >& irkbt 00263 ); 00264 00265 00266 } // namespace Rythmos 00267 00268 #endif //Rythmos_IMPLICIT_RK_STEPPER_DECL_H
1.7.6.1