Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 
13 
14 //#define VERBOSE_DEBUG_OUTPUT
15 //#define DEBUG_OUTPUT
16 
17 namespace Tempus {
18 
19 template <class Scalar>
22  const Thyra::VectorBase<Scalar>& a, const Scalar dt) const
23 {
24 #ifdef VERBOSE_DEBUG_OUTPUT
25  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
26 #endif
27  // vPred = v + dt*(1.0-gamma_)*a
28  Thyra::V_StVpStV(Teuchos::ptrFromRef(vPred), 1.0, v, dt * (1.0 - gamma_), a);
29 }
30 
31 template <class Scalar>
35  const Scalar dt) const
36 {
37 #ifdef VERBOSE_DEBUG_OUTPUT
38  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
39 #endif
41  Thyra::createMember<Scalar>(dPred.space());
42  // dPred = dt*v + dt*dt/2.0*(1.0-2.0*beta_)*a
43  Scalar aConst = dt * dt / 2.0 * (1.0 - 2.0 * beta_);
44  Thyra::V_StVpStV(Teuchos::ptrFromRef(dPred), dt, v, aConst, a);
45  // dPred += d;
46  Thyra::Vp_V(Teuchos::ptrFromRef(dPred), d, 1.0);
47 }
48 
49 template <class Scalar>
52  const Thyra::VectorBase<Scalar>& a, const Scalar dt) const
53 {
54 #ifdef VERBOSE_DEBUG_OUTPUT
55  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
56 #endif
57  // v = vPred + dt*gamma_*a
58  Thyra::V_StVpStV(Teuchos::ptrFromRef(v), 1.0, vPred, dt * gamma_, a);
59 }
60 
61 template <class Scalar>
64  const Thyra::VectorBase<Scalar>& a, const Scalar dt) const
65 {
66 #ifdef VERBOSE_DEBUG_OUTPUT
67  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
68 #endif
69  // d = dPred + beta_*dt*dt*a
70  Thyra::V_StVpStV(Teuchos::ptrFromRef(d), 1.0, dPred, beta_ * dt * dt, a);
71 }
72 
73 template <class Scalar>
75 {
76  if (schemeName_ != "User Defined") {
77  *out_ << "\nWARNING: schemeName != 'User Defined' (=" << schemeName_
78  << ").\n"
79  << " Not setting beta, and leaving as beta = " << beta_ << "!\n";
80  return;
81  }
82 
83  beta_ = beta;
84 
85  if (beta_ == 0.0) {
86  *out_ << "\nWARNING: Running (implicit implementation of) Newmark "
87  << "Implicit a-Form Stepper with Beta = 0.0, which \n"
88  << "specifies an explicit scheme. Mass lumping is not possible, "
89  << "so this will be slow! To run explicit \n"
90  << "implementation of Newmark Implicit a-Form Stepper, please "
91  << "re-run with 'Stepper Type' = 'Newmark Explicit a-Form'.\n"
92  << "This stepper allows for mass lumping when called through "
93  << "Piro::TempusSolver.\n";
94  }
95 
97  (beta_ > 1.0) || (beta_ < 0.0), std::logic_error,
98  "\nError in 'Newmark Implicit a-Form' stepper: invalid value of Beta = "
99  << beta_ << ". Please select Beta >= 0 and <= 1. \n");
100 }
101 
102 template <class Scalar>
104 {
105  if (schemeName_ != "User Defined") {
106  *out_ << "\nWARNING: schemeName != 'User Defined' (=" << schemeName_
107  << ").\n"
108  << " Not setting gamma, and leaving as gamma = " << gamma_ << "!\n";
109  return;
110  }
111 
112  gamma_ = gamma;
113 
115  (gamma_ > 1.0) || (gamma_ < 0.0), std::logic_error,
116  "\nError in 'Newmark Implicit a-Form' stepper: invalid value of Gamma ="
117  << gamma_ << ". Please select Gamma >= 0 and <= 1. \n");
118 }
119 
120 template <class Scalar>
122 {
123  schemeName_ = schemeName;
124 
125  if (schemeName_ == "Average Acceleration") {
126  beta_ = 0.25;
127  gamma_ = 0.5;
128  }
129  else if (schemeName_ == "Linear Acceleration") {
130  beta_ = 0.25;
131  gamma_ = 1.0 / 6.0;
132  }
133  else if (schemeName_ == "Central Difference") {
134  beta_ = 0.0;
135  gamma_ = 0.5;
136  }
137  else if (schemeName_ == "User Defined") {
138  beta_ = 0.25;
139  gamma_ = 0.5; // Use defaults until setBeta and setGamma calls.
140  }
141  else {
143  true, std::logic_error,
144  "\nError in Tempus::StepperNewmarkImplicitAForm! "
145  << "Invalid Scheme Name = " << schemeName_ << ". \n"
146  << "Valid Scheme Names are: 'Average Acceleration', "
147  << "'Linear Acceleration', \n"
148  << "'Central Difference' and 'User Defined'.\n");
149  }
150 
151  this->isInitialized_ = false;
152 }
153 
154 template <class Scalar>
157 {
158  if (appAction == Teuchos::null) {
159  // Create default appAction
160  stepperNewmarkImpAppAction_ =
162  }
163  else {
164  stepperNewmarkImpAppAction_ = appAction;
165  }
166 
167  this->isInitialized_ = false;
168 }
169 
170 template <class Scalar>
172  : out_(Teuchos::VerboseObjectBase::getDefaultOStream())
173 {
174 #ifdef VERBOSE_DEBUG_OUTPUT
175  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
176 #endif
177 
178  this->setStepperName("Newmark Implicit a-Form");
179  this->setStepperType("Newmark Implicit a-Form");
180  this->setUseFSAL(true);
181  this->setICConsistency("Consistent");
182  this->setICConsistencyCheck(false);
183  this->setZeroInitialGuess(false);
184  this->setSchemeName("Average Acceleration");
185 
186  this->setAppAction(Teuchos::null);
187  this->setDefaultSolver();
188 }
189 
190 template <class Scalar>
192  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
194  bool useFSAL, std::string ICConsistency, bool ICConsistencyCheck,
195  bool zeroInitialGuess, std::string schemeName, Scalar beta, Scalar gamma,
197  stepperAppAction)
198  : out_(Teuchos::VerboseObjectBase::getDefaultOStream())
199 {
200  this->setStepperName("Newmark Implicit a-Form");
201  this->setStepperType("Newmark Implicit a-Form");
202  this->setUseFSAL(useFSAL);
203  this->setICConsistency(ICConsistency);
204  this->setICConsistencyCheck(ICConsistencyCheck);
205  this->setZeroInitialGuess(zeroInitialGuess);
206  this->setSchemeName(schemeName);
207  this->setBeta(beta);
208  this->setGamma(gamma);
209  this->setAppAction(stepperAppAction);
210  this->setSolver(solver);
211 
212  if (appModel != Teuchos::null) {
213  this->setModel(appModel);
214  this->initialize();
215  }
216 }
217 
218 template <class Scalar>
220  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel)
221 {
222 #ifdef VERBOSE_DEBUG_OUTPUT
223  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
224 #endif
225  validSecondOrderODE_DAE(appModel);
226  this->wrapperModel_ =
228  appModel, "Newmark Implicit a-Form"));
229 
230  TEUCHOS_TEST_FOR_EXCEPTION(this->getSolver() == Teuchos::null,
231  std::logic_error, "Error - Solver is not set!\n");
232  this->getSolver()->setModel(this->wrapperModel_);
233 
234  this->isInitialized_ = false;
235 }
236 
237 template <class Scalar>
239  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory)
240 {
241  using Teuchos::RCP;
242 
243  int numStates = solutionHistory->getNumStates();
244 
246  numStates < 1, std::logic_error,
247  "Error - setInitialConditions() needs at least one SolutionState\n"
248  " to set the initial condition. Number of States = "
249  << numStates);
250 
251  if (numStates > 1) {
252  RCP<Teuchos::FancyOStream> out = this->getOStream();
253  out->setOutputToRootOnly(0);
254  Teuchos::OSTab ostab(out, 1,
255  "StepperNewmarkImplicitAForm::setInitialConditions()");
256  *out << "Warning -- SolutionHistory has more than one state!\n"
257  << "Setting the initial conditions on the currentState.\n"
258  << std::endl;
259  }
260 
261  RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
262  RCP<Thyra::VectorBase<Scalar> > x = initialState->getX();
263  RCP<Thyra::VectorBase<Scalar> > xDot = initialState->getXDot();
264 
265  auto inArgs = this->wrapperModel_->getNominalValues();
267  !((x != Teuchos::null && xDot != Teuchos::null) ||
268  (inArgs.get_x() != Teuchos::null &&
269  inArgs.get_x_dot() != Teuchos::null)),
270  std::logic_error,
271  "Error - We need to set the initial conditions for x and xDot from\n"
272  " either initialState or appModel_->getNominalValues::InArgs\n"
273  " (but not from a mixture of the two).\n");
274 
275  // Use x and xDot from inArgs as ICs, if needed.
276  if (x == Teuchos::null || xDot == Teuchos::null) {
277  using Teuchos::rcp_const_cast;
279  (inArgs.get_x() == Teuchos::null) ||
280  (inArgs.get_x_dot() == Teuchos::null),
281  std::logic_error,
282  "Error - setInitialConditions() needs the ICs from the initialState\n"
283  " or getNominalValues()!\n");
284  x = rcp_const_cast<Thyra::VectorBase<Scalar> >(inArgs.get_x());
285  initialState->setX(x);
286  xDot = rcp_const_cast<Thyra::VectorBase<Scalar> >(inArgs.get_x_dot());
287  initialState->setXDot(xDot);
288  }
289 
290  // Check if we need Stepper storage for xDotDot
291  if (initialState->getXDotDot() == Teuchos::null)
292  initialState->setXDotDot(initialState->getX()->clone_v());
293  else
294  this->setStepperXDotDot(initialState->getXDotDot());
295 
296  // Perform IC Consistency
297  std::string icConsistency = this->getICConsistency();
298  if (icConsistency == "None") {
299  if (initialState->getXDotDot() == Teuchos::null) {
300  RCP<Teuchos::FancyOStream> out = this->getOStream();
301  out->setOutputToRootOnly(0);
302  Teuchos::OSTab ostab(
303  out, 1, "StepperNewmarkImplicitAForm::setInitialConditions()");
304  *out << "Warning -- Requested IC consistency of 'None' but\n"
305  << " initialState does not have an xDot.\n"
306  << " Setting a 'Zero' xDot!\n"
307  << std::endl;
308 
309  Thyra::assign(this->getStepperXDotDot(initialState).ptr(), Scalar(0.0));
310  }
311  }
312  else if (icConsistency == "Zero")
313  Thyra::assign(this->getStepperXDotDot(initialState).ptr(), Scalar(0.0));
314  else if (icConsistency == "App") {
315  auto xDotDot = Teuchos::rcp_const_cast<Thyra::VectorBase<Scalar> >(
316  inArgs.get_x_dot_dot());
318  xDotDot == Teuchos::null, std::logic_error,
319  "Error - setInitialConditions() requested 'App' for IC consistency,\n"
320  " but 'App' returned a null pointer for xDotDot!\n");
321  Thyra::assign(this->getStepperXDotDot(initialState).ptr(), *xDotDot);
322  }
323  else if (icConsistency == "Consistent") {
324  // Solve f(x, xDot, xDotDot, t) = 0.
325  const Scalar time = initialState->getTime();
326  auto xDotDot = this->getStepperXDotDot(initialState);
327 
328  // Compute initial acceleration using initial displacement
329  // and initial velocity.
330  if (this->initialGuess_ != Teuchos::null) {
332  !((xDotDot->space())->isCompatible(*this->initialGuess_->space())),
333  std::logic_error,
334  "Error - User-provided initial guess for Newton is not compatible\n"
335  " with solution vector!\n");
336  Thyra::copy(*this->initialGuess_, xDotDot.ptr());
337  }
338  else {
339  Thyra::put_scalar(0.0, xDotDot.ptr());
340  }
341 
342  auto wrapperModel =
343  Teuchos::rcp_dynamic_cast<WrapperModelEvaluatorSecondOrder<Scalar> >(
344  this->wrapperModel_);
345 
346  wrapperModel->initializeNewmark(xDot, x, 0.0, time, beta_, gamma_);
347  const Thyra::SolveStatus<Scalar> sStatus =
348  (*(this->solver_)).solve(&*xDotDot);
349 
351  sStatus.solveStatus != Thyra::SOLVE_STATUS_CONVERGED, std::logic_error,
352  "Error - Solver failed while determining the initial conditions.\n"
353  " Solver status is "
354  << Thyra::toString(sStatus.solveStatus) << ".\n");
355  }
356  else {
358  true, std::logic_error,
359  "Error - setInitialConditions() invalid IC consistency, "
360  << icConsistency << ".\n");
361  }
362 
363  // At this point, x, xDot and xDotDot are sync'ed or consistent
364  // at the same time level for the initialState.
365  initialState->setIsSynced(true);
366 
367  // Test for consistency.
368  if (this->getICConsistencyCheck()) {
369  auto f = initialState->getX()->clone_v();
370  auto xDotDot = this->getStepperXDotDot(initialState);
371 
372  typedef Thyra::ModelEvaluatorBase MEB;
373  MEB::InArgs<Scalar> appInArgs =
374  this->wrapperModel_->getAppModel()->createInArgs();
375  MEB::OutArgs<Scalar> appOutArgs =
376  this->wrapperModel_->getAppModel()->createOutArgs();
377 
378  appInArgs.set_x(x);
379  appInArgs.set_x_dot(xDot);
380  appInArgs.set_x_dot_dot(xDotDot);
381 
382  appOutArgs.set_f(appOutArgs.get_f());
383 
384  appInArgs.set_W_x_dot_dot_coeff(Scalar(0.0)); // da/da
385  appInArgs.set_alpha(Scalar(0.0)); // dv/da
386  appInArgs.set_beta(Scalar(0.0)); // dd/da
387 
388  appInArgs.set_t(initialState->getTime());
389 
390  this->wrapperModel_->getAppModel()->evalModel(appInArgs, appOutArgs);
391 
392  Scalar reldiff = Thyra::norm(*f);
393  Scalar normx = Thyra::norm(*x);
394  Scalar eps = Scalar(100.0) * std::abs(Teuchos::ScalarTraits<Scalar>::eps());
395  if (normx > eps * reldiff) reldiff /= normx;
396 
397  if (reldiff > eps) {
398  RCP<Teuchos::FancyOStream> out = this->getOStream();
399  out->setOutputToRootOnly(0);
400  Teuchos::OSTab ostab(
401  out, 1, "StepperNewmarkImplicitAForm::setInitialConditions()");
402  *out << "Warning -- Failed consistency check but continuing!\n"
403  << " ||f(x,xDot,xDotDot,t)||/||x|| > eps" << std::endl
404  << " ||f(x,xDot,xDotDot,t)|| = " << Thyra::norm(*f)
405  << std::endl
406  << " ||x|| = " << Thyra::norm(*x)
407  << std::endl
408  << " ||f(x,xDot,xDotDot,t)||/||x|| = " << reldiff << std::endl
409  << " eps = " << eps << std::endl;
410  }
411  }
412 
413  if (!(this->getUseFSAL())) {
414  RCP<Teuchos::FancyOStream> out = this->getOStream();
415  out->setOutputToRootOnly(0);
416  Teuchos::OSTab ostab(out, 1,
417  "StepperNewmarkImplicitAForm::setInitialConditions()");
418  *out << "\nWarning -- The First-Same-As-Last (FSAL) principle is "
419  << "part of the Newmark Implicit A-Form. The default is to "
420  << "set useFSAL=true, and useFSAL=false will be ignored." << std::endl;
421  }
422 }
423 
424 template <class Scalar>
426  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory)
427 {
428 #ifdef VERBOSE_DEBUG_OUTPUT
429  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
430 #endif
431  this->checkInitialized();
432 
433  using Teuchos::RCP;
434 
435  TEMPUS_FUNC_TIME_MONITOR("Tempus::StepperNewmarkImplicitAForm::takeStep()");
436  {
438  solutionHistory->getNumStates() < 2, std::logic_error,
439  "Error - StepperNewmarkImplicitAForm<Scalar>::takeStep(...)\n"
440  << "Need at least two SolutionStates for NewmarkImplicitAForm.\n"
441  << " Number of States = " << solutionHistory->getNumStates()
442  << "\nTry setting in \"Solution History\" \"Storage Type\" = "
443  << "\"Undo\"\n"
444  << " or \"Storage Type\" = \"Static\" and \"Storage Limit\" = "
445  << "\"2\"\n");
446 
447  auto thisStepper = Teuchos::rcpFromRef(*this);
448  stepperNewmarkImpAppAction_->execute(
449  solutionHistory, thisStepper,
451  Scalar>::ACTION_LOCATION::BEGIN_STEP);
452 
453  RCP<SolutionState<Scalar> > workingState =
454  solutionHistory->getWorkingState();
455  RCP<SolutionState<Scalar> > currentState =
456  solutionHistory->getCurrentState();
457 
458  auto wrapperModel =
459  Teuchos::rcp_dynamic_cast<WrapperModelEvaluatorSecondOrder<Scalar> >(
460  this->wrapperModel_);
461 
462  // Get values of d, v and a from previous step
463  RCP<const Thyra::VectorBase<Scalar> > d_old = currentState->getX();
464  RCP<const Thyra::VectorBase<Scalar> > v_old = currentState->getXDot();
465  RCP<Thyra::VectorBase<Scalar> > a_old = currentState->getXDotDot();
466 
467  // Get new values of d, v and a from workingState
468  RCP<Thyra::VectorBase<Scalar> > d_new = workingState->getX();
469  RCP<Thyra::VectorBase<Scalar> > v_new = workingState->getXDot();
470  RCP<Thyra::VectorBase<Scalar> > a_new = workingState->getXDotDot();
471 
472  // Get time and dt
473  const Scalar time = currentState->getTime();
474  const Scalar dt = workingState->getTimeStep();
475  Scalar t = time + dt;
476 
477  // Compute displacement and velocity predictors
478  predictDisplacement(*d_new, *d_old, *v_old, *a_old, dt);
479  predictVelocity(*v_new, *v_old, *a_old, dt);
480 
481  // Inject d_new, v_new, a and other relevant data into wrapperModel
482  wrapperModel->initializeNewmark(v_new, d_new, dt, t, beta_, gamma_);
483 
484  stepperNewmarkImpAppAction_->execute(
485  solutionHistory, thisStepper,
487  Scalar>::ACTION_LOCATION::BEFORE_SOLVE);
488 
489  if (this->getZeroInitialGuess())
490  Thyra::assign(a_new.ptr(), Teuchos::ScalarTraits<Scalar>::zero());
491 
492  // Solve nonlinear system with a_new as initial guess
493  const Thyra::SolveStatus<Scalar> sStatus =
494  (*(this->solver_)).solve(&*a_new);
495 
496  stepperNewmarkImpAppAction_->execute(
497  solutionHistory, thisStepper,
499  Scalar>::ACTION_LOCATION::AFTER_SOLVE);
500 
501  // Correct velocity, displacement.
502  correctVelocity(*v_new, *v_new, *a_new, dt);
503  correctDisplacement(*d_new, *d_new, *a_new, dt);
504 
505  workingState->setSolutionStatus(sStatus); // Converged --> pass.
506  workingState->setOrder(this->getOrder());
507  workingState->computeNorms(currentState);
508 
509  stepperNewmarkImpAppAction_->execute(
510  solutionHistory, thisStepper,
512  Scalar>::ACTION_LOCATION::END_STEP);
513  }
514  return;
515 }
516 
523 template <class Scalar>
526 {
527 #ifdef VERBOSE_DEBUG_OUTPUT
528  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
529 #endif
531  rcp(new StepperState<Scalar>(this->getStepperType()));
532  return stepperState;
533 }
534 
535 template <class Scalar>
537  Teuchos::FancyOStream& out, const Teuchos::EVerbosityLevel verbLevel) const
538 {
539  out.setOutputToRootOnly(0);
540 #ifdef VERBOSE_DEBUG_OUTPUT
541  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
542 #endif
543 
544  out << std::endl;
545  Stepper<Scalar>::describe(out, verbLevel);
546  StepperImplicit<Scalar>::describe(out, verbLevel);
547 
548  out << "--- StepperNewmarkImplicitAForm ---\n";
549  out << " schemeName_ = " << schemeName_ << std::endl;
550  out << " beta_ = " << beta_ << std::endl;
551  out << " gamma_ = " << gamma_ << std::endl;
552  out << "-----------------------------------" << std::endl;
553 }
554 
555 template <class Scalar>
557  Teuchos::FancyOStream& out) const
558 {
559  out.setOutputToRootOnly(0);
560  bool isValidSetup = true;
561  out.setOutputToRootOnly(0);
562 
563  if (!Stepper<Scalar>::isValidSetup(out)) isValidSetup = false;
564 
565  // if ( !StepperImplicit<Scalar>::isValidSetup(out) ) isValidSetup = false;
566  if (this->wrapperModel_->getAppModel() == Teuchos::null) {
567  isValidSetup = false;
568  out << "The application ModelEvaluator is not set!\n";
569  }
570 
571  if (this->wrapperModel_ == Teuchos::null) {
572  isValidSetup = false;
573  out << "The wrapper ModelEvaluator is not set!\n";
574  }
575 
576  if (this->solver_ == Teuchos::null) {
577  isValidSetup = false;
578  out << "The solver is not set!\n";
579  }
580 
581  if (this->stepperNewmarkImpAppAction_ == Teuchos::null) {
582  isValidSetup = false;
583  out << "The Newmark Implicit A-Form AppAction is not set!\n";
584  }
585 
586  return isValidSetup;
587 }
588 
589 template <class Scalar>
592 {
593 #ifdef VERBOSE_DEBUG_OUTPUT
594  *out_ << "DEBUG: " << __PRETTY_FUNCTION__ << "\n";
595 #endif
596  auto pl = this->getValidParametersBasicImplicit();
597 
598  auto newmarkPL = Teuchos::parameterList("Newmark Parameters");
599  newmarkPL->set<std::string>("Scheme Name", schemeName_);
600  newmarkPL->set<double>("Beta", beta_);
601  newmarkPL->set<double>("Gamma", gamma_);
602  pl->set("Newmark Parameters", *newmarkPL);
603 
604  return pl;
605 }
606 
607 // Nonmember constructor - ModelEvaluator and ParameterList
608 // ------------------------------------------------------------------------
609 template <class Scalar>
612  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
614 {
616  stepper->setStepperImplicitValues(pl);
617 
618  if (pl != Teuchos::null) {
619  if (pl->isSublist("Newmark Parameters")) {
620  auto newmarkPL = pl->sublist("Newmark Parameters", true);
621  std::string schemeName =
622  newmarkPL.get<std::string>("Scheme Name", "Average Acceleration");
623  stepper->setSchemeName(schemeName);
624  if (schemeName == "User Defined") {
625  stepper->setBeta(newmarkPL.get<double>("Beta", 0.25));
626  stepper->setGamma(newmarkPL.get<double>("Gamma", 0.5));
627  }
628  }
629  else {
630  stepper->setSchemeName("Average Acceleration");
631  }
632  }
633 
634  if (model != Teuchos::null) {
635  stepper->setModel(model);
636  stepper->initialize();
637  }
638 
639  return stepper;
640 }
641 
642 } // namespace Tempus
643 #endif // Tempus_StepperNewmarkImplicitAForm_impl_hpp
virtual RCP< const VectorSpaceBase< Scalar > > space() const =0
Application Action for StepperNewmarkImplicitAForm.
virtual void setSolver(Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > solver) override
Set solver.
Teuchos::RCP< StepperNewmarkImplicitAForm< Scalar > > createStepperNewmarkImplicitAForm(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
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.
T & get(const std::string &name, T def_value)
void predictVelocity(Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void setStepperName(std::string s)
Set the stepper name.
virtual void initialize()
Initialize after construction and changing input parameters.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const override
A ModelEvaluator for residual evaluations given a state. This ModelEvaluator takes a state...
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Thyra Base interface for time steppers.
StepperState is a simple class to hold state information about the stepper.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual void setAppAction(Teuchos::RCP< StepperNewmarkImplicitAFormAppAction< Scalar > > appAction)
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
bool isSublist(const std::string &name) const
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
void setICConsistencyCheck(bool c)
TEUCHOSCORE_LIB_DLL_EXPORT std::string toString(const EVerbosityLevel verbLevel)
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions and make them consistent.
virtual void setZeroInitialGuess(bool zIG)
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...
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
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)
Set the model.
ESolveStatus solveStatus
void correctDisplacement(Thyra::VectorBase< Scalar > &d, const Thyra::VectorBase< Scalar > &dPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
void validSecondOrderODE_DAE(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
void correctVelocity(Thyra::VectorBase< Scalar > &v, const Thyra::VectorBase< Scalar > &vPred, const Thyra::VectorBase< Scalar > &a, const Scalar dt) const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Newmark time stepper in acceleration form (a-form).
void setStepperType(std::string s)
Set the stepper type.
void setICConsistency(std::string s)