Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperNewmarkImplicitAForm_impl.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_StepperNewmarkImplicitAForm_impl_hpp
10 #define Tempus_StepperNewmarkImplicitAForm_impl_hpp
11 
12 #include "Tempus_config.hpp"
14 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
15 #include "NOX_Thyra.H"
16 
17 //#define VERBOSE_DEBUG_OUTPUT
18 //#define DEBUG_OUTPUT
19 
20 namespace Tempus {
21 
22 // Forward Declaration for recursive includes (this Stepper <--> StepperFactory)
23 template<class Scalar> class StepperFactory;
24 
25 
26 template<class Scalar>
28 predictVelocity(Thyra::VectorBase<Scalar>& vPred,
29  const Thyra::VectorBase<Scalar>& v,
30  const Thyra::VectorBase<Scalar>& a,
31  const Scalar dt) const
32 {
33 #ifdef VERBOSE_DEBUG_OUTPUT
34  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
35 #endif
36  //vPred = v + dt*(1.0-gamma_)*a
37  Thyra::V_StVpStV(Teuchos::ptrFromRef(vPred), 1.0, v, dt*(1.0-gamma_), a);
38 }
39 
40 template<class Scalar>
42 predictDisplacement(Thyra::VectorBase<Scalar>& dPred,
43  const Thyra::VectorBase<Scalar>& d,
44  const Thyra::VectorBase<Scalar>& v,
45  const Thyra::VectorBase<Scalar>& a,
46  const Scalar dt) const
47 {
48 #ifdef VERBOSE_DEBUG_OUTPUT
49  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
50 #endif
51  Teuchos::RCP<const Thyra::VectorBase<Scalar> > tmp =
52  Thyra::createMember<Scalar>(dPred.space());
53  //dPred = dt*v + dt*dt/2.0*(1.0-2.0*beta_)*a
54  Scalar aConst = dt*dt/2.0*(1.0-2.0*beta_);
55  Thyra::V_StVpStV(Teuchos::ptrFromRef(dPred), dt, v, aConst, a);
56  //dPred += d;
57  Thyra::Vp_V(Teuchos::ptrFromRef(dPred), d, 1.0);
58 }
59 
60 template<class Scalar>
62 correctVelocity(Thyra::VectorBase<Scalar>& v,
63  const Thyra::VectorBase<Scalar>& vPred,
64  const Thyra::VectorBase<Scalar>& a,
65  const Scalar dt) const
66 {
67 #ifdef VERBOSE_DEBUG_OUTPUT
68  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
69 #endif
70  //v = vPred + dt*gamma_*a
71  Thyra::V_StVpStV(Teuchos::ptrFromRef(v), 1.0, vPred, dt*gamma_, a);
72 }
73 
74 template<class Scalar>
76 correctDisplacement(Thyra::VectorBase<Scalar>& d,
77  const Thyra::VectorBase<Scalar>& dPred,
78  const Thyra::VectorBase<Scalar>& a,
79  const Scalar dt) const
80 {
81 #ifdef VERBOSE_DEBUG_OUTPUT
82  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
83 #endif
84  //d = dPred + beta_*dt*dt*a
85  Thyra::V_StVpStV(Teuchos::ptrFromRef(d), 1.0, dPred, beta_*dt*dt, a);
86 }
87 
88 
89 template<class Scalar>
91  out_(Teuchos::VerboseObjectBase::getDefaultOStream())
92 {
93 #ifdef VERBOSE_DEBUG_OUTPUT
94  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
95 #endif
96 
97  this->setParameterList(Teuchos::null);
98  this->modelWarning();
99 }
100 
101 
102 template<class Scalar>
104  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
105  Teuchos::RCP<Teuchos::ParameterList> pList) :
106  out_(Teuchos::VerboseObjectBase::getDefaultOStream())
107 {
108 #ifdef VERBOSE_DEBUG_OUTPUT
109  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
110 #endif
111 
112  this->setParameterList(pList);
113 
114  if (appModel == Teuchos::null) {
115  this->modelWarning();
116  }
117  else {
118  this->setModel(appModel);
119  this->initialize();
120  }
121 }
122 
123 
124 template<class Scalar>
126  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel)
127 {
128 #ifdef VERBOSE_DEBUG_OUTPUT
129  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
130 #endif
131  this->validSecondOrderODE_DAE(appModel);
132  auto wrapperModel =
133  Teuchos::rcp(new WrapperModelEvaluatorSecondOrder<Scalar>(appModel,
134  "Newmark Implicit a-Form"));
135  this->wrapperModel_ = wrapperModel;
136 }
137 
138 
139 template<class Scalar>
141 {
142  TEUCHOS_TEST_FOR_EXCEPTION( this->wrapperModel_ == Teuchos::null,
143  std::logic_error,
144  "Error - Need to set the model, setModel(), before calling "
145  "StepperNewmarkImplicitAForm::initialize()\n");
146 
147 #ifdef VERBOSE_DEBUG_OUTPUT
148  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
149 #endif
150  this->setParameterList(this->stepperPL_);
151  this->setSolver();
152 }
153 
154 
155 template<class Scalar>
157  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory)
158 {
159  using Teuchos::RCP;
160 
161  int numStates = solutionHistory->getNumStates();
162 
163  TEUCHOS_TEST_FOR_EXCEPTION(numStates < 1, std::logic_error,
164  "Error - setInitialConditions() needs at least one SolutionState\n"
165  " to set the initial condition. Number of States = " << numStates);
166 
167  if (numStates > 1) {
168  RCP<Teuchos::FancyOStream> out = this->getOStream();
169  Teuchos::OSTab ostab(out,1,"StepperNewmarkImplicitAForm::setInitialConditions()");
170  *out << "Warning -- SolutionHistory has more than one state!\n"
171  << "Setting the initial conditions on the currentState.\n"<<std::endl;
172  }
173 
174  RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
175  RCP<Thyra::VectorBase<Scalar> > x = initialState->getX();
176  RCP<Thyra::VectorBase<Scalar> > xDot = initialState->getXDot();
177 
178  auto inArgs = this->wrapperModel_->getNominalValues();
179  TEUCHOS_TEST_FOR_EXCEPTION(
180  !((x != Teuchos::null && xDot != Teuchos::null) ||
181  (inArgs.get_x() != Teuchos::null &&
182  inArgs.get_x_dot() != Teuchos::null)), std::logic_error,
183  "Error - We need to set the initial conditions for x and xDot from\n"
184  " either initialState or appModel_->getNominalValues::InArgs\n"
185  " (but not from a mixture of the two).\n");
186 
187  // Use x and xDot from inArgs as ICs, if needed.
188  if ( x == Teuchos::null || xDot == Teuchos::null ) {
189  using Teuchos::rcp_const_cast;
190  TEUCHOS_TEST_FOR_EXCEPTION( (inArgs.get_x() == Teuchos::null) ||
191  (inArgs.get_x_dot() == Teuchos::null), std::logic_error,
192  "Error - setInitialConditions() needs the ICs from the initialState\n"
193  " or getNominalValues()!\n");
194  x = rcp_const_cast<Thyra::VectorBase<Scalar> >(inArgs.get_x());
195  initialState->setX(x);
196  xDot = rcp_const_cast<Thyra::VectorBase<Scalar> >(inArgs.get_x_dot());
197  initialState->setXDot(xDot);
198  }
199 
200  // Check if we need Stepper storage for xDotDot
201  if (initialState->getXDotDot() == Teuchos::null)
202  initialState->setXDotDot(initialState->getX()->clone_v());
203 
204  // Perform IC Consistency
205  std::string icConsistency = this->getICConsistency();
206  if (icConsistency == "None") {
207  if (initialState->getXDotDot() == Teuchos::null) {
208  RCP<Teuchos::FancyOStream> out = this->getOStream();
209  Teuchos::OSTab ostab(out,1,
210  "StepperNewmarkImplicitAForm::setInitialConditions()");
211  *out << "Warning -- Requested IC consistency of 'None' but\n"
212  << " initialState does not have an xDot.\n"
213  << " Setting a 'Zero' xDot!\n" << std::endl;
214 
215  Thyra::assign(this->getStepperXDotDot(initialState).ptr(), Scalar(0.0));
216  }
217  }
218  else if (icConsistency == "Zero")
219  Thyra::assign(this->getStepperXDotDot(initialState).ptr(), Scalar(0.0));
220  else if (icConsistency == "App") {
221  auto xDotDot = Teuchos::rcp_const_cast<Thyra::VectorBase<Scalar> >(
222  inArgs.get_x_dot_dot());
223  TEUCHOS_TEST_FOR_EXCEPTION(xDotDot == Teuchos::null, std::logic_error,
224  "Error - setInitialConditions() requested 'App' for IC consistency,\n"
225  " but 'App' returned a null pointer for xDotDot!\n");
226  Thyra::assign(this->getStepperXDotDot(initialState).ptr(), *xDotDot);
227  }
228  else if (icConsistency == "Consistent") {
229  // Solve f(x, xDot, xDotDot, t) = 0.
230  const Scalar time = initialState->getTime();
231  auto xDotDot = this->getStepperXDotDot(initialState);
232 
233  // Compute initial acceleration using initial displacement
234  // and initial velocity.
235  if (this->initial_guess_ != Teuchos::null) {
236  TEUCHOS_TEST_FOR_EXCEPTION(
237  !((xDotDot->space())->isCompatible(*this->initial_guess_->space())),
238  std::logic_error,
239  "Error - User-provided initial guess for Newton is not compatible\n"
240  " with solution vector!\n");
241  Thyra::copy(*this->initial_guess_, xDotDot.ptr());
242  }
243  else {
244  Thyra::put_scalar(0.0, xDotDot.ptr());
245  }
246 
247  auto wrapperModel =
248  Teuchos::rcp_dynamic_cast<WrapperModelEvaluatorSecondOrder<Scalar> >(
249  this->wrapperModel_);
250 
251  wrapperModel->initializeNewmark(xDot, x, 0.0, time, beta_, gamma_);
252  const Thyra::SolveStatus<Scalar> sStatus = this->solveImplicitODE(xDotDot);
253 
254  TEUCHOS_TEST_FOR_EXCEPTION(
255  sStatus.solveStatus != Thyra::SOLVE_STATUS_CONVERGED, std::logic_error,
256  "Error - Solver failed while determining the initial conditions.\n"
257  " Solver status is "<<Thyra::toString(sStatus.solveStatus)<<".\n");
258  }
259  else {
260  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
261  "Error - setInitialConditions() invalid IC consistency, "
262  << icConsistency << ".\n");
263  }
264 
265  // At this point, x, xDot and xDotDot are sync'ed or consistent
266  // at the same time level for the initialState.
267  initialState->setIsSynced(true);
268 
269  // Test for consistency.
270  if (this->getICConsistencyCheck()) {
271  auto f = initialState->getX()->clone_v();
272  auto xDotDot = this->getStepperXDotDot(initialState);
273 
274  typedef Thyra::ModelEvaluatorBase MEB;
275  MEB::InArgs<Scalar> appInArgs =
276  this->wrapperModel_->getAppModel()->createInArgs();
277  MEB::OutArgs<Scalar> appOutArgs =
278  this->wrapperModel_->getAppModel()->createOutArgs();
279 
280  appInArgs.set_x (x );
281  appInArgs.set_x_dot (xDot );
282  appInArgs.set_x_dot_dot(xDotDot);
283 
284  appOutArgs.set_f(appOutArgs.get_f());
285 
286  appInArgs.set_W_x_dot_dot_coeff(Scalar(0.0)); // da/da
287  appInArgs.set_alpha (Scalar(0.0)); // dv/da
288  appInArgs.set_beta (Scalar(0.0)); // dd/da
289 
290  appInArgs.set_t (initialState->getTime() );
291 
292  this->wrapperModel_->getAppModel()->evalModel(appInArgs, appOutArgs);
293 
294  Scalar reldiff = Thyra::norm(*f);
295  Scalar normx = Thyra::norm(*x);
296  Scalar eps = Scalar(100.0)*std::abs(Teuchos::ScalarTraits<Scalar>::eps());
297  if (normx > eps*reldiff) reldiff /= normx;
298 
299  if (reldiff > eps) {
300  RCP<Teuchos::FancyOStream> out = this->getOStream();
301  Teuchos::OSTab ostab(out,1,
302  "StepperNewmarkImplicitAForm::setInitialConditions()");
303  *out << "Warning -- Failed consistency check but continuing!\n"
304  << " ||f(x,xDot,xDotDot,t)||/||x|| > eps" << std::endl
305  << " ||f(x,xDot,xDotDot,t)|| = " << Thyra::norm(*f)<< std::endl
306  << " ||x|| = " << Thyra::norm(*x)<< std::endl
307  << " ||f(x,xDot,xDotDot,t)||/||x|| = " << reldiff << std::endl
308  << " eps = " << eps << std::endl;
309  }
310  }
311 
312  if (!(this->getUseFSAL())) {
313  RCP<Teuchos::FancyOStream> out = this->getOStream();
314  Teuchos::OSTab ostab(out,1,
315  "StepperNewmarkImplicitAForm::setInitialConditions()");
316  *out << "\nWarning -- The First-Step-As-Last (FSAL) principle is "
317  << "part of the Newmark Implicit A-Form. The default is to "
318  << "set useFSAL=true, and useFSAL=false will be ignored." << std::endl;
319  }
320 }
321 
322 
323 template<class Scalar>
325  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory)
326 {
327 #ifdef VERBOSE_DEBUG_OUTPUT
328  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
329 #endif
330  using Teuchos::RCP;
331 
332  TEMPUS_FUNC_TIME_MONITOR("Tempus::StepperNewmarkImplicitAForm::takeStep()");
333  {
334  TEUCHOS_TEST_FOR_EXCEPTION(solutionHistory->getNumStates() < 2,
335  std::logic_error,
336  "Error - StepperNewmarkImplicitAForm<Scalar>::takeStep(...)\n"
337  "Need at least two SolutionStates for NewmarkImplicitAForm.\n"
338  " Number of States = " << solutionHistory->getNumStates() << "\n"
339  "Try setting in \"Solution History\" \"Storage Type\" = \"Undo\"\n"
340  " or \"Storage Type\" = \"Static\" and \"Storage Limit\" = \"2\"\n");
341 
342  RCP<SolutionState<Scalar> > workingState=solutionHistory->getWorkingState();
343  RCP<SolutionState<Scalar> > currentState=solutionHistory->getCurrentState();
344 
345  auto wrapperModel =
346  Teuchos::rcp_dynamic_cast<WrapperModelEvaluatorSecondOrder<Scalar> >(
347  this->wrapperModel_);
348 
349  // Get values of d, v and a from previous step
350  RCP<const Thyra::VectorBase<Scalar> > d_old = currentState->getX();
351  RCP<const Thyra::VectorBase<Scalar> > v_old = currentState->getXDot();
352  RCP< Thyra::VectorBase<Scalar> > a_old = currentState->getXDotDot();
353 
354  // Get new values of d, v and a from workingState
355  RCP<Thyra::VectorBase<Scalar> > d_new = workingState->getX();
356  RCP<Thyra::VectorBase<Scalar> > v_new = workingState->getXDot();
357  RCP<Thyra::VectorBase<Scalar> > a_new = workingState->getXDotDot();
358 
359  // Get time and dt
360  const Scalar time = currentState->getTime();
361  const Scalar dt = workingState->getTimeStep();
362  Scalar t = time+dt;
363 
364  // Compute acceleration, a_old, using displacement (d_old) and
365  // velocity (v_old), if needed.
366  if (!(this->getUseFSAL()) && workingState->getNConsecutiveFailures() == 0) {
367  wrapperModel->initializeNewmark(v_old, d_old, dt, time,
368  Scalar(0.0), Scalar(0.0));
369  const Thyra::SolveStatus<Scalar> sStatus = this->solveImplicitODE(a_old);
370 
371  workingState->setSolutionStatus(sStatus); // Converged --> pass.
372  }
373 
374  // Compute displacement and velocity predictors
375  predictDisplacement(*d_new, *d_old, *v_old, *a_old, dt);
376  predictVelocity(*v_new, *v_old, *a_old, dt);
377 
378  // Inject d_new, v_new, a and other relevant data into wrapperModel
379  wrapperModel->initializeNewmark(v_new,d_new,dt,t,beta_,gamma_);
380 
381  // Solve nonlinear system with a_new as initial guess
382  const Thyra::SolveStatus<Scalar> sStatus = this->solveImplicitODE(a_new);
383 
384  // Correct velocity, displacement.
385  correctVelocity(*v_new, *v_new, *a_new, dt);
386  correctDisplacement(*d_new, *d_new, *a_new, dt);
387 
388  workingState->setSolutionStatus(sStatus); // Converged --> pass.
389  workingState->setOrder(this->getOrder());
390  }
391  return;
392 }
393 
394 
395 
396 /** \brief Provide a StepperState to the SolutionState.
397  * This Stepper does not have any special state data,
398  * so just provide the base class StepperState with the
399  * Stepper description. This can be checked to ensure
400  * that the input StepperState can be used by this Stepper.
401  */
402 template<class Scalar>
403 Teuchos::RCP<Tempus::StepperState<Scalar> >
406 {
407 #ifdef VERBOSE_DEBUG_OUTPUT
408  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
409 #endif
410  Teuchos::RCP<Tempus::StepperState<Scalar> > stepperState =
411  rcp(new StepperState<Scalar>(description()));
412  return stepperState;
413 }
414 
415 
416 template<class Scalar>
418 {
419 #ifdef VERBOSE_DEBUG_OUTPUT
420  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
421 #endif
422  std::string name = "Newmark Implicit a-Form";
423  return(name);
424 }
425 
426 
427 template<class Scalar>
429  Teuchos::FancyOStream &out,
430  const Teuchos::EVerbosityLevel /* verbLevel */) const
431 {
432 #ifdef VERBOSE_DEBUG_OUTPUT
433  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
434 #endif
435  out << description() << "::describe:" << std::endl
436  << "wrapperModel = " << this->wrapperModel_->description() << std::endl;
437 }
438 
439 
440 template <class Scalar>
442  Teuchos::RCP<Teuchos::ParameterList> const& pList)
443 {
444 #ifdef VERBOSE_DEBUG_OUTPUT
445  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
446 #endif
447  if (pList == Teuchos::null) {
448  // Create default parameters if null, otherwise keep current parameters.
449  if (this->stepperPL_ == Teuchos::null) this->stepperPL_ = this->getDefaultParameters();
450  } else {
451  this->stepperPL_ = pList;
452  }
453  // Can not validate because of optional Parameters.
454  //stepperPL_->validateParametersAndSetDefaults(*this->getValidParameters());
455  //Get beta and gamma from parameter list
456  //IKT, FIXME: does parameter list get validated somewhere? validateParameters above is commented out...
457 
458  Teuchos::RCP<Teuchos::ParameterList> stepperPL = this->stepperPL_;
459  std::string stepperType = stepperPL->get<std::string>("Stepper Type");
460  TEUCHOS_TEST_FOR_EXCEPTION( stepperType != "Newmark Implicit a-Form",
461  std::logic_error,
462  "Error - Stepper Type is not 'Newmark Implicit a-Form'!\n"
463  << " Stepper Type = "<< stepperPL->get<std::string>("Stepper Type")
464  << "\n");
465  beta_ = 0.25; //default value
466  gamma_ = 0.5; //default value
467  Teuchos::VerboseObjectBase::getDefaultOStream();
468  if (this->stepperPL_->isSublist("Newmark Parameters")) {
469  Teuchos::ParameterList &newmarkPL =
470  this->stepperPL_->sublist("Newmark Parameters", true);
471  std::string scheme_name = newmarkPL.get("Scheme Name", "Not Specified");
472  if (scheme_name == "Not Specified") {
473  beta_ = newmarkPL.get("Beta", 0.25);
474  gamma_ = newmarkPL.get("Gamma", 0.5);
475  TEUCHOS_TEST_FOR_EXCEPTION( (beta_ > 1.0) || (beta_ < 0.0),
476  std::logic_error,
477  "\nError in 'Newmark Implicit a-Form' stepper: invalid value of Beta = "
478  << beta_ << ". Please select Beta >= 0 and <= 1. \n");
479  TEUCHOS_TEST_FOR_EXCEPTION( (gamma_ > 1.0) || (gamma_ < 0.0),
480  std::logic_error,
481  "\nError in 'Newmark Implicit a-Form' stepper: invalid value of Gamma ="
482  <<gamma_ << ". Please select Gamma >= 0 and <= 1. \n");
483  *out_ << "\nSetting Beta = " << beta_ << " and Gamma = " << gamma_
484  << " from Newmark Parameters in input file.\n";
485  }
486  else {
487  *out_ << "\nScheme Name = " << scheme_name << ". Using values \n"
488  << "of Beta and Gamma for this scheme (ignoring values of "
489  << "Beta and Gamma \n"
490  << "in input file, if provided).\n";
491  if (scheme_name == "Average Acceleration") {
492  beta_ = 0.25; gamma_ = 0.5;
493  }
494  else if (scheme_name == "Linear Acceleration") {
495  beta_ = 0.25; gamma_ = 1.0/6.0;
496  }
497  else if (scheme_name == "Central Difference") {
498  beta_ = 0.0; gamma_ = 0.5;
499  }
500  else {
501  TEUCHOS_TEST_FOR_EXCEPTION(true,
502  std::logic_error,
503  "\nError in Tempus::StepperNewmarkImplicitAForm! "
504  <<"Invalid Scheme Name = " << scheme_name <<". \n"
505  <<"Valid Scheme Names are: 'Average Acceleration', "
506  <<"'Linear Acceleration', \n"
507  <<"'Central Difference' and 'Not Specified'.\n");
508  }
509  *out_ << "===> Beta = " << beta_ << ", Gamma = " << gamma_ << "\n";
510  }
511  if (beta_ == 0.0) {
512  *out_ << "\nWARNING: Running (implicit implementation of) Newmark "
513  << "Implicit a-Form Stepper with Beta = 0.0, which \n"
514  << "specifies an explicit scheme. Mass lumping is not possible, "
515  << "so this will be slow! To run explicit \n"
516  << "implementation of Newmark Implicit a-Form Stepper, please "
517  << "re-run with 'Stepper Type' = 'Newmark Explicit a-Form'.\n"
518  << "This stepper allows for mass lumping when called through "
519  << "Piro::TempusSolver.\n";
520  }
521  }
522  else {
523  *out_ << "\nNo Newmark Parameters sublist found in input file; using "
524  << "default values of Beta = "
525  << beta_ << " and Gamma = " << gamma_ << ".\n";
526  }
527 }
528 
529 
530 template<class Scalar>
531 Teuchos::RCP<const Teuchos::ParameterList>
533 {
534 #ifdef VERBOSE_DEBUG_OUTPUT
535  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
536 #endif
537  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
538  pl->setName("Default Stepper - " + this->description());
539  pl->set<std::string>("Stepper Type", this->description());
540  this->getValidParametersBasic(pl);
541  pl->set<bool> ("Use FSAL", true);
542  pl->set<std::string>("Initial Condition Consistency", "Consistent");
543  pl->set<bool> ("Zero Initial Guess", false);
544  pl->set<std::string>("Solver Name", "",
545  "Name of ParameterList containing the solver specifications.");
546 
547  return pl;
548 }
549 template<class Scalar>
550 Teuchos::RCP<Teuchos::ParameterList>
552 {
553 #ifdef VERBOSE_DEBUG_OUTPUT
554  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
555 #endif
556  using Teuchos::RCP;
557  using Teuchos::ParameterList;
558  using Teuchos::rcp_const_cast;
559 
560  RCP<ParameterList> pl =
561  rcp_const_cast<ParameterList>(this->getValidParameters());
562 
563  pl->set<std::string>("Solver Name", "Default Solver");
564  RCP<ParameterList> solverPL = this->defaultSolverParameters();
565  pl->set("Default Solver", *solverPL);
566 
567  return pl;
568 }
569 
570 
571 template <class Scalar>
572 Teuchos::RCP<Teuchos::ParameterList>
574 {
575 #ifdef VERBOSE_DEBUG_OUTPUT
576  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
577 #endif
578  return(this->stepperPL_);
579 }
580 
581 
582 template <class Scalar>
583 Teuchos::RCP<Teuchos::ParameterList>
585 {
586 #ifdef VERBOSE_DEBUG_OUTPUT
587  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
588 #endif
589  Teuchos::RCP<Teuchos::ParameterList> temp_plist = this->stepperPL_;
590  this->stepperPL_ = Teuchos::null;
591  return(temp_plist);
592 }
593 
594 
595 } // namespace Tempus
596 #endif // Tempus_StepperNewmarkImplicitAForm_impl_hpp
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl)
const std::string toString(const Status status)
Convert Status to string.
void initializeNewmark(Teuchos::RCP< const Vector > v_pred, Teuchos::RCP< const Vector > d_pred, Scalar delta_t, Scalar t, Scalar beta, Scalar gamma)
Set values needed in evalModelImpl.
void predictVelocity(Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual void modelWarning() const
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
A ModelEvaluator for residual evaluations given a state. This ModelEvaluator takes a state...
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
StepperState is a simple class to hold state information about the stepper.
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions and make them consistent.
Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Nonmember constructor.
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Take the specified timestep, dt, and return true if successful.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
void predictDisplacement(Thyra::VectorBase< Scalar > &dPred, const Thyra::VectorBase< Scalar > &d, const Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
void correctDisplacement(Thyra::VectorBase< Scalar > &d, const Thyra::VectorBase< Scalar > &dPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
virtual void initialize()
Initialize during construction and after changing input parameters.
void correctVelocity(Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< Teuchos::ParameterList > getDefaultParameters() const