00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef Rythmos_IMPLICITBDF_STEPPER_STEP_CONTROL_DECL_H
00030 #define Rythmos_IMPLICITBDF_STEPPER_STEP_CONTROL_DECL_H
00031
00032 #include "Rythmos_ErrWtVecCalcAcceptingStepControlStrategyBase.hpp"
00033
00034 namespace Rythmos {
00035
00037 enum BDFactionFlag { ACTION_UNSET, ACTION_LOWER, ACTION_MAINTAIN, ACTION_RAISE };
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 template<class Scalar>
00055 class ImplicitBDFStepperStepControl
00056 : virtual public ErrWtVecCalcAcceptingStepControlStrategyBase<Scalar>
00057 {
00058 public:
00059
00060 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00061
00065 void setRequestedStepSize(const StepperBase<Scalar>& stepper, const Scalar& stepSize, const StepSizeType& stepSizeType);
00066
00068 void nextStepSize(const StepperBase<Scalar>& stepper, Scalar* stepSize, StepSizeType* stepSizeType, int* order);
00069
00071 void setCorrection(
00072 const StepperBase<Scalar>& stepper
00073 ,const RCP<const Thyra::VectorBase<Scalar> >& soln
00074 ,const RCP<const Thyra::VectorBase<Scalar> >& ee
00075 ,int solveStatus
00076 );
00077
00079 bool acceptStep(const StepperBase<Scalar>& stepper, Scalar* LETValue);
00080
00082 void completeStep(const StepperBase<Scalar>& stepper);
00083
00085 AttemptedStepStatusFlag rejectStep(const StepperBase<Scalar>& stepper);
00086
00088 StepControlStrategyState getCurrentState();
00089
00091 int getMinOrder() const;
00092
00094 int getMaxOrder() const;
00095
00097 void setStepControlData(const StepperBase<Scalar>& stepper);
00098
00100 bool supportsCloning() const;
00101
00103 RCP<StepControlStrategyBase<Scalar> > cloneStepControlStrategyAlgorithm() const;
00104
00106
00109
00111 void setErrWtVecCalc(const RCP<ErrWtVecCalcBase<Scalar> >& errWtVecCalc);
00112
00114 RCP<const ErrWtVecCalcBase<Scalar> > getErrWtVecCalc() const;
00115
00117
00118 ImplicitBDFStepperStepControl();
00119
00123 void describe(
00124 Teuchos::FancyOStream &out,
00125 const Teuchos::EVerbosityLevel verbLevel
00126 ) const;
00128
00132 void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
00133
00135 RCP<Teuchos::ParameterList> getNonconstParameterList();
00136
00138 RCP<Teuchos::ParameterList> unsetParameterList();
00139
00141 RCP<const Teuchos::ParameterList> getValidParameters() const;
00142
00144
00146 void initialize(const StepperBase<Scalar>& stepper);
00147
00148
00149 private:
00150
00151
00152
00153 void defaultInitializeAllData_();
00154
00155 StepControlStrategyState stepControlState_;
00156
00157 RCP<ErrWtVecCalcBase<Scalar> > errWtVecCalc_;
00158
00159 Scalar hh_;
00160 int numberOfSteps_;
00161 StepSizeType stepSizeType_;
00162 int minOrder_;
00163 int maxOrder_;
00164 int nef_;
00165 bool midStep_;
00166
00167 RCP<const Thyra::VectorBase<Scalar> > ee_;
00168 RCP<Thyra::VectorBase<Scalar> > errWtVec_;
00169 RCP<Thyra::VectorBase<Scalar> > delta_;
00170
00171 bool checkReduceOrderCalled_;
00172
00173 RCP<Teuchos::ParameterList> parameterList_;
00174
00175 Scalar time_;
00176
00177 ScalarMag relErrTol_;
00178 ScalarMag absErrTol_;
00179 Scalar usedStep_;
00180 int currentOrder_;
00181 int usedOrder_;
00182 int nscsco_;
00183 Array<Scalar> alpha_;
00184
00185 Array<Scalar> sigma_;
00186 Array<Scalar> gamma_;
00187
00188 Array<Scalar> beta_;
00189 Array<Scalar> psi_;
00190
00191 Scalar alpha_s_;
00192 Scalar alpha_0_;
00193 Scalar cj_ ;
00194 Scalar ck_ ;
00195 Scalar ck_enorm_;
00196
00197 bool constantStepSize_;
00198 Scalar Ek_;
00199 Scalar Ekm1_;
00200 Scalar Ekm2_;
00201 Scalar Ekp1_;
00202 Scalar Est_;
00203 Scalar Tk_;
00204 Scalar Tkm1_;
00205 Scalar Tkm2_;
00206 Scalar Tkp1_;
00207 int newOrder_;
00208 int oldOrder_;
00209 bool initialPhase_;
00210 Scalar stopTime_;
00211
00212
00213 Scalar h0_safety_;
00214 Scalar h0_max_factor_;
00215 Scalar h_phase0_incr_;
00216 Scalar h_max_inv_;
00217 Scalar Tkm1_Tk_safety_;
00218 Scalar Tkp1_Tk_safety_;
00219 Scalar r_factor_;
00220 Scalar r_safety_;
00221 Scalar r_fudge_;
00222 Scalar r_min_;
00223 Scalar r_max_;
00224 Scalar r_hincr_test_;
00225 Scalar r_hincr_;
00226 int max_LET_fail_;
00227 Scalar minTimeStep_;
00228 Scalar maxTimeStep_;
00229
00230 int newtonConvergenceStatus_;
00231
00232
00233
00234 Scalar wRMSNorm_(
00235 const Thyra::VectorBase<Scalar>& weight,
00236 const Thyra::VectorBase<Scalar>& vector
00237 ) const;
00238
00239 Scalar checkReduceOrder_(const StepperBase<Scalar>& stepper);
00240
00241 void getFirstTimeStep_(const StepperBase<Scalar>& stepper);
00242
00243 void setStepControlState_(StepControlStrategyState state);
00244
00245 void updateCoeffs_();
00246
00247 void setDefaultMagicNumbers_(Teuchos::ParameterList &magicNumberList);
00248
00249 };
00250
00251 }
00252
00253 #endif // Rythmos_IMPLICITBDF_STEPPER_STEP_CONTROL_DECL_H
00254