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